Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improved types corresponding to export actions #8122

Merged
merged 2 commits into from
Jul 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

Loading