Skip to content

Commit ba45eed

Browse files
committed
updated ui
1 parent 84df74d commit ba45eed

File tree

22 files changed

+182
-254
lines changed

22 files changed

+182
-254
lines changed

cvat-core/src/api-implementation.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,22 +32,21 @@ import Webhook from './webhook';
3232
import { ArgumentError } from './exceptions';
3333
import {
3434
AnalyticsReportFilter, QualityConflictsFilter, QualityReportsFilter,
35-
QualitySettingsFilter, SerializedAsset,
36-
ConsensusSettingsFilter,
35+
QualitySettingsFilter, SerializedAsset, ConsensusSettingsFilter,
3736
} from './server-response-types';
3837
import QualityReport from './quality-report';
3938
import QualityConflict, { ConflictSeverity } from './quality-conflict';
4039
import QualitySettings from './quality-settings';
4140
import { getFramesMeta } from './frames';
4241
import AnalyticsReport from './analytics-report';
42+
import ConsensusSettings from './consensus-settings';
4343
import {
4444
callAction, listActions, registerAction, runAction,
4545
} from './annotations-actions/annotations-actions';
4646
import { convertDescriptions, getServerAPISchema } from './server-schema';
4747
import { JobType } from './enums';
4848
import { PaginatedResource } from './core-types';
4949
import CVATCore from '.';
50-
import ConsensusSettings from './consensus-settings';
5150

5251
function implementationMixin(func: Function, implementation: Function): void {
5352
Object.assign(func, { implementation });

cvat-ui/src/actions/common.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (C) CVAT.ai Corporation
2+
//
3+
// SPDX-License-Identifier: MIT
4+
5+
import { getCore, ProjectOrTaskOrJob } from 'cvat-core-wrapper';
6+
import { RequestInstanceType } from './requests-actions';
7+
8+
const core = getCore();
9+
10+
export function getInstanceType(instance: ProjectOrTaskOrJob | RequestInstanceType): 'project' | 'task' | 'job' {
11+
if (instance instanceof core.classes.Project) {
12+
return 'project';
13+
}
14+
15+
if (instance instanceof core.classes.Task) {
16+
return 'task';
17+
}
18+
19+
if (instance instanceof core.classes.Job) {
20+
return 'job';
21+
}
22+
23+
return instance.type;
24+
}
Lines changed: 14 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,66 +1,40 @@
1-
// Copyright (C) 2024 CVAT.ai Corporation
1+
// Copyright (C) CVAT.ai Corporation
22
//
33
// SPDX-License-Identifier: MIT
44

55
import { ActionUnion, createAction, ThunkAction } from 'utils/redux';
6-
import { Job, Task } from 'cvat-core-wrapper';
6+
import { Project, ProjectOrTaskOrJob } from 'cvat-core-wrapper';
77

88
export enum ConsensusActionTypes {
99
MERGE_CONSENSUS_JOBS = 'MERGE_CONSENSUS_JOBS',
1010
MERGE_CONSENSUS_JOBS_SUCCESS = 'MERGE_CONSENSUS_JOBS_SUCCESS',
1111
MERGE_CONSENSUS_JOBS_FAILED = 'MERGE_CONSENSUS_JOBS_FAILED',
12-
MERGE_SPECIFIC_CONSENSUS_JOBS = 'MERGE_SPECIFIC_CONSENSUS_JOBS',
13-
MERGE_SPECIFIC_CONSENSUS_JOBS_SUCCESS = 'MERGE_SPECIFIC_CONSENSUS_JOBS_SUCCESS',
14-
MERGE_SPECIFIC_CONSENSUS_JOBS_FAILED = 'MERGE_SPECIFIC_CONSENSUS_JOBS_FAILED',
1512
}
1613

1714
export const consensusActions = {
18-
mergeTaskConsensusJobs: (taskID: number) => (
19-
createAction(ConsensusActionTypes.MERGE_CONSENSUS_JOBS, { taskID })
15+
mergeConsensusJobs: (instance: Exclude<ProjectOrTaskOrJob, Project>) => (
16+
createAction(ConsensusActionTypes.MERGE_CONSENSUS_JOBS, { instance })
2017
),
21-
mergeTaskConsensusJobsSuccess: (taskID: number) => (
22-
createAction(ConsensusActionTypes.MERGE_CONSENSUS_JOBS_SUCCESS, { taskID })
18+
mergeConsensusJobsSuccess: (instance: Exclude<ProjectOrTaskOrJob, Project>) => (
19+
createAction(ConsensusActionTypes.MERGE_CONSENSUS_JOBS_SUCCESS, { instance })
2320
),
24-
mergeTaskConsensusJobsFailed: (taskID: number, error: any) => (
25-
createAction(ConsensusActionTypes.MERGE_CONSENSUS_JOBS_FAILED, { taskID, error })
21+
mergeConsensusJobsFailed: (instance: Exclude<ProjectOrTaskOrJob, Project>, error: any) => (
22+
createAction(ConsensusActionTypes.MERGE_CONSENSUS_JOBS_FAILED, { instance, error })
2623
),
27-
mergeSpecificTaskConsensusJobs: (jobID: number) => (
28-
createAction(ConsensusActionTypes.MERGE_SPECIFIC_CONSENSUS_JOBS, { jobID })
29-
),
30-
mergeSpecificTaskConsensusJobsSuccess: (jobID: number, taskID: number) => (
31-
createAction(ConsensusActionTypes.MERGE_SPECIFIC_CONSENSUS_JOBS_SUCCESS, { jobID, taskID })
32-
),
33-
mergeSpecificTaskConsensusJobsFailed: (jobID: number, taskID: number, error: any) => (
34-
createAction(ConsensusActionTypes.MERGE_SPECIFIC_CONSENSUS_JOBS_FAILED, { jobID, taskID, error })
35-
),
36-
};
37-
38-
export const mergeTaskConsensusJobsAsync = (
39-
taskInstance: Task,
40-
): ThunkAction => async (dispatch) => {
41-
try {
42-
dispatch(consensusActions.mergeTaskConsensusJobs(taskInstance.id));
43-
await taskInstance.mergeConsensusJobs();
44-
} catch (error) {
45-
dispatch(consensusActions.mergeTaskConsensusJobsFailed(taskInstance.id, error));
46-
return;
47-
}
48-
49-
dispatch(consensusActions.mergeTaskConsensusJobsSuccess(taskInstance.id));
5024
};
5125

52-
export const mergeTaskSpecificConsensusJobsAsync = (
53-
jobInstance: Job,
26+
export const mergeConsensusJobsAsync = (
27+
instance: Exclude<ProjectOrTaskOrJob, Project>,
5428
): ThunkAction => async (dispatch) => {
5529
try {
56-
dispatch(consensusActions.mergeSpecificTaskConsensusJobs(jobInstance.id));
57-
await jobInstance.mergeConsensusJobs();
30+
dispatch(consensusActions.mergeConsensusJobs(instance));
31+
await instance.mergeConsensusJobs();
5832
} catch (error) {
59-
dispatch(consensusActions.mergeSpecificTaskConsensusJobsFailed(jobInstance.id, jobInstance.taskId, error));
33+
dispatch(consensusActions.mergeConsensusJobsFailed(instance, error));
6034
return;
6135
}
6236

63-
dispatch(consensusActions.mergeSpecificTaskConsensusJobsSuccess(jobInstance.id, jobInstance.taskId));
37+
dispatch(consensusActions.mergeConsensusJobsSuccess(instance));
6438
};
6539

6640
export type ConsensusActions = ActionUnion<typeof consensusActions>;

cvat-ui/src/actions/export-actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ import {
88
Storage, ProjectOrTaskOrJob, Job, getCore, StorageLocation,
99
} from 'cvat-core-wrapper';
1010
import {
11-
getInstanceType, RequestInstanceType, listen,
11+
RequestInstanceType, listen,
1212
RequestsActions, updateRequestProgress,
1313
} from './requests-actions';
14+
import { getInstanceType } from './common';
1415

1516
export enum ExportActionTypes {
1617
OPEN_EXPORT_DATASET_MODAL = 'OPEN_EXPORT_DATASET_MODAL',

cvat-ui/src/actions/import-actions.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,10 @@ import {
1010
import { getProjectsAsync } from './projects-actions';
1111
import { AnnotationActionTypes, fetchAnnotationsAsync } from './annotation-actions';
1212
import {
13-
getInstanceType, listen, RequestInstanceType,
13+
listen, RequestInstanceType,
1414
RequestsActions, updateRequestProgress,
1515
} from './requests-actions';
16+
import { getInstanceType } from './common';
1617

1718
const core = getCore();
1819

cvat-ui/src/actions/requests-actions.ts

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
import { ActionUnion, createAction } from 'utils/redux';
66
import { CombinedState, RequestsQuery } from 'reducers';
7-
import { Request, ProjectOrTaskOrJob, getCore } from 'cvat-core-wrapper';
7+
import { Request, getCore } from 'cvat-core-wrapper';
88
import { Store } from 'redux';
99
import { getCVATStore } from 'cvat-store';
1010

@@ -64,22 +64,6 @@ export interface RequestInstanceType {
6464
type: 'project' | 'task' | 'job';
6565
}
6666

67-
export function getInstanceType(instance: ProjectOrTaskOrJob | RequestInstanceType): 'project' | 'task' | 'job' {
68-
if (instance instanceof core.classes.Project) {
69-
return 'project';
70-
}
71-
72-
if (instance instanceof core.classes.Task) {
73-
return 'task';
74-
}
75-
76-
if (instance instanceof core.classes.Job) {
77-
return 'job';
78-
}
79-
80-
return instance.type;
81-
}
82-
8367
export function updateRequestProgress(request: Request, dispatch: (action: RequestsActions) => void): void {
8468
dispatch(
8569
requestsActions.getRequestStatusSuccess(request),

cvat-ui/src/base.scss

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,22 @@ $monospaced-fonts-stack: Consolas, Monaco, Lucida Console, Liberation Mono, Deja
6363
align-items: center;
6464
}
6565
}
66+
67+
.cvat-scrollbar {
68+
overflow-y: auto;
69+
70+
&::-webkit-scrollbar {
71+
background-color: #fff;
72+
width: $grid-unit-size * 2;
73+
}
74+
75+
&::-webkit-scrollbar-track {
76+
background-color: #fff;
77+
}
78+
79+
&::-webkit-scrollbar-thumb {
80+
background-color: #babac0;
81+
border-radius: $border-radius-base * 2;
82+
border: 6px solid #fff;
83+
}
84+
}

cvat-ui/src/components/actions-menu/actions-menu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ function ActionsMenuComponent(props: Props): JSX.Element {
5454

5555
const plugins = usePlugins((state: CombinedState) => state.plugins.components.taskActions.items, props);
5656

57-
const mergingConsensus = useSelector((state: CombinedState) => state.consensus.mergingConsensus);
57+
const mergingConsensus = useSelector((state: CombinedState) => state.consensus.actions.merging);
5858
const isTaskInMergingConsensus = mergingConsensus[`task_${taskID}`];
5959

6060
const onClickMenuWrapper = useCallback(

cvat-ui/src/components/consensus-management-page/consensus-management-page.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import Result from 'antd/lib/result';
2020

2121
import CVATLoadingSpinner from 'components/common/loading-spinner';
2222
import { ActionUnion, createAction } from 'utils/redux';
23+
import { fetchTask } from 'utils/fetch';
2324
import ConsensusSettingsTab from './consensus-settings-tab';
2425

2526
const core = getCore();
@@ -125,12 +126,7 @@ function ConsensusManagementPage(): JSX.Element {
125126

126127
const initializeData = async (id: number): Promise<void> => {
127128
try {
128-
let taskInstance = null;
129-
try {
130-
[taskInstance] = await core.tasks.get({ id });
131-
} catch (error: unknown) {
132-
throw new Error('The task was not found on the server');
133-
}
129+
const taskInstance = await fetchTask(id);
134130

135131
setInstance(taskInstance);
136132
try {

cvat-ui/src/components/consensus-management-page/styles.scss

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -4,25 +4,6 @@
44

55
@import 'base';
66

7-
.cvat-consensus-scrollbar {
8-
overflow-y: auto;
9-
10-
&::-webkit-scrollbar {
11-
background-color: #fff;
12-
width: $grid-unit-size * 2;
13-
}
14-
15-
&::-webkit-scrollbar-track {
16-
background-color: #fff;
17-
}
18-
19-
&::-webkit-scrollbar-thumb {
20-
background-color: #babac0;
21-
border-radius: $border-radius-base * 2;
22-
border: 6px solid #fff;
23-
}
24-
}
25-
267
.cvat-consensus-management-inner {
278
background: $background-color-1;
289
padding: $grid-unit-size * 4;
@@ -66,7 +47,7 @@
6647

6748
.cvat-task-control-tabs {
6849
.ant-tabs-tabpane {
69-
@extend .cvat-consensus-scrollbar;
50+
@extend .cvat-scrollbar;
7051

7152
height: calc(100vh - $grid-unit-size * 33);
7253
}

0 commit comments

Comments
 (0)