Skip to content

Commit

Permalink
Improved types corresponding to export actions (#8122)
Browse files Browse the repository at this point in the history
  • Loading branch information
klakhov committed Jul 8, 2024
1 parent 170b52d commit e76ccf8
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 39 deletions.
8 changes: 4 additions & 4 deletions cvat-ui/src/actions/export-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ export enum ExportActionTypes {
}

export const exportActions = {
openExportDatasetModal: (instance: any) => (
openExportDatasetModal: (instance: ProjectOrTaskOrJob) => (
createAction(ExportActionTypes.OPEN_EXPORT_DATASET_MODAL, { instance })
),
closeExportDatasetModal: (instance: any) => (
closeExportDatasetModal: (instance: ProjectOrTaskOrJob) => (
createAction(ExportActionTypes.CLOSE_EXPORT_DATASET_MODAL, { instance })
),
exportDatasetSuccess: (
Expand Down Expand Up @@ -61,10 +61,10 @@ export const exportActions = {
error,
})
),
openExportBackupModal: (instance: any) => (
openExportBackupModal: (instance: ProjectOrTaskOrJob) => (
createAction(ExportActionTypes.OPEN_EXPORT_BACKUP_MODAL, { instance })
),
closeExportBackupModal: (instance: any) => (
closeExportBackupModal: (instance: ProjectOrTaskOrJob) => (
createAction(ExportActionTypes.CLOSE_EXPORT_BACKUP_MODAL, { instance })
),
exportBackupSuccess: (instance: Exclude<ProjectOrTaskOrJob, Job> | RequestInstanceType, instanceType: 'task' | 'project', target?: 'local' | 'cloudstorage') => (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ function ExportDatasetModal(props: StateToProps): JSX.Element {
setUseDefaultTargetStorage(true);
setTargetStorage({ location: StorageLocation.LOCAL });
form.resetFields();
dispatch(exportActions.closeExportDatasetModal(instance));
if (instance) {
dispatch(exportActions.closeExportDatasetModal(instance));
}
};

const handleExport = useCallback(
Expand Down
22 changes: 9 additions & 13 deletions cvat-ui/src/reducers/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
import { Canvas3d } from 'cvat-canvas3d/src/typescript/canvas3d';
import { Canvas, RectDrawingMethod, CuboidDrawingMethod } from 'cvat-canvas-wrapper';
import {
Webhook, MLModel, Organization, Job, Label, User,
Webhook, MLModel, Organization, Job, Task, Project, Label, User,
QualityConflict, FramesMetaData, RQStatus, Event, Invitation, SerializedAPISchema,
Request,
} from 'cvat-core-wrapper';
Expand Down Expand Up @@ -37,8 +37,6 @@ interface Preview {
preview: string;
}

export type Project = any;

export interface ProjectsState {
initialized: boolean;
fetching: boolean;
Expand Down Expand Up @@ -69,8 +67,6 @@ export interface TasksQuery {
projectId: number | null;
}

export type Task = any; // cvat-core instance

export interface JobsQuery {
page: number;
sort: string | null;
Expand Down Expand Up @@ -116,23 +112,23 @@ export interface TasksState {
export interface ExportState {
projects: {
dataset: {
modalInstance: any | null;
modalInstance: Project | null;
};
backup: {
modalInstance: any | null;
modalInstance: Project | null;
};
};
tasks: {
dataset: {
modalInstance: any | null;
modalInstance: Task | null;
};
backup: {
modalInstance: any | null;
modalInstance: Task | null;
};
};
jobs: {
dataset: {
modalInstance: any | null;
modalInstance: Job | null;
};
};
instanceType: 'project' | 'task' | 'job' | null;
Expand All @@ -141,7 +137,7 @@ export interface ExportState {
export interface ImportState {
projects: {
dataset: {
modalInstance: any | null;
modalInstance: Project | null;
uploadState: {
id: number | null,
format: string;
Expand All @@ -156,7 +152,7 @@ export interface ImportState {
};
tasks: {
dataset: {
modalInstance: any | null;
modalInstance: Task | null;
};
backup: {
modalVisible: boolean;
Expand All @@ -165,7 +161,7 @@ export interface ImportState {
};
jobs: {
dataset: {
modalInstance: any | null;
modalInstance: Job | null;
};
};
instanceType: 'project' | 'task' | 'job' | null;
Expand Down
21 changes: 0 additions & 21 deletions cvat-ui/src/utils/deep-copy.ts

This file was deleted.

0 comments on commit e76ccf8

Please sign in to comment.