1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from "react";
6 import { compose } from 'redux';
8 withStyles, Dialog, DialogTitle, DialogContent, DialogActions,
9 Button, StyleRulesCallback, WithStyles, Grid
10 } from '@material-ui/core';
11 import { WithDialogProps, withDialog } from "~/store/dialog/with-dialog";
12 import { API_CLIENT_AUTHORIZATION_ATTRIBUTES_DIALOG } from '~/store/api-client-authorizations/api-client-authorizations-actions';
13 import { ArvadosTheme } from '~/common/custom-theme';
14 import { ApiClientAuthorization } from '~/models/api-client-authorization';
15 import { formatDate } from '~/common/formatters';
17 type CssRules = 'root';
19 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
22 '& div:nth-child(odd)': {
24 color: theme.palette.grey["500"]
29 interface AttributesKeepServiceDialogDataProps {
30 apiClientAuthorization: ApiClientAuthorization;
33 export const AttributesApiClientAuthorizationDialog = compose(
34 withDialog(API_CLIENT_AUTHORIZATION_ATTRIBUTES_DIALOG),
36 ({ open, closeDialog, data, classes }: WithDialogProps<AttributesKeepServiceDialogDataProps> & WithStyles<CssRules>) =>
37 <Dialog open={open} onClose={closeDialog} fullWidth maxWidth='sm'>
38 <DialogTitle>Attributes</DialogTitle>
40 {data.apiClientAuthorization && <Grid container direction="row" spacing={16} className={classes.root}>
41 <Grid item xs={5}>UUID</Grid>
42 <Grid item xs={7}>{data.apiClientAuthorization.uuid}</Grid>
43 <Grid item xs={5}>Owner uuid</Grid>
44 <Grid item xs={7}>{data.apiClientAuthorization.ownerUuid}</Grid>
45 <Grid item xs={5}>API Client ID</Grid>
46 <Grid item xs={7}>{data.apiClientAuthorization.apiClientId}</Grid>
47 <Grid item xs={5}>API Token</Grid>
48 <Grid item xs={7}>{data.apiClientAuthorization.apiToken}</Grid>
49 <Grid item xs={5}>Created by IP address</Grid>
50 <Grid item xs={7}>{data.apiClientAuthorization.createdByIpAddress || '(none)'}</Grid>
51 <Grid item xs={5}>Default owner</Grid>
52 <Grid item xs={7}>{data.apiClientAuthorization.defaultOwnerUuid || '(none)'}</Grid>
53 <Grid item xs={5}>Expires at</Grid>
54 <Grid item xs={7}>{formatDate(data.apiClientAuthorization.expiresAt) || '(none)'}</Grid>
55 <Grid item xs={5}>Last used at</Grid>
56 <Grid item xs={7}>{formatDate(data.apiClientAuthorization.lastUsedAt) || '(none)'}</Grid>
57 <Grid item xs={5}>Last used by IP address</Grid>
58 <Grid item xs={7}>{data.apiClientAuthorization.lastUsedByIpAddress || '(none)'}</Grid>
59 <Grid item xs={5}>Scopes</Grid>
60 <Grid item xs={7}>{JSON.stringify(data.apiClientAuthorization.scopes || '(none)')}</Grid>
61 <Grid item xs={5}>User ID</Grid>
62 <Grid item xs={7}>{data.apiClientAuthorization.userId || '(none)'}</Grid>
63 <Grid item xs={5}>Created at</Grid>
64 <Grid item xs={7}>{formatDate(data.apiClientAuthorization.createdAt) || '(none)'}</Grid>
65 <Grid item xs={5}>Updated at</Grid>
66 <Grid item xs={7}>{formatDate(data.apiClientAuthorization.updatedAt) || '(none)'}</Grid>
73 onClick={closeDialog}>