From e00f9cc69e8e98679c4cb310ff1399c4f1abff71 Mon Sep 17 00:00:00 2001 From: Michal Klobukowski Date: Sun, 1 Jul 2018 22:38:12 +0200 Subject: [PATCH] Clean up the code according to code review Feature #13678 Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski --- .../data-explorer/data-explorer.tsx | 8 +++---- .../data-explorer/data-explorer-action.ts | 23 +++++++------------ 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx index de9cb45d..ff51c71c 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -63,9 +63,7 @@ class DataExplorer extends React.Component & WithStyles< this.props.onRowClick(item)} onRowContextMenu={this.openContextMenu} @@ -121,12 +119,12 @@ class DataExplorer extends React.Component & WithStyles< renderContextMenuTrigger = (item: T) => - this.openContextMenuWithTrigger(event, item)}> + this.openContextMenuTrigger(event, item)}> - openContextMenuWithTrigger = (event: React.MouseEvent, item: T) => { + openContextMenuTrigger = (event: React.MouseEvent, item: T) => { event.preventDefault(); this.setState({ contextMenu: { diff --git a/src/store/data-explorer/data-explorer-action.ts b/src/store/data-explorer/data-explorer-action.ts index c4ff6145..fd3a7afe 100644 --- a/src/store/data-explorer/data-explorer-action.ts +++ b/src/store/data-explorer/data-explorer-action.ts @@ -3,27 +3,20 @@ // SPDX-License-Identifier: AGPL-3.0 import { default as unionize, ofType, UnionOf } from "unionize"; -import { SortDirection, 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"; -type WithId = T & { id: string }; - const actions = unionize({ - SET_COLUMNS: ofType }>>(), - SET_FILTERS: ofType>(), - SET_ITEMS: ofType>(), - SET_PAGE: ofType>(), - SET_ROWS_PER_PAGE: ofType>(), - TOGGLE_COLUMN: ofType>(), - TOGGLE_SORT: ofType>(), - SET_SEARCH_VALUE: ofType>() + SET_COLUMNS: ofType<{id: string, columns: DataColumns }>(), + SET_FILTERS: ofType<{id: string,columnName: string, filters: DataTableFilterItem[]}>(), + SET_ITEMS: ofType<{id: string,items: any[]}>(), + SET_PAGE: ofType<{id: string,page: number}>(), + SET_ROWS_PER_PAGE: ofType<{id: string,rowsPerPage: number}>(), + TOGGLE_COLUMN: ofType<{id: string, columnName: string }>(), + TOGGLE_SORT: ofType<{id: string, columnName: string }>(), + SET_SEARCH_VALUE: ofType<{id: string,searchValue: string}>() }, { tag: "type", value: "payload" }); export type DataExplorerAction = UnionOf; export default actions; - - - - -- 2.30.2