1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import * as React from 'react';
6 import { ArvadosTheme } from '~/common/custom-theme';
7 import { StyleRulesCallback, withStyles, WithStyles, Card, CardHeader, CardContent, Grid, Switch } from '@material-ui/core';
9 type CssRules = 'root' | 'label' | 'value' | 'middleValue' | 'switch' | 'grid';
11 const styles: StyleRulesCallback<CssRules> = (theme: ArvadosTheme) => ({
16 color: theme.palette.grey["500"],
17 marginBottom: theme.spacing.unit
20 marginBottom: theme.spacing.unit
23 marginBottom: theme.spacing.unit - 2
26 '& span:first-child': {
35 type SubprocessesProps = WithStyles<CssRules>;
37 export const SubprocessesCard = withStyles(styles)(
38 class extends React.Component<SubprocessesProps> {
47 handleChange = (name: string) => (event: any) => {
48 this.setState({ [name]: event.target.checked });
52 const { classes } = this.props;
54 <Card className={classes.root}>
55 <CardHeader title="Subprocess and filters" />
57 <Grid container direction="row" spacing={16} justify="flex-start" alignItems="stretch">
59 <Grid container direction="column" alignItems="flex-end" spacing={8}>
60 <Grid item className={classes.label}>Subprocesses:</Grid>
61 <Grid item className={classes.label}>Queued:</Grid>
62 <Grid item className={classes.label}>Active:</Grid>
66 <Grid container direction="column" alignItems="flex-start" spacing={8}>
67 <Grid item className={classes.value}>1</Grid>
68 <Grid item className={classes.middleValue}>
70 <Switch classes={{ root: classes.switch }}
71 checked={this.state.queued}
72 onChange={this.handleChange('queued')}
76 <Grid item className={classes.value}>
78 <Switch classes={{ root: classes.switch }}
79 checked={this.state.active}
80 onChange={this.handleChange('active')}
86 <Grid item className={classes.grid}>
87 <Grid container direction="column" alignItems="flex-end" spacing={8}>
88 <Grid item className={classes.label}> </Grid>
89 <Grid item className={classes.label}>Completed:</Grid>
90 <Grid item className={classes.label}>Failed:</Grid>
94 <Grid container direction="column" alignItems="flex-end" spacing={8}>
95 <Grid item className={classes.value}> </Grid>
96 <Grid item className={classes.middleValue}>
98 <Switch classes={{ root: classes.switch }}
99 checked={this.state.completed}
100 onChange={this.handleChange('completed')}
104 <Grid item className={classes.value}>
106 <Switch classes={{ root: classes.switch }}
107 checked={this.state.failed}
108 onChange={this.handleChange('failed')}