Skip to content

Commit 5645cdf

Browse files
authored
React-UI: settings (#1164)
* Image filters: brightness, contrast, saturation * Auto saving * Frame auto fit * Player speed * Leave confirmation for unsaved changes
1 parent 90d594d commit 5645cdf

File tree

20 files changed

+653
-121
lines changed

20 files changed

+653
-121
lines changed

cvat-core/src/session.js

+8-8
Original file line numberDiff line numberDiff line change
@@ -77,12 +77,6 @@
7777
return result;
7878
},
7979

80-
async hasUnsavedChanges() {
81-
const result = await PluginRegistry
82-
.apiWrapper.call(this, prototype.annotations.hasUnsavedChanges);
83-
return result;
84-
},
85-
8680
async merge(objectStates) {
8781
const result = await PluginRegistry
8882
.apiWrapper.call(this, prototype.annotations.merge, objectStates);
@@ -107,6 +101,12 @@
107101
.apiWrapper.call(this, prototype.annotations.exportDataset, format);
108102
return result;
109103
},
104+
105+
hasUnsavedChanges() {
106+
const result = prototype.annotations
107+
.hasUnsavedChanges.implementation.call(this);
108+
return result;
109+
},
110110
},
111111
writable: true,
112112
}),
@@ -381,14 +381,14 @@
381381
* @async
382382
*/
383383
/**
384-
* Indicate if there are any changes in
384+
* Method indicates if there are any changes in
385385
* annotations which haven't been saved on a server
386+
* </br><b> This function cannot be wrapped with a plugin </b>
386387
* @method hasUnsavedChanges
387388
* @memberof Session.annotations
388389
* @returns {boolean}
389390
* @throws {module:API.cvat.exceptions.PluginError}
390391
* @instance
391-
* @async
392392
*/
393393
/**
394394
* Export as a dataset.

cvat-core/tests/api/annotations.js

+22-22
Original file line numberDiff line numberDiff line change
@@ -341,11 +341,11 @@ describe('Feature: save annotations', () => {
341341
zOrder: 0,
342342
});
343343

344-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
344+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
345345
await task.annotations.put([state]);
346-
expect(await task.annotations.hasUnsavedChanges()).toBe(true);
346+
expect(task.annotations.hasUnsavedChanges()).toBe(true);
347347
await task.annotations.save();
348-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
348+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
349349
annotations = await task.annotations.get(0);
350350
expect(annotations).toHaveLength(length + 1);
351351
});
@@ -354,23 +354,23 @@ describe('Feature: save annotations', () => {
354354
const task = (await window.cvat.tasks.get({ id: 101 }))[0];
355355
const annotations = await task.annotations.get(0);
356356

357-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
357+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
358358
annotations[0].occluded = true;
359359
await annotations[0].save();
360-
expect(await task.annotations.hasUnsavedChanges()).toBe(true);
360+
expect(task.annotations.hasUnsavedChanges()).toBe(true);
361361
await task.annotations.save();
362-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
362+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
363363
});
364364

365365
test('delete & save annotations for a task', async () => {
366366
const task = (await window.cvat.tasks.get({ id: 101 }))[0];
367367
const annotations = await task.annotations.get(0);
368368

369-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
369+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
370370
await annotations[0].delete();
371-
expect(await task.annotations.hasUnsavedChanges()).toBe(true);
371+
expect(task.annotations.hasUnsavedChanges()).toBe(true);
372372
await task.annotations.save();
373-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
373+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
374374
});
375375

376376
test('create & save annotations for a job', async () => {
@@ -387,11 +387,11 @@ describe('Feature: save annotations', () => {
387387
zOrder: 0,
388388
});
389389

390-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
390+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
391391
await job.annotations.put([state]);
392-
expect(await job.annotations.hasUnsavedChanges()).toBe(true);
392+
expect(job.annotations.hasUnsavedChanges()).toBe(true);
393393
await job.annotations.save();
394-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
394+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
395395
annotations = await job.annotations.get(0);
396396
expect(annotations).toHaveLength(length + 1);
397397
});
@@ -400,23 +400,23 @@ describe('Feature: save annotations', () => {
400400
const job = (await window.cvat.jobs.get({ jobID: 100 }))[0];
401401
const annotations = await job.annotations.get(0);
402402

403-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
403+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
404404
annotations[0].points = [0, 100, 200, 300];
405405
await annotations[0].save();
406-
expect(await job.annotations.hasUnsavedChanges()).toBe(true);
406+
expect(job.annotations.hasUnsavedChanges()).toBe(true);
407407
await job.annotations.save();
408-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
408+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
409409
});
410410

411411
test('delete & save annotations for a job', async () => {
412412
const job = (await window.cvat.jobs.get({ jobID: 100 }))[0];
413413
const annotations = await job.annotations.get(0);
414414

415-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
415+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
416416
await annotations[0].delete();
417-
expect(await job.annotations.hasUnsavedChanges()).toBe(true);
417+
expect(job.annotations.hasUnsavedChanges()).toBe(true);
418418
await job.annotations.save();
419-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
419+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
420420
});
421421

422422
test('delete & save annotations for a job when there are a track and a shape with the same id', async () => {
@@ -658,11 +658,11 @@ describe('Feature: clear annotations', () => {
658658
expect(annotations.length).not.toBe(0);
659659
annotations[0].occluded = true;
660660
await annotations[0].save();
661-
expect(await task.annotations.hasUnsavedChanges()).toBe(true);
661+
expect(task.annotations.hasUnsavedChanges()).toBe(true);
662662
await task.annotations.clear(true);
663663
annotations = await task.annotations.get(0);
664664
expect(annotations.length).not.toBe(0);
665-
expect(await task.annotations.hasUnsavedChanges()).toBe(false);
665+
expect(task.annotations.hasUnsavedChanges()).toBe(false);
666666
});
667667

668668
test('clear annotations with reload in a job', async () => {
@@ -671,11 +671,11 @@ describe('Feature: clear annotations', () => {
671671
expect(annotations.length).not.toBe(0);
672672
annotations[0].occluded = true;
673673
await annotations[0].save();
674-
expect(await job.annotations.hasUnsavedChanges()).toBe(true);
674+
expect(job.annotations.hasUnsavedChanges()).toBe(true);
675675
await job.annotations.clear(true);
676676
annotations = await job.annotations.get(0);
677677
expect(annotations.length).not.toBe(0);
678-
expect(await job.annotations.hasUnsavedChanges()).toBe(false);
678+
expect(job.annotations.hasUnsavedChanges()).toBe(false);
679679
});
680680

681681
test('clear annotations with bad reload parameter', async () => {

0 commit comments

Comments
 (0)