Skip to content

Commit

Permalink
Merge bs/advanced_filtering
Browse files Browse the repository at this point in the history
  • Loading branch information
Marishka17 committed Feb 24, 2022
2 parents c7f26fa + 59a4a32 commit a50e20c
Show file tree
Hide file tree
Showing 9 changed files with 15 additions and 19 deletions.
4 changes: 0 additions & 4 deletions cvat-core/src/api-implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions cvat-core/src/api.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2019-2021 Intel Corporation
// Copyright (C) 2019-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions cvat-core/src/cloud-storage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
};

Expand Down
2 changes: 1 addition & 1 deletion cvat-core/tests/api/cloud-storages.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/actions/cloud-storage-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ export function getCloudStoragesAsync(query: Partial<CloudStoragesQuery>): 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<object[]>((acc, filterField) => {
and: ['displayName', 'resource', 'description', 'owner', 'providerType', 'credentialsType'].reduce<object[]>((acc, filterField) => {
if (filterField in filteredQuery) {
acc.push({ '==': [{ var: camelToSnake(filterField) }, filteredQuery[filterField]] });
delete filteredQuery[filterField];
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -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,
};

Expand Down
4 changes: 2 additions & 2 deletions cvat-ui/src/components/search-tooltip/search-tooltip.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand Down Expand Up @@ -51,7 +51,7 @@ export default function SearchTooltip(props: Props): JSX.Element {
) : null}
{instance === 'cloudstorage' ? (
<Paragraph>
<Text strong>resourceName: mycvatbucket</Text>
<Text strong>resource: mycvatbucket</Text>
<Text>
all
{instances}
Expand Down
4 changes: 2 additions & 2 deletions cvat-ui/src/reducers/cloud-storages-reducer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (C) 2021 Intel Corporation
// Copyright (C) 2021-2022 Intel Corporation
//
// SPDX-License-Identifier: MIT

Expand All @@ -20,7 +20,7 @@ const defaultState: CloudStoragesState = {
owner: null,
displayName: null,
description: null,
resourceName: null,
resource: null,
providerType: null,
credentialsType: null,
status: null,
Expand Down
2 changes: 1 addition & 1 deletion cvat-ui/src/reducers/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit a50e20c

Please sign in to comment.