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

Migrate quality UI changes #7441

Merged
merged 31 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
77f06b5
draft fix of job list
klakhov Feb 5, 2024
5337022
fixed number representation & conflicts display
klakhov Feb 5, 2024
f115555
A bunch more fixes to job-list
klakhov Feb 5, 2024
e690143
added missing newlines
klakhov Feb 6, 2024
b4dc0ed
removed analytics state
klakhov Feb 6, 2024
33a36ab
moved more refactoring
klakhov Feb 6, 2024
992bfb3
migrated styles
klakhov Feb 6, 2024
18b08cc
applied quality settings refactoring
klakhov Feb 6, 2024
9a051b4
analytics page refactoring
klakhov Feb 6, 2024
e84d0fb
fix getting report
klakhov Feb 6, 2024
24012c3
updated changelog
klakhov Feb 6, 2024
f1f4902
updated versions
klakhov Feb 6, 2024
e0c51c9
Merge branch 'develop' into kl/quality-bugfixes
klakhov Feb 6, 2024
a43cdf9
fixed test
klakhov Feb 6, 2024
ce1e731
Merge branch 'kl/quality-bugfixes' of https://github.com/cvat-ai/cvat…
klakhov Feb 6, 2024
8844536
Merge branch 'develop' into kl/quality-bugfixes
klakhov Feb 9, 2024
41b491d
Merge branch 'develop' into kl/quality-bugfixes
klakhov Feb 12, 2024
a338e5e
fixed changelog
klakhov Feb 12, 2024
d734b19
added analytics filter types to server-proxy
klakhov Feb 12, 2024
ceb7ede
added types for analytics module in cvat-core index
klakhov Feb 12, 2024
a00d478
removed excessive parameter in fieldsToSnakeCase
klakhov Feb 12, 2024
7e48601
fixed count on quality reports
klakhov Feb 12, 2024
2404ff8
fixed index types
klakhov Feb 12, 2024
2490b6d
added camelized filter versions
klakhov Feb 12, 2024
8f037ca
force `ID` in camelization
klakhov Feb 12, 2024
7ef3014
Id to ID across analytics
klakhov Feb 12, 2024
1766675
Merge branch 'develop' into kl/quality-bugfixes
klakhov Feb 14, 2024
db34cb4
fixed license header
klakhov Feb 14, 2024
c470313
fixed analytics tabs hash
klakhov Feb 14, 2024
5cc875e
rewritten quality component with state/reducer
klakhov Feb 14, 2024
8f608e2
applied comments
klakhov Feb 15, 2024
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
4 changes: 4 additions & 0 deletions changelog.d/20240206_125854_klakhov_quality_bugfixes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
### Fixed

- On task quality page only the first job page had quality report results displayed in UI
klakhov marked this conversation as resolved.
Show resolved Hide resolved
(<https://github.com/opencv/cvat/pull/7441>)
72 changes: 33 additions & 39 deletions cvat-core/src/api-implementation.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,10 +13,12 @@ import {
isBoolean,
isInteger,
isString,
isPageSize,
checkFilter,
checkExclusiveFields,
checkObjectType,
filterFieldsToSnakeCase,
fieldsToSnakeCase,
} from './common';

import User from './user';
Expand Down Expand Up @@ -400,24 +402,27 @@ export default function implementAPI(cvat: CVATCore): CVATCore {
});

implementationMixin(cvat.analytics.quality.reports, async (filter) => {
let updatedParams: Record<string, string> = {};
if ('taskId' in filter) {
updatedParams = {
task_id: filter.taskId,
sort: '-created_date',
target: filter.target,
};
}
if ('jobId' in filter) {
updatedParams = {
job_id: filter.jobId,
sort: '-created_date',
target: filter.target,
};
}
const reportsData = await serverProxy.analytics.quality.reports(updatedParams);
checkFilter(filter, {
page: isInteger,
pageSize: isPageSize,
parentId: isInteger,
projectId: isInteger,
taskId: isInteger,
jobId: isInteger,
target: isString,
filter: isString,
search: isString,
sort: isString,
});

return reportsData.map((report) => new QualityReport({ ...report }));
const params = fieldsToSnakeCase(filter, { sort: '-created_date' });

const reportsData = await serverProxy.analytics.quality.reports(params);
const reports = Object.assign(
reportsData.map((report) => new QualityReport({ ...report })),
{ count: reportsData.count },
);
return reports;
});
implementationMixin(cvat.analytics.quality.conflicts, async (filter) => {
let updatedParams: Record<string, string> = {};
Expand Down Expand Up @@ -496,8 +501,14 @@ export default function implementAPI(cvat: CVATCore): CVATCore {

return mergedConflicts;
});
implementationMixin(cvat.analytics.quality.settings.get, async (taskID: number) => {
const settings = await serverProxy.analytics.quality.settings.get(taskID);
implementationMixin(cvat.analytics.quality.settings.get, async (filter) => {
checkFilter(filter, {
taskId: isInteger,
});

const params = fieldsToSnakeCase(filter);

const settings = await serverProxy.analytics.quality.settings.get(params);
return new QualitySettings({ ...settings });
});
implementationMixin(cvat.analytics.performance.reports, async (filter) => {
Expand All @@ -511,25 +522,8 @@ export default function implementAPI(cvat: CVATCore): CVATCore {

checkExclusiveFields(filter, ['jobID', 'taskID', 'projectID'], ['startDate', 'endDate']);

const updatedParams: Record<string, string> = {};

if ('taskID' in filter) {
updatedParams.task_id = filter.taskID;
}
if ('jobID' in filter) {
updatedParams.job_id = filter.jobID;
}
if ('projectID' in filter) {
updatedParams.project_id = filter.projectID;
}
if ('startDate' in filter) {
updatedParams.start_date = filter.startDate;
}
if ('endDate' in filter) {
updatedParams.end_date = filter.endDate;
}

const reportData = await serverProxy.analytics.performance.reports(updatedParams);
const params = fieldsToSnakeCase(filter);
const reportData = await serverProxy.analytics.performance.reports(params);
return new AnalyticsReport(reportData);
});
implementationMixin(cvat.frames.getMeta, async (type, id) => {
Expand Down
8 changes: 4 additions & 4 deletions cvat-core/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -346,17 +346,17 @@ function build(): CVATCore {
},
},
quality: {
async reports(filter: any) {
async reports(filter = {}) {
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const result = await PluginRegistry.apiWrapper(cvat.analytics.quality.reports, filter);
return result;
},
async conflicts(filter: any) {
async conflicts(filter = {}) {
const result = await PluginRegistry.apiWrapper(cvat.analytics.quality.conflicts, filter);
return result;
},
settings: {
async get(taskID: number) {
const result = await PluginRegistry.apiWrapper(cvat.analytics.quality.settings.get, taskID);
async get(filter = {}) {
const result = await PluginRegistry.apiWrapper(cvat.analytics.quality.settings.get, filter);
return result;
},
},
Expand Down
17 changes: 16 additions & 1 deletion cvat-core/src/common.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
// Copyright (C) 2019-2022 Intel Corporation
// Copyright (C) 2022-2023s CVAT.ai Corporation
// Copyright (C) 2022-2024 CVAT.ai Corporation
//
// SPDX-License-Identifier: MIT

import { snakeCase } from 'lodash';
import { ArgumentError } from './exceptions';

export function isBoolean(value): boolean {
Expand Down Expand Up @@ -145,3 +146,17 @@ export function filterFieldsToSnakeCase(filter: Record<string, string>, keysToSn
export function isResourceURL(url: string): boolean {
return /\/([0-9]+)$/.test(url);
}

export function isPageSize(value: number | 'all'): boolean {
return isInteger(value) || value === 'all';
}

export function fieldsToSnakeCase(
params: Record<string, any>, out?: Record<string, any>,
): Record<string, any> {
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const result = (out !== undefined) ? out : {};
for (const [k, v] of Object.entries(params)) {
result[snakeCase(k)] = v;
}
return result;
}
4 changes: 2 additions & 2 deletions cvat-core/src/server-proxy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2310,13 +2310,13 @@ async function createAsset(file: File, guideId: number): Promise<SerializedAsset
}
}

async function getQualitySettings(taskID: number): Promise<SerializedQualitySettingsData> {
async function getQualitySettings(filter): Promise<SerializedQualitySettingsData> {
klakhov marked this conversation as resolved.
Show resolved Hide resolved
const { backendAPI } = config;

try {
const response = await Axios.get(`${backendAPI}/quality/settings`, {
params: {
task_id: taskID,
...filter,
},
});

Expand Down
107 changes: 0 additions & 107 deletions cvat-ui/src/actions/analytics-actions.ts

This file was deleted.

Loading
Loading