// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import React from 'react'; import { StyleRulesCallback, WithStyles, withStyles, Tooltip, Typography, Card, CardHeader, CardContent, IconButton } from '@material-ui/core'; import { connect, DispatchProp } from "react-redux"; import { RouteComponentProps } from 'react-router'; import { ArvadosTheme } from 'common/custom-theme'; import { RootState } from 'store/store'; import { WorkflowIcon, MoreVerticalIcon } from 'components/icon/icon'; import { WorkflowResource } from 'models/workflow'; import { ProcessOutputCollectionFiles } from 'views/process-panel/process-output-collection-files'; import { WorkflowDetailsAttributes, RegisteredWorkflowPanelDataProps, getRegisteredWorkflowPanelData } from 'views-components/details-panel/workflow-details'; import { getResource } from 'store/resources/resources'; import { openContextMenu, resourceUuidToContextMenuKind } from 'store/context-menu/context-menu-actions'; import { MPVContainer, MPVPanelContent, MPVPanelState } from 'components/multi-panel-view/multi-panel-view'; import { ProcessIOCard, ProcessIOCardType } from 'views/process-panel/process-io-card'; import { NotFoundView } from 'views/not-found-panel/not-found-panel'; type CssRules = 'root' | 'button' | 'infoCard' | 'propertiesCard' | 'filesCard' | 'iconHeader' | 'tag' | 'label' | 'value' | 'link' | 'centeredLabel' | 'warningLabel' | 'collectionName' | 'readOnlyIcon' | 'header' | 'title' | 'avatar' | 'content'; const styles: StyleRulesCallback = (theme: ArvadosTheme) => ({ root: { width: '100%', }, button: { cursor: 'pointer' }, infoCard: { }, propertiesCard: { padding: 0, }, filesCard: { padding: 0, }, iconHeader: { fontSize: '1.875rem', color: theme.customs.colors.greyL }, tag: { marginRight: theme.spacing.unit / 2, marginBottom: theme.spacing.unit / 2 }, label: { fontSize: '0.875rem', }, centeredLabel: { fontSize: '0.875rem', textAlign: 'center' }, warningLabel: { fontStyle: 'italic' }, collectionName: { flexDirection: 'column', }, value: { textTransform: 'none', fontSize: '0.875rem' }, link: { fontSize: '0.875rem', color: theme.palette.primary.main, '&:hover': { cursor: 'pointer' } }, readOnlyIcon: { marginLeft: theme.spacing.unit, fontSize: 'small', }, header: { paddingTop: theme.spacing.unit, paddingBottom: theme.spacing.unit, }, title: { overflow: 'hidden', paddingTop: theme.spacing.unit * 0.5, color: theme.customs.colors.green700, }, avatar: { alignSelf: 'flex-start', paddingTop: theme.spacing.unit * 0.5 }, content: { padding: theme.spacing.unit * 1.0, paddingTop: theme.spacing.unit * 0.5, '&:last-child': { paddingBottom: theme.spacing.unit * 1, } } }); type RegisteredWorkflowPanelProps = RegisteredWorkflowPanelDataProps & DispatchProp & WithStyles export const RegisteredWorkflowPanel = withStyles(styles)(connect( (state: RootState, props: RouteComponentProps<{ id: string }>) => { const item = getResource(props.match.params.id)(state.resources); if (item) { return getRegisteredWorkflowPanelData(item, state.auth); } return { item, inputParams: [], outputParams: [], workflowCollection: "", gitprops: {} }; })( class extends React.Component { render() { const { classes, item, inputParams, outputParams, workflowCollection } = this.props; const panelsData: MPVPanelState[] = [ { name: "Details" }, { name: "Inputs" }, { name: "Outputs" }, { name: "Files" }, ]; return item ? } title={ {item.name} } subheader={ {item.description || '(no-description)'} } action={ this.handleContextMenu(event)}> } /> : } handleContextMenu = (event: React.MouseEvent) => { const { uuid, ownerUuid, name, description, kind } = this.props.item; const menuKind = this.props.dispatch(resourceUuidToContextMenuKind(uuid)); const resource = { uuid, ownerUuid, name, description, kind, menuKind, }; // Avoid expanding/collapsing the panel event.stopPropagation(); this.props.dispatch(openContextMenu(event, resource)); } } ) );