[ARVADOS-WORKBENCH2] updated: 1.1.4-454-g5b38ed2
Git user
git at public.curoverse.com
Wed Aug 1 02:55:19 EDT 2018
Summary of changes:
.../data-explorer-middleware-service.ts | 2 -
.../data-explorer/data-explorer-middleware.ts | 14 +++---
.../favorite-panel-middleware-service.ts | 6 +--
.../project-panel-middleware-service.ts | 6 +--
.../data-explorer/data-explorer.tsx | 51 ++++++++++++----------
src/views/favorite-panel/favorite-panel.tsx | 1 +
src/views/project-panel/project-panel.tsx | 1 +
7 files changed, 38 insertions(+), 43 deletions(-)
via 5b38ed263a3efd88a215c0911dc969303001645c (commit)
from aa45c97670b9726e7afe66c3e747ccab4b82fa6d (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 5b38ed263a3efd88a215c0911dc969303001645c
Author: Daniel Kos <daniel.kos at contractors.roche.com>
Date: Wed Aug 1 08:54:56 2018 +0200
Move columns definition out of middleware scope
Feature #13887
Arvados-DCO-1.1-Signed-off-by: Daniel Kos <daniel.kos at contractors.roche.com>
diff --git a/src/store/data-explorer/data-explorer-middleware-service.ts b/src/store/data-explorer/data-explorer-middleware-service.ts
index e47824c..14be4ea 100644
--- a/src/store/data-explorer/data-explorer-middleware-service.ts
+++ b/src/store/data-explorer/data-explorer-middleware-service.ts
@@ -3,7 +3,6 @@
// SPDX-License-Identifier: AGPL-3.0
import { Dispatch, MiddlewareAPI } from "redux";
-import { DataColumns } from "../../components/data-table/data-table";
import { RootState } from "../store";
export abstract class DataExplorerMiddlewareService {
@@ -17,6 +16,5 @@ export abstract class DataExplorerMiddlewareService {
return this.id;
}
- abstract getColumns(): DataColumns<any>;
abstract requestItems(api: MiddlewareAPI<Dispatch, RootState>): void;
}
diff --git a/src/store/data-explorer/data-explorer-middleware.ts b/src/store/data-explorer/data-explorer-middleware.ts
index c4ea4e5..146867c 100644
--- a/src/store/data-explorer/data-explorer-middleware.ts
+++ b/src/store/data-explorer/data-explorer-middleware.ts
@@ -8,17 +8,15 @@ import { dataExplorerActions, bindDataExplorerActions } from "./data-explorer-ac
import { DataExplorerMiddlewareService } from "./data-explorer-middleware-service";
export const dataExplorerMiddleware = (service: DataExplorerMiddlewareService): Middleware => api => next => {
+ const handleAction = <T extends { id: string }>(handler: (data: T) => void) =>
+ (data: T) => {
+ if (data.id === service.getId()) {
+ handler(data);
+ }
+ };
const actions = bindDataExplorerActions(service.getId());
- next(actions.SET_COLUMNS({ columns: service.getColumns() }));
return action => {
- const handleAction = <T extends { id: string }>(handler: (data: T) => void) =>
- (data: T) => {
- next(action);
- if (data.id === service.getId()) {
- handler(data);
- }
- };
dataExplorerActions.match(action, {
SET_PAGE: handleAction(() => {
api.dispatch(actions.REQUEST_ITEMS());
diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts
index 7df86d9..8908fff 100644
--- a/src/store/favorite-panel/favorite-panel-middleware-service.ts
+++ b/src/store/favorite-panel/favorite-panel-middleware-service.ts
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import { DataExplorerMiddlewareService } from "../data-explorer/data-explorer-middleware-service";
-import { columns, FavoritePanelFilter, FavoritePanelColumnNames } from "../../views/favorite-panel/favorite-panel";
+import { FavoritePanelFilter, FavoritePanelColumnNames } from "../../views/favorite-panel/favorite-panel";
import { RootState } from "../store";
import { DataColumns } from "../../components/data-table/data-table";
import { FavoritePanelItem, resourceToDataItem } from "../../views/favorite-panel/favorite-panel-item";
@@ -21,10 +21,6 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
super(id);
}
- getColumns() {
- return columns;
- }
-
requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
const dataExplorer = api.getState().dataExplorer[this.getId()];
const columns = dataExplorer.columns as DataColumns<FavoritePanelItem, FavoritePanelFilter>;
diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index 626b926..761ec18 100644
--- a/src/store/project-panel/project-panel-middleware-service.ts
+++ b/src/store/project-panel/project-panel-middleware-service.ts
@@ -3,7 +3,7 @@
// SPDX-License-Identifier: AGPL-3.0
import { DataExplorerMiddlewareService } from "../data-explorer/data-explorer-middleware-service";
-import { columns, ProjectPanelColumnNames, ProjectPanelFilter } from "../../views/project-panel/project-panel";
+import { ProjectPanelColumnNames, ProjectPanelFilter } from "../../views/project-panel/project-panel";
import { RootState } from "../store";
import { DataColumns } from "../../components/data-table/data-table";
import { groupsService } from "../../services/services";
@@ -22,10 +22,6 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
super(id);
}
- getColumns() {
- return columns;
- }
-
requestItems(api: MiddlewareAPI<Dispatch, RootState>) {
const state = api.getState();
const dataExplorer = state.dataExplorer[this.getId()];
diff --git a/src/views-components/data-explorer/data-explorer.tsx b/src/views-components/data-explorer/data-explorer.tsx
index 2645504..6449bf8 100644
--- a/src/views-components/data-explorer/data-explorer.tsx
+++ b/src/views-components/data-explorer/data-explorer.tsx
@@ -10,9 +10,11 @@ import { Dispatch } from "redux";
import { dataExplorerActions } from "../../store/data-explorer/data-explorer-action";
import { DataColumn } from "../../components/data-table/data-column";
import { DataTableFilterItem } from "../../components/data-table-filters/data-table-filters";
+import { DataColumns } from "../../components/data-table/data-table";
interface Props {
id: string;
+ columns: DataColumns<any>;
onRowClick: (item: any) => void;
onContextMenu: (event: React.MouseEvent<HTMLElement>, item: any) => void;
onRowDoubleClick: (item: any) => void;
@@ -22,37 +24,40 @@ interface Props {
const mapStateToProps = (state: RootState, { id }: Props) =>
getDataExplorer(state.dataExplorer, id);
-const mapDispatchToProps = (dispatch: Dispatch, { id, onRowClick, onRowDoubleClick, onContextMenu }: Props) => ({
- onSearch: (searchValue: string) => {
- dispatch(dataExplorerActions.SET_SEARCH_VALUE({ id, searchValue }));
- },
+const mapDispatchToProps = (dispatch: Dispatch, { id, columns, onRowClick, onRowDoubleClick, onContextMenu }: Props) => {
+ dispatch(dataExplorerActions.SET_COLUMNS({ id, columns }));
+ return {
+ onSearch: (searchValue: string) => {
+ dispatch(dataExplorerActions.SET_SEARCH_VALUE({ id, searchValue }));
+ },
- onColumnToggle: (column: DataColumn<any>) => {
- dispatch(dataExplorerActions.TOGGLE_COLUMN({ id, columnName: column.name }));
- },
+ onColumnToggle: (column: DataColumn<any>) => {
+ dispatch(dataExplorerActions.TOGGLE_COLUMN({ id, columnName: column.name }));
+ },
- onSortToggle: (column: DataColumn<any>) => {
- dispatch(dataExplorerActions.TOGGLE_SORT({ id, columnName: column.name }));
- },
+ onSortToggle: (column: DataColumn<any>) => {
+ dispatch(dataExplorerActions.TOGGLE_SORT({ id, columnName: column.name }));
+ },
- onFiltersChange: (filters: DataTableFilterItem[], column: DataColumn<any>) => {
- dispatch(dataExplorerActions.SET_FILTERS({ id, columnName: column.name, filters }));
- },
+ onFiltersChange: (filters: DataTableFilterItem[], column: DataColumn<any>) => {
+ dispatch(dataExplorerActions.SET_FILTERS({ id, columnName: column.name, filters }));
+ },
- onChangePage: (page: number) => {
- dispatch(dataExplorerActions.SET_PAGE({ id, page }));
- },
+ onChangePage: (page: number) => {
+ dispatch(dataExplorerActions.SET_PAGE({ id, page }));
+ },
- onChangeRowsPerPage: (rowsPerPage: number) => {
- dispatch(dataExplorerActions.SET_ROWS_PER_PAGE({ id, rowsPerPage }));
- },
+ onChangeRowsPerPage: (rowsPerPage: number) => {
+ dispatch(dataExplorerActions.SET_ROWS_PER_PAGE({ id, rowsPerPage }));
+ },
- onRowClick,
+ onRowClick,
- onRowDoubleClick,
+ onRowDoubleClick,
- onContextMenu,
-});
+ onContextMenu,
+ };
+};
export const DataExplorer = connect(mapStateToProps, mapDispatchToProps)(DataExplorerComponent);
diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx
index 92d8c39..f99afec 100644
--- a/src/views/favorite-panel/favorite-panel.tsx
+++ b/src/views/favorite-panel/favorite-panel.tsx
@@ -146,6 +146,7 @@ export const FavoritePanel = withStyles(styles)(
render() {
return <DataExplorer
id={FAVORITE_PANEL_ID}
+ columns={columns}
onRowClick={this.props.onItemClick}
onRowDoubleClick={this.props.onItemDoubleClick}
onContextMenu={this.props.onContextMenu}
diff --git a/src/views/project-panel/project-panel.tsx b/src/views/project-panel/project-panel.tsx
index d48890b..b6985a9 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -159,6 +159,7 @@ export const ProjectPanel = withStyles(styles)(
</div>
<DataExplorer
id={PROJECT_PANEL_ID}
+ columns={columns}
onRowClick={this.props.onItemClick}
onRowDoubleClick={this.props.onItemDoubleClick}
onContextMenu={this.props.onContextMenu}
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list