From 2c661020b61b6c87efe086a8de6aeeb7052aa747 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Tue, 11 Aug 2020 12:50:54 +0300 Subject: [PATCH] Fixed issue related with deactivated nuclio dashboard (#2008) * Fixed issue related with deactivated nuclio dashboard * Updated version, updated changelog --- CHANGELOG.md | 1 + cvat-ui/package-lock.json | 2 +- cvat-ui/package.json | 2 +- cvat-ui/src/actions/plugins-actions.ts | 19 +++++------------- cvat-ui/src/components/cvat-app.tsx | 18 +++++++++++++---- .../model-runner-modal/model-runner-modal.tsx | 16 +-------------- .../components/models-page/models-page.tsx | 19 +----------------- .../model-runner-dialog.tsx | 20 ++----------------- .../containers/models-page/models-page.tsx | 20 +------------------ cvat-ui/src/index.tsx | 9 ++++++++- cvat-ui/src/reducers/interfaces.ts | 3 --- cvat-ui/src/reducers/notifications-reducer.ts | 19 ------------------ cvat-ui/src/utils/plugin-checker.ts | 8 ++++++-- 13 files changed, 41 insertions(+), 115 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 48c0d0ff..26e3bafc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Issue loading openvino models for semi-automatic and automatic annotation () +- Basic functions of CVAT works without activated nuclio dashboard ### Security - diff --git a/cvat-ui/package-lock.json b/cvat-ui/package-lock.json index 256a48e6..8def8aaa 100644 --- a/cvat-ui/package-lock.json +++ b/cvat-ui/package-lock.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.7.0", + "version": "1.7.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/cvat-ui/package.json b/cvat-ui/package.json index 1ec122bd..f20e3eb6 100644 --- a/cvat-ui/package.json +++ b/cvat-ui/package.json @@ -1,6 +1,6 @@ { "name": "cvat-ui", - "version": "1.7.0", + "version": "1.7.1", "description": "CVAT single-page application", "main": "src/index.tsx", "scripts": { diff --git a/cvat-ui/src/actions/plugins-actions.ts b/cvat-ui/src/actions/plugins-actions.ts index 5d58a11f..6b5ca2c9 100644 --- a/cvat-ui/src/actions/plugins-actions.ts +++ b/cvat-ui/src/actions/plugins-actions.ts @@ -9,7 +9,6 @@ import PluginChecker from 'utils/plugin-checker'; export enum PluginsActionTypes { CHECK_PLUGINS = 'CHECK_PLUGINS', CHECKED_ALL_PLUGINS = 'CHECKED_ALL_PLUGINS', - RAISE_PLUGIN_CHECK_ERROR = 'RAISE_PLUGIN_CHECK_ERROR' } type PluginObjects = Record; @@ -21,11 +20,6 @@ const pluginActions = { list, }) ), - raisePluginCheckError: (error: Error) => ( - createAction(PluginsActionTypes.RAISE_PLUGIN_CHECK_ERROR, { - error, - }) - ), }; export type PluginActions = ActionUnion; @@ -40,18 +34,15 @@ export function checkPluginsAsync(): ThunkAction { }; const promises: Promise[] = [ + // check must return true/false with no exceptions PluginChecker.check(SupportedPlugins.ANALYTICS), PluginChecker.check(SupportedPlugins.GIT_INTEGRATION), PluginChecker.check(SupportedPlugins.DEXTR_SEGMENTATION), ]; - 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)); - } + const values = await Promise.all(promises); + [plugins.ANALYTICS, plugins.GIT_INTEGRATION, + plugins.DEXTR_SEGMENTATION] = values; + dispatch(pluginActions.checkedAllPlugins(plugins)); }; } diff --git a/cvat-ui/src/components/cvat-app.tsx b/cvat-ui/src/components/cvat-app.tsx index 3417b4b4..8b732270 100644 --- a/cvat-ui/src/components/cvat-app.tsx +++ b/cvat-ui/src/components/cvat-app.tsx @@ -34,6 +34,7 @@ interface CVATAppProps { verifyAuthorized: () => void; loadUserAgreements: () => void; initPlugins: () => void; + initModels: () => void; resetErrors: () => void; resetMessages: () => void; switchShortcutsDialog: () => void; @@ -44,6 +45,8 @@ interface CVATAppProps { userFetching: boolean; pluginsInitialized: boolean; pluginsFetching: boolean; + modelsInitialized: boolean; + modelsFetching: boolean; formatsInitialized: boolean; formatsFetching: boolean; usersInitialized: boolean; @@ -88,6 +91,7 @@ class CVATApplication extends React.PureComponent - {!modelsInitialized - && } - {modelsInitialized && this.renderContent()} + { this.renderContent() } ) ); diff --git a/cvat-ui/src/components/models-page/models-page.tsx b/cvat-ui/src/components/models-page/models-page.tsx index 7c744c8d..a5606a2a 100644 --- a/cvat-ui/src/components/models-page/models-page.tsx +++ b/cvat-ui/src/components/models-page/models-page.tsx @@ -4,7 +4,6 @@ import './styles.scss'; import React from 'react'; -import Spin from 'antd/lib/spin'; import TopBarComponent from './top-bar'; import DeployedModelsList from './deployed-models-list'; @@ -13,27 +12,11 @@ import FeedbackComponent from '../feedback/feedback'; import { Model } from '../../reducers/interfaces'; interface Props { - modelsInitialized: boolean; - modelsFetching: boolean; deployedModels: Model[]; - getModels(): void; } export default function ModelsPageComponent(props: Props): JSX.Element { - const { - modelsInitialized, - modelsFetching, - deployedModels, - } = props; - - if (!modelsInitialized) { - if (!modelsFetching) { - props.getModels(); - } - return ( - - ); - } + const { deployedModels } = props; return (
diff --git a/cvat-ui/src/containers/model-runner-dialog/model-runner-dialog.tsx b/cvat-ui/src/containers/model-runner-dialog/model-runner-dialog.tsx index 9ec5b670..b956876c 100644 --- a/cvat-ui/src/containers/model-runner-dialog/model-runner-dialog.tsx +++ b/cvat-ui/src/containers/model-runner-dialog/model-runner-dialog.tsx @@ -5,20 +5,10 @@ import { connect } from 'react-redux'; import ModelRunnerModalComponent from 'components/model-runner-modal/model-runner-modal'; -import { - Model, - CombinedState, -} from 'reducers/interfaces'; -import { - getModelsAsync, - startInferenceAsync, - modelsActions, -} from 'actions/models-actions'; - +import { Model, CombinedState } from 'reducers/interfaces'; +import { startInferenceAsync, modelsActions } from 'actions/models-actions'; interface StateToProps { - modelsFetching: boolean; - modelsInitialized: boolean; models: Model[]; activeProcesses: { [index: string]: string; @@ -33,7 +23,6 @@ interface DispatchToProps { model: Model, body: object, ): void; - getModels(): void; closeDialog(): void; } @@ -41,8 +30,6 @@ function mapStateToProps(state: CombinedState): StateToProps { const { models } = state; return { - modelsFetching: models.fetching, - modelsInitialized: models.initialized, models: models.models, activeProcesses: {}, taskInstance: models.activeRunTask, @@ -59,9 +46,6 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { ): void { dispatch(startInferenceAsync(taskInstance, model, body)); }, - getModels(): void { - dispatch(getModelsAsync()); - }, closeDialog(): void { dispatch(modelsActions.closeRunModelDialog()); }, diff --git a/cvat-ui/src/containers/models-page/models-page.tsx b/cvat-ui/src/containers/models-page/models-page.tsx index 27eb9df9..8282d41d 100644 --- a/cvat-ui/src/containers/models-page/models-page.tsx +++ b/cvat-ui/src/containers/models-page/models-page.tsx @@ -9,37 +9,19 @@ import { Model, CombinedState, } from 'reducers/interfaces'; -import { getModelsAsync } from 'actions/models-actions'; interface StateToProps { - modelsInitialized: boolean; - modelsFetching: boolean; deployedModels: Model[]; } -interface DispatchToProps { - getModels(): void; -} - function mapStateToProps(state: CombinedState): StateToProps { const { models } = state; return { - modelsInitialized: models.initialized, - modelsFetching: models.fetching, deployedModels: models.models, }; } -function mapDispatchToProps(dispatch: any): DispatchToProps { - return { - getModels(): void { - dispatch(getModelsAsync()); - }, - }; -} - export default connect( - mapStateToProps, - mapDispatchToProps, + mapStateToProps, {}, )(ModelsPageComponent); diff --git a/cvat-ui/src/index.tsx b/cvat-ui/src/index.tsx index d246dc0e..cfb1605d 100644 --- a/cvat-ui/src/index.tsx +++ b/cvat-ui/src/index.tsx @@ -22,6 +22,7 @@ import { getFormatsAsync } from 'actions/formats-actions'; import { checkPluginsAsync } from 'actions/plugins-actions'; import { getUsersAsync } from 'actions/users-actions'; import { getAboutAsync } from 'actions/about-actions'; +import { getModelsAsync } from 'actions/models-actions'; import { getUserAgreementsAsync } from 'actions/useragreements-actions'; import { shortcutsActions } from 'actions/shortcuts-actions'; import { switchSettingsDialog } from 'actions/settings-actions'; @@ -30,7 +31,6 @@ import { resetMessages, } from './actions/notification-actions'; - import { CombinedState, NotificationsState, @@ -42,6 +42,8 @@ const cvatStore = getCVATStore(); interface StateToProps { pluginsInitialized: boolean; pluginsFetching: boolean; + modelsInitialized: boolean; + modelsFetching: boolean; userInitialized: boolean; userFetching: boolean; usersInitialized: boolean; @@ -65,6 +67,7 @@ interface DispatchToProps { verifyAuthorized: () => void; loadUsers: () => void; loadAbout: () => void; + initModels: () => void; initPlugins: () => void; resetErrors: () => void; resetMessages: () => void; @@ -82,12 +85,15 @@ function mapStateToProps(state: CombinedState): StateToProps { const { about } = state; const { shortcuts } = state; const { userAgreements } = state; + const { models } = state; return { userInitialized: auth.initialized, userFetching: auth.fetching, pluginsInitialized: plugins.initialized, pluginsFetching: plugins.fetching, + modelsInitialized: models.initialized, + modelsFetching: models.fetching, usersInitialized: users.initialized, usersFetching: users.fetching, aboutInitialized: about.initialized, @@ -111,6 +117,7 @@ function mapDispatchToProps(dispatch: any): DispatchToProps { verifyAuthorized: (): void => dispatch(authorizedAsync()), loadUserAgreements: (): void => dispatch(getUserAgreementsAsync()), initPlugins: (): void => dispatch(checkPluginsAsync()), + initModels: (): void => dispatch(getModelsAsync()), loadUsers: (): void => dispatch(getUsersAsync()), loadAbout: (): void => dispatch(getAboutAsync()), resetErrors: (): void => dispatch(resetErrors()), diff --git a/cvat-ui/src/reducers/interfaces.ts b/cvat-ui/src/reducers/interfaces.ts index b7cf3cd4..72feee69 100644 --- a/cvat-ui/src/reducers/interfaces.ts +++ b/cvat-ui/src/reducers/interfaces.ts @@ -241,9 +241,6 @@ export interface NotificationsState { userAgreements: { fetching: null | ErrorState; }; - plugins: { - initializationError: null | ErrorState; - }; }; messages: { tasks: { diff --git a/cvat-ui/src/reducers/notifications-reducer.ts b/cvat-ui/src/reducers/notifications-reducer.ts index d9b39153..e4da7086 100644 --- a/cvat-ui/src/reducers/notifications-reducer.ts +++ b/cvat-ui/src/reducers/notifications-reducer.ts @@ -15,7 +15,6 @@ 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'; @@ -88,9 +87,6 @@ const defaultState: NotificationsState = { userAgreements: { fetching: null, }, - plugins: { - initializationError: null, - }, }, messages: { tasks: { @@ -857,21 +853,6 @@ 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, diff --git a/cvat-ui/src/utils/plugin-checker.ts b/cvat-ui/src/utils/plugin-checker.ts index 7bb016ae..38c29575 100644 --- a/cvat-ui/src/utils/plugin-checker.ts +++ b/cvat-ui/src/utils/plugin-checker.ts @@ -18,8 +18,12 @@ class PluginChecker { return isReachable(`${serverHost}/git/repository/meta/get`, 'OPTIONS'); } case SupportedPlugins.DEXTR_SEGMENTATION: { - const list = await core.lambda.list(); - return list.map((func: any): boolean => func.id).includes('openvino.dextr'); + try { + const list = await core.lambda.list(); + return list.map((func: any): boolean => func.id).includes('openvino.dextr'); + } catch (_) { + return false; + } } case SupportedPlugins.ANALYTICS: { return isReachable(`${serverHost}/analytics/app/kibana`, 'GET');