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, DialogTitle, DialogContent, Tabs, Tab, DialogContentText } from '@material-ui/core';
7 import { WithDialogProps } from '~/store/dialog/with-dialog';
8 import { withDialog } from "~/store/dialog/with-dialog";
9 import { compose } from 'redux';
10 import { ADVANCED_TAB_DIALOG } from "~/store/advanced-tab/advanced-tab";
11 import { DefaultCodeSnippet } from "~/components/default-code-snippet/default-code-snippet";
13 type CssRules = 'content' | 'codeSnippet' | 'secondContentText';
15 const styles: StyleRulesCallback<CssRules> = theme => ({
17 paddingTop: theme.spacing.unit * 3
20 borderRadius: theme.spacing.unit * 0.5,
22 borderColor: theme.palette.grey["400"]
25 paddingTop: theme.spacing.unit * 2
29 export const AdvancedTabDialog = compose(
30 withDialog(ADVANCED_TAB_DIALOG),
33 class extends React.Component<WithDialogProps<any> & WithStyles<CssRules>>{
39 this.setState({ value: 0 });
42 handleChange = (event: React.MouseEvent<HTMLElement>, value: number) => {
43 this.setState({ value });
46 const { classes, open, closeDialog } = this.props;
47 const { value } = this.state;
62 onExit={() => this.setState({ value: 0 })} >
63 <DialogTitle>Advanced</DialogTitle>
64 <Tabs value={value} onChange={this.handleChange}>
65 <Tab label="API RESPONSE" />
66 <Tab label="METADATA" />
67 <Tab label="PYTHON EXAMPLE" />
68 <Tab label="CLI EXAMPLE" />
69 <Tab label="CURL EXAMPLE" />
71 <DialogContent className={classes.content}>
79 <DialogContentText>{pythonHeader}</DialogContentText>
81 className={classes.codeSnippet}
82 lines={[pythonExample]} />
85 <DialogContentText>{CLIGetHeader}</DialogContentText>
87 className={classes.codeSnippet}
88 lines={[CLIGetExample]} />
89 <DialogContentText className={classes.secondContentText}>{CLIUpdateHeader}</DialogContentText>
91 className={classes.codeSnippet}
92 lines={[CLIUpdateExample]} />
95 <DialogContentText>{curlHeader}</DialogContentText>
97 className={classes.codeSnippet}
98 lines={[curlExample]} />
102 <Button variant='flat' color='primary' onClick={closeDialog}>