fix browse the contents of a Project in Trash and tooltips around button
authorJanicki Artur <artur.janicki@contractors.roche.com>
Wed, 7 Nov 2018 12:06:13 +0000 (13:06 +0100)
committerJanicki Artur <artur.janicki@contractors.roche.com>
Wed, 7 Nov 2018 12:06:13 +0000 (13:06 +0100)
Feature #14319_loaded_contents_for_project_in_trash

Arvados-DCO-1.1-Signed-off-by: Janicki Artur <artur.janicki@contractors.roche.com>

src/components/collection-panel-files/collection-panel-files.tsx
src/components/data-explorer/data-explorer.tsx
src/components/file-tree/file-tree-item.tsx
src/store/project-panel/project-panel-action.ts
src/store/project-panel/project-panel-middleware-service.ts
src/store/workbench/workbench-actions.ts
src/views/process-log-panel/process-log-main-card.tsx
src/views/process-panel/process-information-card.tsx
src/views/process-panel/process-subprocesses-card.tsx

index c3cb4acc486d55bd297f41d020721bb15e475b1c..9a534e4bcba8a1fcf24dd09f1d0b32fc53fdf1fa 100644 (file)
@@ -63,7 +63,7 @@ export const CollectionPanelFiles =
                 <CardHeader
                     className={classes.cardSubheader}
                     action={
-                        <Tooltip title="More options">
+                        <Tooltip title="More options" disableFocusListener>
                             <IconButton onClick={onOptionsMenuOpen}>
                                 <CustomizeTableIcon />
                             </IconButton>
index fcb10aff539d79cbf4304ee50411d784b2f51130..08f52d00d37663f321106be226cea10c81ef08f0 100644 (file)
@@ -125,7 +125,7 @@ export const DataExplorer = withStyles(styles)(
 
         renderContextMenuTrigger = (item: T) =>
             <Grid container justify="center">
-                <Tooltip title="More options">
+                <Tooltip title="More options" disableFocusListener>
                     <IconButton className={this.props.classes.moreOptionsButton} onClick={event => this.props.onContextMenu(event, item)}>
                         <MoreVertIcon />
                     </IconButton>
index 98164ad4204a8fb5d7cea1c4e25ede59a3a5d6b4..89bf43c66d84d3c6f9f157adb3e84812866ddde2 100644 (file)
@@ -50,7 +50,7 @@ export const FileTreeItem = withStyles(fileTreeItemStyle)(
                 <Typography
                     className={classes.sizeInfo}
                     variant="caption">{formatFileSize(item.data.size)}</Typography>
-                <Tooltip title="More options">
+                <Tooltip title="More options" disableFocusListener>
                     <IconButton
                         className={classes.button}
                         onClick={this.handleClick}>
index 6e639017dbd7de0bdd0289443efe1169694f8abe..e094cb1851b125bc9755212efbf76eb9578fefe7 100644 (file)
@@ -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<string>(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 }));
+    };
index 0da669a261ccd223fcdf75ef4d4d1181e3aebe2a..a641b318477dc03cc1d147613632a098b2b18a3a 100644 (file)
@@ -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<string>(PROJECT_PANEL_CURRENT_UUID)(state.properties);
+        const isProjectTrashed = getProperty<string>(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<any>(updateFavorites(resourceUuids));
@@ -105,10 +106,11 @@ export const setItems = (listResults: ListResults<GroupContentsResource>) =>
         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) => {
index f86ea78b395c6fd2ae75a8f945c181132ceb8db6..400264c3193b162653cfdef71ab2515d0fac5245 100644 (file)
@@ -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<any>, 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<any>(setTrashBreadcrumbs(uuid));
+                            dispatch(setIsProjectPanelTrashed(true));
                             dispatch(activateSidePanelTreeItem(SidePanelTreeCategory.TRASH));
                             dispatch(finishLoadingProject(project));
                         }
index 397f0378224df4c3827d5f64b36a29179f8df759..42df2d92d7dc33933500cb8c7e54daf7d5a166a2 100644 (file)
@@ -73,7 +73,7 @@ export const ProcessLogMainCard = withStyles(styles)(
                 <CardHeader
                     avatar={<ProcessIcon className={classes.iconHeader} />}
                     action={
-                        <Tooltip title="More options">
+                        <Tooltip title="More options" disableFocusListener>
                             <IconButton onClick={event => onContextMenu(event, process)} aria-label="More options">
                                 <MoreOptionsIcon />
                             </IconButton>
index 9b21ce5e27e4f38c908eed42fb6497bc9884c6bb..7fcabcbb094f279580b08f8afe01406ede0af290 100644 (file)
@@ -87,7 +87,7 @@ export const ProcessInformationCard = withStyles(styles, { withTheme: true })(
                         <Chip label={getProcessStatus(process)}
                             className={classes.chip}
                             style={{ backgroundColor: getProcessStatusColor(getProcessStatus(process), theme as ArvadosTheme) }} />
-                        <Tooltip title="More options">
+                        <Tooltip title="More options" disableFocusListener>
                             <IconButton
                                 aria-label="More options"
                                 onClick={event => onContextMenu(event)}>
index be4ad9058b0fee6541068cbb06f7991d91d9f5c6..7a1901f13f797644cfd1842a97b3b37b2b6ffe63 100644 (file)
@@ -86,7 +86,7 @@ export const ProcessSubprocessesCard = withStyles(styles, { withTheme: true })(
                         <Typography noWrap variant="body2" className={classes.status}>
                             {getProcessStatus(subprocess)}
                         </Typography>
-                        <Tooltip title="More options">
+                        <Tooltip title="More options" disableFocusListener>
                             <IconButton
                                 className={classes.options}
                                 aria-label="More options"