Skip to content

Commit 8d8a38f

Browse files
committed
Start a general component for a button to run a plan
1 parent 56fc03b commit 8d8a38f

File tree

2 files changed

+33
-6
lines changed

2 files changed

+33
-6
lines changed

src/blueapi/BlueapiComponents.tsx

Lines changed: 32 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from "react";
2-
import { abortCurrentPlan } from "./blueapi";
2+
import { abortCurrentPlan, submitAndRunPlanImmediately } from "./blueapi";
33
import {
44
Alert,
55
Button,
@@ -8,7 +8,37 @@ import {
88
Tooltip,
99
} from "@mui/material";
1010

11-
export function RunPlanButton() {}
11+
type PlanButtonProps = {
12+
btnLabel: string;
13+
planName: string;
14+
planParams?: object;
15+
title?: string;
16+
// btnColour?: string;
17+
// btnVariant?: string;
18+
};
19+
20+
export function RunPlanButton(props: PlanButtonProps) {
21+
const params = props.planParams ? props.planParams : {};
22+
23+
return (
24+
<div>
25+
<Tooltip title={props.title ? props.title : ""} placement="bottom">
26+
<Button
27+
variant="contained"
28+
color="custom"
29+
onClick={() =>
30+
submitAndRunPlanImmediately({
31+
planName: props.planName,
32+
planParams: params,
33+
})
34+
}
35+
>
36+
{props.btnLabel}
37+
</Button>
38+
</Tooltip>
39+
</div>
40+
);
41+
}
1242

1343
export function AbortButton() {
1444
const [openMsg, setOpenMsg] = React.useState<boolean>(false);

src/screens/CollectionPanel.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,7 @@ import {
1313
import { PvComponent } from "../pv/PvComponent";
1414
import React from "react";
1515
import { MapView, PumpProbeOptions } from "../components/CollectionComponents";
16-
import {
17-
abortCurrentPlan,
18-
submitAndRunPlanImmediately,
19-
} from "../blueapi/blueapi";
16+
import { submitAndRunPlanImmediately } from "../blueapi/blueapi";
2017
import { chipTypes, MapTypes, pumpProbeMode } from "../components/params";
2118
import { forceString } from "../pv/util";
2219
import { AbortButton } from "../blueapi/BlueapiComponents";

0 commit comments

Comments
 (0)