From e2c327b3473c0ca9be4b3d642bb7bad8ed6591b2 Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 24 Feb 2022 17:27:03 +0300 Subject: [PATCH 1/2] Renamed resourceName to resource --- cvat-core/src/api-implementation.js | 4 ---- cvat-core/src/api.js | 4 ++-- cvat-core/src/cloud-storage.js | 8 ++++---- cvat-ui/src/actions/cloud-storage-actions.ts | 2 +- .../create-cloud-storage-page/cloud-storage-form.tsx | 4 ++-- cvat-ui/src/components/search-tooltip/search-tooltip.tsx | 4 ++-- cvat-ui/src/reducers/cloud-storages-reducer.ts | 4 ++-- cvat-ui/src/reducers/interfaces.ts | 2 +- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/cvat-core/src/api-implementation.js b/cvat-core/src/api-implementation.js index 8e38ff4f562..98bf84de335 100644 --- a/cvat-core/src/api-implementation.js +++ b/cvat-core/src/api-implementation.js @@ -264,10 +264,6 @@ const config = require('./config'); } } - if (Object.prototype.hasOwnProperty.call(filter, 'resourceName')) { - searchParams.set('resource', filter.resourceName); - } - const cloudStoragesData = await serverProxy.cloudStorages.get(searchParams.toString()); const cloudStorages = cloudStoragesData.map((cloudStorage) => new CloudStorage(cloudStorage)); cloudStorages.count = cloudStoragesData.count; diff --git a/cvat-core/src/api.js b/cvat-core/src/api.js index 9ad28db2265..722ce925c7f 100644 --- a/cvat-core/src/api.js +++ b/cvat-core/src/api.js @@ -1,4 +1,4 @@ -// Copyright (C) 2019-2021 Intel Corporation +// Copyright (C) 2019-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -773,7 +773,7 @@ function build() { /** * @typedef {Object} CloudStorageFilter * @property {string} displayName Check if displayName contains this value - * @property {string} resourceName Check if resourceName contains this value + * @property {string} resource Check if resource name contains this value * @property {module:API.cvat.enums.ProviderType} providerType Check if providerType equal this value * @property {integer} id Check if id equals this value * @property {integer} page Get specific page diff --git a/cvat-core/src/cloud-storage.js b/cvat-core/src/cloud-storage.js index b4799962cc7..9be108b3ffa 100644 --- a/cvat-core/src/cloud-storage.js +++ b/cvat-core/src/cloud-storage.js @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2021-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -174,13 +174,13 @@ }, /** * Unique resource name - * @name resourceName + * @name resource * @type {string} * @memberof module:API.cvat.classes.CloudStorage * @instance * @throws {module:API.cvat.exceptions.ArgumentError} */ - resourceName: { + resource: { get: () => data.resource, set: (value) => { validateNotEmptyString(value); @@ -456,7 +456,7 @@ display_name: this.displayName, credentials_type: this.credentialsType, provider_type: this.providerType, - resource: this.resourceName, + resource: this.resource, manifests: this.manifests, }; diff --git a/cvat-ui/src/actions/cloud-storage-actions.ts b/cvat-ui/src/actions/cloud-storage-actions.ts index 1a1242cdf6a..f7cb770368e 100644 --- a/cvat-ui/src/actions/cloud-storage-actions.ts +++ b/cvat-ui/src/actions/cloud-storage-actions.ts @@ -123,7 +123,7 @@ export function getCloudStoragesAsync(query: Partial): Thunk // Temporary hack to do not change UI currently for cloud storages // Will be redesigned in a different PR const filter = { - and: ['displayName', 'resourceName', 'description', 'owner', 'providerType', 'credentialsType'].reduce((acc, filterField) => { + and: ['displayName', 'resource', 'description', 'owner', 'providerType', 'credentialsType'].reduce((acc, filterField) => { if (filterField in filteredQuery) { acc.push({ '==': [{ var: camelToSnake(filterField) }, filteredQuery[filterField]] }); delete filteredQuery[filterField]; diff --git a/cvat-ui/src/components/create-cloud-storage-page/cloud-storage-form.tsx b/cvat-ui/src/components/create-cloud-storage-page/cloud-storage-form.tsx index 6913130cc3a..bd34dd95adf 100644 --- a/cvat-ui/src/components/create-cloud-storage-page/cloud-storage-form.tsx +++ b/cvat-ui/src/components/create-cloud-storage-page/cloud-storage-form.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2021-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -95,7 +95,7 @@ export default function CreateCloudStorageForm(props: Props): JSX.Element { display_name: cloudStorage.displayName, description: cloudStorage.description, provider_type: cloudStorage.providerType, - resource: cloudStorage.resourceName, + resource: cloudStorage.resource, manifests: manifestNames, }; diff --git a/cvat-ui/src/components/search-tooltip/search-tooltip.tsx b/cvat-ui/src/components/search-tooltip/search-tooltip.tsx index 3fc5dcb7b99..a1e4b866a33 100644 --- a/cvat-ui/src/components/search-tooltip/search-tooltip.tsx +++ b/cvat-ui/src/components/search-tooltip/search-tooltip.tsx @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2021-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -51,7 +51,7 @@ export default function SearchTooltip(props: Props): JSX.Element { ) : null} {instance === 'cloudstorage' ? ( - resourceName: mycvatbucket + resource: mycvatbucket all {instances} diff --git a/cvat-ui/src/reducers/cloud-storages-reducer.ts b/cvat-ui/src/reducers/cloud-storages-reducer.ts index 5e5ecd6f881..92b17a3cea2 100644 --- a/cvat-ui/src/reducers/cloud-storages-reducer.ts +++ b/cvat-ui/src/reducers/cloud-storages-reducer.ts @@ -1,4 +1,4 @@ -// Copyright (C) 2021 Intel Corporation +// Copyright (C) 2021-2022 Intel Corporation // // SPDX-License-Identifier: MIT @@ -20,7 +20,7 @@ const defaultState: CloudStoragesState = { owner: null, displayName: null, description: null, - resourceName: null, + resource: null, providerType: null, credentialsType: null, status: null, diff --git a/cvat-ui/src/reducers/interfaces.ts b/cvat-ui/src/reducers/interfaces.ts index 437f224716d..5d03f6f975e 100644 --- a/cvat-ui/src/reducers/interfaces.ts +++ b/cvat-ui/src/reducers/interfaces.ts @@ -159,7 +159,7 @@ export interface CloudStoragesQuery { owner: string | null; displayName: string | null; description: string | null; - resourceName: string | null; + resource: string | null; providerType: string | null; credentialsType: string | null; [key: string]: string | number | null | undefined; From 59a4a32cf19d25fb9671931fc0b2d7b385bd78de Mon Sep 17 00:00:00 2001 From: Boris Sekachev Date: Thu, 24 Feb 2022 21:45:25 +0300 Subject: [PATCH 2/2] Fixed core test --- cvat-core/tests/api/cloud-storages.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cvat-core/tests/api/cloud-storages.js b/cvat-core/tests/api/cloud-storages.js index a2d2472442d..66ccf11abdc 100644 --- a/cvat-core/tests/api/cloud-storages.js +++ b/cvat-core/tests/api/cloud-storages.js @@ -36,7 +36,7 @@ describe('Feature: get cloud storages', () => { expect(cloudStorage.id).toBe(1); expect(cloudStorage.providerType).toBe('AWS_S3_BUCKET'); expect(cloudStorage.credentialsType).toBe('KEY_SECRET_KEY_PAIR'); - expect(cloudStorage.resourceName).toBe('bucket'); + expect(cloudStorage.resource).toBe('bucket'); expect(cloudStorage.displayName).toBe('Demonstration bucket'); expect(cloudStorage.manifests).toHaveLength(1); expect(cloudStorage.manifests[0]).toBe('manifest.jsonl');