Skip to content

Commit

Permalink
Add allow dome calibrations switch
Browse files Browse the repository at this point in the history
  • Loading branch information
albireox committed Aug 19, 2024
1 parent ff852ca commit 2e5e9d1
Showing 1 changed file with 21 additions and 4 deletions.
25 changes: 21 additions & 4 deletions src/components/APITables/OverwatcherTable/OverwatcherTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,12 @@ function OverwatcherPill(props: OverwatcherPillProps) {
);
}

function EnabledGroup(props: OverwatcherPillProps) {
const { value, nodata } = props;
interface EnabledGroupProps {
route: string;
}

function EnabledGroup(props: EnabledGroupProps & OverwatcherPillProps) {
const { route, value, nodata } = props;

const [isOn, setOn] = React.useState(value);

Expand Down Expand Up @@ -80,6 +84,7 @@ function EnabledGroup(props: OverwatcherPillProps) {
</Group>
);
}

export default function OverwatcherTable() {
const [data, , noData, refresh] = useAPICall<OverwatcherResponse>(
'/overwatcher/status',
Expand All @@ -95,7 +100,13 @@ export default function OverwatcherTable() {
{
key: 'enabled',
label: 'Enabled',
value: <EnabledGroup value={data?.enabled} nodata={noData} />,
value: (
<EnabledGroup
route="/overwatcher/status"
value={data?.enabled}
nodata={noData}
/>
),
},
{
key: 'observing',
Expand All @@ -110,7 +121,13 @@ export default function OverwatcherTable() {
{
key: 'allow_dome_calibrations',
label: 'Allow dome calibrations',
value: <OverwatcherPill value={data?.allow_dome_calibrations} nodata={noData} />,
value: (
<EnabledGroup
route="/overwatcher/allow_dome_calibrations"
value={data?.allow_dome_calibrations}
nodata={noData}
/>
),
},
];

Expand Down

0 comments on commit 2e5e9d1

Please sign in to comment.