Skip to content

Commit

Permalink
Merge branch 'ma/link-update' of https://github.com/cvat-ai/cvat into…
Browse files Browse the repository at this point in the history
… ma/link-update
  • Loading branch information
mdacoca committed Jun 24, 2024
2 parents 1798d8c + 7675813 commit 9a9166e
Show file tree
Hide file tree
Showing 37 changed files with 860 additions and 993 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Exception 'this.el.node.getScreenCTM() is null' occuring in Firefox when
a user resizes window during skeleton dragging/resizing (<https://github.com/cvat-ai/cvat/pull/8067>)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Exception 'Edge's nodeFrom M or nodeTo N do not to refer to any node'
occuring when a user resizes window during skeleton dragging/resizing (<https://github.com/cvat-ai/cvat/pull/8067>)
4 changes: 4 additions & 0 deletions changelog.d/20240624_145717_boris.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- Slightly broken layout when running attributed face detection model
(<https://github.com/cvat-ai/cvat/pull/8072>)
2 changes: 1 addition & 1 deletion cvat-canvas/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cvat-canvas",
"version": "2.20.3",
"version": "2.20.4",
"type": "module",
"description": "Part of Computer Vision Annotation Tool which presents its canvas library",
"main": "src/canvas.ts",
Expand Down
875 changes: 386 additions & 489 deletions cvat-canvas/src/typescript/canvasView.ts

Large diffs are not rendered by default.

15 changes: 12 additions & 3 deletions cvat-core/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,24 +74,33 @@ export function checkObjectType(name, value, type, instance?): boolean {
return true;
}

throw new ArgumentError(`"${name}" is expected to be "${type}", but "${typeof value}" has been got.`);
throw new ArgumentError(`"${name}" is expected to be "${type}", but "${typeof value}" received.`);
}
} else if (instance) {
if (!(value instanceof instance)) {
if (value !== undefined) {
throw new ArgumentError(
`"${name}" is expected to be ${instance.name}, but ` +
`"${value.constructor.name}" has been got`,
`"${value.constructor.name}" received`,
);
}

throw new ArgumentError(`"${name}" is expected to be ${instance.name}, but "undefined" has been got.`);
throw new ArgumentError(`"${name}" is expected to be ${instance.name}, but "undefined" received`);
}
}

return true;
}

export function checkInEnum<T>(name: string, value: T, values: T[]): boolean {
const possibleValues = Object.values(values);
if (!possibleValues.includes(value)) {
throw new ArgumentError(`Value ${name} must be on of [${possibleValues.join(', ')}]`);
}

return true;
}

export class FieldUpdateTrigger {
#updatedFlags: Record<string, boolean> = {};

Expand Down
2 changes: 1 addition & 1 deletion cvat-core/src/project.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export default class Project {
public readonly owner: User;
public readonly createdDate: string;
public readonly updatedDate: string;
public readonly taskSubsets: string[];
public readonly subsets: string[];
public readonly dimension: DimensionType;
public readonly sourceStorage: Storage;
public readonly targetStorage: Storage;
Expand Down
42 changes: 24 additions & 18 deletions cvat-core/src/session-implementation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@

import { omit } from 'lodash';
import { ArgumentError } from './exceptions';
import { HistoryActions, JobType } from './enums';
import {
HistoryActions, JobStage, JobState, JobType,
} from './enums';
import { Task as TaskClass, Job as JobClass } from './session';
import logger from './logger';
import serverProxy from './server-proxy';
Expand All @@ -23,12 +25,13 @@ import {
} from './frames';
import Issue from './issue';
import { SerializedLabel, SerializedTask } from './server-response-types';
import { checkObjectType } from './common';
import { checkInEnum, checkObjectType } from './common';
import {
getCollection, getSaver, clearAnnotations, getAnnotations,
importDataset, exportDataset, clearCache, getHistory,
} from './annotations';
import AnnotationGuide from './guide';
import User from './user';

// must be called with task/job context
async function deleteFrameWrapper(jobID, frame): Promise<void> {
Expand Down Expand Up @@ -57,28 +60,30 @@ export function implementJob(Job: typeof JobClass): typeof JobClass {
Object.defineProperty(Job.prototype.save, 'implementation', {
value: async function saveImplementation(
this: JobClass,
additionalData: any,
fields: any,
): ReturnType<typeof JobClass.prototype.save> {
if (this.id) {
const jobData = this._updateTrigger.getUpdated(this);
const jobData = {
...('assignee' in fields ? { assignee: fields.assignee } : {}),
...('stage' in fields ? { stage: fields.stage } : {}),
...('state' in fields ? { state: fields.state } : {}),
};

if (jobData.assignee) {
checkObjectType('job assignee', jobData.assignee, null, User);
jobData.assignee = jobData.assignee.id;
}

let updatedJob = null;
try {
const data = await serverProxy.jobs.save(this.id, jobData);
updatedJob = new Job(data);
} catch (error) {
updatedJob = new Job(this._initialData);
throw error;
} finally {
this.stage = updatedJob.stage;
this.state = updatedJob.state;
this.assignee = updatedJob.assignee;
this._updateTrigger.reset();
if (jobData.state) {
checkInEnum<JobState>('job state', jobData.state, Object.values(JobState));
}

if (jobData.stage) {
checkInEnum<JobStage>('job stage', jobData.stage, Object.values(JobStage));
}

const data = await serverProxy.jobs.save(this.id, jobData);
this.reinit({ ...data, labels: [] });
return this;
}

Expand All @@ -89,8 +94,9 @@ export function implementJob(Job: typeof JobClass): typeof JobClass {
type: this.type,
task_id: this.taskId,
};
const job = await serverProxy.jobs.create({ ...jobSpec, ...additionalData });
return new Job(job);

const job = await serverProxy.jobs.create({ ...jobSpec, ...fields });
return new JobClass({ ...job, labels: [] });
},
});

Expand Down
Loading

0 comments on commit 9a9166e

Please sign in to comment.