[ARVADOS-WORKBENCH2] updated: 1.2.0-824-g60df705
Git user
git at public.curoverse.com
Tue Nov 13 06:45:17 EST 2018
Summary of changes:
src/store/data-explorer/data-explorer-reducer.ts | 5 ++++-
src/store/favorite-panel/favorite-panel-middleware-service.ts | 3 ++-
src/store/project-panel/project-panel-middleware-service.ts | 3 ++-
src/store/search-results-panel/search-results-middleware-service.ts | 3 ++-
src/store/shared-with-me-panel/shared-with-me-middleware-service.ts | 3 ++-
src/store/trash-panel/trash-panel-middleware-service.ts | 3 ++-
src/store/workflow-panel/workflow-middleware-service.ts | 3 ++-
7 files changed, 16 insertions(+), 7 deletions(-)
via 60df7056b536f7a333299638ca19bc12aee94d47 (commit)
from 853d8c61628e6c948406aa7ad4b9c4a6e11ef25a (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 60df7056b536f7a333299638ca19bc12aee94d47
Author: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>
Date: Tue Nov 13 12:45:08 2018 +0100
Move sorting function to separate function
Feature #14421
Arvados-DCO-1.1-Signed-off-by: Pawel Kromplewski <pawel.kromplewski at contractors.roche.com>
diff --git a/src/store/data-explorer/data-explorer-reducer.ts b/src/store/data-explorer/data-explorer-reducer.ts
index 141d1a9..d3a4389 100644
--- a/src/store/data-explorer/data-explorer-reducer.ts
+++ b/src/store/data-explorer/data-explorer-reducer.ts
@@ -2,7 +2,7 @@
//
// SPDX-License-Identifier: AGPL-3.0
-import { DataColumn, toggleSortDirection, resetSortDirection } from "~/components/data-table/data-column";
+import { DataColumn, toggleSortDirection, resetSortDirection, SortDirection } from "~/components/data-table/data-column";
import { dataExplorerActions, DataExplorerAction } from "./data-explorer-action";
import { DataTableFilterItem } from "~/components/data-table-filters/data-table-filters";
import { DataColumns } from "~/components/data-table/data-table";
@@ -65,6 +65,9 @@ export const dataExplorerReducer = (state: DataExplorerState = {}, action: DataE
export const getDataExplorer = (state: DataExplorerState, id: string) =>
state[id] || initialDataExplorer;
+export const getSortColumns = (dataExplorer: DataExplorer) => dataExplorer.columns.find((c: any) =>
+ !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+
const update = (state: DataExplorerState, id: string, updateFn: (dataExplorer: DataExplorer) => DataExplorer) =>
({ ...state, [id]: updateFn(getDataExplorer(state, id)) });
diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts
index 76b65de..6a83a20 100644
--- a/src/store/favorite-panel/favorite-panel-middleware-service.ts
+++ b/src/store/favorite-panel/favorite-panel-middleware-service.ts
@@ -20,6 +20,7 @@ import { snackbarActions, SnackbarKind } from '~/store/snackbar/snackbar-actions
import { progressIndicatorActions } from '~/store/progress-indicator/progress-indicator-actions.ts';
import { getDataExplorer } from "~/store/data-explorer/data-explorer-reducer";
import { loadMissingProcessesInformation } from "~/store/project-panel/project-panel-middleware-service";
+import { getSortColumns } from "~/store/data-explorer/data-explorer-reducer";
export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -32,7 +33,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
api.dispatch(favoritesPanelDataExplorerIsNotSet());
} else {
const columns = dataExplorer.columns as DataColumns<string, FavoritePanelFilter>;
- const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+ const sortColumn = getSortColumns(dataExplorer);
const typeFilters = this.getColumnFilters(columns, FavoritePanelColumnNames.TYPE);
const linkOrder = new OrderBuilder<LinkResource>();
diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index c34045a..14e7f80 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -31,6 +31,7 @@ import { ResourceKind } from '~/models/resource';
import { getResource } from "~/store/resources/resources";
import { CollectionResource } from "~/models/collection";
import { resourcesDataActions } from "~/store/resources-data/resources-data-actions";
+import { getSortColumns } from "~/store/data-explorer/data-explorer-reducer";
export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -126,7 +127,7 @@ export const getFilters = (dataExplorer: DataExplorer) => {
};
export const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+ const sortColumn = getSortColumns(dataExplorer);
const order = new OrderBuilder<ProjectResource>();
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 d64ebd0..1300ffb 100644
--- a/src/store/search-results-panel/search-results-middleware-service.ts
+++ b/src/store/search-results-panel/search-results-middleware-service.ts
@@ -16,6 +16,7 @@ import { GroupContentsResource, GroupContentsResourcePrefix } from "~/services/g
import { ListResults } from '~/services/common-service/common-resource-service';
import { searchResultsPanelActions } from '~/store/search-results-panel/search-results-panel-actions';
import { getFilters } from '~/store/search-bar/search-bar-actions';
+import { getSortColumns } from "~/store/data-explorer/data-explorer-reducer";
export class SearchResultsMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -44,7 +45,7 @@ export const getParams = (dataExplorer: DataExplorer, searchValue: string) => ({
});
const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+ const sortColumn = getSortColumns(dataExplorer);
const order = new OrderBuilder<GroupContentsResource>();
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 ad9bbd9..1ad1a4d 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
@@ -19,6 +19,7 @@ import { OrderBuilder, OrderDirection } from '~/services/api/order-builder';
import { ProjectResource } from '~/models/project';
import { ProjectPanelColumnNames } from '~/views/project-panel/project-panel';
import { FilterBuilder } from '~/services/api/filter-builder';
+import { getSortColumns } from "~/store/data-explorer/data-explorer-reducer";
export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -59,7 +60,7 @@ export const getFilters = (dataExplorer: DataExplorer) => {
};
export const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+ const sortColumn = getSortColumns(dataExplorer);
const order = new OrderBuilder<ProjectResource>();
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 5166f61..fba4adf 100644
--- a/src/store/trash-panel/trash-panel-middleware-service.ts
+++ b/src/store/trash-panel/trash-panel-middleware-service.ts
@@ -22,6 +22,7 @@ import { updateFavorites } from "~/store/favorites/favorites-actions";
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 { getSortColumns } from "~/store/data-explorer/data-explorer-reducer";
export class TrashPanelMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -31,7 +32,7 @@ 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, TrashPanelFilter>;
- const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+ const sortColumn = getSortColumns(dataExplorer);
const typeFilters = this.getColumnFilters(columns, TrashPanelColumnNames.TYPE);
const order = new OrderBuilder<ProjectResource>();
diff --git a/src/store/workflow-panel/workflow-middleware-service.ts b/src/store/workflow-panel/workflow-middleware-service.ts
index 0aa1d51..687700f 100644
--- a/src/store/workflow-panel/workflow-middleware-service.ts
+++ b/src/store/workflow-panel/workflow-middleware-service.ts
@@ -16,6 +16,7 @@ import { OrderDirection, OrderBuilder } from '~/services/api/order-builder';
import { WorkflowResource } from '~/models/workflow';
import { ListResults } from '~/services/common-service/common-resource-service';
import { workflowPanelActions } from './workflow-panel-actions';
+import { getSortColumns } from "~/store/data-explorer/data-explorer-reducer";
export class WorkflowMiddlewareService extends DataExplorerMiddlewareService {
constructor(private services: ServiceRepository, id: string) {
@@ -49,7 +50,7 @@ export const getFilters = (dataExplorer: DataExplorer) => {
};
export const getOrder = (dataExplorer: DataExplorer) => {
- const sortColumn = dataExplorer.columns.find(c => !!c.sortDirection && c.sortDirection !== SortDirection.NONE);
+ const sortColumn = getSortColumns(dataExplorer);
const order = new OrderBuilder<WorkflowResource>();
if (sortColumn) {
const sortDirection = sortColumn && sortColumn.sortDirection === SortDirection.ASC
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list