Skip to content

Commit

Permalink
Added displayed versions of core, canvas, and ui in about (#1191)
Browse files Browse the repository at this point in the history
* Added displayed versions of core, canvas, and ui in about

* Removed extra method
  • Loading branch information
bsekachev authored Feb 25, 2020
1 parent 105357d commit f329e14
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 23 deletions.
2 changes: 2 additions & 0 deletions cvat-canvas/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ Standard JS events are used.
// Create an instance of a canvas
const canvas = new window.canvas.Canvas();

console.log('Version', window.canvas.CanvasVersion);

// Put canvas to a html container
htmlContainer.appendChild(canvas.html());
canvas.fitCanvas();
Expand Down
2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas",
"version": "0.1.0",
"version": "0.5.2",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
"scripts": {
Expand Down
5 changes: 4 additions & 1 deletion cvat-canvas/src/typescript/canvas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ import {
} from './canvasView';

import '../scss/canvas.scss';
import pjson from '../../package.json';

const CanvasVersion = pjson.version;

interface Canvas {
html(): HTMLDivElement;
Expand Down Expand Up @@ -130,8 +133,8 @@ class CanvasImpl implements Canvas {
}
}


export {
CanvasImpl as Canvas,
Rotation,
CanvasVersion,
};
2 changes: 2 additions & 0 deletions cvat-canvas/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
"noImplicitAny": true,
"preserveConstEnums": true,
"declaration": true,
"resolveJsonModule": true,
"esModuleInterop": true,
"moduleResolution": "node",
"declarationDir": "dist/declaration",
"paths": {
Expand Down
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core.js",
"version": "0.1.0",
"version": "0.5.2",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-ui",
"version": "0.1.0",
"version": "0.5.2",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
46 changes: 35 additions & 11 deletions cvat-ui/src/components/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,26 @@ import {

import Text from 'antd/lib/typography/Text';

import getCore from 'cvat-core';
import {
CVATLogo,
AccountIcon,
} from 'icons';

const core = getCore();
const serverHost = core.config.backendAPI.slice(0, -7);

interface HeaderContainerProps {
onLogout: () => void;
logoutFetching: boolean;
installedAnalytics: boolean;
installedAutoAnnotation: boolean;
installedTFAnnotation: boolean;
installedTFSegmentation: boolean;
serverHost: string;
username: string;
serverAbout: any;
toolName: string;
serverVersion: string;
serverDescription: string;
coreVersion: string;
canvasVersion: string;
uiVersion: string;
}

type Props = HeaderContainerProps & RouteComponentProps;
Expand All @@ -45,7 +47,13 @@ function HeaderContainer(props: Props): JSX.Element {
installedTFAnnotation,
installedAnalytics,
username,
serverAbout,
toolName,
serverHost,
serverVersion,
serverDescription,
coreVersion,
canvasVersion,
uiVersion,
onLogout,
logoutFetching,
} = props;
Expand All @@ -61,26 +69,42 @@ function HeaderContainer(props: Props): JSX.Element {
const FORUM = 'https://software.intel.com/en-us/forums/intel-distribution-of-openvino-toolkit';

Modal.info({
title: `${serverAbout.name}`,
title: `${toolName}`,
content: (
<div>
<p>
{`${serverAbout.description}`}
{`${serverDescription}`}
</p>
<p>
<Text strong>
Server version:
</Text>
<Text type='secondary'>
{` ${serverAbout.version}`}
{` ${serverVersion}`}
</Text>
</p>
<p>
<Text strong>
Core version:
</Text>
<Text type='secondary'>
{` ${coreVersion}`}
</Text>
</p>
<p>
<Text strong>
Canvas version:
</Text>
<Text type='secondary'>
{` ${canvasVersion}`}
</Text>
</p>
<p>
<Text strong>
Client version:
UI version:
</Text>
<Text type='secondary'>
{` ${core.client.version}`}
{` ${uiVersion}`}
</Text>
</p>
<Row type='flex' justify='space-around'>
Expand Down
41 changes: 34 additions & 7 deletions cvat-ui/src/containers/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,36 +5,63 @@ import {
CombinedState,
} from 'reducers/interfaces';

import getCore from 'cvat-core';
import HeaderComponent from 'components/header/header';
import { logoutAsync } from 'actions/auth-actions';

const core = getCore();

interface StateToProps {
logoutFetching: boolean;
installedAnalytics: boolean;
installedAutoAnnotation: boolean;
installedTFSegmentation: boolean;
installedTFAnnotation: boolean;
username: string;
serverAbout: any;
toolName: string;
serverHost: string;
serverVersion: string;
serverDescription: string;
coreVersion: string;
canvasVersion: string;
uiVersion: string;
}

interface DispatchToProps {
onLogout: typeof logoutAsync;
}

function mapStateToProps(state: CombinedState): StateToProps {
const { auth } = state;
const { list } = state.plugins;
const { about } = state;
const {
auth: {
fetching: logoutFetching,
user: {
username,
},
},
plugins: {
list,
},
about: {
server,
packageVersion,
},
} = state;

return {
logoutFetching: state.auth.fetching,
logoutFetching,
installedAnalytics: list[SupportedPlugins.ANALYTICS],
installedAutoAnnotation: list[SupportedPlugins.AUTO_ANNOTATION],
installedTFSegmentation: list[SupportedPlugins.TF_SEGMENTATION],
installedTFAnnotation: list[SupportedPlugins.TF_ANNOTATION],
username: auth.user.username,
serverAbout: about.server,
username,
toolName: server.name as string,
serverHost: core.config.backendAPI.slice(0, -7),
serverDescription: server.description as string,
serverVersion: server.version as string,
coreVersion: packageVersion.core,
canvasVersion: packageVersion.canvas,
uiVersion: packageVersion.ui,
};
}

Expand Down
2 changes: 2 additions & 0 deletions cvat-ui/src/cvat-canvas.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import {
Canvas,
Rotation,
CanvasVersion,
} from '../../cvat-canvas/src/typescript/canvas';

export {
Canvas,
Rotation,
CanvasVersion,
};
8 changes: 8 additions & 0 deletions cvat-ui/src/reducers/about-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,17 @@ import { AboutActions, AboutActionTypes } from 'actions/about-actions';
import { AuthActions, AuthActionTypes } from 'actions/auth-actions';
import { AboutState } from './interfaces';

import { CanvasVersion } from '../cvat-canvas';
import getCore from '../cvat-core';
import pjson from '../../package.json';

const defaultState: AboutState = {
server: {},
packageVersion: {
core: getCore().client.version,
canvas: CanvasVersion,
ui: pjson.version,
},
fetching: false,
initialized: false,
};
Expand Down
5 changes: 5 additions & 0 deletions cvat-ui/src/reducers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,11 @@ export interface UsersState {

export interface AboutState {
server: any;
packageVersion: {
core: string;
canvas: string;
ui: string;
};
fetching: boolean;
initialized: boolean;
}
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
],
"allowJs": true,
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "preserve",
Expand Down

0 comments on commit f329e14

Please sign in to comment.