Skip to content

Commit

Permalink
Merge branch 'develop' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
nmanovic committed Jun 30, 2020
2 parents 38b19cb + 6d85840 commit 681ea2b
Show file tree
Hide file tree
Showing 32 changed files with 739 additions and 83 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Highlights for the first point of a polygon/polyline and direction (<https://github.com/opencv/cvat/pull/1571>)
- Ability to change orientation for poylgons/polylines in context menu (<https://github.com/opencv/cvat/pull/1571>)
- Ability to set the first point for polygons in points context menu (<https://github.com/opencv/cvat/pull/1571>)
- Added new tag annotation workspace (<https://github.com/opencv/cvat/pull/1570>)

### Changed
- Removed information about e-mail from the basic user information (<https://github.com/opencv/cvat/pull/1627>)
Expand All @@ -33,6 +34,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Implemented import and export of annotations with relative image paths (<https://github.com/opencv/cvat/pull/1463>)
- Using only single click to start editing or remove a point (<https://github.com/opencv/cvat/pull/1571>)
- Added support for attributes in VOC XML format (https://github.com/opencv/cvat/pull/1792)
- Added annotation attributes in COCO format (https://github.com/opencv/cvat/pull/1782)
- Colorized object items in the side panel (<https://github.com/opencv/cvat/pull/1753>)

### Deprecated
-
Expand All @@ -54,7 +57,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- A couple of exceptions in AAM related with early object activation (<https://github.com/opencv/cvat/pull/1755>)
- Propagation from the latest frame (<https://github.com/opencv/cvat/pull/1800>)
- Number attribute value validation (didn't work well with floats) (<https://github.com/opencv/cvat/pull/1800>)
- Fixed Logout function (<https://github.com/opencv/cvat/issues/1810>)
- Logout doesn't work (<https://github.com/opencv/cvat/pull/1812>)
- Annotations aren't updated after reopening a task (<https://github.com/opencv/cvat/pull/1753>)
- Labels aren't updated after reopening a task (<https://github.com/opencv/cvat/pull/1753>)
- Canvas isn't fitted after collapsing side panel in attribute annotation mode (<https://github.com/opencv/cvat/pull/1753>)

### Security
- SQL injection in Django `CVE-2020-9402` (<https://github.com/opencv/cvat/pull/1657>)
Expand Down
6 changes: 4 additions & 2 deletions cvat-canvas/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ const webConfig = {
target: 'web',
mode: 'production',
devtool: 'source-map',
entry: './src/typescript/canvas.ts',
entry: {
'cvat-canvas': './src/typescript/canvas.ts',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cvat-canvas.js',
filename: '[name].[contenthash].js',
library: 'canvas',
libraryTarget: 'window',
},
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",
"version": "3.0.1",
"version": "3.1.0",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
10 changes: 10 additions & 0 deletions cvat-core/src/annotations.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,15 @@
}
}

async function closeSession(session) {
const sessionType = session instanceof Task ? 'task' : 'job';
const cache = getCache(sessionType);

if (cache.has(session)) {
cache.delete(session);
}
}

async function getAnnotations(session, frame, allTracks, filters) {
const sessionType = session instanceof Task ? 'task' : 'job';
const cache = getCache(sessionType);
Expand Down Expand Up @@ -365,5 +374,6 @@
redoActions,
clearActions,
getActions,
closeSession,
};
})();
25 changes: 25 additions & 0 deletions cvat-core/src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -1309,6 +1309,21 @@
};
}

/**
* Method removes all task related data from the client (annotations, history, etc.)
* @method close
* @returns {module:API.cvat.classes.Task}
* @memberof module:API.cvat.classes.Task
* @readonly
* @async
* @instance
* @throws {module:API.cvat.exceptions.PluginError}
*/
async close() {
const result = await PluginRegistry.apiWrapper.call(this, Task.prototype.close);
return result;
}

/**
* Method updates data of a created task or creates new task from scratch
* @method save
Expand Down Expand Up @@ -1372,6 +1387,7 @@
redoActions,
clearActions,
getActions,
closeSession,
} = require('./annotations');

buildDublicatedAPI(Job.prototype);
Expand Down Expand Up @@ -1576,6 +1592,15 @@
return result;
};

Task.prototype.close.implementation = function closeTask() {
for (const job of this.jobs) {
closeSession(job);
}

closeSession(this);
return this;
};

Task.prototype.save.implementation = async function saveTaskImplementation(onUpdate) {
// TODO: Add ability to change an owner and an assignee
if (typeof (this.id) !== 'undefined') {
Expand Down
10 changes: 6 additions & 4 deletions cvat-core/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,12 @@ const webConfig = {
target: 'web',
mode: 'production',
devtool: 'source-map',
entry: './src/api.js',
entry: {
'cvat-core': './src/api.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cvat-core.min.js',
filename: '[name].[contenthash].min.js',
library: 'cvat',
libraryTarget: 'window',
},
Expand All @@ -58,7 +60,7 @@ const webConfig = {
loader: 'worker-loader',
options: {
publicPath: '/static/engine/js/3rdparty/',
name: '[name].js',
name: '[name].[contenthash].js',
},
},
}, {
Expand All @@ -68,7 +70,7 @@ const webConfig = {
loader: 'worker-loader',
options: {
publicPath: '/static/engine/js/',
name: '[name].js',
name: '[name].[contenthash].js',
},
},
},
Expand Down
10 changes: 6 additions & 4 deletions cvat-data/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ const CopyPlugin = require('copy-webpack-plugin');
const cvatData = {
target: 'web',
mode: 'production',
entry: './src/js/cvat-data.js',
entry: {
'cvat-data': './src/js/cvat-data.js',
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'cvat-data.min.js',
filename: '[name].[contenthash].min.js',
library: 'cvatData',
libraryTarget: 'window',
},
Expand All @@ -39,7 +41,7 @@ const cvatData = {
loader: 'worker-loader',
options: {
publicPath: '/',
name: '[name].js',
name: '[name].[contenthash].js',
},
},
}, {
Expand All @@ -48,7 +50,7 @@ const cvatData = {
loader: 'worker-loader',
options: {
publicPath: '/3rdparty/',
name: '3rdparty/[name].js',
name: '3rdparty/[name].[contenthash].js',
},
},
},
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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": "1.4.1",
"version": "1.5.0",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
20 changes: 13 additions & 7 deletions cvat-ui/src/actions/annotation-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -906,6 +906,19 @@ export function confirmCanvasReady(): AnyAction {
};
}

export function closeJob(): ThunkAction<Promise<void>, {}, {}, AnyAction> {
return async (dispatch: ActionCreator<Dispatch>): Promise<void> => {
const { jobInstance } = receiveAnnotationsParameters();
if (jobInstance) {
await jobInstance.task.close();
}

dispatch({
type: AnnotationActionTypes.CLOSE_JOB,
});
};
}

export function getJobAsync(
tid: number,
jid: number,
Expand All @@ -918,13 +931,6 @@ export function getJobAsync(
const filters = initialFilters;
const { showAllInterpolationTracks } = state.settings.workspace;

// Check if already loaded job is different from asking one
if (state.annotation.job.instance && state.annotation.job.instance.id !== jid) {
dispatch({
type: AnnotationActionTypes.CLOSE_JOB,
});
}

dispatch({
type: AnnotationActionTypes.GET_JOB,
payload: {
Expand Down
3 changes: 2 additions & 1 deletion cvat-ui/src/base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ $danger-icon-color: #ff4136;
$info-icon-color: #0074d9;
$objects-bar-tabs-color: #bebebe;
$objects-bar-icons-color: #242424; // #6e6e6e
$active-object-item-background-color: #d8ecff;
$active-label-background-color: #d8ecff;
$object-item-border-color: #000;
$slider-color: #1890ff;

$monospaced-fonts-stack: Consolas, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace;
11 changes: 9 additions & 2 deletions cvat-ui/src/components/annotation-page/annotation-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import AnnotationTopBarContainer from 'containers/annotation-page/top-bar/top-ba
import StatisticsModalContainer from 'containers/annotation-page/top-bar/statistics-modal';
import StandardWorkspaceComponent from './standard-workspace/standard-workspace';
import AttributeAnnotationWorkspace from './attribute-annotation-workspace/attribute-annotation-workspace';
import TagAnnotationWorkspace from './tag-annotation-workspace/tag-annotation-workspace';

interface Props {
job: any | null | undefined;
Expand Down Expand Up @@ -70,15 +71,21 @@ export default function AnnotationPageComponent(props: Props): JSX.Element {
<Layout.Header className='cvat-annotation-header'>
<AnnotationTopBarContainer />
</Layout.Header>
{ workspace === Workspace.STANDARD ? (
{ workspace === Workspace.STANDARD && (
<Layout.Content>
<StandardWorkspaceComponent />
</Layout.Content>
) : (
)}
{ workspace === Workspace.ATTRIBUTE_ANNOTATION && (
<Layout.Content>
<AttributeAnnotationWorkspace />
</Layout.Content>
)}
{ workspace === Workspace.TAG_ANNOTATION && (
<Layout.Content>
<TagAnnotationWorkspace />
</Layout.Content>
)}
<StatisticsModalContainer />
</Layout>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { Row, Col } from 'antd/lib/grid';
import Text from 'antd/lib/typography/Text';
import Icon from 'antd/lib/icon';

import { Canvas } from 'cvat-canvas-wrapper';
import { LogType } from 'cvat-logger';
import {
activateObject as activateObjectAction,
Expand All @@ -35,6 +36,7 @@ interface StateToProps {
jobInstance: any;
keyMap: Record<string, ExtendedKeyMapOptions>;
normalizedKeyMap: Record<string, string>;
canvasInstance: Canvas;
canvasIsReady: boolean;
}

Expand All @@ -60,6 +62,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
labels,
},
canvas: {
instance: canvasInstance,
ready: canvasIsReady,
},
},
Expand All @@ -77,6 +80,7 @@ function mapStateToProps(state: CombinedState): StateToProps {
states,
keyMap,
normalizedKeyMap,
canvasInstance,
canvasIsReady,
};
}
Expand All @@ -103,6 +107,7 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.
activateObject,
keyMap,
normalizedKeyMap,
canvasInstance,
canvasIsReady,
} = props;

Expand All @@ -115,6 +120,19 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.

const [sidebarCollapsed, setSidebarCollapsed] = useState(false);

const collapse = (): void => {
const [collapser] = window.document
.getElementsByClassName('attribute-annotation-sidebar');

if (collapser) {
collapser.addEventListener('transitionend', () => {
canvasInstance.fitCanvas();
}, { once: true });
}

setSidebarCollapsed(!sidebarCollapsed);
};

const [activeObjectState] = activatedStateID === null
? [null] : states.filter((objectState: any): boolean => (
objectState.clientID === activatedStateID
Expand Down Expand Up @@ -235,7 +253,7 @@ function AttributeAnnotationSidebar(props: StateToProps & DispatchToProps): JSX.
className={`cvat-objects-sidebar-sider
ant-layout-sider-zero-width-trigger
ant-layout-sider-zero-width-trigger-left`}
onClick={() => setSidebarCollapsed(!sidebarCollapsed)}
onClick={collapse}
>
{sidebarCollapsed ? <Icon type='menu-fold' title='Show' />
: <Icon type='menu-unfold' title='Hide' />}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,8 +226,8 @@ export default class CanvasWrapperComponent extends React.PureComponent<Props> {
}

if (prevProps.frame !== frameData.number
&& resetZoom
&& workspace !== Workspace.ATTRIBUTE_ANNOTATION
&& ((resetZoom && workspace !== Workspace.ATTRIBUTE_ANNOTATION) ||
workspace === Workspace.TAG_ANNOTATION)
) {
canvasInstance.html().addEventListener('canvas.setup', () => {
canvasInstance.fit();
Expand Down Expand Up @@ -462,7 +462,7 @@ export default class CanvasWrapperComponent extends React.PureComponent<Props> {
onActivateObject,
} = this.props;

if (workspace === Workspace.ATTRIBUTE_ANNOTATION) {
if (workspace !== Workspace.STANDARD) {
return;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ function ObjectItemComponent(props: Props): JSX.Element {
: 'cvat-objects-sidebar-state-item cvat-objects-sidebar-state-active-item';

return (
<div style={{ display: 'flex' }}>
<div style={{ display: 'flex', marginBottom: '1px' }}>
<Popover
placement='left'
trigger='click'
Expand All @@ -872,14 +872,14 @@ function ObjectItemComponent(props: Props): JSX.Element {
>
<div
className='cvat-objects-sidebar-state-item-color'
style={{ background: ` ${color}` }}
style={{ background: `${color}` }}
/>
</Popover>
<div
onMouseEnter={activate}
id={`cvat-objects-sidebar-state-item-${clientID}`}
className={className}
style={{ borderColor: ` ${color}` }}
style={{ backgroundColor: `${color}88` }}
>
<ItemTop
serverID={serverID}
Expand Down
Loading

0 comments on commit 681ea2b

Please sign in to comment.