-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathAutomatedCommandSequenceList.jsx
More file actions
executable file
·86 lines (82 loc) · 3.73 KB
/
AutomatedCommandSequenceList.jsx
File metadata and controls
executable file
·86 lines (82 loc) · 3.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
import React from 'react'
import Typography from "@material-ui/core/Typography";
import ErrorOutlineIcon from '@material-ui/icons/ErrorOutline';
import EditIcon from "@material-ui/icons/Edit";
import DeleteIcon from '@material-ui/icons/Delete';
import Table from '@material-ui/core/Table';
import TableBody from '@material-ui/core/TableBody';
import TableCell from '@material-ui/core/TableCell';
import TableHead from '@material-ui/core/TableHead';
import TableRow from '@material-ui/core/TableRow';
import LinearProgress from '@material-ui/core/LinearProgress';
import IconButton from '@material-ui/core/IconButton';
import ArrowDropUpIcon from '@material-ui/icons/ArrowDropUp';
import ArrowDropDownIcon from '@material-ui/icons/ArrowDropDown';
const AutomatedCommandSequenceList = (props) => {
if (props.isLoading) {
return (
<div>
<LinearProgress />
</div>
)
}
if (props.empty && !props.isLoading) {
return (
<div>
<ErrorOutlineIcon /> There are no automated command sequences!
</div>
)
}
const getArgString = (args) => {
let allArgs = [];
args.forEach((arg) => allArgs.push(arg.argument));
return allArgs.join(", ");
}
return (
<div>
<Table aria-label="simple table" size="small">
<TableHead>
<TableRow>
<TableCell style={{fontWeight: "bold"}}>Command Name</TableCell>
<TableCell style={{fontWeight: "bold"}}>Arguments</TableCell>
<TableCell style={{fontWeight: "bold"}} align="right">{props.is_admin ? "Navigation" : ""}</TableCell>
</TableRow>
</TableHead>
<TableBody>
{props.commands.map((command, idx) => (
<TableRow key={idx}>
<TableCell component="th" scope="row">
{command.command.command_name}
</TableCell>
<TableCell>
{getArgString(command.args)}
</TableCell>
{props.is_admin &&
<TableCell align="right">
<IconButton onClick={(event) => props.handleRearrangeClick(event, idx, true)}>
<ArrowDropUpIcon style={{color: '#4bacb8'}} />
</IconButton>
<IconButton onClick={(event) => props.handleRearrangeClick(event, idx, false)}>
<ArrowDropDownIcon style={{color: '#4bacb8'}} />
</IconButton>
<IconButton onClick={(event) => props.handleEditCommandOpenClick(event, idx)}>
<EditIcon style={{color: "#4bacb8"}} />
</IconButton>
<IconButton onClick={(event) => props.handleDeleteCommandOpenClick(event, idx)}>
<DeleteIcon style={{color: '#4bacb8'}} />
</IconButton>
</TableCell>
}
{!props.is_admin &&
<TableCell align="right">
<Typography variant="body1"></Typography>
</TableCell>
}
</TableRow>
))}
</TableBody>
</Table>
</div>
)
}
export default AutomatedCommandSequenceList;