From 994434ce0881e5e4f309982790352e9af66cdb05 Mon Sep 17 00:00:00 2001 From: Janicki Artur Date: Wed, 7 Nov 2018 13:06:13 +0100 Subject: [PATCH] fix browse the contents of a Project in Trash and tooltips around button Feature #14319_loaded_contents_for_project_in_trash Arvados-DCO-1.1-Signed-off-by: Janicki Artur --- .../collection-panel-files/collection-panel-files.tsx | 2 +- src/components/data-explorer/data-explorer.tsx | 2 +- src/components/file-tree/file-tree-item.tsx | 2 +- src/store/project-panel/project-panel-action.ts | 5 +++++ .../project-panel/project-panel-middleware-service.ts | 8 +++++--- src/store/workbench/workbench-actions.ts | 5 +++-- src/views/process-log-panel/process-log-main-card.tsx | 2 +- src/views/process-panel/process-information-card.tsx | 2 +- src/views/process-panel/process-subprocesses-card.tsx | 2 +- 9 files changed, 19 insertions(+), 11 deletions(-) diff --git a/src/components/collection-panel-files/collection-panel-files.tsx b/src/components/collection-panel-files/collection-panel-files.tsx index c3cb4acc..9a534e4b 100644 --- a/src/components/collection-panel-files/collection-panel-files.tsx +++ b/src/components/collection-panel-files/collection-panel-files.tsx @@ -63,7 +63,7 @@ export const CollectionPanelFiles = + diff --git a/src/components/data-explorer/data-explorer.tsx b/src/components/data-explorer/data-explorer.tsx index fcb10aff..08f52d00 100644 --- a/src/components/data-explorer/data-explorer.tsx +++ b/src/components/data-explorer/data-explorer.tsx @@ -125,7 +125,7 @@ export const DataExplorer = withStyles(styles)( renderContextMenuTrigger = (item: T) => - + this.props.onContextMenu(event, item)}> diff --git a/src/components/file-tree/file-tree-item.tsx b/src/components/file-tree/file-tree-item.tsx index 98164ad4..89bf43c6 100644 --- a/src/components/file-tree/file-tree-item.tsx +++ b/src/components/file-tree/file-tree-item.tsx @@ -50,7 +50,7 @@ export const FileTreeItem = withStyles(fileTreeItemStyle)( {formatFileSize(item.data.size)} - + diff --git a/src/store/project-panel/project-panel-action.ts b/src/store/project-panel/project-panel-action.ts index 6e639017..e094cb18 100644 --- a/src/store/project-panel/project-panel-action.ts +++ b/src/store/project-panel/project-panel-action.ts @@ -10,6 +10,7 @@ import { RootState } from '~/store/store'; import { getProperty } from "~/store/properties/properties"; export const PROJECT_PANEL_ID = "projectPanel"; export const PROJECT_PANEL_CURRENT_UUID = "projectPanelCurrentUuid"; +export const IS_PROJECT_PANEL_TRASHED = 'isProjectPanelTrashed'; export const projectPanelActions = bindDataExplorerActions(PROJECT_PANEL_ID); export const openProjectPanel = (projectUuid: string) => @@ -20,3 +21,7 @@ export const openProjectPanel = (projectUuid: string) => export const getProjectPanelCurrentUuid = (state: RootState) => getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties); +export const setIsProjectPanelTrashed = (isTrashed: boolean) => + (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { + dispatch(propertiesActions.SET_PROPERTY({ key: IS_PROJECT_PANEL_TRASHED, value: isTrashed })); + }; diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts index 0da669a2..a641b318 100644 --- a/src/store/project-panel/project-panel-middleware-service.ts +++ b/src/store/project-panel/project-panel-middleware-service.ts @@ -17,7 +17,7 @@ import { OrderBuilder, OrderDirection } from "~/services/api/order-builder"; import { FilterBuilder } from "~/services/api/filter-builder"; import { GroupContentsResource, GroupContentsResourcePrefix } from "~/services/groups-service/groups-service"; import { updateFavorites } from "../favorites/favorites-actions"; -import { PROJECT_PANEL_CURRENT_UUID, projectPanelActions } from './project-panel-action'; +import { PROJECT_PANEL_CURRENT_UUID, IS_PROJECT_PANEL_TRASHED, projectPanelActions } from './project-panel-action'; import { Dispatch, MiddlewareAPI } from "redux"; import { ProjectResource } from "~/models/project"; import { updateResources } from "~/store/resources/resources-actions"; @@ -41,6 +41,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService const state = api.getState(); const dataExplorer = getDataExplorer(state.dataExplorer, this.getId()); const projectUuid = getProperty(PROJECT_PANEL_CURRENT_UUID)(state.properties); + const isProjectTrashed = getProperty(IS_PROJECT_PANEL_TRASHED)(state.properties); if (!projectUuid) { api.dispatch(projectPanelCurrentUuidIsNotSet()); } else if (!dataExplorer) { @@ -48,7 +49,7 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService } else { try { api.dispatch(progressIndicatorActions.START_WORKING(this.getId())); - const response = await this.services.groupsService.contents(projectUuid, getParams(dataExplorer)); + const response = await this.services.groupsService.contents(projectUuid, getParams(dataExplorer, !!isProjectTrashed)); api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); const resourceUuids = response.items.map(item => item.uuid); api.dispatch(updateFavorites(resourceUuids)); @@ -105,10 +106,11 @@ export const setItems = (listResults: ListResults) => items: listResults.items.map(resource => resource.uuid), }); -export const getParams = (dataExplorer: DataExplorer) => ({ +export const getParams = (dataExplorer: DataExplorer, isProjectTrashed: boolean) => ({ ...dataExplorerToListParams(dataExplorer), order: getOrder(dataExplorer), filters: getFilters(dataExplorer), + includeTrash: isProjectTrashed }); export const getFilters = (dataExplorer: DataExplorer) => { diff --git a/src/store/workbench/workbench-actions.ts b/src/store/workbench/workbench-actions.ts index f86ea78b..400264c3 100644 --- a/src/store/workbench/workbench-actions.ts +++ b/src/store/workbench/workbench-actions.ts @@ -7,7 +7,7 @@ import { RootState } from "../store"; import { loadDetailsPanel } from '~/store/details-panel/details-panel-action'; import { snackbarActions } from '../snackbar/snackbar-actions'; import { loadFavoritePanel } from '../favorite-panel/favorite-panel-action'; -import { openProjectPanel, projectPanelActions } from '~/store/project-panel/project-panel-action'; +import { openProjectPanel, projectPanelActions, setIsProjectPanelTrashed } from '~/store/project-panel/project-panel-action'; import { activateSidePanelTreeItem, initSidePanelTree, SidePanelTreeCategory, loadSidePanelTreeProjects } from '../side-panel-tree/side-panel-tree-actions'; import { loadResource, updateResources } from '../resources/resources-actions'; import { favoritePanelActions } from '~/store/favorite-panel/favorite-panel-action'; @@ -53,7 +53,6 @@ import { collectionPanelActions } from "~/store/collection-panel/collection-pane import { CollectionResource } from "~/models/collection"; import { searchResultsPanelActions, loadSearchResultsPanel } from '~/store/search-results-panel/search-results-panel-actions'; import { searchResultsPanelColumns } from '~/views/search-results-panel/search-results-panel-view'; -import * as uuid from 'uuid/v4'; export const WORKBENCH_LOADING_SCREEN = 'workbenchLoadingScreen'; @@ -123,6 +122,7 @@ export const loadProject = (uuid: string) => handleFirstTimeLoad( async (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { const userUuid = services.authService.getUuid(); + dispatch(setIsProjectPanelTrashed(false)); if (userUuid) { if (userUuid !== uuid) { const match = await loadGroupContentsResource({ uuid, userUuid, services }); @@ -139,6 +139,7 @@ export const loadProject = (uuid: string) => }, TRASHED: project => { dispatch(setTrashBreadcrumbs(uuid)); + dispatch(setIsProjectPanelTrashed(true)); dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH)); dispatch(finishLoadingProject(project)); } diff --git a/src/views/process-log-panel/process-log-main-card.tsx b/src/views/process-log-panel/process-log-main-card.tsx index 397f0378..42df2d92 100644 --- a/src/views/process-log-panel/process-log-main-card.tsx +++ b/src/views/process-log-panel/process-log-main-card.tsx @@ -73,7 +73,7 @@ export const ProcessLogMainCard = withStyles(styles)( } action={ - + onContextMenu(event, process)} aria-label="More options"> diff --git a/src/views/process-panel/process-information-card.tsx b/src/views/process-panel/process-information-card.tsx index 9b21ce5e..7fcabcbb 100644 --- a/src/views/process-panel/process-information-card.tsx +++ b/src/views/process-panel/process-information-card.tsx @@ -87,7 +87,7 @@ export const ProcessInformationCard = withStyles(styles, { withTheme: true })( - + onContextMenu(event)}> diff --git a/src/views/process-panel/process-subprocesses-card.tsx b/src/views/process-panel/process-subprocesses-card.tsx index be4ad905..7a1901f1 100644 --- a/src/views/process-panel/process-subprocesses-card.tsx +++ b/src/views/process-panel/process-subprocesses-card.tsx @@ -86,7 +86,7 @@ export const ProcessSubprocessesCard = withStyles(styles, { withTheme: true })( {getProcessStatus(subprocess)} - +