From facccf58114be4d8c7a08286cd2197bd222abdc1 Mon Sep 17 00:00:00 2001 From: Lucas Di Pentima Date: Tue, 18 Jan 2022 14:46:29 -0300 Subject: [PATCH] 18207: Makes 'working' status work in 'Shared with me' & 'Groups' DataExplorers Also, replaces the 'folder' icon that we usually use in projects with a more generic one because DataTable is used on other object types listings. Arvados-DCO-1.1-Signed-off-by: Lucas Di Pentima --- src/components/data-table/data-table.tsx | 4 ++-- src/components/icon/icon.tsx | 8 +++++++- .../groups-panel/groups-panel-middleware-service.ts | 4 ++++ .../project-panel/project-panel-middleware-service.ts | 3 ++- .../shared-with-me-middleware-service.ts | 4 ++++ .../shared-with-me-panel-actions.ts | 11 +---------- .../shared-with-me-panel/shared-with-me-panel.tsx | 6 +++++- 7 files changed, 25 insertions(+), 15 deletions(-) diff --git a/src/components/data-table/data-table.tsx b/src/components/data-table/data-table.tsx index 3646fc8f..2119e53d 100644 --- a/src/components/data-table/data-table.tsx +++ b/src/components/data-table/data-table.tsx @@ -10,7 +10,7 @@ import { DataTableDefaultView } from '../data-table-default-view/data-table-defa import { DataTableFilters } from '../data-table-filters/data-table-filters-tree'; import { DataTableFiltersPopover } from '../data-table-filters/data-table-filters-popover'; import { countNodes } from 'models/tree'; -import { ProjectIcon } from 'components/icon/icon'; +import { PendingIcon } from 'components/icon/icon'; import { SvgIconProps } from '@material-ui/core/SvgIcon'; import ArrowDownwardIcon from '@material-ui/icons/ArrowDownward'; @@ -100,7 +100,7 @@ export const DataTable = withStyles(styles)( this.props.working ?
: items.map(this.renderBodyRow) } diff --git a/src/components/icon/icon.tsx b/src/components/icon/icon.tsx index 15a9f02d..4f7305f7 100644 --- a/src/components/icon/icon.tsx +++ b/src/components/icon/icon.tsx @@ -68,14 +68,20 @@ import Computer from '@material-ui/icons/Computer'; // Import FontAwesome icons import { library } from '@fortawesome/fontawesome-svg-core'; -import { faPencilAlt, faSlash, faUsers } from '@fortawesome/free-solid-svg-icons'; +import { faPencilAlt, faSlash, faUsers, faEllipsisH } from '@fortawesome/free-solid-svg-icons'; import { CropFreeSharp } from '@material-ui/icons'; library.add( faPencilAlt, faSlash, faUsers, + faEllipsisH, ); +export const PendingIcon = (props: any) => + + + + export const ReadOnlyIcon = (props: any) =>
diff --git a/src/store/groups-panel/groups-panel-middleware-service.ts b/src/store/groups-panel/groups-panel-middleware-service.ts index 28415506..3997e33c 100644 --- a/src/store/groups-panel/groups-panel-middleware-service.ts +++ b/src/store/groups-panel/groups-panel-middleware-service.ts @@ -15,6 +15,7 @@ import { OrderBuilder, OrderDirection } from 'services/api/order-builder'; import { GroupResource, GroupClass } from 'models/group'; import { SortDirection } from 'components/data-table/data-column'; import { GroupsPanelColumnNames } from 'views/groups-panel/groups-panel'; +import { progressIndicatorActions } from "store/progress-indicator/progress-indicator-actions"; export class GroupsPanelMiddlewareService extends DataExplorerMiddlewareService { constructor(private services: ServiceRepository, id: string) { @@ -26,6 +27,7 @@ export class GroupsPanelMiddlewareService extends DataExplorerMiddlewareService api.dispatch(groupsPanelDataExplorerIsNotSet()); } else { try { + api.dispatch(progressIndicatorActions.START_WORKING(this.getId())); const order = new OrderBuilder(); const sortColumn = getSortColumn(dataExplorer); if (sortColumn) { @@ -58,6 +60,8 @@ export class GroupsPanelMiddlewareService extends DataExplorerMiddlewareService api.dispatch(updateResources(permissions.items)); } catch (e) { api.dispatch(couldNotFetchFavoritesContents()); + } finally { + api.dispatch(progressIndicatorActions.STOP_WORKING(this.getId())); } } } diff --git a/src/store/project-panel/project-panel-middleware-service.ts b/src/store/project-panel/project-panel-middleware-service.ts index 659cd957..45650843 100644 --- a/src/store/project-panel/project-panel-middleware-service.ts +++ b/src/store/project-panel/project-panel-middleware-service.ts @@ -58,7 +58,6 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService await api.dispatch(loadMissingProcessesInformation(response.items)); api.dispatch(setItems(response)); } catch (e) { - api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); api.dispatch(projectPanelActions.SET_ITEMS({ items: [], itemsAvailable: 0, @@ -66,6 +65,8 @@ export class ProjectPanelMiddlewareService extends DataExplorerMiddlewareService rowsPerPage: dataExplorer.rowsPerPage })); api.dispatch(couldNotFetchProjectContents()); + } finally { + api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); } } } diff --git a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts index c55a893d..5f92637c 100644 --- a/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts +++ b/src/store/shared-with-me-panel/shared-with-me-middleware-service.ts @@ -21,6 +21,7 @@ import { ProjectPanelColumnNames } from 'views/project-panel/project-panel'; import { getSortColumn } from "store/data-explorer/data-explorer-reducer"; import { updatePublicFavorites } from 'store/public-favorites/public-favorites-actions'; import { FilterBuilder } from 'services/api/filter-builder'; +import { progressIndicatorActions } from 'store/progress-indicator/progress-indicator-actions'; export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService { constructor(private services: ServiceRepository, id: string) { @@ -31,6 +32,7 @@ export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService const state = api.getState(); const dataExplorer = getDataExplorer(state.dataExplorer, this.getId()); try { + api.dispatch(progressIndicatorActions.START_WORKING(this.getId())); const response = await this.services.groupsService .contents('', { ...getParams(dataExplorer), @@ -44,6 +46,8 @@ export class SharedWithMeMiddlewareService extends DataExplorerMiddlewareService api.dispatch(setItems(response)); } catch (e) { api.dispatch(couldNotFetchSharedItems()); + } finally { + api.dispatch(progressIndicatorActions.PERSIST_STOP_WORKING(this.getId())); } } } diff --git a/src/store/shared-with-me-panel/shared-with-me-panel-actions.ts b/src/store/shared-with-me-panel/shared-with-me-panel-actions.ts index 1210edbb..c8731ae6 100644 --- a/src/store/shared-with-me-panel/shared-with-me-panel-actions.ts +++ b/src/store/shared-with-me-panel/shared-with-me-panel-actions.ts @@ -3,16 +3,7 @@ // SPDX-License-Identifier: AGPL-3.0 import { bindDataExplorerActions } from "../data-explorer/data-explorer-action"; -import { Dispatch } from 'redux'; -import { ServiceRepository } from "services/services"; -import { RootState } from 'store/store'; export const SHARED_WITH_ME_PANEL_ID = "sharedWithMePanel"; export const sharedWithMePanelActions = bindDataExplorerActions(SHARED_WITH_ME_PANEL_ID); - -export const loadSharedWithMePanel = () => - (dispatch: Dispatch, getState: () => RootState, services: ServiceRepository) => { - dispatch(sharedWithMePanelActions.REQUEST_ITEMS()); - }; - - +export const loadSharedWithMePanel = () => sharedWithMePanelActions.REQUEST_ITEMS(); diff --git a/src/views/shared-with-me-panel/shared-with-me-panel.tsx b/src/views/shared-with-me-panel/shared-with-me-panel.tsx index 219410c5..7ba9077c 100644 --- a/src/views/shared-with-me-panel/shared-with-me-panel.tsx +++ b/src/views/shared-with-me-panel/shared-with-me-panel.tsx @@ -55,7 +55,11 @@ export const SharedWithMePanel = withStyles(styles)( onRowDoubleClick={this.handleRowDoubleClick} onContextMenu={this.handleContextMenu} contextMenuColumn={false} - dataTableDefaultView={} />
; + dataTableDefaultView={ + + } />; } handleContextMenu = (event: React.MouseEvent, resourceUuid: string) => { -- 2.30.2