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' | '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 '& span:first-child': {
32 type SubprocessesProps = WithStyles<CssRules>;
34 export const SubprocessesCard = withStyles(styles)(
35 class extends React.Component<SubprocessesProps> {
44 handleChange = (name: string) => (event: any) => {
45 this.setState({ [name]: event.target.checked });
49 const { classes } = this.props;
51 <Card className={classes.root}>
52 <CardHeader title="Subprocesses and filters" />
54 <Grid container direction="row" spacing={16} justify="flex-start" alignItems="stretch">
56 <Grid container direction="column" alignItems="flex-end" spacing={8}>
57 <Grid item className={classes.label}>Subprocesses:</Grid>
58 <Grid item className={classes.label}>Queued:</Grid>
59 <Grid item className={classes.label}>Active:</Grid>
63 <Grid container direction="column" alignItems="flex-start" spacing={8}>
64 <Grid item className={classes.value}>1</Grid>
65 <Grid item className={classes.value}>
67 <Switch classes={{ root: classes.switch }}
68 checked={this.state.queued}
69 onChange={this.handleChange('queued')}
73 <Grid item className={classes.value}>
75 <Switch classes={{ root: classes.switch }}
76 checked={this.state.active}
77 onChange={this.handleChange('active')}
83 <Grid item className={classes.grid}>
84 <Grid container direction="column" alignItems="flex-end" spacing={8}>
85 <Grid item className={classes.label}> </Grid>
86 <Grid item className={classes.label}>Completed:</Grid>
87 <Grid item className={classes.label}>Failed:</Grid>
91 <Grid container direction="column" alignItems="flex-end" spacing={8}>
92 <Grid item className={classes.value}> </Grid>
93 <Grid item className={classes.value}>
95 <Switch classes={{ root: classes.switch }}
96 checked={this.state.completed}
97 onChange={this.handleChange('completed')}
101 <Grid item className={classes.value}>
103 <Switch classes={{ root: classes.switch }}
104 checked={this.state.failed}
105 onChange={this.handleChange('failed')}