Skip to content

Commit f6c3965

Browse files
authored
[React UI] A couple of fixes (#1966)
1 parent 0062ecd commit f6c3965

File tree

9 files changed

+58
-13
lines changed

9 files changed

+58
-13
lines changed

CHANGELOG.md

+2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212
- Intelligent polygon editing (<https://github.com/opencv/cvat/pull/1921>)
1313
- Support creating multiple jobs for each task through python cli (https://github.com/opencv/cvat/pull/1950)
1414
- python cli over https (<https://github.com/opencv/cvat/pull/1942>)
15+
- Error message when plugins weren't able to initialize instead of infinite loading (<https://github.com/opencv/cvat/pull/1966>)
1516

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

4648
### Security
4749
-

cvat-core/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cvat-core",
3-
"version": "3.3.0",
3+
"version": "3.3.1",
44
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
55
"main": "babel.config.js",
66
"scripts": {

cvat-core/src/frames.js

+8
Original file line numberDiff line numberDiff line change
@@ -605,10 +605,18 @@
605605
};
606606
}
607607

608+
function clear(taskID) {
609+
if (taskID in frameDataCache) {
610+
frameDataCache[taskID].frameBuffer.clear();
611+
delete frameDataCache[taskID];
612+
}
613+
}
614+
608615
module.exports = {
609616
FrameData,
610617
getFrame,
611618
getRanges,
612619
getPreview,
620+
clear,
613621
};
614622
})();

cvat-core/src/session.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,12 @@
1111
const PluginRegistry = require('./plugins');
1212
const loggerStorage = require('./logger-storage');
1313
const serverProxy = require('./server-proxy');
14-
const { getFrame, getRanges, getPreview } = require('./frames');
14+
const {
15+
getFrame,
16+
getRanges,
17+
getPreview,
18+
clear: clearFrames,
19+
} = require('./frames');
1520
const { ArgumentError } = require('./exceptions');
1621
const { TaskStatus } = require('./enums');
1722
const { Label } = require('./labels');
@@ -1593,6 +1598,7 @@
15931598
};
15941599

15951600
Task.prototype.close.implementation = function closeTask() {
1601+
clearFrames(this.id);
15961602
for (const job of this.jobs) {
15971603
closeSession(job);
15981604
}

cvat-ui/package-lock.json

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cvat-ui/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cvat-ui",
3-
"version": "1.6.6",
3+
"version": "1.6.7",
44
"description": "CVAT single-page application",
55
"main": "src/index.tsx",
66
"scripts": {

cvat-ui/src/actions/plugins-actions.ts

+15-5
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import PluginChecker from 'utils/plugin-checker';
88

99
export enum PluginsActionTypes {
1010
CHECK_PLUGINS = 'CHECK_PLUGINS',
11-
CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS'
11+
CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS',
12+
RAISE_PLUGIN_CHECK_ERROR = 'RAISE_PLUGIN_CHECK_ERROR'
1213
}
1314

1415
type PluginObjects = Record<SupportedPlugins, boolean>;
@@ -20,6 +21,11 @@ const pluginActions = {
2021
list,
2122
})
2223
),
24+
raisePluginCheckError: (error: Error) => (
25+
createAction(PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR, {
26+
error,
27+
})
28+
),
2329
};
2430

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

42-
const values = await Promise.all(promises);
43-
[plugins.ANALYTICS, plugins.GIT_INTEGRATION,
44-
plugins.DEXTR_SEGMENTATION] = values;
45-
dispatch(pluginActions.checkedAllPlugins(plugins));
48+
try {
49+
const values = await Promise.all(promises);
50+
[plugins.ANALYTICS, plugins.GIT_INTEGRATION,
51+
plugins.DEXTR_SEGMENTATION] = values;
52+
dispatch(pluginActions.checkedAllPlugins(plugins));
53+
} catch (error) {
54+
dispatch(pluginActions.raisePluginCheckError(error));
55+
}
4656
};
4757
}

cvat-ui/src/reducers/interfaces.ts

+3-4
Original file line numberDiff line numberDiff line change
@@ -235,8 +235,9 @@ export interface NotificationsState {
235235
userAgreements: {
236236
fetching: null | ErrorState;
237237
};
238-
239-
[index: string]: any;
238+
plugins: {
239+
initializationError: null | ErrorState;
240+
};
240241
};
241242
messages: {
242243
tasks: {
@@ -245,8 +246,6 @@ export interface NotificationsState {
245246
models: {
246247
inferenceDone: string;
247248
};
248-
249-
[index: string]: any;
250249
};
251250
}
252251

cvat-ui/src/reducers/notifications-reducer.ts

+20
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,11 @@ import { AnnotationActionTypes } from 'actions/annotation-actions';
1515
import { NotificationsActionType } from 'actions/notification-actions';
1616
import { BoundariesActionTypes } from 'actions/boundaries-actions';
1717
import { UserAgreementsActionTypes } from 'actions/useragreements-actions';
18+
import { PluginsActionTypes } from 'actions/plugins-actions';
1819

1920
import { NotificationsState } from './interfaces';
2021

22+
2123
const defaultState: NotificationsState = {
2224
errors: {
2325
auth: {
@@ -84,6 +86,9 @@ const defaultState: NotificationsState = {
8486
userAgreements: {
8587
fetching: null,
8688
},
89+
plugins: {
90+
initializationError: null,
91+
},
8792
},
8893
messages: {
8994
tasks: {
@@ -805,6 +810,21 @@ export default function (state = defaultState, action: AnyAction): Notifications
805810
},
806811
};
807812
}
813+
case PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR: {
814+
return {
815+
...state,
816+
errors: {
817+
...state.errors,
818+
plugins: {
819+
...state.errors.plugins,
820+
initializationError: {
821+
message: 'Could not initialize plugins state',
822+
reason: action.payload.error.toString(),
823+
},
824+
},
825+
},
826+
};
827+
}
808828
case NotificationsActionType.RESET_ERRORS: {
809829
return {
810830
...state,

0 commit comments

Comments
 (0)