Skip to content

Commit

Permalink
Minor client changes (#1847)
Browse files Browse the repository at this point in the history
* Minor client changes

* Removed extra code
  • Loading branch information
bsekachev authored Jul 8, 2020
1 parent 9b0faf6 commit b4bc20f
Show file tree
Hide file tree
Showing 25 changed files with 55 additions and 704 deletions.
48 changes: 5 additions & 43 deletions cvat-ui/src/actions/models-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,14 @@
// SPDX-License-Identifier: MIT

import { ActionUnion, createAction, ThunkAction } from 'utils/redux';
import {
Model,
ModelFiles,
ActiveInference,
CombinedState,
} from 'reducers/interfaces';
import { Model, ModelFiles, ActiveInference } from 'reducers/interfaces';
import getCore from 'cvat-core-wrapper';

export enum PreinstalledModels {
RCNN = 'RCNN Object Detector',
MaskRCNN = 'Mask RCNN Object Detector',
}

export enum ModelsActionTypes {
GET_MODELS = 'GET_MODELS',
GET_MODELS_SUCCESS = 'GET_MODELS_SUCCESS',
GET_MODELS_FAILED = 'GET_MODELS_FAILED',
DELETE_MODEL = 'DELETE_MODEL',
DELETE_MODEL_SUCCESS = 'DELETE_MODEL_SUCCESS',
DELETE_MODEL_FAILED = 'DELETE_MODEL_FAILED',
CREATE_MODEL = 'CREATE_MODEL',
CREATE_MODEL_SUCCESS = 'CREATE_MODEL_SUCCESS',
CREATE_MODEL_FAILED = 'CREATE_MODEL_FAILED',
Expand All @@ -49,16 +37,6 @@ export const modelsActions = {
error,
},
),
deleteModelSuccess: (id: number) => createAction(
ModelsActionTypes.DELETE_MODEL_SUCCESS, {
id,
},
),
deleteModelFailed: (id: number, error: any) => createAction(
ModelsActionTypes.DELETE_MODEL_FAILED, {
error, id,
},
),
createModel: () => createAction(ModelsActionTypes.CREATE_MODEL),
createModelSuccess: () => createAction(ModelsActionTypes.CREATE_MODEL_SUCCESS),
createModelFailed: (error: any) => createAction(
Expand Down Expand Up @@ -115,7 +93,7 @@ const core = getCore();
const baseURL = core.config.backendAPI.slice(0, -7);

export function getModelsAsync(): ThunkAction {
return async (dispatch, getState): Promise<void> => {
return async (dispatch): Promise<void> => {
dispatch(modelsActions.getModels());
const models: Model[] = [];

Expand All @@ -133,7 +111,6 @@ export function getModelsAsync(): ThunkAction {
if (model.kind === 'detector') {
models.push({
id: model.id,
primary: true,
name: model.name,
description: model.description,
framework: model.framework,
Expand All @@ -151,21 +128,6 @@ export function getModelsAsync(): ThunkAction {
};
}

export function deleteModelAsync(id: number): ThunkAction {
return async (dispatch): Promise<void> => {
try {
await core.server.request(`${baseURL}/auto_annotation/delete/${id}`, {
method: 'DELETE',
});
} catch (error) {
dispatch(modelsActions.deleteModelFailed(id, error));
return;
}

dispatch(modelsActions.deleteModelSuccess(id));
};
}

export function createModelAsync(name: string, files: ModelFiles, global: boolean): ThunkAction {
return async (dispatch): Promise<void> => {
async function checkCallback(id: string): Promise<void> {
Expand Down Expand Up @@ -316,8 +278,8 @@ function subscribe(
}
}

export function getInferenceStatusAsync(tasks: number[]): ThunkAction {
return async (dispatch, getState): Promise<void> => {
export function getInferenceStatusAsync(): ThunkAction {
return async (dispatch): Promise<void> => {
const dispatchCallback = (action: ModelsActions): void => {
dispatch(action);
};
Expand Down Expand Up @@ -370,7 +332,7 @@ export function startInferenceAsync(
},
);

dispatch(getInferenceStatusAsync([taskInstance.id]));
dispatch(getInferenceStatusAsync());
} catch (error) {
dispatch(modelsActions.startInferenceFailed(taskInstance.id, error));
}
Expand Down
3 changes: 0 additions & 3 deletions cvat-ui/src/actions/plugins-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ export function checkPluginsAsync(): ThunkAction {
dispatch(pluginActions.checkPlugins());
const plugins: PluginObjects = {
ANALYTICS: false,
AUTO_ANNOTATION: true,
GIT_INTEGRATION: false,
TF_ANNOTATION: false,
TF_SEGMENTATION: false,
REID: false,
DEXTR_SEGMENTATION: false,
};
Expand Down
30 changes: 6 additions & 24 deletions cvat-ui/src/components/actions-menu/actions-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,11 @@ interface Props {
taskID: number;
taskMode: string;
bugTracker: string;

loaders: any[];
dumpers: any[];
loadActivity: string | null;
dumpActivities: string[] | null;
exportActivities: string[] | null;

installedTFAnnotation: boolean;
installedTFSegmentation: boolean;
installedAutoAnnotation: boolean;
inferenceIsActive: boolean;

onClickMenu: (params: ClickParam, file?: File) => void;
Expand All @@ -44,12 +39,7 @@ export default function ActionsMenuComponent(props: Props): JSX.Element {
taskID,
taskMode,
bugTracker,

installedAutoAnnotation,
installedTFAnnotation,
installedTFSegmentation,
inferenceIsActive,

dumpers,
loaders,
onClickMenu,
Expand All @@ -58,9 +48,6 @@ export default function ActionsMenuComponent(props: Props): JSX.Element {
loadActivity,
} = props;

const renderModelRunner = installedAutoAnnotation
|| installedTFAnnotation || installedTFSegmentation;

let latestParams: ClickParam | null = null;
function onClickMenuWrapper(params: ClickParam | null, file?: File): void {
const copyParams = params || latestParams;
Expand Down Expand Up @@ -137,17 +124,12 @@ export default function ActionsMenuComponent(props: Props): JSX.Element {
})
}
{!!bugTracker && <Menu.Item key={Actions.OPEN_BUG_TRACKER}>Open bug tracker</Menu.Item>}
{
renderModelRunner
&& (
<Menu.Item
disabled={inferenceIsActive}
key={Actions.RUN_AUTO_ANNOTATION}
>
Automatic annotation
</Menu.Item>
)
}
<Menu.Item
disabled={inferenceIsActive}
key={Actions.RUN_AUTO_ANNOTATION}
>
Automatic annotation
</Menu.Item>
<hr />
<Menu.Item key={Actions.DELETE_TASK}>Delete</Menu.Item>
</Menu>
Expand Down
160 changes: 0 additions & 160 deletions cvat-ui/src/components/create-model-page/create-model-content.tsx

This file was deleted.

Loading

0 comments on commit b4bc20f

Please sign in to comment.