Skip to content

Commit

Permalink
[React UI] A couple of fixes (#1966)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Jul 30, 2020
1 parent 0062ecd commit f6c3965
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 13 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)
- Support creating multiple jobs for each task through python cli (https://github.com/opencv/cvat/pull/1950)
- python cli over https (<https://github.com/opencv/cvat/pull/1942>)
- Error message when plugins weren't able to initialize instead of infinite loading (<https://github.com/opencv/cvat/pull/1966>)

### Changed
- Smaller object details (<https://github.com/opencv/cvat/pull/1877>)
Expand Down Expand Up @@ -42,6 +43,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Interpolated shapes exported as `keyframe = True` (<https://github.com/opencv/cvat/pull/1937>)
- Stylelint filetype scans (<https://github.com/opencv/cvat/pull/1952>)
- Fixed toolip closing issue (<https://github.com/opencv/cvat/pull/1955>)
- Clearing frame cache when close a task (<https://github.com/opencv/cvat/pull/1966>)

### Security
-
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.3.0",
"version": "3.3.1",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "babel.config.js",
"scripts": {
Expand Down
8 changes: 8 additions & 0 deletions cvat-core/src/frames.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,10 +605,18 @@
};
}

function clear(taskID) {
if (taskID in frameDataCache) {
frameDataCache[taskID].frameBuffer.clear();
delete frameDataCache[taskID];
}
}

module.exports = {
FrameData,
getFrame,
getRanges,
getPreview,
clear,
};
})();
8 changes: 7 additions & 1 deletion cvat-core/src/session.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@
const PluginRegistry = require('./plugins');
const loggerStorage = require('./logger-storage');
const serverProxy = require('./server-proxy');
const { getFrame, getRanges, getPreview } = require('./frames');
const {
getFrame,
getRanges,
getPreview,
clear: clearFrames,
} = require('./frames');
const { ArgumentError } = require('./exceptions');
const { TaskStatus } = require('./enums');
const { Label } = require('./labels');
Expand Down Expand Up @@ -1593,6 +1598,7 @@
};

Task.prototype.close.implementation = function closeTask() {
clearFrames(this.id);
for (const job of this.jobs) {
closeSession(job);
}
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.6.6",
"version": "1.6.7",
"description": "CVAT single-page application",
"main": "src/index.tsx",
"scripts": {
Expand Down
20 changes: 15 additions & 5 deletions cvat-ui/src/actions/plugins-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ import PluginChecker from 'utils/plugin-checker';

export enum PluginsActionTypes {
CHECK_PLUGINS = 'CHECK_PLUGINS',
CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS'
CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS',
RAISE_PLUGIN_CHECK_ERROR = 'RAISE_PLUGIN_CHECK_ERROR'
}

type PluginObjects = Record<SupportedPlugins, boolean>;
Expand All @@ -20,6 +21,11 @@ const pluginActions = {
list,
})
),
raisePluginCheckError: (error: Error) => (
createAction(PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR, {
error,
})
),
};

export type PluginActions = ActionUnion<typeof pluginActions>;
Expand All @@ -39,9 +45,13 @@ export function checkPluginsAsync(): ThunkAction {
PluginChecker.check(SupportedPlugins.DEXTR_SEGMENTATION),
];

const values = await Promise.all(promises);
[plugins.ANALYTICS, plugins.GIT_INTEGRATION,
plugins.DEXTR_SEGMENTATION] = values;
dispatch(pluginActions.checkedAllPlugins(plugins));
try {
const values = await Promise.all(promises);
[plugins.ANALYTICS, plugins.GIT_INTEGRATION,
plugins.DEXTR_SEGMENTATION] = values;
dispatch(pluginActions.checkedAllPlugins(plugins));
} catch (error) {
dispatch(pluginActions.raisePluginCheckError(error));
}
};
}
7 changes: 3 additions & 4 deletions cvat-ui/src/reducers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ export interface NotificationsState {
userAgreements: {
fetching: null | ErrorState;
};

[index: string]: any;
plugins: {
initializationError: null | ErrorState;
};
};
messages: {
tasks: {
Expand All @@ -245,8 +246,6 @@ export interface NotificationsState {
models: {
inferenceDone: string;
};

[index: string]: any;
};
}

Expand Down
20 changes: 20 additions & 0 deletions cvat-ui/src/reducers/notifications-reducer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import { AnnotationActionTypes } from 'actions/annotation-actions';
import { NotificationsActionType } from 'actions/notification-actions';
import { BoundariesActionTypes } from 'actions/boundaries-actions';
import { UserAgreementsActionTypes } from 'actions/useragreements-actions';
import { PluginsActionTypes } from 'actions/plugins-actions';

import { NotificationsState } from './interfaces';


const defaultState: NotificationsState = {
errors: {
auth: {
Expand Down Expand Up @@ -84,6 +86,9 @@ const defaultState: NotificationsState = {
userAgreements: {
fetching: null,
},
plugins: {
initializationError: null,
},
},
messages: {
tasks: {
Expand Down Expand Up @@ -805,6 +810,21 @@ export default function (state = defaultState, action: AnyAction): Notifications
},
};
}
case PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR: {
return {
...state,
errors: {
...state.errors,
plugins: {
...state.errors.plugins,
initializationError: {
message: 'Could not initialize plugins state',
reason: action.payload.error.toString(),
},
},
},
};
}
case NotificationsActionType.RESET_ERRORS: {
return {
...state,
Expand Down

0 comments on commit f6c3965

Please sign in to comment.