// Copyright (C) The Arvados Authors. All rights reserved. // // SPDX-License-Identifier: AGPL-3.0 import * as React from "react"; import { Dialog, DialogActions, Button, StyleRulesCallback, WithStyles, withStyles, DialogTitle, DialogContent, Tabs, Tab, DialogContentText } from '@material-ui/core'; import { WithDialogProps } from '~/store/dialog/with-dialog'; import { withDialog } from "~/store/dialog/with-dialog"; import { compose } from 'redux'; import { ADVANCED_TAB_DIALOG } from "~/store/advanced-tab/advanced-tab"; import { DefaultCodeSnippet } from "~/components/default-code-snippet/default-code-snippet"; import { MetadataTab } from '~/views-components/advanced-tab-dialog/metadataTab'; type CssRules = 'content' | 'codeSnippet' | 'spacing'; const styles: StyleRulesCallback = theme => ({ content: { paddingTop: theme.spacing.unit * 3, minHeight: '400px', minWidth: '1232px' }, codeSnippet: { borderRadius: theme.spacing.unit * 0.5, border: '1px solid', borderColor: theme.palette.grey["400"], maxHeight: '400px' }, spacing: { paddingBottom: theme.spacing.unit * 2 }, }); export const AdvancedTabDialog = compose( withDialog(ADVANCED_TAB_DIALOG), withStyles(styles), )( class extends React.Component & WithStyles>{ state = { value: 0, }; componentDidMount() { this.setState({ value: 0 }); } handleChange = (event: React.MouseEvent, value: number) => { this.setState({ value }); } render() { const { classes, open, closeDialog } = this.props; const { value } = this.state; const { apiResponse, metadata, pythonHeader, pythonExample, cliGetHeader, cliGetExample, cliUpdateHeader, cliUpdateExample, curlHeader, curlExample } = this.props.data; return this.setState({ value: 0 })} > Advanced {value === 0 &&
{dialogContentExample(apiResponse, classes)}
} {value === 1 &&
{metadata.items.length > 0 ? : dialogContentHeader('(No metadata links found)')}
} {value === 2 && dialogContent(pythonHeader, pythonExample, classes)} {value === 3 &&
{dialogContent(cliGetHeader, cliGetExample, classes)} {dialogContent(cliUpdateHeader, cliUpdateExample, classes)}
} {value === 4 && dialogContent(curlHeader, curlExample, classes)}
; } } ); const dialogContent = (header: string, example: string, classes: any) =>
{dialogContentHeader(header)} {dialogContentExample(example, classes)}
; const dialogContentHeader = (header: string) => {header} ; const dialogContentExample = (example: string, classes: any) => ;