X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/3c4424da163db13b80a2070eef1e73fe744fad9e..9ae74b6dd7f14cd244a6c283b87aca0638e08a27:/src/views/shared-with-me-panel/shared-with-me-panel.tsx 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 9b4bcc85..e6cfccd2 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 @@ -2,23 +2,24 @@ // // SPDX-License-Identifier: AGPL-3.0 -import * as React from 'react'; +import React from 'react'; import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core'; -import { DataExplorer } from "~/views-components/data-explorer/data-explorer"; +import { DataExplorer } from "views-components/data-explorer/data-explorer"; import { connect, DispatchProp } from 'react-redux'; -import { RootState } from '~/store/store'; -import { ArvadosTheme } from '~/common/custom-theme'; -import { ShareMeIcon } from '~/components/icon/icon'; -import { ResourcesState, getResourceWithEditableStatus } from '~/store/resources/resources'; -import { navigateTo } from "~/store/navigation/navigation-action"; -import { loadDetailsPanel } from "~/store/details-panel/details-panel-action"; -import { DataTableDefaultView } from '~/components/data-table-default-view/data-table-default-view'; -import { SHARED_WITH_ME_PANEL_ID } from '~/store/shared-with-me-panel/shared-with-me-panel-actions'; -import { openContextMenu, resourceKindToContextMenuKind } from '~/store/context-menu/context-menu-actions'; -import { GroupResource } from '~/models/group'; -import { EditableResource } from '~/models/resource'; +import { RootState } from 'store/store'; +import { ArvadosTheme } from 'common/custom-theme'; +import { ShareMeIcon } from 'components/icon/icon'; +import { ResourcesState, getResource } from 'store/resources/resources'; +import { navigateTo } from "store/navigation/navigation-action"; +import { loadDetailsPanel } from "store/details-panel/details-panel-action"; +import { SHARED_WITH_ME_PANEL_ID } from 'store/shared-with-me-panel/shared-with-me-panel-actions'; +import { + openContextMenu, + resourceUuidToContextMenuKind +} from 'store/context-menu/context-menu-actions'; +import { GroupContentsResource } from 'services/groups-service/groups-service'; -type CssRules = "toolbar" | "button"; +type CssRules = "toolbar" | "button" | "root"; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ toolbar: { @@ -28,11 +29,13 @@ const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ button: { marginLeft: theme.spacing.unit }, + root: { + width: '100%', + }, }); interface SharedWithMePanelDataProps { resources: ResourcesState; - isAdmin: boolean; userUuid: string; } @@ -41,30 +44,32 @@ type SharedWithMePanelProps = SharedWithMePanelDataProps & DispatchProp & WithSt export const SharedWithMePanel = withStyles(styles)( connect((state: RootState) => ({ resources: state.resources, - isAdmin: state.auth.user!.isAdmin, userUuid: state.auth.user!.uuid, }))( class extends React.Component { render() { - return } />; + defaultViewIcon={ShareMeIcon} + defaultViewMessages={['No shared items']} /> + ; } handleContextMenu = (event: React.MouseEvent, resourceUuid: string) => { - const { isAdmin, userUuid, resources } = this.props; - const resource = getResourceWithEditableStatus(resourceUuid, userUuid)(resources); - const menuKind = resourceKindToContextMenuKind(resourceUuid, isAdmin, (resource || {} as EditableResource).isEditable); + const { resources } = this.props; + const resource = getResource(resourceUuid)(resources); + const menuKind = this.props.dispatch(resourceUuidToContextMenuKind(resourceUuid)); if (menuKind && resource) { this.props.dispatch(openContextMenu(event, { - name: '', + name: resource.name, uuid: resource.uuid, + description: resource.description, ownerUuid: resource.ownerUuid, - isTrashed: resource.isTrashed, + isTrashed: ('isTrashed' in resource) ? resource.isTrashed: false, kind: resource.kind, menuKind }));