Skip to content

Commit 658da4b

Browse files
bsekachevChris Lee-Messer
authored andcommitted
UI Enhancements (cvat-ai#985)
* Single import of basic styles * A little bit redesigned header * Specified min resolution 1280x768 * Getting a job instance * Improved handling when task doesn't exist
1 parent b8ef29a commit 658da4b

File tree

12 files changed

+225
-105
lines changed

12 files changed

+225
-105
lines changed

cvat-ui/src/base.scss

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -15,27 +15,3 @@ $danger-icon-color: #FF4136;
1515
$info-icon-color: #0074D9;
1616

1717
$monospaced-fonts-stack: Consolas,Monaco,Lucida Console,Liberation Mono,DejaVu Sans Mono,Bitstream Vera Sans Mono,Courier New, monospace;
18-
19-
hr {
20-
border: none;
21-
border-top: 1px solid $border-color-1;
22-
height: 1px;
23-
}
24-
25-
.cvat-text-color {
26-
color: $text-color;
27-
}
28-
29-
.cvat-title {
30-
font-weight: 400;
31-
font-size: 21px;
32-
color: $text-color;
33-
padding-top: 5px;
34-
}
35-
36-
#root {
37-
width: 100%;
38-
height: 100%;
39-
min-height: 100%;
40-
display: grid;
41-
}

cvat-ui/src/components/annotation-page/annotation-page.tsx

Lines changed: 34 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,45 @@ import React from 'react';
33

44
import {
55
Layout,
6+
Spin,
7+
Result,
68
} from 'antd';
79

810
import AnnotationTopBarComponent from './top-bar/top-bar';
911
import StandardWorkspaceComponent from './standard-workspace/standard-workspace';
1012

11-
export default function AnnotationPageComponent(): JSX.Element {
13+
interface Props {
14+
jobInstance: any | null | undefined;
15+
fetching: boolean;
16+
getJob(): void;
17+
}
18+
19+
export default function AnnotationPageComponent(props: Props): JSX.Element {
20+
const {
21+
jobInstance,
22+
fetching,
23+
getJob,
24+
} = props;
25+
26+
if (jobInstance === null) {
27+
if (!fetching) {
28+
getJob();
29+
}
30+
31+
return <Spin size='large' className='cvat-spinner' />;
32+
}
33+
34+
if (typeof (jobInstance) === 'undefined') {
35+
return (
36+
<Result
37+
className='cvat-not-found'
38+
status='404'
39+
title='Sorry, but this job was not found'
40+
subTitle='Please, be sure information you tried to get exist and you have access'
41+
/>
42+
);
43+
}
44+
1245
return (
1346
<Layout className='cvat-annotation-page'>
1447
<AnnotationTopBarComponent />

cvat-ui/src/components/annotation-page/styles.scss

Lines changed: 34 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -14,46 +14,48 @@
1414
.cvat-annotation-header-left-group {
1515
height: 100%;
1616

17-
> div {
18-
padding: 0px;
19-
width: 54px;
20-
height: 54px;
21-
float: left;
22-
text-align: center;
17+
> div:first-child {
18+
filter: invert(0.9);
19+
background: $background-color-1;
20+
border-radius: 0px;
21+
width: 70px;
22+
}
23+
}
2324

24-
> span {
25-
font-size: 10px;
26-
}
25+
.cvat-annotation-header-button {
26+
padding: 0px;
27+
width: 54px;
28+
height: 54px;
29+
float: left;
30+
text-align: center;
31+
user-select: none;
2732

28-
> i {
29-
transform: scale(0.8);
30-
padding: 3px;
31-
}
33+
> span {
34+
font-size: 10px;
35+
}
3236

33-
&:hover > i {
34-
transform: scale(0.9);
35-
}
37+
> i {
38+
transform: scale(0.8);
39+
padding: 3px;
40+
}
3641

37-
&:active > i {
38-
transform: scale(0.8);
39-
}
42+
&:hover > i {
43+
transform: scale(0.9);
44+
}
4045

41-
> * {
42-
display: block;
43-
line-height: 0px;
44-
}
46+
&:active > i {
47+
transform: scale(0.8);
4548
}
4649

47-
> div:first-child {
48-
filter: invert(0.9);
49-
background: $background-color-1;
50-
border-radius: 0px;
51-
width: 70px;
50+
> * {
51+
display: block;
52+
line-height: 0px;
5253
}
5354
}
5455

5556
.cvat-annotation-header-player-group > div {
5657
height: 54px;
58+
line-height: 0px;
5759
}
5860

5961
.cvat-annotation-header-player-buttons {
@@ -96,14 +98,16 @@
9698
}
9799

98100
.cvat-annotation-header-filename-wrapper {
99-
max-width: 180px;
101+
max-width: 300px;
100102
overflow: hidden;
101103
text-overflow: ellipsis;
104+
user-select: none;
102105
}
103106

104107
.cvat-annotation-header-frame-selector {
105108
width: 5em;
106-
margin-right: 0.5em;
109+
padding-right: 5px;
110+
margin-left: 5px;
107111
}
108112

109113
.cvat-annotation-header-right-group {

cvat-ui/src/components/annotation-page/top-bar/top-bar.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -34,25 +34,25 @@ export default function AnnotationPageComponent(): JSX.Element {
3434
<Layout.Header className='cvat-annotation-page-header'>
3535
<Row type='flex' justify='space-between'>
3636
<Col className='cvat-annotation-header-left-group'>
37-
<div>
37+
<div className='cvat-annotation-header-button'>
3838
<Icon component={MainMenuIcon} />
3939
<span>Menu</span>
4040
</div>
41-
<div>
41+
<div className='cvat-annotation-header-button'>
4242
<Icon component={SaveIcon} />
4343
<span>Save</span>
4444
</div>
45-
<div>
45+
<div className='cvat-annotation-header-button'>
4646
<Icon component={UndoIcon} />
4747
<span>Undo</span>
4848
</div>
49-
<div>
49+
<div className='cvat-annotation-header-button'>
5050
<Icon component={RedoIcon} />
5151
<span>Redo</span>
5252
</div>
5353
</Col>
5454
<Col className='cvat-annotation-header-player-group'>
55-
<Row type='flex'>
55+
<Row type='flex' align='middle'>
5656
<Col className='cvat-annotation-header-player-buttons'>
5757
<Icon component={PlaycontrolFirstIcon} />
5858
<Icon component={PlaycontrolBackJumpIcon} />
@@ -68,26 +68,25 @@ export default function AnnotationPageComponent(): JSX.Element {
6868
<Slider className='cvat-annotation-header-player-slider' tipFormatter={null} />
6969
</Col>
7070
</Row>
71-
<Row type='flex' justify='space-between'>
71+
<Row type='flex' justify='space-around'>
7272
<Col className='cvat-annotation-header-filename-wrapper'>
7373
<Tooltip overlay='filename.png'>
7474
<Text type='secondary'>filename.png</Text>
7575
</Tooltip>
7676
</Col>
77-
<Col>
78-
<Input className='cvat-annotation-header-frame-selector' type='number' size='small' />
79-
<Text type='secondary'>of 200</Text>
80-
</Col>
8177
</Row>
8278
</Col>
79+
<Col>
80+
<Input className='cvat-annotation-header-frame-selector' type='number' />
81+
</Col>
8382
</Row>
8483
</Col>
8584
<Col className='cvat-annotation-header-right-group'>
86-
<div>
85+
<div className='cvat-annotation-header-button'>
8786
<Icon component={FullscreenIcon} />
8887
<span>Fullscreen</span>
8988
</div>
90-
<div>
89+
<div className='cvat-annotation-header-button'>
9190
<Icon component={InfoIcon} />
9291
<span>Info</span>
9392
</div>

cvat-ui/src/components/cvat-app.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import 'antd/dist/antd.less';
2-
import '../base.scss';
2+
import '../styles.scss';
33
import React from 'react';
44
import { BrowserRouter } from 'react-router-dom';
55
import {
@@ -262,7 +262,7 @@ export default class CVATApplication extends React.PureComponent<CVATAppProps> {
262262
<Route exact path='/tasks' component={TasksPageContainer} />
263263
<Route exact path='/tasks/create' component={CreateTaskPageContainer} />
264264
<Route exact path='/tasks/:id' component={TaskPageContainer} />
265-
<Route exact path='/tasks/:id/jobs/:id' component={AnnotationPageContainer} />
265+
<Route exact path='/tasks/:tid/jobs/:jid' component={AnnotationPageContainer} />
266266
{ withModels
267267
&& <Route exact path='/models' component={ModelsPageContainer} /> }
268268
{ installedAutoAnnotation
@@ -289,7 +289,7 @@ export default class CVATApplication extends React.PureComponent<CVATAppProps> {
289289
}
290290

291291
return (
292-
<Spin size='large' style={{ margin: '25% 50%' }} />
292+
<Spin size='large' className='cvat-spinner' />
293293
);
294294
}
295295
}

cvat-ui/src/components/model-runner-modal/model-runner-modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ export default class ModelRunnerModalComponent extends React.PureComponent<Props
407407
visible
408408
>
409409
{!modelsInitialized
410-
&& <Spin size='large' style={{ margin: '25% 50%' }} />}
410+
&& <Spin size='large' className='cvat-spinner' />}
411411
{modelsInitialized && this.renderContent()}
412412
</Modal>
413413
)

cvat-ui/src/components/models-page/models-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function ModelsPageComponent(props: Props): JSX.Element {
4242
props.getModels();
4343
}
4444
return (
45-
<Spin size='large' style={{ margin: '25% 45%' }} />
45+
<Spin size='large' className='cvat-spinner' />
4646
);
4747
}
4848

cvat-ui/src/components/task-page/task-page.tsx

Lines changed: 14 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import {
77
Col,
88
Row,
99
Spin,
10-
notification,
10+
Result,
1111
} from 'antd';
1212

1313
import TopBarComponent from './top-bar';
@@ -17,11 +17,11 @@ import ModelRunnerModalContainer from '../../containers/model-runner-dialog/mode
1717
import { Task } from '../../reducers/interfaces';
1818

1919
interface TaskPageComponentProps {
20-
task: Task | null;
20+
task: Task | null | undefined;
2121
fetching: boolean;
2222
deleteActivity: boolean | null;
2323
installedGit: boolean;
24-
onFetchTask: (tid: number) => void;
24+
getTask: () => void;
2525
}
2626

2727
type Props = TaskPageComponentProps & RouteComponentProps<{id: string}>;
@@ -38,41 +38,33 @@ class TaskPageComponent extends React.PureComponent<Props> {
3838
if (deleteActivity) {
3939
history.replace('/tasks');
4040
}
41-
42-
if (this.attempts === 2) {
43-
notification.warning({
44-
message: 'Something wrong with the task. It cannot be fetched from the server',
45-
});
46-
}
4741
}
4842

4943
public render(): JSX.Element {
5044
const {
51-
match,
5245
task,
5346
fetching,
54-
onFetchTask,
47+
getTask,
5548
} = this.props;
56-
const { id } = match.params;
57-
const fetchTask = !task;
5849

59-
if (fetchTask) {
50+
if (task === null) {
6051
if (!fetching) {
61-
if (!this.attempts) {
62-
this.attempts++;
63-
onFetchTask(+id);
64-
} else {
65-
this.attempts++;
66-
}
52+
getTask();
6753
}
54+
6855
return (
69-
<Spin size='large' style={{ margin: '25% 50%' }} />
56+
<Spin size='large' className='cvat-spinner' />
7057
);
7158
}
7259

7360
if (typeof (task) === 'undefined') {
7461
return (
75-
<div> </div>
62+
<Result
63+
className='cvat-not-found'
64+
status='404'
65+
title='Sorry, but this task was not found'
66+
subTitle='Please, be sure information you tried to get exist and you have access'
67+
/>
7668
);
7769
}
7870

cvat-ui/src/components/tasks-page/tasks-page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class TasksPageComponent extends React.PureComponent<TasksPageProps & RouteCompo
207207

208208
if (tasksFetching) {
209209
return (
210-
<Spin size='large' style={{ margin: '25% 45%' }} />
210+
<Spin size='large' className='cvat-spinner' />
211211
);
212212
}
213213

0 commit comments

Comments
 (0)