From 853d8c61628e6c948406aa7ad4b9c4a6e11ef25a Mon Sep 17 00:00:00 2001 From: Pawel Kromplewski Date: Mon, 12 Nov 2018 14:27:50 +0100 Subject: [PATCH] Fix order in tables after filtering Feature #14421 Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski --- src/store/favorite-panel/favorite-panel-middleware-service.ts | 2 +- src/store/project-panel/project-panel-middleware-service.ts | 2 +- .../search-results-panel/search-results-middleware-service.ts | 2 +- .../shared-with-me-panel/shared-with-me-middleware-service.ts | 2 +- src/store/trash-panel/trash-panel-middleware-service.ts | 2 +- src/store/workflow-panel/workflow-middleware-service.ts | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts index acdc12b4d3..76b65de2aa 100644 --- a/src/store/favorite-panel/favorite-panel-middleware-service.ts +++ b/src/store/favorite-panel/favorite-panel-middleware-service.ts @@ -32,7 +32,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic api.dispatch(favoritesPanelDataExplorerIsNotSet()); } else { const columns = dataExplorer.columns as DataColumns; - const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE); + const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE); const typeFilters = this.getColumnFilters(columns, FavoritePanelColumnNames.TYPE); const linkOrder = new OrderBuilder(); diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts index a641b31847..c34045aa74 100644 --- a/src/store/project-panel/project-panel-middleware-service.ts +++ b/src/store/project-panel/project-panel-middleware-service.ts @@ -126,7 +126,7 @@ export const getFilters = (dataExplorer: DataExplorer) => { }; export const getOrder = (dataExplorer: DataExplorer) => { - const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE); + const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE); const order = new OrderBuilder(); if (sortColumn) { const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC diff --git a/src/store/search-results-panel/search-results-middleware-service.ts b/src/store/search-results-panel/search-results-middleware-service.ts index e8097e9838..d64ebd01f9 100644 --- a/src/store/search-results-panel/search-results-middleware-service.ts +++ b/src/store/search-results-panel/search-results-middleware-service.ts @@ -44,7 +44,7 @@ export const getParams = (dataExplorer: DataExplorer, searchValue: string) => ({ }); const getOrder = (dataExplorer: DataExplorer) => { - const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE); + const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE); const order = new OrderBuilder(); if (sortColumn) { const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC 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 5ec3ae7e2b..ad9bbd939d 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 @@ -59,7 +59,7 @@ export const getFilters = (dataExplorer: DataExplorer) => { }; export const getOrder = (dataExplorer: DataExplorer) => { - const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE); + const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE); const order = new OrderBuilder(); if (sortColumn) { const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC diff --git a/src/store/trash-panel/trash-panel-middleware-service.ts b/src/store/trash-panel/trash-panel-middleware-service.ts index 90838b207a..5166f61920 100644 --- a/src/store/trash-panel/trash-panel-middleware-service.ts +++ b/src/store/trash-panel/trash-panel-middleware-service.ts @@ -31,7 +31,7 @@ export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService { async requestItems(api: MiddlewareAPI) { const dataExplorer = api.getState().dataExplorer[this.getId()]; const columns = dataExplorer.columns as DataColumns; - const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE); + const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE); const typeFilters = this.getColumnFilters(columns, TrashPanelColumnNames.TYPE); const order = new OrderBuilder(); diff --git a/src/store/workflow-panel/workflow-middleware-service.ts b/src/store/workflow-panel/workflow-middleware-service.ts index 1002979a05..0aa1d51513 100644 --- a/src/store/workflow-panel/workflow-middleware-service.ts +++ b/src/store/workflow-panel/workflow-middleware-service.ts @@ -49,7 +49,7 @@ export const getFilters = (dataExplorer: DataExplorer) => { }; export const getOrder = (dataExplorer: DataExplorer) => { - const sortColumn = dataExplorer.columns.find(c => c.sortDirection !== SortDirection.NONE); + const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE); const order = new OrderBuilder(); if (sortColumn) { const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC -- 2.30.2