[ARVADOS-WORKBENCH2] updated: 1.1.4-446-gffac6f1
Git user
git at public.curoverse.com
Thu Jul 26 06:58:41 EDT 2018
Summary of changes:
src/store/favorite-panel/favorite-panel-action.ts | 8 ++++++++
.../favorite-panel/favorite-panel-middleware-service.ts | 14 ++++++--------
src/store/navigation/navigation-action.ts | 7 +++----
src/store/project-panel/project-panel-action.ts | 8 ++++++++
.../project-panel/project-panel-middleware-service.ts | 14 ++++++--------
src/store/side-panel/side-panel-reducer.ts | 7 +++----
.../context-menu/action-sets/favorite-action-set.ts | 5 ++---
.../context-menu/action-sets/project-action-set.ts | 5 ++---
.../create-project-dialog/create-project-dialog.tsx | 5 ++---
src/views/favorite-panel/favorite-panel.tsx | 5 ++---
src/views/project-panel/project-panel.tsx | 5 ++---
src/views/workbench/workbench.tsx | 8 ++++----
12 files changed, 48 insertions(+), 43 deletions(-)
create mode 100644 src/store/favorite-panel/favorite-panel-action.ts
create mode 100644 src/store/project-panel/project-panel-action.ts
via ffac6f1051efb642db49c4c4a5d2f3f477ca6d34 (commit)
from 3eba091748f10f981d48f44eed14115b4fcee0ce (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 ffac6f1051efb642db49c4c4a5d2f3f477ca6d34
Author: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
Date: Thu Jul 26 12:58:00 2018 +0200
Create actions for panels using bindDataExplorerActions function, move panel identifiers to corresponding services
Feature #13887
Arvados-DCO-1.1-Signed-off-by: Michal Klobukowski <michal.klobukowski at contractors.roche.com>
diff --git a/src/store/favorite-panel/favorite-panel-action.ts b/src/store/favorite-panel/favorite-panel-action.ts
new file mode 100644
index 0000000..48dd19c
--- /dev/null
+++ b/src/store/favorite-panel/favorite-panel-action.ts
@@ -0,0 +1,8 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
+import { FavoritePanelMiddlewareService } from "./favorite-panel-middleware-service";
+
+export const favoritePanelActions = bindDataExplorerActions(FavoritePanelMiddlewareService.getInstance());
diff --git a/src/store/favorite-panel/favorite-panel-middleware-service.ts b/src/store/favorite-panel/favorite-panel-middleware-service.ts
index 3826c4b..89e78b2 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 { FAVORITE_PANEL_ID, columns, FavoritePanelFilter, FavoritePanelColumnNames } from "../../views/favorite-panel/favorite-panel";
+import { columns, FavoritePanelFilter, FavoritePanelColumnNames } from "../../views/favorite-panel/favorite-panel";
import { getDataExplorer } from "../data-explorer/data-explorer-reducer";
import { RootState } from "../store";
import { DataColumns } from "../../components/data-table/data-table";
@@ -13,8 +13,8 @@ import { favoriteService } from "../../services/services";
import { SortDirection } from "../../components/data-table/data-column";
import { FilterBuilder } from "../../common/api/filter-builder";
import { LinkResource } from "../../models/link";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
import { checkPresenceInFavorites } from "../favorites/favorites-actions";
+import { favoritePanelActions } from "./favorite-panel-action";
export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareService {
@@ -31,7 +31,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
}
get Id() {
- return FAVORITE_PANEL_ID;
+ return "favoritePanel";
}
get Columns() {
@@ -40,7 +40,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
requestItems() {
const state = this.api.getState() as RootState;
- const dataExplorer = getDataExplorer(state.dataExplorer, FAVORITE_PANEL_ID);
+ const dataExplorer = getDataExplorer(state.dataExplorer, this.Id);
const columns = dataExplorer.columns as DataColumns<FavoritePanelItem, FavoritePanelFilter>;
const sortColumn = dataExplorer.columns.find(({ sortDirection }) => Boolean(sortDirection && sortDirection !== "none"));
const typeFilters = getColumnFilters(columns, FavoritePanelColumnNames.TYPE);
@@ -61,8 +61,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
.addILike("name", dataExplorer.searchValue)
})
.then(response => {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: FAVORITE_PANEL_ID,
+ this.api.dispatch(favoritePanelActions.SET_ITEMS({
items: response.items.map(resourceToDataItem),
itemsAvailable: response.itemsAvailable,
page: Math.floor(response.offset / response.limit),
@@ -71,8 +70,7 @@ export class FavoritePanelMiddlewareService extends DataExplorerMiddlewareServic
this.api.dispatch<any>(checkPresenceInFavorites(response.items.map(item => item.uuid)));
});
} else {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: FAVORITE_PANEL_ID,
+ this.api.dispatch(favoritePanelActions.SET_ITEMS({
items: [],
itemsAvailable: 0,
page: 0,
diff --git a/src/store/navigation/navigation-action.ts b/src/store/navigation/navigation-action.ts
index 5208623..5e9d304 100644
--- a/src/store/navigation/navigation-action.ts
+++ b/src/store/navigation/navigation-action.ts
@@ -7,10 +7,9 @@ import { projectActions, getProjectList } from "../project/project-action";
import { push } from "react-router-redux";
import { TreeItemStatus } from "../../components/tree/tree";
import { findTreeItem } from "../project/project-reducer";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
-import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
import { RootState } from "../store";
import { Resource, ResourceKind } from "../../models/resource";
+import { projectPanelActions } from "../project-panel/project-panel-action";
export const getResourceUrl = <T extends Resource>(resource: T): string => {
switch (resource.kind) {
@@ -51,8 +50,8 @@ export const setProjectItem = (itemId: string, itemMode: ItemMode) =>
if (itemMode === ItemMode.OPEN || itemMode === ItemMode.BOTH) {
dispatch(projectActions.TOGGLE_PROJECT_TREE_ITEM_OPEN(treeItem.data.uuid));
}
- dispatch(dataExplorerActions.RESET_PAGINATION({id: PROJECT_PANEL_ID}));
- dispatch(dataExplorerActions.REQUEST_ITEMS({id: PROJECT_PANEL_ID}));
+ dispatch(projectPanelActions.RESET_PAGINATION());
+ dispatch(projectPanelActions.REQUEST_ITEMS());
}));
}
diff --git a/src/store/project-panel/project-panel-action.ts b/src/store/project-panel/project-panel-action.ts
new file mode 100644
index 0000000..e0d5824
--- /dev/null
+++ b/src/store/project-panel/project-panel-action.ts
@@ -0,0 +1,8 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { bindDataExplorerActions } from "../data-explorer/data-explorer-action";
+import { ProjectPanelMiddlewareService } from "./project-panel-middleware-service";
+
+export const projectPanelActions = bindDataExplorerActions(ProjectPanelMiddlewareService.getInstance());
diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts
index 03ccbfd..5c828be 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 { PROJECT_PANEL_ID, columns, ProjectPanelColumnNames, ProjectPanelFilter } from "../../views/project-panel/project-panel";
+import { columns, ProjectPanelColumnNames, ProjectPanelFilter } from "../../views/project-panel/project-panel";
import { getDataExplorer } from "../data-explorer/data-explorer-reducer";
import { RootState } from "../store";
import { DataColumns } from "../../components/data-table/data-table";
@@ -14,8 +14,8 @@ import { OrderBuilder } from "../../common/api/order-builder";
import { FilterBuilder } from "../../common/api/filter-builder";
import { ProcessResource } from "../../models/process";
import { GroupContentsResourcePrefix, GroupContentsResource } from "../../services/groups-service/groups-service";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
import { checkPresenceInFavorites } from "../favorites/favorites-actions";
+import { projectPanelActions } from "./project-panel-action";
export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService {
@@ -32,7 +32,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
}
get Id() {
- return PROJECT_PANEL_ID;
+ return "projectPanel";
}
get Columns() {
@@ -41,7 +41,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
requestItems() {
const state = this.api.getState() as RootState;
- const dataExplorer = getDataExplorer(state.dataExplorer, PROJECT_PANEL_ID);
+ const dataExplorer = getDataExplorer(state.dataExplorer, this.Id);
const columns = dataExplorer.columns as DataColumns<ProjectPanelItem, ProjectPanelFilter>;
const typeFilters = getColumnFilters(columns, ProjectPanelColumnNames.TYPE);
const statusFilters = getColumnFilters(columns, ProjectPanelColumnNames.STATUS);
@@ -68,8 +68,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
.concat(getSearchFilter(dataExplorer.searchValue))
})
.then(response => {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: PROJECT_PANEL_ID,
+ this.api.dispatch(projectPanelActions.SET_ITEMS({
items: response.items.map(resourceToDataItem),
itemsAvailable: response.itemsAvailable,
page: Math.floor(response.offset / response.limit),
@@ -78,8 +77,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService
this.api.dispatch<any>(checkPresenceInFavorites(response.items.map(item => item.uuid)));
});
} else {
- this.api.dispatch(dataExplorerActions.SET_ITEMS({
- id: PROJECT_PANEL_ID,
+ this.api.dispatch(projectPanelActions.SET_ITEMS({
items: [],
itemsAvailable: 0,
page: 0,
diff --git a/src/store/side-panel/side-panel-reducer.ts b/src/store/side-panel/side-panel-reducer.ts
index 9d56102..cae42ac 100644
--- a/src/store/side-panel/side-panel-reducer.ts
+++ b/src/store/side-panel/side-panel-reducer.ts
@@ -6,10 +6,9 @@ import * as _ from "lodash";
import { sidePanelActions, SidePanelAction } from './side-panel-action';
import { SidePanelItem } from '../../components/side-panel/side-panel';
import { ProjectsIcon, ShareMeIcon, WorkflowIcon, RecentIcon, FavoriteIcon, TrashIcon } from "../../components/icon/icon";
-import { dataExplorerActions } from "../data-explorer/data-explorer-action";
import { Dispatch } from "redux";
-import { FAVORITE_PANEL_ID } from "../../views/favorite-panel/favorite-panel";
import { push } from "react-router-redux";
+import { favoritePanelActions } from "../favorite-panel/favorite-panel-action";
export type SidePanelState = SidePanelItem[];
@@ -84,8 +83,8 @@ export const sidePanelData = [
active: false,
activeAction: (dispatch: Dispatch) => {
dispatch(push("/favorites"));
- dispatch(dataExplorerActions.RESET_PAGINATION({id: FAVORITE_PANEL_ID}));
- dispatch(dataExplorerActions.REQUEST_ITEMS({id: FAVORITE_PANEL_ID}));
+ dispatch(favoritePanelActions.RESET_PAGINATION());
+ dispatch(favoritePanelActions.REQUEST_ITEMS());
}
},
{
diff --git a/src/views-components/context-menu/action-sets/favorite-action-set.ts b/src/views-components/context-menu/action-sets/favorite-action-set.ts
index 58cf6cc..a6117b3 100644
--- a/src/views-components/context-menu/action-sets/favorite-action-set.ts
+++ b/src/views-components/context-menu/action-sets/favorite-action-set.ts
@@ -5,14 +5,13 @@
import { ContextMenuActionSet } from "../context-menu-action-set";
import { ToggleFavoriteAction } from "./favorite-action";
import { toggleFavorite } from "../../../store/favorites/favorites-actions";
-import { dataExplorerActions } from "../../../store/data-explorer/data-explorer-action";
-import { FAVORITE_PANEL_ID } from "../../../views/favorite-panel/favorite-panel";
+import { favoritePanelActions } from "../../../store/favorite-panel/favorite-panel-action";
export const favoriteActionSet: ContextMenuActionSet = [[{
component: ToggleFavoriteAction,
execute: (dispatch, resource) => {
dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id : FAVORITE_PANEL_ID }));
+ dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
});
}
}]];
diff --git a/src/views-components/context-menu/action-sets/project-action-set.ts b/src/views-components/context-menu/action-sets/project-action-set.ts
index efcc429..d0034e1 100644
--- a/src/views-components/context-menu/action-sets/project-action-set.ts
+++ b/src/views-components/context-menu/action-sets/project-action-set.ts
@@ -7,8 +7,7 @@ import { projectActions } from "../../../store/project/project-action";
import { NewProjectIcon } from "../../../components/icon/icon";
import { ToggleFavoriteAction } from "./favorite-action";
import { toggleFavorite } from "../../../store/favorites/favorites-actions";
-import { dataExplorerActions } from "../../../store/data-explorer/data-explorer-action";
-import { FAVORITE_PANEL_ID } from "../../../views/favorite-panel/favorite-panel";
+import { favoritePanelActions } from "../../../store/favorite-panel/favorite-panel-action";
export const projectActionSet: ContextMenuActionSet = [[{
icon: NewProjectIcon,
@@ -20,7 +19,7 @@ export const projectActionSet: ContextMenuActionSet = [[{
component: ToggleFavoriteAction,
execute: (dispatch, resource) => {
dispatch<any>(toggleFavorite(resource)).then(() => {
- dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id : FAVORITE_PANEL_ID }));
+ dispatch<any>(favoritePanelActions.REQUEST_ITEMS());
});
}
}]];
diff --git a/src/views-components/create-project-dialog/create-project-dialog.tsx b/src/views-components/create-project-dialog/create-project-dialog.tsx
index cf5b24f..e06b569 100644
--- a/src/views-components/create-project-dialog/create-project-dialog.tsx
+++ b/src/views-components/create-project-dialog/create-project-dialog.tsx
@@ -9,8 +9,7 @@ import { SubmissionError } from "redux-form";
import { RootState } from "../../store/store";
import { DialogProjectCreate } from "../dialog-create/dialog-project-create";
import { projectActions, createProject, getProjectList } from "../../store/project/project-action";
-import { dataExplorerActions } from "../../store/data-explorer/data-explorer-action";
-import { PROJECT_PANEL_ID } from "../../views/project-panel/project-panel";
+import { projectPanelActions } from "../../store/project-panel/project-panel-action";
const mapStateToProps = (state: RootState) => ({
open: state.projects.creator.opened
@@ -20,7 +19,7 @@ const addProject = (data: { name: string, description: string }) =>
(dispatch: Dispatch, getState: () => RootState) => {
const { ownerUuid } = getState().projects.creator;
return dispatch<any>(createProject(data)).then(() => {
- dispatch(dataExplorerActions.REQUEST_ITEMS({ id: PROJECT_PANEL_ID }));
+ dispatch(projectPanelActions.REQUEST_ITEMS());
dispatch<any>(getProjectList(ownerUuid));
});
};
diff --git a/src/views/favorite-panel/favorite-panel.tsx b/src/views/favorite-panel/favorite-panel.tsx
index 25a8251..e126de3 100644
--- a/src/views/favorite-panel/favorite-panel.tsx
+++ b/src/views/favorite-panel/favorite-panel.tsx
@@ -17,6 +17,7 @@ import { ResourceKind } from '../../models/resource';
import { resourceLabel } from '../../common/labels';
import { ArvadosTheme } from '../../common/custom-theme';
import { renderName, renderStatus, renderType, renderOwner, renderFileSize, renderDate } from '../../views-components/data-explorer/renderers';
+import { FavoritePanelMiddlewareService } from '../../store/favorite-panel/favorite-panel-middleware-service';
type CssRules = "toolbar" | "button";
@@ -118,8 +119,6 @@ export const columns: DataColumns<FavoritePanelItem, FavoritePanelFilter> = [
}
];
-export const FAVORITE_PANEL_ID = "favoritePanel";
-
interface FavoritePanelDataProps {
currentItemId: string;
}
@@ -140,7 +139,7 @@ export const FavoritePanel = withStyles(styles)(
class extends React.Component<FavoritePanelProps> {
render() {
return <DataExplorer
- id={FAVORITE_PANEL_ID}
+ id={FavoritePanelMiddlewareService.getInstance().Id}
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 c7138c3..2654dd1 100644
--- a/src/views/project-panel/project-panel.tsx
+++ b/src/views/project-panel/project-panel.tsx
@@ -17,6 +17,7 @@ import { ResourceKind } from '../../models/resource';
import { resourceLabel } from '../../common/labels';
import { ArvadosTheme } from '../../common/custom-theme';
import { renderName, renderStatus, renderType, renderOwner, renderFileSize, renderDate } from '../../views-components/data-explorer/renderers';
+import { ProjectPanelMiddlewareService } from '../../store/project-panel/project-panel-middleware-service';
type CssRules = "toolbar" | "button";
@@ -118,8 +119,6 @@ export const columns: DataColumns<ProjectPanelItem, ProjectPanelFilter> = [
}
];
-export const PROJECT_PANEL_ID = "projectPanel";
-
interface ProjectPanelDataProps {
currentItemId: string;
}
@@ -153,7 +152,7 @@ export const ProjectPanel = withStyles(styles)(
</Button>
</div>
<DataExplorer
- id={PROJECT_PANEL_ID}
+ id={ProjectPanelMiddlewareService.getInstance().Id}
onRowClick={this.props.onItemClick}
onRowDoubleClick={this.props.onItemDoubleClick}
onContextMenu={this.props.onContextMenu}
diff --git a/src/views/workbench/workbench.tsx b/src/views/workbench/workbench.tsx
index 3637528..667a019 100644
--- a/src/views/workbench/workbench.tsx
+++ b/src/views/workbench/workbench.tsx
@@ -28,14 +28,14 @@ import { authService } from '../../services/services';
import { detailsPanelActions, loadDetails } from "../../store/details-panel/details-panel-action";
import { contextMenuActions } from "../../store/context-menu/context-menu-actions";
-import { sidePanelData, SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
+import { SidePanelIdentifiers } from '../../store/side-panel/side-panel-reducer';
import { ProjectResource } from '../../models/project';
import { ResourceKind } from '../../models/resource';
import { ContextMenu, ContextMenuKind } from "../../views-components/context-menu/context-menu";
-import { FavoritePanel, FAVORITE_PANEL_ID } from "../favorite-panel/favorite-panel";
+import { FavoritePanel } from "../favorite-panel/favorite-panel";
import { CurrentTokenDialog } from '../../views-components/current-token-dialog/current-token-dialog';
-import { dataExplorerActions } from '../../store/data-explorer/data-explorer-action';
import { Snackbar } from '../../views-components/snackbar/snackbar';
+import { favoritePanelActions } from '../../store/favorite-panel/favorite-panel-action';
const drawerWidth = 240;
const appBarHeight = 100;
@@ -248,7 +248,7 @@ export const Workbench = withStyles(styles)(
{...props} />
renderFavoritePanel = (props: RouteComponentProps<{ id: string }>) => <FavoritePanel
- onItemRouteChange={() => this.props.dispatch<any>(dataExplorerActions.REQUEST_ITEMS({ id: FAVORITE_PANEL_ID }))}
+ onItemRouteChange={() => this.props.dispatch<any>(favoritePanelActions.REQUEST_ITEMS())}
onContextMenu={(event, item) => {
const kind = item.kind === ResourceKind.PROJECT ? ContextMenuKind.PROJECT : ContextMenuKind.RESOURCE;
this.openContextMenu(event, {
-----------------------------------------------------------------------
hooks/post-receive
--
More information about the arvados-commits
mailing list