Skip to content

Commit

Permalink
Fixes after review comments at cvat-ai#30
Browse files Browse the repository at this point in the history
  • Loading branch information
wooyey committed May 19, 2022
1 parent 9e7f061 commit 1361ded
Show file tree
Hide file tree
Showing 10 changed files with 89 additions and 53 deletions.
13 changes: 6 additions & 7 deletions cvat-core/src/api-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -326,10 +326,10 @@

cvat.aifred.dtls.implementation = (workspaceId) => aifredProxy.dtls(workspaceId);

cvat.aifred.createWorkout
.implementation = (name, instance, workspaceId, dtlId, iterations) => {
aifredProxy.createWorkout(name, instance, workspaceId, dtlId, iterations);
};
cvat.aifred.createWorkout.implementation =
(name, instance, workspaceId, dtlId, iterations) => (
aifredProxy.createWorkout(name, instance, workspaceId, dtlId, iterations)
);

cvat.aifred.getSelf.implementation = () => aifredProxy.getSelf();

Expand Down Expand Up @@ -410,9 +410,8 @@
};
};

cvat.aifred.getWorkoutImage.implementation = (workoutId, fileType, fileName) => {
aifredProxy.getWorkoutImage(workoutId, fileType, fileName);
};
cvat.aifred.getWorkoutImage.implementation =
(workoutId, fileType, fileName) => aifredProxy.getWorkoutImage(workoutId, fileType, fileName);

cvat.aifred.getWorkoutMetrics.implementation = (workoutId) => aifredProxy.getWorkoutMetrics(workoutId);

Expand Down
Binary file modified cvat-ui/dist/favicon.ico
Binary file not shown.
4 changes: 2 additions & 2 deletions cvat-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"main": "src/index.tsx",
"scripts": {
"build": "webpack --config ./webpack.config.js",
"start": "webpack-dev-server --env.API_URL=http://cvat:8080 --config ./webpack.config.js --mode=development",
"start": "webpack-dev-server --env.API_URL=http://cvat.lab:8080 --config ./webpack.config.js --mode=development",
"type-check": "tsc --noEmit",
"type-check:watch": "npm run type-check -- --watch",
"lint": "eslint './src/**/*.{ts,tsx}'",
Expand Down Expand Up @@ -62,4 +62,4 @@
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0"
}
}
}
42 changes: 12 additions & 30 deletions cvat-ui/src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,14 @@
import './styles.scss';
import React from 'react';
import { connect } from 'react-redux';
import { useHistory } from 'react-router';
import { useHistory, useLocation } from 'react-router';
import { Row, Col } from 'antd/lib/grid';
import Icon, {
SettingOutlined,
InfoCircleOutlined,
EditOutlined,
LoadingOutlined,
LogoutOutlined,
GithubOutlined,
QuestionCircleOutlined,
CaretDownOutlined,
ControlOutlined,
Expand Down Expand Up @@ -148,10 +147,11 @@ function HeaderContainer(props: Props): JSX.Element {
} = props;

const {
CHANGELOG_URL, LICENSE_URL, GITTER_URL, FORUM_URL, GITHUB_URL,
CHANGELOG_URL, LICENSE_URL, GITTER_URL, FORUM_URL,
} = consts;

const history = useHistory();
const location = useLocation();

function showAboutModal(): void {
Modal.info({
Expand Down Expand Up @@ -255,12 +255,18 @@ function HeaderContainer(props: Props): JSX.Element {
</Menu>
);

const getButtonClassName = (value: string): string => {
// eslint-disable-next-line security/detect-non-literal-regexp
const regex = new RegExp(`${value}$`);
return location.pathname.match(regex) ? 'cvat-header-button cvat-active-header-button' : 'cvat-header-button';
};

return (
<Layout.Header className='cvat-header'>
<div className='cvat-left-header'>
<Icon className='ocellus-logo-icon' component={OcellusLogo} />
<Button
className='cvat-header-button'
className={getButtonClassName('projects')}
type='link'
value='projects'
href='/projects'
Expand All @@ -272,7 +278,7 @@ function HeaderContainer(props: Props): JSX.Element {
Projects
</Button>
<Button
className='cvat-header-button'
className={getButtonClassName('tasks')}
type='link'
value='tasks'
href='/tasks?page=1'
Expand All @@ -284,7 +290,7 @@ function HeaderContainer(props: Props): JSX.Element {
Tasks
</Button>
<Button
className='cvat-header-button'
className={getButtonClassName('workouts')}
type='link'
value='workouts'
href='/workouts?page=1'
Expand All @@ -295,18 +301,6 @@ function HeaderContainer(props: Props): JSX.Element {
>
Workouts
</Button>
<Button
className='cvat-header-button'
type='link'
value='cloudstorages'
href='/cloudstorages?page=1'
onClick={(event: React.MouseEvent): void => {
event.preventDefault();
history.push('/cloudstorages?page=1');
}}
>
Cloud Storages
</Button>
{isModelsPluginActive && (
<Button
className='cvat-header-button'
Expand Down Expand Up @@ -338,18 +332,6 @@ function HeaderContainer(props: Props): JSX.Element {
)}
</div>
<div className='cvat-right-header'>
<Button
className='cvat-header-button'
type='link'
href={GITHUB_URL}
onClick={(event: React.MouseEvent): void => {
event.preventDefault();
window.open(GITHUB_URL, '_blank');
}}
>
<GithubOutlined />
<Text className='cvat-text-color'>GitHub</Text>
</Button>
<Button
className='cvat-header-button'
type='link'
Expand Down
40 changes: 31 additions & 9 deletions cvat-ui/src/components/workout-page/details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import React, { useState } from 'react';
import { useDispatch } from 'react-redux';
import { useHistory } from 'react-router';
import moment from 'moment';
import { Table } from 'antd';
import { Row, Col } from 'antd/lib/grid';
import Title from 'antd/lib/typography/Title';
import Button from 'antd/lib/button';
Expand Down Expand Up @@ -34,20 +35,41 @@ export default function DetailsComponent(props: DetailsComponentProps): JSX.Elem
</div>
);

const histogramColumns = [
{
title: 'Name',
dataIndex: 'name',
key: 'name',
},
{
title: 'Number of instances',
dataIndex: 'instances',
key: 'instances',
},
{
title: '%',
dataIndex: 'percent',
key: 'percent',
},
];

const histogramData = (Object.keys(workout.histogram).length > 0) ? workout.histogram?.classes.map(
(item: any): { key: string, name: string; instances: number; percent: number; } => (
{
...item,
percent: Math.round((item.instances / workout.histogram.total) * 100),
key: item.name,
}
),
) : null;

const histogram = (
<Row justify='space-between' className='cvat-workout-classes'>

{(Object.keys(workout.histogram).length > 0) && (
{(histogramData !== null) && (
<Col span={24}>
<Text strong>Classes:</Text>
<ul>
{workout.histogram.classes.map((item: any): JSX.Element => (
<li key={item.name}>
{`${item.name}: ${item.instances} `}
{`(${Math.round((item.instances / workout.histogram.total) * 100)} %)`}
</li>
))}
</ul>
<Table columns={histogramColumns} dataSource={histogramData} />
</Col>
)}
</Row>
Expand Down
3 changes: 2 additions & 1 deletion cvat-ui/src/components/workout-page/progress-bar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export default function ProgressBarComponent(props: Props): JSX.Element {
const numOfIterations = workout.iterations;
const numOfCompleted = workout.iteration;
const timeLeft = (workout.eta < 0) ? 'N/A' : formatSeconds(workout.eta);
const showETA = !(workout.eta === 0); // don't show ETA for finished workout

const progressText = (
<Text strong className={ProgressColor(status)}>
Expand Down Expand Up @@ -75,7 +76,7 @@ export default function ProgressBarComponent(props: Props): JSX.Element {
</Row>
<Row justify='space-between' align='top'>
<Col span={24}>
<Text type='secondary'>{`ETA: ${timeLeft}`}</Text>
<Text type='secondary'>{showETA && `ETA: ${timeLeft}`}</Text>
</Col>
</Row>
</Col>
Expand Down
5 changes: 5 additions & 0 deletions cvat-ui/src/components/workout-page/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -127,4 +127,9 @@

.cvat-workout-classes {
margin-top: $grid-unit-size * 2;
}

.cvat-workout-validation-preview {
margin-left: 1%;
width: 97%;
}
6 changes: 4 additions & 2 deletions cvat-ui/src/components/workout-page/validations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Title from 'antd/lib/typography/Title';
import { useDispatch, useSelector } from 'react-redux';
import Spin from 'antd/lib/spin';

import Text from 'antd/lib/typography/Text';
import { getWorkoutValidationsAsync } from 'actions/workout-actions';
import { CombinedState, WorkoutValidation } from 'reducers/interfaces';
import EmptyListComponent from './empty-list';
Expand Down Expand Up @@ -37,9 +38,10 @@ export default function ValidationsComponent(props: ValidationsComponentProps):
Model Validations
</Title>
{imagesFetching ? <Spin key={workout.id} size='large' className='cvat-spinner' /> : images.map(
(item: WorkoutValidation): JSX.Element => (
(item: WorkoutValidation, idx: number): JSX.Element => (
<div key={item.name} className='cvat-workout-image-container'>
<img key={item.name} alt={item.name} className='cvat-task-item-preview' src={item.image} />
<Text strong>{`#${idx + 1}:`}</Text>
<img key={item.name} alt={item.name} className='cvat-workout-validation-preview' src={item.image} />
</div>
),
)}
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const LICENSE_URL = 'https://github.com/openvinotoolkit/cvat/blob/develop/LICENS
const GITTER_URL = 'https://gitter.im/opencv-cvat';
const GITTER_PUBLIC_URL = 'https://gitter.im/opencv-cvat/public';
const FORUM_URL = 'https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit';
const GITHUB_URL = 'https://github.com/openvinotoolkit/cvat';
const GITHUB_URL = 'https://github.com/byte-motion/cvat';
const GITHUB_IMAGE_URL =
'https://github.com/openvinotoolkit/cvat/raw/develop/site/content/en/images/cvat.jpg';
const SHARE_MOUNT_GUIDE_URL =
Expand Down
27 changes: 26 additions & 1 deletion cvat-ui/src/ocellus.scss
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,33 @@ $monospaced-fonts-stack: Roboto Mono, Consolas, Monaco, Lucida Console, Liberati
color: $inprogress-progress-color;
}


.cvat-workout-top-bar-actions .cvat-menu-icon svg,
.cvat-task-top-bar .cvat-menu-icon svg,
.cvat-annotation-header svg,
.cvat-objects-sidebar-tabs svg,
.cvat-canvas-controls-sidebar svg {
.cvat-canvas-controls-sidebar svg,
.cvat-header-account-icon svg,
.cvat-item-open-task-actions svg {
filter: invert(0.8);
}

.cvat-item-open-task-actions svg:hover {
cursor: pointer;
}

.cvat-active-header-button {
font-weight: bold;
}

.anticon.cvat-header-account-icon {
> svg {
transform: scale(0.7);
}
}

.anticon.anticon-question-circle {
> svg {
transform: scale(1.5);
}
}

0 comments on commit 1361ded

Please sign in to comment.