Skip to content

Commit 83beaf7

Browse files
committed
Add a detector state box in the detector tab
1 parent 0ca6892 commit 83beaf7

File tree

2 files changed

+40
-35
lines changed

2 files changed

+40
-35
lines changed

src/screens/BeamlineStats.tsx

Lines changed: 24 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,26 @@ import { PvComponent } from "../pv/PvComponent";
44
import { forceString, parseNumericPv } from "../pv/util";
55
import { WorkerStatus } from "../components/WorkerStatus";
66

7+
type StateBoxProps = { bgColor: string; title: string; titleColor: string };
8+
79
// These should be in a permanent sidebar
810
// See https://github.com/DiamondLightSource/mx-daq-ui/issues/46
911
// Maybe I should leave this for separate PR when I put in drawer ...
10-
function PmacStagesState() {
11-
const theme = useTheme();
12-
const bgColor = theme.palette.background.paper;
12+
function PmacStagesState(props: StateBoxProps) {
1313
return (
1414
<Grid2
15-
bgcolor={bgColor}
15+
bgcolor={props.bgColor}
1616
justifyContent={"center"}
1717
sx={{
1818
maxWidth: 500,
1919
position: "relative",
2020
padding: 2,
21-
// left: 500,
2221
display: "flex",
2322
}}
24-
// justify={"center"}
2523
>
26-
{/* // <Box
27-
// sx={{
28-
// maxWidth: 400,
29-
// padding: 2,
30-
// position: "relative",
31-
// zIndex: 1,
32-
// left: 250,
33-
// }}
34-
// component={"section"}
35-
// bgColor={bgColor}
36-
// > */}
3724
<Stack alignItems={"center"}>
38-
<Box alignItems={"center"} color={theme.palette.info.main}>
39-
<b>Serial Fixed Target Stages</b>
25+
<Box color={props.titleColor}>
26+
<b>{props.title}</b>
4027
</Box>
4128
<Stack spacing={2} direction="row">
4229
<Stack alignItems={"center"} spacing={1}>
@@ -59,7 +46,7 @@ function PmacStagesState() {
5946
decimals={4}
6047
/>
6148
</Stack>
62-
<Stack alignItems={"center"} spacing={1}>
49+
<Stack alignItems={"center"} spacing={1} justifyContent={"center"}>
6350
<PvComponent
6451
label="Scan Status"
6552
pv="ca://BL24I-MO-STEP-14:signal:P2401"
@@ -84,8 +71,8 @@ export function BeamlineStatsTabPanel() {
8471
<Box sx={{ flexGrow: 1 }}>
8572
<Stack spacing={4} alignItems={"center"}>
8673
<WorkerStatus />
87-
<Grid2 container spacing={2} justifyContent="center">
88-
<Grid2 size={3} sx={{ bgcolor: bgColor }}>
74+
<Grid2 container spacing={3} justifyContent="center">
75+
<Box bgcolor={bgColor}>
8976
<PvComponent
9077
label="Flux"
9178
pv="ca://BL24I-EA-FLUX-01:XBPM-03"
@@ -102,41 +89,45 @@ export function BeamlineStatsTabPanel() {
10289
);
10390
}}
10491
/>
105-
</Grid2>
106-
<Grid2 size={3} sx={{ bgcolor: bgColor }}>
92+
</Box>
93+
<Box bgcolor={bgColor}>
10794
<PvComponent
10895
label="Energy"
10996
pv="ca://BL24I-MO-DCM-01:ENERGY.RBV"
11097
transformValue={parseNumericPv}
11198
decimals={4}
11299
/>
113-
</Grid2>
114-
<Grid2 size={6} sx={{ bgcolor: bgColor }}>
100+
</Box>
101+
<Box bgcolor={bgColor}>
115102
<PvComponent
116103
label="Filter Transmission"
117104
pv="ca://BL24I-OP-ATTN-01:MATCH"
118105
transformValue={parseNumericPv}
119106
decimals={4}
120107
/>
121-
</Grid2>
108+
</Box>
122109
</Grid2>
123110
<Grid2 container spacing={4} justifyContent="center">
124-
<Grid2 size={6} sx={{ bgcolor: bgColor }}>
111+
<Box bgcolor={bgColor}>
125112
<PvComponent
126-
label="Expt Shutter"
113+
label="Experiment Shutter"
127114
pv="ca://BL24I-PS-SHTR-01:CON"
128115
transformValue={forceString}
129116
/>
130-
</Grid2>
131-
<Grid2 size={6} sx={{ bgcolor: bgColor }}>
117+
</Box>
118+
<Box bgcolor={bgColor}>
132119
<PvComponent
133120
label="Fast Shutter"
134121
pv="ca://BL24I-EA-SHTR-01:STA"
135122
transformValue={forceString}
136123
/>
137-
</Grid2>
124+
</Box>
138125
</Grid2>
139-
<PmacStagesState />
126+
<PmacStagesState
127+
bgColor={bgColor}
128+
title="Serial Fixed Target Stages"
129+
titleColor={theme.palette.info.main}
130+
/>
140131
</Stack>
141132
</Box>
142133
);

src/screens/DetectorMotion.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,24 @@
1-
import { Button, Stack } from "@mui/material";
1+
import { Button, Stack, Box, useTheme } from "@mui/material";
22
import { RoPvBox } from "../pv/PvComponent";
33
import { submitAndRunPlanImmediately } from "../blueapi/blueapi";
44

5+
function DetectorState() {
6+
const theme = useTheme();
7+
return (
8+
<Stack spacing={2} direction={"row"}>
9+
<Box color={theme.palette.info.main}>
10+
<p>Detector State</p>
11+
</Box>
12+
<RoPvBox label="P6M" pv="ca://BL24I-EA-PILAT-01:cam1:DetectorState_RBV" />
13+
<RoPvBox label="E9M" pv="ca://BL24I-EA-EIGER-01:CAM:DetectorState_RBV" />
14+
</Stack>
15+
);
16+
}
17+
518
export function DetectorMotionTabPanel() {
619
return (
720
<div>
8-
<Stack spacing={1}>
21+
<Stack spacing={2} alignItems={"center"}>
922
<RoPvBox label="Selected detector" pv="ca://ME14E-MO-IOC-01:GP101" />
1023
<RoPvBox
1124
label="Detector stage y position"
@@ -35,6 +48,7 @@ export function DetectorMotionTabPanel() {
3548
Move to Pilatus!
3649
</Button>
3750
</Stack>
51+
<DetectorState />
3852
</Stack>
3953
</div>
4054
);

0 commit comments

Comments
 (0)