1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { Dialog, DialogActions, Button, StyleRulesCallback, WithStyles, withStyles, Tooltip, IconButton, CardHeader } from '@material-ui/core';
7 import { withDialog } from "~/store/dialog/with-dialog";
8 import { PROCESS_COMMAND_DIALOG_NAME } from '~/store/processes/process-command-actions';
9 import { WithDialogProps } from '~/store/dialog/with-dialog';
10 import { ProcessCommandDialogData } from '~/store/processes/process-command-actions';
11 import { DefaultCodeSnippet } from "~/components/default-code-snippet/default-code-snippet";
12 import { compose } from 'redux';
13 import * as CopyToClipboard from "react-copy-to-clipboard";
14 import { CopyIcon } from '~/components/icon/icon';
16 type CssRules = 'codeSnippet' | 'copyToClipboard';
18 const styles: StyleRulesCallback<CssRules> = theme => ({
20 marginLeft: theme.spacing.unit * 3,
21 marginRight: theme.spacing.unit * 3,
24 marginRight: theme.spacing.unit,
28 export const ProcessCommandDialog = compose(
29 withDialog(PROCESS_COMMAND_DIALOG_NAME),
32 (props: WithDialogProps<ProcessCommandDialogData> & WithStyles<CssRules>) =>
36 onClose={props.closeDialog}
37 style={{ alignSelf: 'stretch' }}>
39 title={`Command - ${props.data.processName}`}
41 <Tooltip title="Copy to clipboard">
42 <CopyToClipboard text={props.data.command}>
43 <IconButton className={props.classes.copyToClipboard}>
50 className={props.classes.codeSnippet}
51 lines={[props.data.command]} />
56 onClick={props.closeDialog}>