Pointf5ive commited on
Commit
f21149b
·
1 Parent(s): bef6364

Keep dashboard intake controls mounted after refresh

Browse files
Files changed (1) hide show
  1. app.py +17 -9
app.py CHANGED
@@ -1416,24 +1416,32 @@ HEAD = """
1416
  return true;
1417
  };
1418
 
1419
- const mountIntakeRow = () => {
1420
- const mount = document.getElementById('totem-intake-mount');
1421
- const row = document.getElementById('intake-row');
1422
- if (!mount || !row) return;
1423
- if (row.parentElement !== mount) {
1424
- mount.appendChild(row);
1425
  }
 
1426
  };
1427
 
1428
- const mountRunButton = () => {
1429
- const mount = document.getElementById('totem-run-mount');
1430
- const row = document.getElementById('totem-run-button-row');
1431
  if (!mount || !row) return;
1432
  if (row.parentElement !== mount) {
1433
  mount.appendChild(row);
1434
  }
1435
  };
1436
 
 
 
 
 
 
 
 
 
1437
  const mountDashboardControls = () => {
1438
  mountRunButton();
1439
  mountIntakeRow();
 
1416
  return true;
1417
  };
1418
 
1419
+ const persistentNode = (key, id) => {
1420
+ const live = document.getElementById(id);
1421
+ if (live) {
1422
+ window[key] = live;
1423
+ return live;
 
1424
  }
1425
+ return window[key] || null;
1426
  };
1427
 
1428
+ const mountPersistentRow = (mountId, rowId, key) => {
1429
+ const mount = document.getElementById(mountId);
1430
+ const row = persistentNode(key, rowId);
1431
  if (!mount || !row) return;
1432
  if (row.parentElement !== mount) {
1433
  mount.appendChild(row);
1434
  }
1435
  };
1436
 
1437
+ const mountIntakeRow = () => {
1438
+ mountPersistentRow('totem-intake-mount', 'intake-row', '__totemIntakeRow');
1439
+ };
1440
+
1441
+ const mountRunButton = () => {
1442
+ mountPersistentRow('totem-run-mount', 'totem-run-button-row', '__totemRunButtonRow');
1443
+ };
1444
+
1445
  const mountDashboardControls = () => {
1446
  mountRunButton();
1447
  mountIntakeRow();