1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import React from "react";
6 import { Dialog, DialogTitle, DialogContent, DialogActions, Button } from "@material-ui/core";
7 import { WithDialogProps } from "store/dialog/with-dialog";
8 import { withDialog } from 'store/dialog/with-dialog';
9 import { DefaultCodeSnippet } from 'components/default-code-snippet/default-code-snippet';
10 import { StyleRulesCallback, WithStyles, withStyles } from '@material-ui/core/styles';
11 import { ArvadosTheme } from 'common/custom-theme';
12 import { compose } from "redux";
13 import { API_CLIENT_AUTHORIZATION_HELP_DIALOG } from 'store/api-client-authorizations/api-client-authorizations-actions';
15 type CssRules = 'codeSnippet';
17 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
19 borderRadius: theme.spacing.unit * 0.5,
20 border: `1px solid ${theme.palette.grey["400"]}`,
27 interface HelpApiClientAuthorizationDataProps {
33 export const HelpApiClientAuthorizationDialog = compose(
34 withDialog(API_CLIENT_AUTHORIZATION_HELP_DIALOG),
36 (props: WithDialogProps<HelpApiClientAuthorizationDataProps> & WithStyles<CssRules>) =>
37 <Dialog open={props.open}
38 onClose={props.closeDialog}
41 <DialogTitle>HELP:</DialogTitle>
44 className={props.classes.codeSnippet}
45 lines={[snippetText(props.data)]} />
46 {/* // lines={snippetText2(props.data)} /> */}
52 onClick={props.closeDialog}>
59 const snippetText = (data: HelpApiClientAuthorizationDataProps) => `### Pasting the following lines at a shell prompt will allow Arvados SDKs
60 ### to authenticate to your account, ${data.email}
62 read ARVADOS_API_TOKEN <<EOF
65 export ARVADOS_API_TOKEN ARVADOS_API_HOST=${data.apiHost}
66 unset ARVADOS_API_HOST_INSECURE`;