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

Requests page #7537

Open
wants to merge 163 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 115 commits
Commits
Show all changes
163 commits
Select commit Hold shift + click to select a range
190c233
added mock server endpoints
klakhov Feb 9, 2024
0f0ced5
Merge branch 'develop' into kl/data-processing
klakhov Feb 12, 2024
b12bffe
prototype draft
klakhov Feb 14, 2024
67f369d
some adjustments to the server
klakhov Feb 14, 2024
7bedeab
show errors in cards
klakhov Feb 14, 2024
741c218
added header link
klakhov Feb 15, 2024
428b4cd
fixed collapse auto open
klakhov Feb 15, 2024
b91cb91
prototype preparations
klakhov Feb 15, 2024
fe0db3e
download only when ready
klakhov Feb 19, 2024
146072d
card structure change
klakhov Feb 19, 2024
3940e42
changes to demo v2
klakhov Feb 21, 2024
49484c6
Merge branch 'develop' into kl/data-processing
klakhov Feb 22, 2024
d6fb167
Merge branch 'develop' into kl/data-processing
klakhov Feb 26, 2024
9571d3c
updated server side, added pagination, empty component
klakhov Feb 27, 2024
7a3a2c2
Merge branch 'develop' into kl/data-processing
klakhov Feb 27, 2024
b2f356f
updated dates on cards
klakhov Feb 27, 2024
a5a5bf4
added error notification for fetching requests
klakhov Feb 27, 2024
397d5cb
Display full error message
klakhov Feb 27, 2024
3d46c03
fixed links
klakhov Feb 27, 2024
7862b93
moved format on the card
klakhov Feb 27, 2024
215754c
fixed notification
klakhov Feb 27, 2024
e468689
finalize project import/export
klakhov Feb 28, 2024
a0fe81b
fixed name
klakhov Feb 28, 2024
47ea9fb
import export for task/job
klakhov Feb 29, 2024
90bb023
backups
klakhov Feb 29, 2024
b49070f
refactored solution
klakhov Feb 29, 2024
fa6b99a
prettified code
klakhov Feb 29, 2024
477cc1d
Merge branch 'develop' into kl/data-processing
klakhov Mar 4, 2024
965ba21
added comment
klakhov Mar 4, 2024
d818fbc
improved notifications
klakhov Mar 4, 2024
16f493e
Merge branch 'develop' into kl/data-processing
klakhov Mar 6, 2024
811db70
Merge branch 'develop' into kl/data-processing
klakhov Mar 26, 2024
a109c78
Merge branch 'develop' into kl/data-processing
Marishka17 Apr 11, 2024
453aa4e
Refactor server code
Marishka17 Apr 16, 2024
d7f3aa5
Fix missing result url for exported backups
Marishka17 Apr 16, 2024
e0ab017
Handle redis exceptions
Marishka17 Apr 16, 2024
7640c7e
Clean up code && fix small bugs
Marishka17 Apr 17, 2024
9476bc6
[cvat-ui:request-card] Add delete/cancel actions && fix time format
Marishka17 Apr 17, 2024
7db407a
Merge branch 'develop' into kl/data-processing
klakhov Apr 22, 2024
09de287
fixed status message for queued
klakhov Apr 22, 2024
d9f794e
added pangination requests from ui
klakhov Apr 22, 2024
0be2a84
fixed sorting from new to old
klakhov Apr 22, 2024
f620181
fixed not reseting page on opening Requests tab
klakhov Apr 22, 2024
b7a66cd
Refactor code layout && fix small bugs && normalize used RQ IDs
Marishka17 Apr 22, 2024
f2b141d
Update server schema
Marishka17 Apr 22, 2024
455a8db
Merge branch 'develop' into kl/data-processing
Marishka17 Apr 22, 2024
b12f57d
Merge branch 'kl/data-processing' of https://github.com/cvat-ai/cvat …
klakhov Apr 22, 2024
ad5371e
Fix rq id parsing
Marishka17 Apr 22, 2024
e444fec
Remove user id from rq id for import job
Marishka17 Apr 22, 2024
e8463b7
Fix pylint issues
Marishka17 Apr 22, 2024
b5cbbd2
More robust handling of adding result_url to meta
Marishka17 Apr 22, 2024
6be9f03
Fix REST API tests
Marishka17 Apr 22, 2024
be628a6
Fix part of REST API tests
Marishka17 Apr 23, 2024
4ad0d78
Normailize viewset basename
Marishka17 Apr 23, 2024
d5f28f8
Update server schema
Marishka17 Apr 23, 2024
1e09d7a
Fix black issues
Marishka17 Apr 23, 2024
bfabf91
t
Marishka17 Apr 23, 2024
9a4baf1
isort
Marishka17 Apr 23, 2024
920f206
Fix missed decorator
Marishka17 Apr 23, 2024
9b88085
Fix typos
Marishka17 Apr 23, 2024
74aef09
Merge branch 'develop' into kl/data-processing
klakhov Apr 24, 2024
280bb3e
added duration for requests notificaitons
klakhov Apr 24, 2024
45d33fd
fixed notifications
klakhov Apr 25, 2024
00a5e72
listen to tasks
klakhov Apr 25, 2024
f6c3bc5
reworked cancel and delete
klakhov Apr 25, 2024
28a6d45
added more clear names for callbacks
klakhov Apr 25, 2024
de2ec86
fixed first test
klakhov Apr 25, 2024
51bb734
added exception for request errors
klakhov Apr 25, 2024
26c9bad
Merge branch 'kl/data-processing' of https://github.com/cvat-ai/cvat …
klakhov Apr 26, 2024
489557e
fixed a couple of bugs, fixed tests
klakhov Apr 26, 2024
750b9c6
updated cvat-core package
klakhov Apr 26, 2024
466ca55
updated cvat-ui package
klakhov Apr 26, 2024
b8ed90c
fixed possible undefined callbacks
klakhov Apr 26, 2024
a574252
fixed unit tests
klakhov Apr 26, 2024
3d4a7e1
fixed uncaught errors with tasks create
klakhov Apr 26, 2024
64c3d6c
Resolve conflicts
Marishka17 Apr 26, 2024
5adba32
removed using name on ui
klakhov Apr 28, 2024
dd12855
Revert missing code after merge
Marishka17 Apr 29, 2024
bc7e56f
Merge branch 'develop' into kl/data-processing
klakhov May 2, 2024
d428a1c
codestyle fixes
klakhov May 2, 2024
e49ce01
Add ability to sort and filter requests
Marishka17 May 4, 2024
9d435a6
Merge branch 'kl/data-processing' of https://github.com/opencv/cvat i…
Marishka17 May 4, 2024
efd64e0
Merge branch 'develop' into kl/data-processing
klakhov May 7, 2024
887ee65
updated styles
klakhov May 7, 2024
6f721bf
fixed notifications
klakhov May 7, 2024
bcd5b1d
fixed timestamps, updating requests
klakhov May 7, 2024
6069f40
Merge branch 'develop' into kl/data-processing
klakhov May 8, 2024
5393ac5
updated timeout system
klakhov May 8, 2024
e6e6af4
Merge branch 'develop' into kl/data-processing
klakhov May 13, 2024
09a691e
removed console log
klakhov May 13, 2024
0aaab07
fixed operations after refreshing the page
klakhov May 13, 2024
207a31d
fixed variable name
klakhov May 13, 2024
dd9909a
removed delete request
klakhov May 13, 2024
e2c11ab
updated types for import/export actions
klakhov May 13, 2024
2c6fb7a
[server] Fix several bugs && comments
Marishka17 May 14, 2024
272b517
fixed type guard
klakhov May 15, 2024
33d5756
adjusted request retry delays to prime number series
klakhov May 15, 2024
1fbbaab
improved timeout system
klakhov May 16, 2024
f28aee6
fixed multiple notifications
klakhov May 16, 2024
fa742d6
increased cypress requestTimeout
klakhov May 17, 2024
5f6de72
improved timeouts
klakhov May 17, 2024
a8919cb
added mouseout
klakhov May 17, 2024
6973236
fixed a couple of bugs
klakhov May 17, 2024
b508615
Merge branch 'develop' into kl/data-processing
klakhov May 17, 2024
68779c3
Merge branch 'develop' into kl/data-processing
klakhov May 20, 2024
ce3c547
[hotfix] changed request operation serializer name
klakhov May 20, 2024
4eeacf0
[hotfix] removed non-existent type
klakhov May 20, 2024
284e496
move request timeout to base config
klakhov May 20, 2024
a0384ff
[hotfix] fixed deffered jobs test
klakhov May 20, 2024
7ebe699
fixed error notifications with backups
klakhov May 22, 2024
66661ba
disabled request card after download
klakhov May 22, 2024
c854f25
moved callbacks from export
klakhov May 23, 2024
1a307d1
removed callback from import/backups
klakhov May 23, 2024
0209788
updated task creation
klakhov May 23, 2024
358e046
improved queued delays
klakhov May 23, 2024
8b02cec
improved listen to create for tasks
klakhov May 23, 2024
53cd931
applied comments to requests-manager
klakhov May 23, 2024
c0046b0
made Request read-only
klakhov May 23, 2024
90d269d
removed try-catches
klakhov May 23, 2024
af7c243
refactored rqIds
klakhov May 23, 2024
684d3ac
fixed backup/server proxy comments
klakhov May 23, 2024
a87fe59
made createTask return id and rq_id
klakhov May 23, 2024
bfba715
fixed consecutive export
klakhov May 23, 2024
b1bc728
removed excessive setters
klakhov May 23, 2024
c9d68dc
refactored to use common body
klakhov May 23, 2024
593b760
removed excessive check
klakhov May 23, 2024
ba0173c
Merged develop
bsekachev May 23, 2024
8720c48
Applied common style
bsekachev May 23, 2024
4ddc47a
Adjusted style
bsekachev May 23, 2024
f121324
fixed should log
klakhov May 24, 2024
d0be1c9
renamed action
klakhov May 24, 2024
2fa5039
applied small comments
klakhov May 24, 2024
de0cd19
removed excessive callback
klakhov May 24, 2024
5bf2910
refactored cvat-ui to use listening functions
klakhov May 25, 2024
b425878
added ability to export dataset and annotations simultaneously
klakhov May 27, 2024
f6a53ef
fixed export notification in case of not downloaded state
klakhov May 27, 2024
24cde45
Merge branch 'kl/data-processing' of https://github.com/cvat-ai/cvat …
klakhov May 27, 2024
3590701
small fixes
klakhov May 27, 2024
05f3366
refactored listening functions
klakhov May 27, 2024
2034551
updated menu
klakhov May 27, 2024
057c33e
reworked tests pipeline, intercept download before button press
klakhov May 27, 2024
ed4fdf6
applied a couple of comments
klakhov May 28, 2024
dc6cc10
updated test
klakhov May 28, 2024
1316776
small type fix
klakhov May 28, 2024
7062e92
removed imprt/export activities from state
klakhov May 28, 2024
822e9b5
removed other code with importing
klakhov May 28, 2024
9c02472
Merge branch 'develop' into kl/data-processing
klakhov May 28, 2024
5fbf35d
revert backup importing state
klakhov May 28, 2024
c175526
Merge branch 'kl/data-processing' of https://github.com/cvat-ai/cvat …
klakhov May 28, 2024
021c3ce
Merge branch 'develop' into kl/data-processing
klakhov May 28, 2024
00fcaa3
Merge branch 'develop' into kl/data-processing
bsekachev May 29, 2024
1cda2e3
Fixed linters
bsekachev May 29, 2024
b3bf1f9
Minor refactoring
bsekachev May 29, 2024
ad790c9
Renamed type
bsekachev May 29, 2024
e1ec671
Fix bugs && update sdk/REST API tests
Marishka17 May 30, 2024
705b1c4
applied comments
klakhov May 30, 2024
e202777
Merge branch 'develop' into kl/data-processing
klakhov May 31, 2024
6c4060e
applied more comments
klakhov May 31, 2024
270ecc0
Merge branch 'kl/data-processing' of https://github.com/cvat-ai/cvat …
klakhov May 31, 2024
9e66edb
count requests `count` dynamically
klakhov May 31, 2024
ade595d
Merge branch 'develop' into kl/data-processing
Marishka17 Jun 8, 2024
b136a3d
Add new API to export project/task/job dataset/backup
Marishka17 Jun 9, 2024
b64ef3b
Merge branch 'kl/data-processing' of https://github.com/opencv/cvat i…
Marishka17 Jun 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions changelog.d/20240515_100610_kirill.9992_data_processing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Added

- Page with status information for different data processing jobs. Currently import/export and task creation jobs are supported
klakhov marked this conversation as resolved.
Show resolved Hide resolved
(<https://github.com/cvat-ai/cvat/pull/7537>)
2 changes: 1 addition & 1 deletion cvat-core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-core",
"version": "15.0.5",
"version": "15.1.0",
"type": "module",
"description": "Part of Computer Vision Tool which presents an interface for client-side integration",
"main": "src/api.ts",
Expand Down
12 changes: 6 additions & 6 deletions cvat-core/src/annotations.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019-2022 Intel Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
// Copyright (C) 2022-2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -161,20 +161,20 @@ export function importDataset(
file: File | string,
options: {
convMaskToPoly?: boolean,
updateStatusCallback?: (s: string, n: number) => void,
uploadStatusCallback?: (s: string, n: number) => void,
} = {},
): Promise<void> {
const updateStatusCallback = options.updateStatusCallback || (() => {});
): Promise<string> {
const uploadStatusCallback = options.uploadStatusCallback || (() => {});
const convMaskToPoly = 'convMaskToPoly' in options ? options.convMaskToPoly : true;
const adjustedOptions = {
updateStatusCallback,
uploadStatusCallback,
convMaskToPoly,
};

if (!(instance instanceof Project || instance instanceof Task || instance instanceof Job)) {
throw new ArgumentError('Instance must be a Project || Task || Job instance');
}
if (!(typeof updateStatusCallback === 'function')) {
if (!(typeof uploadStatusCallback === 'function')) {
throw new ArgumentError('Callback must be a function');
}
if (!(typeof convMaskToPoly === 'boolean')) {
Expand Down
5 changes: 5 additions & 0 deletions cvat-core/src/api-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import config from './config';
import PluginRegistry from './plugins';
import serverProxy from './server-proxy';
import lambdaManager from './lambda-manager';
import requestsManager from './requests-manager';
import {
isBoolean,
isInteger,
Expand Down Expand Up @@ -61,6 +62,10 @@ export default function implementAPI(cvat: CVATCore): CVATCore {
implementationMixin(cvat.lambda.listen, lambdaManager.listen.bind(lambdaManager));
implementationMixin(cvat.lambda.requests, lambdaManager.requests.bind(lambdaManager));

implementationMixin(cvat.requests.list, requestsManager.list.bind(requestsManager));
implementationMixin(cvat.requests.listen, requestsManager.listen.bind(requestsManager));
implementationMixin(cvat.requests.cancel, requestsManager.cancel.bind(requestsManager));

implementationMixin(cvat.server.about, async () => {
const result = await serverProxy.server.about();
return result;
Expand Down
22 changes: 22 additions & 0 deletions cvat-core/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ import Organization from './organization';
import Webhook from './webhook';
import AnnotationGuide from './guide';
import BaseSingleFrameAction from './annotations-actions';
import { Request } from './requests-manager';

import * as enums from './enums';

Expand Down Expand Up @@ -374,6 +375,27 @@ function build(): CVATCore {
},
},
},
requests: {
async list(): Promise<{
requests: Request[];
count: number;
}> {
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const result = await PluginRegistry.apiWrapper(cvat.requests.list);
return result;
},
async delete(rqID: string): Promise<void> {
const result = await PluginRegistry.apiWrapper(cvat.requests.delete, rqID);
return result;
},
async cancel(rqID: string): Promise<void> {
const result = await PluginRegistry.apiWrapper(cvat.requests.cancel, rqID);
return result;
},
async listen(rqID: string, callback: (request: Request) => void): Promise<Request> {
const result = await PluginRegistry.apiWrapper(cvat.requests.listen, rqID, callback);
return result;
},
},
classes: {
User,
Project: implementProject(Project),
Expand Down
1 change: 1 addition & 0 deletions cvat-core/src/enums.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export enum RQStatus {
FINISHED = 'finished',
FAILED = 'failed',
UNKNOWN = 'unknown',
DEFERRED = 'deferred',
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test it?

I have several deferred requests, but they are returned as queued
image

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have several deferred requests, but they are returned as queued

This is consciously changed on the server, a user shouldn't know that his job is deferred. For him job is just in a queue.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a user shouldn't know that his job is deferred

  1. Why do you think so?
  2. For a user on UI we will still may show "Queued", no problem.
  3. But this information is required to implement correct long-time-pooling algorithm (when user has 500+ jobs queued, will client ask the server about each status every N seconds??? Definitely No -> throttling issues. So, for which Requests should client fetch the information? I would say that we not even should now which jobs are deferred [at minimum], but also information about dependend jobs is important)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From my perspective this PR is already too large to add some complex algorithms with handling dependent jobs. Now on client side we have escalating timeouts for "Queued" statuses and a mechanism that prevents sending more than 5 requests simultaneously(it reschedules the request for quite large timeout).
Sending "smart" status requests - something like checking only one job in each class that can be in progress (as other ones are in the queue behind it) requires some info from the server (position in queue for example, or dependent list). It looks like its a theme for another feature and discussion

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, let's postpone this algorithm, but in this case please remove all 'deferred' from cvat-core

}

export enum TaskMode {
Expand Down
4 changes: 3 additions & 1 deletion cvat-core/src/exceptions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019-2022 Intel Corporation
// Copyright (C) 2022 CVAT.ai Corporation
// Copyright (C) 2022-2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -99,6 +99,8 @@ export class DataError extends Exception {}

export class ScriptingError extends Exception {}

export class RequestError extends Exception {}

export class ServerError extends Exception {
public code: number;
constructor(message, code) {
Expand Down
15 changes: 15 additions & 0 deletions cvat-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

import {
AnalyticsReportFilter, QualityConflictsFilter, QualityReportsFilter, QualitySettingsFilter,
RequestsFilter,
} from './server-response-types';
import PluginRegistry from './plugins';
import serverProxy from './server-proxy';
Expand Down Expand Up @@ -32,6 +33,7 @@ import QualityConflict from './quality-conflict';
import QualitySettings from './quality-settings';
import AnalyticsReport from './analytics-report';
import AnnotationGuide from './guide';
import { Request } from './requests-manager';
import BaseSingleFrameAction, { listActions, registerAction, runActions } from './annotations-actions';
import {
ArgumentError, DataError, Exception, ScriptingError, ServerError,
Expand Down Expand Up @@ -150,6 +152,19 @@ export default interface CVATCore {
frames: {
getMeta: any;
};
requests: {
list: () => Promise<{ requests: Request[], count: number }>;
listen: (
rqID: string | null,
klakhov marked this conversation as resolved.
Show resolved Hide resolved
options?: {
callback?: (request: Request) => void,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall this callback be optional? What is a reason to listen for something if we do not want to get updates?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not, if some code wants to listen but dont need to update any UI

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please provide example?

filter?: RequestsFilter,
klakhov marked this conversation as resolved.
Show resolved Hide resolved
initialRequest?: Request,
}
) => Promise<Request>;
cancel: (rqID: string) => Promise<void>;
delete: (rqID: string) => Promise<void>;
};
actions: {
list: typeof listActions;
register: typeof registerAction;
Expand Down
35 changes: 25 additions & 10 deletions cvat-core/src/project-implementation.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (C) 2021-2022 Intel Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
// Copyright (C) 2022-2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

import requestsManager, { Request } from './requests-manager';
import { Storage } from './storage';
import serverProxy from './server-proxy';
import { decodePreview } from './frames';
Expand All @@ -11,8 +12,9 @@
import { SerializedLabel } from './server-response-types';
import { Label } from './labels';
import AnnotationGuide from './guide';
import { RQStatus } from './enums';

export default function implementProject(projectClass) {

Check warning on line 17 in cvat-core/src/project-implementation.ts

View workflow job for this annotation

GitHub Actions / Linter

Missing return type on function
klakhov marked this conversation as resolved.
Show resolved Hide resolved
projectClass.prototype.save.implementation = async function () {
if (typeof this.id !== 'undefined') {
const projectData = this._updateTrigger.getUpdated(this, {
Expand Down Expand Up @@ -97,8 +99,8 @@
targetStorage: Storage,
customName?: string,
) {
const result = exportDataset(this, format, saveImages, useDefaultSettings, targetStorage, customName);
return result;
const rqID = await exportDataset(this, format, saveImages, useDefaultSettings, targetStorage, customName);
return rqID;
klakhov marked this conversation as resolved.
Show resolved Hide resolved
};
projectClass.prototype.annotations.importDataset.implementation = async function (
format: string,
Expand All @@ -107,24 +109,37 @@
file: File | string,
options?: {
convMaskToPoly?: boolean,
updateStatusCallback?: (s: string, n: number) => void,
uploadStatusCallback?: (s: string, n: number) => void,
requestStatusCallback?: (request: Request) => void,
},
) {
return importDataset(this, format, useDefaultSettings, sourceStorage, file, options);
const { requestStatusCallback } = options || {};
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const rqID = await importDataset(this, format, useDefaultSettings, sourceStorage, file, options);
return requestsManager.listen(rqID, { callback: requestStatusCallback });
klakhov marked this conversation as resolved.
Show resolved Hide resolved
};

projectClass.prototype.backup.implementation = async function (
targetStorage: Storage,
useDefaultSettings: boolean,
fileName?: string,
options?: { requestStatusCallback?: (request: Request) => void },
) {
const result = await serverProxy.projects.backup(this.id, targetStorage, useDefaultSettings, fileName);
return result;
const { requestStatusCallback } = options || {};
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const rqID = await serverProxy.projects.backup(this.id, targetStorage, useDefaultSettings, fileName);
if (rqID) {
return requestsManager.listen(rqID, { callback: requestStatusCallback });
}
klakhov marked this conversation as resolved.
Show resolved Hide resolved
return new Request({ status: RQStatus.FINISHED, message: '' });
klakhov marked this conversation as resolved.
Show resolved Hide resolved
};

projectClass.restore.implementation = async function (storage: Storage, file: File | string) {
const result = await serverProxy.projects.restore(storage, file);
return result;
projectClass.restore.implementation = async function (
klakhov marked this conversation as resolved.
Show resolved Hide resolved
storage: Storage,
file: File | string,
options?: { requestStatusCallback?: (request: Request) => void },
) {
const { requestStatusCallback } = options || {};
const rqID = await serverProxy.projects.restore(storage, file);
return requestsManager.listen(rqID, { callback: requestStatusCallback });
klakhov marked this conversation as resolved.
Show resolved Hide resolved
};

projectClass.prototype.guide.implementation = async function guide() {
Expand Down
19 changes: 14 additions & 5 deletions cvat-core/src/project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright (C) 2019-2022 Intel Corporation
// Copyright (C) 2022-2023 CVAT.ai Corporation
// Copyright (C) 2022-2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -13,6 +13,7 @@
import User from './user';
import { FieldUpdateTrigger } from './common';
import AnnotationGuide from './guide';
import { Request } from './requests-manager';

export default class Project {
public readonly id: number;
Expand Down Expand Up @@ -206,22 +207,26 @@
};
}

async preview() {

Check warning on line 210 in cvat-core/src/project.ts

View workflow job for this annotation

GitHub Actions / Linter

Missing return type on function
const result = await PluginRegistry.apiWrapper.call(this, Project.prototype.preview);
return result;
}

async save() {

Check warning on line 215 in cvat-core/src/project.ts

View workflow job for this annotation

GitHub Actions / Linter

Missing return type on function
const result = await PluginRegistry.apiWrapper.call(this, Project.prototype.save);
return result;
}

async delete() {

Check warning on line 220 in cvat-core/src/project.ts

View workflow job for this annotation

GitHub Actions / Linter

Missing return type on function
const result = await PluginRegistry.apiWrapper.call(this, Project.prototype.delete);
return result;
}

async backup(targetStorage: Storage, useDefaultSettings: boolean, fileName?: string) {
async backup(

Check warning on line 225 in cvat-core/src/project.ts

View workflow job for this annotation

GitHub Actions / Linter

Missing return type on function
targetStorage: Storage,
useDefaultSettings: boolean,
fileName?: string,
) {
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const result = await PluginRegistry.apiWrapper.call(
this,
Project.prototype.backup,
Expand All @@ -232,8 +237,12 @@
return result;
}

static async restore(storage: Storage, file: File | string) {
const result = await PluginRegistry.apiWrapper.call(this, Project.restore, storage, file);
static async restore(

Check warning on line 240 in cvat-core/src/project.ts

View workflow job for this annotation

GitHub Actions / Linter

Missing return type on function
storage: Storage,
file: File | string,
options?: { requestStatusCallback?: (request: Request) => void },
) {
const result = await PluginRegistry.apiWrapper.call(this, Project.restore, storage, file, options);
klakhov marked this conversation as resolved.
Show resolved Hide resolved
return result;
}

Expand Down Expand Up @@ -273,7 +282,7 @@
file: File | string,
options?: {
convMaskToPoly?: boolean,
updateStatusCallback?: (s: string, n: number) => void,
uploadStatusCallback?: (s: string, n: number) => void,
},
) {
const result = await PluginRegistry.apiWrapper.call(
Expand Down