X-Git-Url: https://git.arvados.org/arvados-workbench2.git/blobdiff_plain/59100a72caedbc8f3c9872de1153bf3d4129122a..6b562ae2431132439e488f509d698800ee8ebe7d:/src/views-components/data-explorer/renderers.tsx diff --git a/src/views-components/data-explorer/renderers.tsx b/src/views-components/data-explorer/renderers.tsx index 6e25508d..ca79bba4 100644 --- a/src/views-components/data-explorer/renderers.tsx +++ b/src/views-components/data-explorer/renderers.tsx @@ -9,18 +9,18 @@ import { ResourceKind, TrashableResource } from '~/models/resource'; import { ProjectIcon, CollectionIcon, ProcessIcon, DefaultIcon, WorkflowIcon, ShareIcon } from '~/components/icon/icon'; import { formatDate, formatFileSize } from '~/common/formatters'; import { resourceLabel } from '~/common/labels'; -import { connect } from 'react-redux'; +import { connect, DispatchProp } from 'react-redux'; import { RootState } from '~/store/store'; import { getResource } from '~/store/resources/resources'; import { GroupContentsResource } from '~/services/groups-service/groups-service'; import { getProcess, Process, getProcessStatus, getProcessStatusColor } from '~/store/processes/process'; import { ArvadosTheme } from '~/common/custom-theme'; -import { compose } from 'redux'; +import { compose, Dispatch } from 'redux'; import { WorkflowResource } from '~/models/workflow'; import { ResourceStatus } from '~/views/workflow-panel/workflow-panel-view'; -import { getUuidPrefix } from '~/store/workflow-panel/workflow-panel-actions'; -import { CollectionResource } from "~/models/collection"; +import { getUuidPrefix, openRunProcess } from '~/store/workflow-panel/workflow-panel-actions'; import { getResourceData } from "~/store/resources-data/resources-data"; +import { openSharingDialog } from '~/store/sharing-dialog/sharing-dialog-actions'; export const renderName = (item: { name: string; uuid: string, kind: string }) => @@ -86,13 +86,19 @@ const getPublicUuid = (uuidPrefix: string) => { return `${uuidPrefix}-tpzed-anonymouspublic`; }; -// do share onClick -export const resourceShare = (uuidPrefix: string, ownerUuid?: string) => { - return - undefined}> - {ownerUuid === getPublicUuid(uuidPrefix) ? : null} - - ; +export const resourceShare = (dispatch: Dispatch, uuidPrefix: string, ownerUuid?: string, uuid?: string) => { + const isPublic = ownerUuid === getPublicUuid(uuidPrefix); + return ( +
+ {isPublic && uuid && + + dispatch(openSharingDialog(uuid))}> + + + + } +
+ ); }; export const ResourceShare = connect( @@ -100,10 +106,34 @@ export const ResourceShare = connect( const resource = getResource(props.uuid)(state.resources); const uuidPrefix = getUuidPrefix(state); return { + uuid: resource ? resource.uuid : '', ownerUuid: resource ? resource.ownerUuid : '', uuidPrefix }; - })((props: { ownerUuid?: string, uuidPrefix: string }) => resourceShare(props.uuidPrefix, props.ownerUuid)); + })((props: { ownerUuid?: string, uuidPrefix: string, uuid?: string } & DispatchProp) => + resourceShare(props.dispatch, props.uuidPrefix, props.ownerUuid, props.uuid)); + +export const resourceRunProcess = (dispatch: Dispatch, uuid: string) => { + return ( +
+ {uuid && + + dispatch(openRunProcess(uuid))}> + + + } +
+ ); +}; + +export const ResourceRunProcess = connect( + (state: RootState, props: { uuid: string }) => { + const resource = getResource(props.uuid)(state.resources); + return { + uuid: resource ? resource.uuid : '' + }; + })((props: { uuid: string } & DispatchProp) => + resourceRunProcess(props.dispatch, props.uuid)); export const renderWorkflowStatus = (uuidPrefix: string, ownerUuid?: string) => { if (ownerUuid === getPublicUuid(uuidPrefix)) {