Skip to content

Commit b9da8db

Browse files
committed
web: TacComponents: UpdateChannels: take enable_polling into account
No need to show a spinner if polling for updates is not enabled etc.. Signed-off-by: Leonard Göhrs <[email protected]>
1 parent 848692b commit b9da8db

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

web/src/TacComponents.tsx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,13 @@ export function UpdateChannels() {
225225
const channels_topic = useMqttSubscription<Array<Channel>>(
226226
"/v1/tac/update/channels",
227227
);
228+
const enable_polling_topic = useMqttSubscription<Array<Channel>>(
229+
"/v1/tac/update/enable_polling",
230+
);
228231

229232
const channels = channels_topic !== undefined ? channels_topic : [];
233+
const enable_polling =
234+
enable_polling_topic !== undefined ? enable_polling_topic : false;
230235

231236
return (
232237
<Table
@@ -260,7 +265,9 @@ export function UpdateChannels() {
260265
{
261266
id: "enabled",
262267
header: "Enabled",
263-
cell: (e) => <Checkbox checked={e.enabled} />,
268+
cell: (e) => (
269+
<Checkbox checked={e.enabled} disabled={!enable_polling} />
270+
),
264271
},
265272
{
266273
id: "description",
@@ -276,8 +283,12 @@ export function UpdateChannels() {
276283
},
277284
{
278285
id: "interval",
279-
header: "Update Interval",
286+
header: "Polling Interval",
280287
cell: (e) => {
288+
if (!enable_polling) {
289+
return "Disabled";
290+
}
291+
281292
if (!e.polling_interval) {
282293
return "Never";
283294
}
@@ -313,7 +324,11 @@ export function UpdateChannels() {
313324
}
314325

315326
if (!e.bundle) {
316-
return <Spinner />;
327+
if (enable_polling) {
328+
return <Spinner />;
329+
} else {
330+
return "Polling disabled";
331+
}
317332
}
318333

319334
if (!e.bundle.newer_than_installed) {

0 commit comments

Comments
 (0)