[arvados-workbench2] updated: 2.5.0-68-gab598e2d
git repository hosting
git at public.arvados.org
Fri Feb 24 15:27:34 UTC 2023
Summary of changes:
cypress/integration/project.spec.js | 55 +++++++++++++++++++++-
.../all-processes-panel-middleware-service.ts | 24 ++--------
...api-client-authorizations-middleware-service.ts | 23 +--------
...llections-content-address-middleware-service.ts | 25 ++--------
.../data-explorer-middleware-service.ts | 21 ++++++++-
.../link-panel/link-panel-middleware-service.ts | 23 +--------
.../project-panel-middleware-service.ts | 2 +-
.../shared-with-me-middleware-service.ts | 2 +-
.../subprocess-panel-middleware-service.ts | 23 +--------
.../trash-panel/trash-panel-middleware-service.ts | 34 +++++++------
src/store/users/user-panel-middleware-service.ts | 2 +-
.../workflow-panel/workflow-middleware-service.ts | 23 +--------
src/views/favorite-panel/favorite-panel.tsx | 2 -
.../public-favorites-panel.tsx | 2 -
14 files changed, 110 insertions(+), 151 deletions(-)
via ab598e2d31f8ec72c602e59c11f9a59e4c860463 (commit)
via 052a725b9d763d46e297ca71a2eab5947743480c (commit)
from ea39c941f858898a9c701c818daee2b53714d19d (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
commit ab598e2d31f8ec72c602e59c11f9a59e4c860463
Author: Stephen Smith <stephen at curii.com>
Date: Fri Feb 24 10:27:16 2023 -0500
19988: Add cypress test for project data explorer sort field names
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/cypress/integration/project.spec.js b/cypress/integration/project.spec.js
index 7c3f9f7a..43f36945 100644
--- a/cypress/integration/project.spec.js
+++ b/cypress/integration/project.spec.js
@@ -495,5 +495,58 @@ describe('Project tests', function() {
));
});
-});
+ it('sorts displayed items correctly', () => {
+ cy.loginAs(activeUser);
+
+ cy.get('[data-cy=project-panel] button[title="Select columns"]').click();
+ cy.get('div[role=presentation] ul > div[role=button]').contains('Date Created').click();
+ cy.get('div[role=presentation] ul > div[role=button]').contains('Trash at').click();
+ cy.get('div[role=presentation] ul > div[role=button]').contains('Delete at').click();
+ cy.get('div[role=presentation] > div[aria-hidden=true]').click();
+
+ cy.intercept({method: 'GET', url: '**/arvados/v1/groups/*/contents*'}).as('filteredQuery');
+ [
+ {
+ name: "Name",
+ asc: "collections.name asc,container_requests.name asc,groups.name asc",
+ desc: "collections.name desc,container_requests.name desc,groups.name desc"
+ },
+ {
+ name: "Last Modified",
+ asc: "collections.modified_at asc,container_requests.modified_at asc,groups.modified_at asc",
+ desc: "collections.modified_at desc,container_requests.modified_at desc,groups.modified_at desc"
+ },
+ {
+ name: "Date Created",
+ asc: "collections.created_at asc,container_requests.created_at asc,groups.created_at asc",
+ desc: "collections.created_at desc,container_requests.created_at desc,groups.created_at desc"
+
+ },
+ {
+ name: "Trash at",
+ asc: "collections.trash_at asc,container_requests.trash_at asc,groups.trash_at asc",
+ desc: "collections.trash_at desc,container_requests.trash_at desc,groups.trash_at desc"
+
+ },
+ {
+ name: "Delete at",
+ asc: "collections.delete_at asc,container_requests.delete_at asc,groups.delete_at asc",
+ desc: "collections.delete_at desc,container_requests.delete_at desc,groups.delete_at desc"
+
+ },
+ ].forEach((test) => {
+ cy.get('[data-cy=project-panel] table thead th').contains(test.name).click();
+ cy.wait('@filteredQuery').then(interception => {
+ const searchParams = new URLSearchParams((new URL(interception.request.url).search));
+ expect(searchParams.get('order')).to.eq(test.asc);
+ });
+ cy.get('[data-cy=project-panel] table thead th').contains(test.name).click();
+ cy.wait('@filteredQuery').then(interception => {
+ const searchParams = new URLSearchParams((new URL(interception.request.url).search));
+ expect(searchParams.get('order')).to.eq(test.desc);
+ });
+ });
+
+ });
+});
commit 052a725b9d763d46e297ca71a2eab5947743480c
Author: Stephen Smith <stephen at curii.com>
Date: Thu Feb 23 13:18:55 2023 -0500
19988: Refactor getOrder into data explorer middleware when no order prefixes are used
Arvados-DCO-1.1-Signed-off-by: Stephen Smith <stephen at curii.com>
diff --git a/src/store/all-processes-panel/all-processes-panel-middleware-service.ts b/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
index fe9c8a9d..227d2fa0 100644
--- a/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
+++ b/src/store/all-processes-panel/all-processes-panel-middleware-service.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { DataExplorerMiddlewareService, dataExplorerToListParams, getDataExplorerColumnFilters } from "store/data-explorer/data-explorer-middleware-service";
+import { DataExplorerMiddlewareService, dataExplorerToListParams, getDataExplorerColumnFilters, getOrder } from "store/data-explorer/data-explorer-middleware-service";
import { RootState } from "../store";
import { ServiceRepository } from "services/services";
import { FilterBuilder, joinFilters } from "services/api/filter-builder";
@@ -11,7 +11,7 @@ import { Dispatch, MiddlewareAPI } from "redux";
import { resourcesActions } from "store/resources/resources-actions";
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
-import { getDataExplorer, DataExplorer, getSortColumn } from "store/data-explorer/data-explorer-reducer";
+import { getDataExplorer, DataExplorer } from "store/data-explorer/data-explorer-reducer";
import { loadMissingProcessesInformation } from "store/project-panel/project-panel-middleware-service";
import { DataColumns } from "components/data-table/data-table";
import {
@@ -20,8 +20,6 @@ import {
serializeOnlyProcessTypeFilters
} from "../resource-type-filters/resource-type-filters";
import { AllProcessesPanelColumnNames } from "views/all-processes-panel/all-processes-panel";
-import { OrderBuilder, OrderDirection } from "services/api/order-builder";
-import { SortDirection } from "components/data-table/data-column";
import { containerRequestFieldsNoMounts, ContainerRequestResource } from "models/container-request";
export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareService {
@@ -68,7 +66,7 @@ export class AllProcessesPanelMiddlewareService extends DataExplorerMiddlewareSe
const getParams = ( dataExplorer: DataExplorer ) => ({
...dataExplorerToListParams(dataExplorer),
- order: getOrder(dataExplorer),
+ order: getOrder<ContainerRequestResource>(dataExplorer),
filters: getFilters(dataExplorer)
});
@@ -90,22 +88,6 @@ const getFilters = ( dataExplorer: DataExplorer ) => {
);
};
-const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = getSortColumn<ContainerRequestResource>(dataExplorer);
- const order = new OrderBuilder<ContainerRequestResource>();
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- return order
- .addOrder(sortDirection, sortColumn.sort.field)
- .getOrder();
- } else {
- return order.getOrder();
- }
-};
-
const allProcessesPanelDataExplorerIsNotSet = () =>
snackbarActions.OPEN_SNACKBAR({
message: 'All Processes panel is not ready.',
diff --git a/src/store/api-client-authorizations/api-client-authorizations-middleware-service.ts b/src/store/api-client-authorizations/api-client-authorizations-middleware-service.ts
index b919bff7..9ab02549 100644
--- a/src/store/api-client-authorizations/api-client-authorizations-middleware-service.ts
+++ b/src/store/api-client-authorizations/api-client-authorizations-middleware-service.ts
@@ -4,17 +4,14 @@
import { ServiceRepository } from 'services/services';
import { MiddlewareAPI, Dispatch } from 'redux';
-import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from 'store/data-explorer/data-explorer-middleware-service';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, getOrder, listResultsToDataExplorerItemsMeta } from 'store/data-explorer/data-explorer-middleware-service';
import { RootState } from 'store/store';
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
import { DataExplorer, getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
import { updateResources } from 'store/resources/resources-actions';
-import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
import { apiClientAuthorizationsActions } from 'store/api-client-authorizations/api-client-authorizations-actions';
-import { OrderDirection, OrderBuilder } from 'services/api/order-builder';
import { ListResults } from 'services/common-service/common-service';
import { ApiClientAuthorization } from 'models/api-client-authorization';
-import { SortDirection } from 'components/data-table/data-column';
export class ApiClientAuthorizationMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -36,25 +33,9 @@ export class ApiClientAuthorizationMiddlewareService extends DataExplorerMiddlew
export const getParams = (dataExplorer: DataExplorer) => ({
...dataExplorerToListParams(dataExplorer),
- order: getOrder(dataExplorer)
+ order: getOrder<ApiClientAuthorization>(dataExplorer)
});
-const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = getSortColumn<ApiClientAuthorization>(dataExplorer);
- const order = new OrderBuilder<ApiClientAuthorization>();
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- return order
- .addOrder(sortDirection, sortColumn.sort.field)
- .getOrder();
- } else {
- return order.getOrder();
- }
-};
-
export const setItems = (listResults: ListResults<ApiClientAuthorization>) =>
apiClientAuthorizationsActions.SET_ITEMS({
...listResultsToDataExplorerItemsMeta(listResults),
diff --git a/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts b/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
index 390292a9..18023aff 100644
--- a/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
+++ b/src/store/collections-content-address-panel/collections-content-address-middleware-service.ts
@@ -4,16 +4,13 @@
import { ServiceRepository } from 'services/services';
import { MiddlewareAPI, Dispatch } from 'redux';
-import { DataExplorerMiddlewareService } from 'store/data-explorer/data-explorer-middleware-service';
+import { DataExplorerMiddlewareService, getOrder } from 'store/data-explorer/data-explorer-middleware-service';
import { RootState } from 'store/store';
import { getUserUuid } from "common/getuser";
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
-import { DataExplorer, getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
+import { getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
import { resourcesActions } from 'store/resources/resources-actions';
import { FilterBuilder } from 'services/api/filter-builder';
-import { SortDirection } from 'components/data-table/data-column';
-import { OrderDirection, OrderBuilder } from 'services/api/order-builder';
-import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions';
import { collectionsContentAddressActions } from './collections-content-address-panel-actions';
import { navigateTo } from 'store/navigation/navigation-action';
@@ -48,7 +45,7 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl
.addILike("name", dataExplorer.searchValue)
.getFilters(),
includeOldVersions: true,
- order: getOrder(dataExplorer)
+ order: getOrder<CollectionResource>(dataExplorer)
});
const userUuids = response.items.map(it => {
if (extractUuidKind(it.ownerUuid) === ResourceKind.USER) {
@@ -118,22 +115,6 @@ export class CollectionsWithSameContentAddressMiddlewareService extends DataExpl
}
}
-const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = getSortColumn<CollectionResource>(dataExplorer);
- const order = new OrderBuilder<CollectionResource>();
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- return order
- .addOrder(sortDirection, sortColumn.sort.field)
- .getOrder();
- } else {
- return order.getOrder();
- }
-};
-
const collectionPanelDataExplorerIsNotSet = () =>
snackbarActions.OPEN_SNACKBAR({
message: 'Collection panel is not ready.',
diff --git a/src/store/data-explorer/data-explorer-middleware-service.ts b/src/store/data-explorer/data-explorer-middleware-service.ts
index 347c7331..01964fa4 100644
--- a/src/store/data-explorer/data-explorer-middleware-service.ts
+++ b/src/store/data-explorer/data-explorer-middleware-service.ts
@@ -5,10 +5,13 @@
import { Dispatch, MiddlewareAPI } from 'redux';
import { RootState } from '../store';
import { DataColumns } from 'components/data-table/data-table';
-import { DataExplorer } from './data-explorer-reducer';
+import { DataExplorer, getSortColumn } from './data-explorer-reducer';
import { ListResults } from 'services/common-service/common-service';
import { createTree } from 'models/tree';
import { DataTableFilters } from 'components/data-table-filters/data-table-filters-tree';
+import { OrderBuilder, OrderDirection } from 'services/api/order-builder';
+import { SortDirection } from 'components/data-table/data-column';
+import { Resource } from 'models/resource';
export abstract class DataExplorerMiddlewareService {
protected readonly id: string;
@@ -47,6 +50,22 @@ export const dataExplorerToListParams = (dataExplorer: DataExplorer) => ({
offset: dataExplorer.page * dataExplorer.rowsPerPage,
});
+export const getOrder = <T extends Resource = Resource>(dataExplorer: DataExplorer) => {
+ const sortColumn = getSortColumn<T>(dataExplorer);
+ const order = new OrderBuilder<T>();
+ if (sortColumn && sortColumn.sort) {
+ const sortDirection = sortColumn.sort.direction === SortDirection.ASC
+ ? OrderDirection.ASC
+ : OrderDirection.DESC;
+
+ return order
+ .addOrder(sortDirection, sortColumn.sort.field)
+ .getOrder();
+ } else {
+ return order.getOrder();
+ }
+};
+
export const listResultsToDataExplorerItemsMeta = <R>({
itemsAvailable,
offset,
diff --git a/src/store/link-panel/link-panel-middleware-service.ts b/src/store/link-panel/link-panel-middleware-service.ts
index cce313fb..87bcba0c 100644
--- a/src/store/link-panel/link-panel-middleware-service.ts
+++ b/src/store/link-panel/link-panel-middleware-service.ts
@@ -4,15 +4,12 @@
import { ServiceRepository } from 'services/services';
import { MiddlewareAPI, Dispatch } from 'redux';
-import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from 'store/data-explorer/data-explorer-middleware-service';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, getOrder, listResultsToDataExplorerItemsMeta } from 'store/data-explorer/data-explorer-middleware-service';
import { RootState } from 'store/store';
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
import { DataExplorer, getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
import { updateResources } from 'store/resources/resources-actions';
-import { SortDirection } from 'components/data-table/data-column';
-import { OrderDirection, OrderBuilder } from 'services/api/order-builder';
import { ListResults } from 'services/common-service/common-service';
-import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
import { LinkResource } from 'models/link';
import { linkPanelActions } from 'store/link-panel/link-panel-actions';
@@ -36,25 +33,9 @@ export class LinkMiddlewareService extends DataExplorerMiddlewareService {
export const getParams = (dataExplorer: DataExplorer) => ({
...dataExplorerToListParams(dataExplorer),
- order: getOrder(dataExplorer)
+ order: getOrder<LinkResource>(dataExplorer)
});
-const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = getSortColumn<LinkResource>(dataExplorer);
- const order = new OrderBuilder<LinkResource>();
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- return order
- .addOrder(sortDirection, sortColumn.sort.field)
- .getOrder();
- } else {
- return order.getOrder();
- }
-};
-
export const setItems = (listResults: ListResults<LinkResource>) =>
linkPanelActions.SET_ITEMS({
...listResultsToDataExplorerItemsMeta(listResults),
diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index 72c5f811..cc8511a4 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -136,7 +136,7 @@ export const getFilters = (dataExplorer: DataExplorer) => {
);
};
-export const getOrder = (dataExplorer: DataExplorer) => {
+const getOrder = (dataExplorer: DataExplorer) => {
const sortColumn = getSortColumn<ProjectResource>(dataExplorer);
const order = new OrderBuilder<ProjectResource>();
if (sortColumn && sortColumn.sort) {
diff --git a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
index 2f84fdc8..a4197870 100644
--- a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
+++ b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts
@@ -57,7 +57,7 @@ export const getParams = (dataExplorer: DataExplorer) => ({
filters: getFilters(dataExplorer),
});
-export const getOrder = (dataExplorer: DataExplorer) => {
+const getOrder = (dataExplorer: DataExplorer) => {
const sortColumn = getSortColumn<ProjectResource>(dataExplorer);
const order = new OrderBuilder<ProjectResource>();
if (sortColumn && sortColumn.sort) {
diff --git a/src/store/subprocess-panel/subprocess-panel-middleware-service.ts b/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
index 283f04f8..986c6ebd 100644
--- a/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
+++ b/src/store/subprocess-panel/subprocess-panel-middleware-service.ts
@@ -5,16 +5,13 @@
import { ServiceRepository } from 'services/services';
import { MiddlewareAPI, Dispatch } from 'redux';
import {
- DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta, getDataExplorerColumnFilters
+ DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta, getDataExplorerColumnFilters, getOrder
} from 'store/data-explorer/data-explorer-middleware-service';
import { RootState } from 'store/store';
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
import { DataExplorer, getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
import { updateResources } from 'store/resources/resources-actions';
-import { SortDirection } from 'components/data-table/data-column';
-import { OrderDirection, OrderBuilder } from 'services/api/order-builder';
import { ListResults } from 'services/common-service/common-service';
-import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
import { ProcessResource } from 'models/process';
import { FilterBuilder, joinFilters } from 'services/api/filter-builder';
import { subprocessPanelActions } from './subprocess-panel-actions';
@@ -61,26 +58,10 @@ export const getParams = (
dataExplorer: DataExplorer,
parentContainerRequest: ContainerRequestResource) => ({
...dataExplorerToListParams(dataExplorer),
- order: getOrder(dataExplorer),
+ order: getOrder<ProcessResource>(dataExplorer),
filters: getFilters(dataExplorer, parentContainerRequest)
});
-const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = getSortColumn<ProcessResource>(dataExplorer);
- const order = new OrderBuilder<ProcessResource>();
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- return order
- .addOrder(sortDirection, sortColumn.sort.field)
- .getOrder();
- } else {
- return order.getOrder();
- }
-};
-
export const getFilters = (
dataExplorer: DataExplorer,
parentContainerRequest: ContainerRequestResource) => {
diff --git a/src/store/trash-panel/trash-panel-middleware-service.ts b/src/store/trash-panel/trash-panel-middleware-service.ts
index 779963af..bed3e628 100644
--- a/src/store/trash-panel/trash-panel-middleware-service.ts
+++ b/src/store/trash-panel/trash-panel-middleware-service.ts
@@ -22,7 +22,7 @@ import { updatePublicFavorites } from 'store/public-favorites/public-favorites-a
import { snackbarActions, SnackbarKind } from "store/snackbar/snackbar-actions";
import { updateResources } from "store/resources/resources-actions";
import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions";
-import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
+import { DataExplorer, getSortColumn } from "store/data-explorer/data-explorer-reducer";
import { serializeResourceTypeFilters } from 'store//resource-type-filters/resource-type-filters';
import { getDataExplorerColumnFilters } from 'store/data-explorer/data-explorer-middleware-service';
import { joinFilters } from 'services/api/filter-builder';
@@ -36,7 +36,6 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
async requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
const dataExplorer = api.getState().dataExplorer[this.getId()];
const columns = dataExplorer.columns as DataColumns<string, CollectionResource>;
- const sortColumn = getSortColumn<GroupContentsResource>(dataExplorer);
const typeFilters = serializeResourceTypeFilters(getDataExplorerColumnFilters(columns, ProjectPanelColumnNames.TYPE));
@@ -52,18 +51,6 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
otherFilters,
);
- const order = new OrderBuilder<GroupContentsResource>();
-
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- order
- .addOrder(sortDirection, sortColumn.sort.field, GroupContentsResourcePrefix.COLLECTION)
- .addOrder(sortDirection, sortColumn.sort.field, GroupContentsResourcePrefix.PROJECT);
- }
-
const userUuid = getUserUuid(api.getState());
if (!userUuid) { return; }
try {
@@ -71,7 +58,7 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
const listResults = await this.services.groupsService
.contents(userUuid, {
...dataExplorerToListParams(dataExplorer),
- order: order.getOrder(),
+ order: getOrder(dataExplorer),
filters,
recursive: true,
includeTrash: true
@@ -100,6 +87,23 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
}
}
+const getOrder = (dataExplorer: DataExplorer) => {
+ const sortColumn = getSortColumn<GroupContentsResource>(dataExplorer);
+ const order = new OrderBuilder<GroupContentsResource>();
+ if (sortColumn && sortColumn.sort) {
+ const sortDirection = sortColumn.sort.direction === SortDirection.ASC
+ ? OrderDirection.ASC
+ : OrderDirection.DESC;
+
+ return order
+ .addOrder(sortDirection, sortColumn.sort.field, GroupContentsResourcePrefix.COLLECTION)
+ .addOrder(sortDirection, sortColumn.sort.field, GroupContentsResourcePrefix.PROJECT)
+ .getOrder();
+ } else {
+ return order.getOrder();
+ }
+};
+
const couldNotFetchTrashContents = () =>
snackbarActions.OPEN_SNACKBAR({
message: 'Could not fetch trash contents.',
diff --git a/src/store/users/user-panel-middleware-service.ts b/src/store/users/user-panel-middleware-service.ts
index b062401c..e965cd00 100644
--- a/src/store/users/user-panel-middleware-service.ts
+++ b/src/store/users/user-panel-middleware-service.ts
@@ -56,7 +56,7 @@ const getParams = (dataExplorer: DataExplorer) => ({
.getFilters()
});
-export const getOrder = (dataExplorer: DataExplorer) => {
+const getOrder = (dataExplorer: DataExplorer) => {
const sortColumn = getSortColumn<UserResource>(dataExplorer);
const order = new OrderBuilder<UserResource>();
if (sortColumn && sortColumn.sort) {
diff --git a/src/store/workflow-panel/workflow-middleware-service.ts b/src/store/workflow-panel/workflow-middleware-service.ts
index 14c80fe1..587f0224 100644
--- a/src/store/workflow-panel/workflow-middleware-service.ts
+++ b/src/store/workflow-panel/workflow-middleware-service.ts
@@ -4,18 +4,15 @@
import { ServiceRepository } from 'services/services';
import { MiddlewareAPI, Dispatch } from 'redux';
-import { DataExplorerMiddlewareService, dataExplorerToListParams, listResultsToDataExplorerItemsMeta } from 'store/data-explorer/data-explorer-middleware-service';
+import { DataExplorerMiddlewareService, dataExplorerToListParams, getOrder, listResultsToDataExplorerItemsMeta } from 'store/data-explorer/data-explorer-middleware-service';
import { RootState } from 'store/store';
import { snackbarActions, SnackbarKind } from 'store/snackbar/snackbar-actions';
import { DataExplorer, getDataExplorer } from 'store/data-explorer/data-explorer-reducer';
import { updateResources } from 'store/resources/resources-actions';
import { FilterBuilder } from 'services/api/filter-builder';
-import { SortDirection } from 'components/data-table/data-column';
-import { OrderDirection, OrderBuilder } from 'services/api/order-builder';
import { WorkflowResource } from 'models/workflow';
import { ListResults } from 'services/common-service/common-service';
import { workflowPanelActions } from 'store/workflow-panel/workflow-panel-actions';
-import { getSortColumn } from "store/data-explorer/data-explorer-reducer";
export class WorkflowMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -37,7 +34,7 @@ export class WorkflowMiddlewareService extends DataExplorerMiddlewareService {
export const getParams = (dataExplorer: DataExplorer) => ({
...dataExplorerToListParams(dataExplorer),
- order: getOrder(dataExplorer),
+ order: getOrder<WorkflowResource>(dataExplorer),
filters: getFilters(dataExplorer)
});
@@ -48,22 +45,6 @@ export const getFilters = (dataExplorer: DataExplorer) => {
return filters;
};
-export const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = getSortColumn<WorkflowResource>(dataExplorer);
- const order = new OrderBuilder<WorkflowResource>();
- if (sortColumn && sortColumn.sort) {
- const sortDirection = sortColumn.sort.direction === SortDirection.ASC
- ? OrderDirection.ASC
- : OrderDirection.DESC;
-
- return order
- .addOrder(sortDirection, sortColumn.sort.field)
- .getOrder();
- } else {
- return order.getOrder();
- }
-};
-
export const setItems = (listResults: ListResults<WorkflowResource>) =>
workflowPanelActions.SET_ITEMS({
...listResultsToDataExplorerItemsMeta(listResults),
diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx
index a74da762..2392d6fd 100644
--- a/src/views/favorite-panel/favorite-panel.tsx
+++ b/src/views/favorite-panel/favorite-panel.tsx
@@ -72,7 +72,6 @@ export const favoritePanelColumns: DataColumns<string, GroupContentsResource> =
name: FavoritePanelColumnNames.NAME,
selected: true,
configurable: true,
- // sort: {direction: SortDirection.NONE, field: "name"},
filters: createTree(),
render: uuid => <ResourceName uuid={uuid} />
},
@@ -108,7 +107,6 @@ export const favoritePanelColumns: DataColumns<string, GroupContentsResource> =
name: FavoritePanelColumnNames.LAST_MODIFIED,
selected: true,
configurable: true,
- // sort: {direction: SortDirection.DESC, field: "modifiedAt"},
filters: createTree(),
render: uuid => <ResourceLastModifiedDate uuid={uuid} />
}
diff --git a/src/views/public-favorites-panel/public-favorites-panel.tsx b/src/views/public-favorites-panel/public-favorites-panel.tsx
index 0aa0e9fd..47c8aede 100644
--- a/src/views/public-favorites-panel/public-favorites-panel.tsx
+++ b/src/views/public-favorites-panel/public-favorites-panel.tsx
@@ -70,7 +70,6 @@ export const publicFavoritePanelColumns: DataColumns<string, GroupContentsResour
name: PublicFavoritePanelColumnNames.NAME,
selected: true,
configurable: true,
- // sort: {direction: SortDirection.NONE, field: "name"},
filters: createTree(),
render: uuid => <ResourceName uuid={uuid} />
},
@@ -106,7 +105,6 @@ export const publicFavoritePanelColumns: DataColumns<string, GroupContentsResour
name: PublicFavoritePanelColumnNames.LAST_MODIFIED,
selected: true,
configurable: true,
- // sort: {direction: SortDirection.DESC, field: "modifiedAt"},
filters: createTree(),
render: uuid => <ResourceLastModifiedDate uuid={uuid} />
}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list