@rocket.chat/houston 0.27.0-next.3 → 2.1.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (293) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -15
  3. package/bin/houston +62 -0
  4. package/data/docs/ARCHITECTURE.md +387 -0
  5. package/data/docs/automation.md +107 -0
  6. package/data/docs/e2ee.md +76 -0
  7. package/data/docs/eks.md +258 -0
  8. package/data/docs/gui.md +282 -0
  9. package/data/docs/guide.md +669 -0
  10. package/data/docs/kubernetes.md +138 -0
  11. package/data/docs/troubleshooting.md +193 -0
  12. package/data/docs/upgrading.md +84 -0
  13. package/data/docs/voice.md +253 -0
  14. package/data/iam/engineer-policy.json +11 -0
  15. package/data/iam/engineer-rbac.yaml +42 -0
  16. package/data/iam/operator-policy.json +211 -0
  17. package/data/loadtest/badbot.js +22 -0
  18. package/data/loadtest/common.js +168 -0
  19. package/data/loadtest/custom.js +20 -0
  20. package/data/loadtest/journey.js +58 -0
  21. package/data/loadtest/login.js +18 -0
  22. package/data/loadtest/messages.js +13 -0
  23. package/data/loadtest/mixed.js +39 -0
  24. package/data/loadtest/read.js +12 -0
  25. package/data/loadtest/webhook.js +20 -0
  26. package/data/monitoring/houston-logs.json +98 -0
  27. package/data/monitoring/k6-loadtest.json +610 -0
  28. package/data/monitoring/mongodb-exporter.json +3007 -0
  29. package/data/monitoring/node-exporter-full.json +16114 -0
  30. package/data/monitoring/rocketchat-metrics.json +6471 -0
  31. package/data/presets/airgapped.yaml +16 -0
  32. package/data/presets/default.yaml +9 -0
  33. package/data/seed/avatar-0.png +0 -0
  34. package/data/seed/avatar-1.png +0 -0
  35. package/data/seed/avatar-2.png +0 -0
  36. package/data/seed/avatar-3.png +0 -0
  37. package/data/seed/avatar-4.png +0 -0
  38. package/data/seed/avatar-5.png +0 -0
  39. package/data/seed/avatar-6.png +0 -0
  40. package/data/seed/avatar-7.png +0 -0
  41. package/data/seed/seed-metrics.csv +3 -0
  42. package/data/seed/seed-preview.png +0 -0
  43. package/data/seed/seed-report.pdf +32 -0
  44. package/data/seed/seed-runbook.txt +3 -0
  45. package/data/skill/SKILL.md +399 -0
  46. package/data/versions.yaml +55 -0
  47. package/data/voice/freeswitch/drachtio.xml +52 -0
  48. package/data/voice/freeswitch/public.xml +87 -0
  49. package/data/webui/app.css +2003 -0
  50. package/data/webui/index.html +678 -0
  51. package/data/webui/js/api.js +561 -0
  52. package/data/webui/js/boot.js +44 -0
  53. package/data/webui/js/clusters-tail.js +1377 -0
  54. package/data/webui/js/clusters.js +896 -0
  55. package/data/webui/js/create.js +276 -0
  56. package/data/webui/js/detail.js +507 -0
  57. package/data/webui/js/jobs.js +636 -0
  58. package/data/webui/js/logs.js +634 -0
  59. package/data/webui/js/main.js +14 -0
  60. package/data/webui/js/options.js +408 -0
  61. package/data/webui/js/people.js +438 -0
  62. package/data/webui/js/perf.js +303 -0
  63. package/data/webui/js/render.js +438 -0
  64. package/data/webui/js/shared.js +3 -0
  65. package/data/webui/js/state.js +583 -0
  66. package/data/webui/js/theme.js +123 -0
  67. package/data/webui/js/util.js +584 -0
  68. package/dist/cli/app.js +593 -0
  69. package/dist/cli/capabilities.js +76 -0
  70. package/dist/cli/cell-widths.js +495 -0
  71. package/dist/cli/entry.js +10 -0
  72. package/dist/cli/error-panel.js +492 -0
  73. package/dist/cli/handlers/actor.js +84 -0
  74. package/dist/cli/handlers/https.js +614 -0
  75. package/dist/cli/handlers/prompt.js +299 -0
  76. package/dist/cli/handlers/users.js +226 -0
  77. package/dist/cli/handlers.js +3678 -0
  78. package/dist/cli/help.js +183 -0
  79. package/dist/cli/index.js +15 -0
  80. package/dist/cli/perf.js +810 -0
  81. package/dist/cli/render.js +254 -0
  82. package/dist/cli/serve.js +858 -0
  83. package/dist/cli/spec-data.js +2593 -0
  84. package/dist/cli/spec-types.js +8 -0
  85. package/dist/cli/usage-error.js +520 -0
  86. package/dist/cli/wire.js +70 -0
  87. package/dist/core/audit.js +346 -0
  88. package/dist/core/backup-compat.js +85 -0
  89. package/dist/core/backup.js +1639 -0
  90. package/dist/core/cluster.js +1398 -0
  91. package/dist/core/configimport.js +344 -0
  92. package/dist/core/data.js +267 -0
  93. package/dist/core/database-of.js +82 -0
  94. package/dist/core/diagnose.js +159 -0
  95. package/dist/core/doctor.js +1518 -0
  96. package/dist/core/edge/acme.js +338 -0
  97. package/dist/core/edge/engine.js +500 -0
  98. package/dist/core/edge/networks.js +174 -0
  99. package/dist/core/edge/paths.js +107 -0
  100. package/dist/core/edge/routes.js +251 -0
  101. package/dist/core/edge/routeyml.js +195 -0
  102. package/dist/core/edge/runtime.js +493 -0
  103. package/dist/core/edge/spec.js +305 -0
  104. package/dist/core/edge/types.js +202 -0
  105. package/dist/core/eks-docs.js +135 -0
  106. package/dist/core/eks.js +2240 -0
  107. package/dist/core/envvars.js +562 -0
  108. package/dist/core/eventlog.js +541 -0
  109. package/dist/core/firstrun.js +153 -0
  110. package/dist/core/journal.js +691 -0
  111. package/dist/core/kube/ask.js +231 -0
  112. package/dist/core/kube/capabilities.js +269 -0
  113. package/dist/core/kube/certmanager.js +452 -0
  114. package/dist/core/kube/chart.js +413 -0
  115. package/dist/core/kube/cluster.js +196 -0
  116. package/dist/core/kube/context.js +545 -0
  117. package/dist/core/kube/endpoints.js +448 -0
  118. package/dist/core/kube/exec.js +195 -0
  119. package/dist/core/kube/forward.js +732 -0
  120. package/dist/core/kube/grafana-ingress.js +110 -0
  121. package/dist/core/kube/ingress.js +218 -0
  122. package/dist/core/kube/manifests.js +361 -0
  123. package/dist/core/kube/monitoring.js +768 -0
  124. package/dist/core/kube/names.js +237 -0
  125. package/dist/core/kube/namespace.js +678 -0
  126. package/dist/core/kube/operator.js +941 -0
  127. package/dist/core/kube/probe.js +202 -0
  128. package/dist/core/kube/reachability.js +163 -0
  129. package/dist/core/kube/release.js +439 -0
  130. package/dist/core/kube/replicaset.js +180 -0
  131. package/dist/core/kube/scale.js +398 -0
  132. package/dist/core/kube/status.js +633 -0
  133. package/dist/core/kube/tools.js +238 -0
  134. package/dist/core/kube/transfer.js +173 -0
  135. package/dist/core/kube/workspace.js +423 -0
  136. package/dist/core/lifecycle/admin.js +64 -0
  137. package/dist/core/lifecycle/create-docker.js +1533 -0
  138. package/dist/core/lifecycle/create-k8s.js +939 -0
  139. package/dist/core/lifecycle/destroy.js +339 -0
  140. package/dist/core/lifecycle/inspect.js +635 -0
  141. package/dist/core/lifecycle/naming.js +298 -0
  142. package/dist/core/lifecycle/notes.js +726 -0
  143. package/dist/core/lifecycle/ownership.js +313 -0
  144. package/dist/core/lifecycle/payload.js +401 -0
  145. package/dist/core/lifecycle/ports.js +388 -0
  146. package/dist/core/lifecycle/preconditions.js +367 -0
  147. package/dist/core/lifecycle/pruning.js +551 -0
  148. package/dist/core/lifecycle/ready.js +753 -0
  149. package/dist/core/lifecycle/request.js +525 -0
  150. package/dist/core/lifecycle/seeding.js +281 -0
  151. package/dist/core/lifecycle/sizing.js +392 -0
  152. package/dist/core/lifecycle/state.js +286 -0
  153. package/dist/core/lifecycle/tlsplan.js +704 -0
  154. package/dist/core/lifecycle/types.js +232 -0
  155. package/dist/core/loadtest.js +995 -0
  156. package/dist/core/migrate.js +612 -0
  157. package/dist/core/monitor.js +494 -0
  158. package/dist/core/postready.js +969 -0
  159. package/dist/core/promote.js +804 -0
  160. package/dist/core/rcapi.js +1285 -0
  161. package/dist/core/recovery.js +75 -0
  162. package/dist/core/runner/engine.js +394 -0
  163. package/dist/core/runner/host.js +298 -0
  164. package/dist/core/runner/locks.js +129 -0
  165. package/dist/core/runner/paths.js +173 -0
  166. package/dist/core/runner/ports.js +172 -0
  167. package/dist/core/runner/queries.js +612 -0
  168. package/dist/core/runner/record.js +563 -0
  169. package/dist/core/scaleseed.js +271 -0
  170. package/dist/core/seed-db.js +208 -0
  171. package/dist/core/sessions.js +472 -0
  172. package/dist/core/skill.js +326 -0
  173. package/dist/core/sso-identities.js +172 -0
  174. package/dist/core/sso.js +703 -0
  175. package/dist/core/tls-local.js +311 -0
  176. package/dist/core/tls.js +878 -0
  177. package/dist/core/topology.js +482 -0
  178. package/dist/core/upgrade.js +868 -0
  179. package/dist/core/users.js +739 -0
  180. package/dist/lib/audit.js +100 -0
  181. package/dist/lib/close-matches.js +238 -0
  182. package/dist/lib/compose.js +672 -0
  183. package/dist/lib/config.js +1398 -0
  184. package/dist/lib/context.js +18 -0
  185. package/dist/lib/errors.js +305 -0
  186. package/dist/lib/events.js +208 -0
  187. package/dist/lib/float-text.js +126 -0
  188. package/dist/lib/format.js +1320 -0
  189. package/dist/lib/home.js +325 -0
  190. package/dist/lib/journal.js +122 -0
  191. package/dist/lib/json-text.js +733 -0
  192. package/dist/lib/jsonout.js +382 -0
  193. package/dist/lib/lock.js +516 -0
  194. package/dist/lib/login-name.js +202 -0
  195. package/dist/lib/map-limit.js +29 -0
  196. package/dist/lib/mkdir-parents.js +90 -0
  197. package/dist/lib/mongo-kernel.js +67 -0
  198. package/dist/lib/monitoring.js +492 -0
  199. package/dist/lib/platform-name.js +59 -0
  200. package/dist/lib/presets/common.js +390 -0
  201. package/dist/lib/presets/composite.js +326 -0
  202. package/dist/lib/presets/e2ee.js +143 -0
  203. package/dist/lib/presets/email.js +172 -0
  204. package/dist/lib/presets/guides.js +27 -0
  205. package/dist/lib/presets/index.js +490 -0
  206. package/dist/lib/presets/keycloak.js +369 -0
  207. package/dist/lib/presets/ldap.js +1285 -0
  208. package/dist/lib/presets/livechat.js +220 -0
  209. package/dist/lib/presets/multi-instance.js +124 -0
  210. package/dist/lib/presets/oidc.js +161 -0
  211. package/dist/lib/presets/public.js +496 -0
  212. package/dist/lib/presets/registry.js +64 -0
  213. package/dist/lib/presets/s3-minio.js +300 -0
  214. package/dist/lib/presets/saml.js +149 -0
  215. package/dist/lib/presets/scenario.js +51 -0
  216. package/dist/lib/presets/types.js +86 -0
  217. package/dist/lib/presets/voice-pbx.js +320 -0
  218. package/dist/lib/presets/voice.js +345 -0
  219. package/dist/lib/presets/webhooks.js +182 -0
  220. package/dist/lib/redact.js +106 -0
  221. package/dist/lib/seed-options.js +68 -0
  222. package/dist/lib/seed-profiles.js +59 -0
  223. package/dist/lib/targz.js +1383 -0
  224. package/dist/lib/teammode.js +25 -0
  225. package/dist/lib/tempdir.js +162 -0
  226. package/dist/lib/unicode-tables.js +2335 -0
  227. package/dist/lib/version-spec.js +357 -0
  228. package/dist/lib/versions.js +463 -0
  229. package/dist/lib/yaml-dump.js +1361 -0
  230. package/dist/perf/baseline.js +168 -0
  231. package/dist/perf/constrain.js +296 -0
  232. package/dist/perf/k6.js +235 -0
  233. package/dist/perf/mongoprof.js +171 -0
  234. package/dist/perf/rcmetrics.js +178 -0
  235. package/dist/perf/report.js +386 -0
  236. package/dist/perf/resources.js +224 -0
  237. package/dist/perf/slo.js +111 -0
  238. package/dist/perf/timeline.js +187 -0
  239. package/dist/perf/timings.js +85 -0
  240. package/dist/perf/verdict.js +201 -0
  241. package/dist/seams/aws-cli.js +126 -0
  242. package/dist/seams/docker-cli.js +280 -0
  243. package/dist/seams/exec.js +861 -0
  244. package/dist/seams/fs/lock.js +528 -0
  245. package/dist/seams/kubectl.js +83 -0
  246. package/dist/seams/rc-http.js +921 -0
  247. package/dist/seed/apply.js +190 -0
  248. package/dist/seed/assets.js +76 -0
  249. package/dist/seed/check.js +391 -0
  250. package/dist/seed/client.js +172 -0
  251. package/dist/seed/executor.js +726 -0
  252. package/dist/seed/history.js +281 -0
  253. package/dist/seed/kinds.js +91 -0
  254. package/dist/seed/plan.js +432 -0
  255. package/dist/seed/receipt.js +339 -0
  256. package/dist/seed/repairs.js +75 -0
  257. package/dist/seed/verification.js +363 -0
  258. package/dist/seed/wording.js +248 -0
  259. package/dist/web/app.js +326 -0
  260. package/dist/web/jobs.js +510 -0
  261. package/dist/web/route-deps.js +211 -0
  262. package/dist/web/route-table.js +213 -0
  263. package/dist/web/routes/backup.js +244 -0
  264. package/dist/web/routes/clusters.js +303 -0
  265. package/dist/web/routes/data.js +187 -0
  266. package/dist/web/routes/edge.js +82 -0
  267. package/dist/web/routes/index.js +63 -0
  268. package/dist/web/routes/jobs.js +95 -0
  269. package/dist/web/routes/logs.js +297 -0
  270. package/dist/web/routes/meta.js +191 -0
  271. package/dist/web/routes/people.js +151 -0
  272. package/dist/web/routes/perf.js +95 -0
  273. package/dist/web/routes/repros.js +550 -0
  274. package/dist/web/routes/session.js +361 -0
  275. package/dist/web/routes/spa.js +198 -0
  276. package/dist/web/security.js +475 -0
  277. package/dist/web/signin.js +246 -0
  278. package/package.json +67 -32
  279. package/.eslintrc +0 -94
  280. package/.swcrc +0 -18
  281. package/dist/bin.js +0 -3
  282. package/dist/cli.js +0 -184
  283. package/dist/commands/createBranch.js +0 -194
  284. package/dist/outputCI.js +0 -59
  285. package/src/bin.js +0 -4
  286. package/src/cli.ts +0 -25
  287. package/src/commands/createBranch.ts +0 -28
  288. package/src/outputCI.ts +0 -12
  289. package/src-old/logs.js +0 -323
  290. package/src-old/md.js +0 -191
  291. package/src-old/release-table.js +0 -60
  292. package/src-old/set-version.js +0 -614
  293. package/src-old/utils.js +0 -15
@@ -0,0 +1,584 @@
1
+ import { ctx } from "./shared.js";
2
+
3
+ "use strict";
4
+ const $ = (sel) => document.querySelector(sel);
5
+ const el = (tag, attrs = {}, ...kids) => {
6
+ const n = document.createElement(tag);
7
+ for (const [k, v] of Object.entries(attrs)) {
8
+ if (k === "class") n.className = v;
9
+ else if (k === "html") n.innerHTML = v;
10
+ else if (k.startsWith("on")) n.addEventListener(k.slice(2), v);
11
+ else n.setAttribute(k, v);
12
+ }
13
+ for (const kid of kids) n.append(kid);
14
+ return n;
15
+ };
16
+
17
+ // kind: "error" (default) | "ok" | "info". Toasts were unconditionally red, so
18
+ // "copied" and "pruned 3" flashed like failures; and every toast shared one fixed
19
+ // position, so a repeating failure (the 4s poll against a bad token) piled
20
+ // unreadable banners exactly on top of each other.
21
+ function toast(msg, kind = "error") {
22
+ const stack = $("#toasts") || el("div", { id: "toasts", class: "toasts" });
23
+ // INSIDE THE OPEN MODAL, when there is one. showModal() puts a dialog in the top layer
24
+ // and the rest of the page under its backdrop -- a stack on <body> included -- so a
25
+ // create the server refused toasted its reason where nobody could read it, and Create
26
+ // looked as if it had done nothing. Re-homed on every toast, because which dialog is
27
+ // open changes; the last open modal in the document stands in for the topmost.
28
+ const host = [...document.querySelectorAll("dialog[open]")].filter((d) => d.matches(":modal")).pop()
29
+ || document.body;
30
+ if (stack.parentElement !== host) host.append(stack);
31
+ const last = stack.lastElementChild;
32
+ if (last && last.textContent === msg) last.remove(); // collapse an identical repeat
33
+ const t = el("div", { class: "toast " + kind, role: "status" }, msg);
34
+ stack.append(t);
35
+ while (stack.childElementCount > 4) stack.removeChild(stack.firstChild);
36
+ setTimeout(() => t.remove(), 4000);
37
+ }
38
+
39
+ // EVERY url on screen is the one the server reported, shown and linked verbatim.
40
+ //
41
+ // There used to be a rewrite here that swapped `localhost` for whatever host the
42
+ // GUI was loaded from, so that links stayed clickable when `serve` is reached
43
+ // through a proxy or a remote lab. It is gone, deliberately: a workspace's
44
+ // ROOT_URL is what Rocket.Chat itself is configured with, so it is the address
45
+ // that identifies the workspace, and the rewrite meant the interface showed a
46
+ // number that appears in no config file anywhere. Applying it to an href but not
47
+ // to the label also put two different addresses for one workspace on one screen.
48
+ //
49
+ // The cost is real and is accepted: from a browser that is not on the docker host,
50
+ // `http://localhost:3000` is that browser's own machine, so the link will not
51
+ // open the workspace. It is still the correct thing to display, and copying it is
52
+ // what a support engineer pastes into a ticket.
53
+
54
+ // Set once the server says a login is in force. Until then every 401 is a token
55
+ // problem, not an expired session, and bouncing to /signin would be wrong.
56
+ let ACCOUNTS = false;
57
+ let MY_ROLE = "";
58
+ // The Okta username of an account linked to Okta, shown beside the houston name.
59
+ // Display only: ME, ownership and the audit trail stay on the houston name.
60
+ let SSO_USER = "";
61
+ // What this session may do, so the interface can say so BEFORE the click rather
62
+ // than refusing after it. The server is the boundary -- every one of these is
63
+ // enforced in `guard` regardless -- but a button that always answers with a red
64
+ // toast reads as a broken feature, not as a permission.
65
+ // Token mode has no roles, so everything is allowed there exactly as before.
66
+ const canWrite = () => MY_ROLE !== "readonly";
67
+ const canAdmin = () => MY_ROLE === "admin";
68
+ // A member sees every workspace and changes only their own: the server refuses the rest
69
+ // with 409. The detail's `may_destroy` is the server's answer for this viewer.
70
+ const canChange = (d) => canWrite() && !(d && d.may_destroy === false);
71
+ const ownerOf = (d) => (d && (d.owner || d.created_by)) || "its owner";
72
+ const READONLY_WHY = "Your role is readonly. Workspace logs carry LDAP bind "
73
+ + "passwords and OAuth secrets, so readonly cannot read them either.";
74
+ let SIGNING_OUT = false;
75
+
76
+ // A session can expire mid-session (12h idle / 7d absolute) or be revoked from
77
+ // another browser. Both arrive as a 401 on whatever the page happened to be
78
+ // doing -- the 4s poll, an SSE reconnect, a click. Without this the dashboard
79
+ // just started failing silently, which is the failure mode the old
80
+ // no-logout-no-login-page design had no answer for either.
81
+ function toSignIn(reason) {
82
+ if (SIGNING_OUT) return;
83
+ SIGNING_OUT = true;
84
+ const next = encodeURIComponent(location.pathname + location.search + location.hash);
85
+ location.assign(`/signin?e=${reason}&next=${next}`);
86
+ }
87
+
88
+ // NO REQUEST WAITS FOREVER. A reply that never came -- a server stalled mid-read, a
89
+ // connection a sleeping laptop left half-open -- held its caller for good, and the list
90
+ // poll queues each read behind the last (`loadRepros`), so one such request froze the
91
+ // rail until the page was reloaded. Two minutes is longer than the slowest read measured
92
+ // (an EKS workspace's panel, one to two minutes), so only a request that is stuck is cut.
93
+ let API_TIMEOUT_MS = 120_000;
94
+ function timedOut() {
95
+ const err = new Error(`The server did not answer within ${Math.round(API_TIMEOUT_MS / 1000)} s.`);
96
+ err.status = 0;
97
+ return err;
98
+ }
99
+
100
+ async function api(path, opts = {}) {
101
+ if (!SERVER_ONLINE && !["GET", "HEAD"].includes((opts.method || "GET").toUpperCase())) {
102
+ throw new Error("Server unavailable — wait for the connection to return before making changes.");
103
+ }
104
+ const headers = Object.assign({}, opts.headers || {});
105
+ if (opts.body) headers["Content-Type"] = "application/json";
106
+ // same-origin credentials so the session cookie rides along; it is HttpOnly,
107
+ // so this file can neither read nor forge it.
108
+ const init = { credentials: "same-origin", signal: AbortSignal.timeout(API_TIMEOUT_MS) };
109
+ let r;
110
+ try { r = await fetch(path, Object.assign(init, opts, { headers })); }
111
+ catch (e) { throw e && e.name === "TimeoutError" ? timedOut() : e; }
112
+ // The deadline covers the body too: one that stops arriving is the same stuck reply.
113
+ const data = await r.json().catch((e) => { if (e && e.name === "TimeoutError") throw timedOut(); return {}; });
114
+ if (r.status === 401) { toSignIn("expired"); throw new Error("signed out"); }
115
+ if (!r.ok) {
116
+ // The STATUS rides along, because "retry in three seconds" and "this will
117
+ // never work" are different answers and the message alone cannot tell them
118
+ // apart. src/lib/errors.ts assigns the code by class: 409 is a refusal (not running,
119
+ // no metrics-server), 502 is docker, 400 is the request itself.
120
+ const err = new Error(data.error || `HTTP ${r.status}`);
121
+ err.status = r.status;
122
+ throw err;
123
+ }
124
+ return data;
125
+ }
126
+
127
+ // The same call for a MULTIPART body. `api()` sets Content-Type: application/json
128
+ // whenever there is a body, which is exactly wrong for a FormData upload -- the
129
+ // browser has to set its own boundary. So this shares everything that matters (the
130
+ // same-origin session cookie, the 401 redirect, the status-carrying error) and
131
+ // differs only in not touching Content-Type.
132
+ //
133
+ // The config-import preview used a bare `fetch` for this reason and lost the 401
134
+ // with it: an expired session showed an error inside a dialog that could no longer
135
+ // do anything, instead of returning the reader to sign-in.
136
+ async function apiForm(path, opts = {}) {
137
+ if (!SERVER_ONLINE) throw new Error("Server unavailable — wait for the connection to return before making changes.");
138
+ const r = await fetch(path, Object.assign({ credentials: "same-origin" }, opts));
139
+ const data = await r.json().catch(() => ({}));
140
+ if (r.status === 401) { toSignIn("expired"); throw new Error("signed out"); }
141
+ if (!r.ok) {
142
+ const err = new Error(data.error || `HTTP ${r.status}`);
143
+ err.status = r.status;
144
+ throw err;
145
+ }
146
+ return data;
147
+ }
148
+
149
+ // ---- where is this browser? -------------------------------------------------
150
+ // Nothing is DETECTED here. Whether `serve` is on EC2, on a colleague's desktop or
151
+ // on the reader's own laptop is not a question this needs answered -- the only thing
152
+ // that matters is whether the browser and the workspaces are on the same machine,
153
+ // and the browser already knows that: it is the address in its own URL bar. No cloud
154
+ // metadata, no guessing from a hostname, no new endpoint.
155
+ //
156
+ // Loopback => `serve` and the browser are the same box, and every localhost link in
157
+ // this UI is correct. Anything else => they are not, and "localhost" names the
158
+ // READER'S machine, where nothing is running.
159
+ // The whole of 127.0.0.0/8, not just 127.0.0.1: every address in it is this machine
160
+ // talking to itself, so a GUI opened at 127.0.0.2 is no more remote than one opened
161
+ // at 127.0.0.1 and must not be told otherwise.
162
+ const LOOPBACK_HOSTS = ["localhost", "::1", "[::1]", ""];
163
+ function isLoopbackHost(h) {
164
+ return LOOPBACK_HOSTS.includes(h) || /^127\.\d+\.\d+\.\d+$/.test(h);
165
+ }
166
+ function remoteHost() {
167
+ return isLoopbackHost(location.hostname) ? "" : location.hostname;
168
+ }
169
+ // A link that, read from another computer, opens on THAT computer rather than the server.
170
+ // *.localhost is loopback in every browser (a local-certificate workspace's name).
171
+ function remoteLoopback(url) {
172
+ if (!remoteHost()) return false;
173
+ let h = "";
174
+ try { h = new URL(url).hostname; } catch (_) { return false; }
175
+ return isLoopbackHost(h) || h.endsWith(".localhost");
176
+ }
177
+ const LOOPBACK_TITLE = "Opens localhost on YOUR computer; only a browser on this server can open it. "
178
+ + "A workspace created with HTTPS gets a public address.";
179
+ // A workspace bound to one of these is reachable from another machine; bound to
180
+ // anything else it answers only on the box that runs it. "" means the workspace
181
+ // predates the metadata key, so nothing is claimed either way.
182
+ const WIDE_BINDS = ["0.0.0.0", "::", "*"];
183
+
184
+ // ---- repro list (master) ----------------------------------------------------
185
+ let ALL_REPROS = [];
186
+ // The Grafana origins this page's frame-src was built from: the monitored workspaces of its
187
+ // first list read. A job naming one of these needs no reload.
188
+ let GRAFANAS_AT_LOAD = null;
189
+ let SELECTED = null;
190
+ // What the stage is showing: "home" when nothing is picked, "workspace" for
191
+ // the selected one, "activity" for the box-wide log. The rail selection and
192
+ // the view are separate on purpose -- opening Activity must not silently
193
+ // deselect the workspace you were working on.
194
+ let VIEW = "home";
195
+ // Every view change goes through here, so "what is on the stage" and "what the
196
+ // top bar says is current" cannot disagree. They did: Activity and Scenarios were
197
+ // reachable and nothing led back, because the brand was a <div> and no link was
198
+ // ever marked.
199
+ function setView(v, { history: writeHistory = true } = {}) {
200
+ if (VIEW === "workspace" && v !== "workspace") ctx.closeLogs();
201
+ VIEW = v;
202
+ if (writeHistory) saveLocation();
203
+ for (const [id, name] of [["#btn-home", "home"], ["#btn-jobs", "activity"],
204
+ ["#btn-clusters", "clusters"],
205
+ ["#btn-scenarios", "scenarios"], ["#btn-backups", "backups"]]) {
206
+ const b = $(id);
207
+ // A cluster's own view is still "Clusters" in the top bar.
208
+ if (b) b.toggleAttribute("aria-current", VIEW === name || (name === "clusters" && VIEW === "cluster"));
209
+ }
210
+ }
211
+ // The URL describes the view, selected workspace and tab. It survives a reload and
212
+ // uses the browser's own history; restoring it never adds another history entry.
213
+ let restoringLocation = false;
214
+ const ROUTE_VIEWS = new Set(["home", "workspace", "clusters", "cluster", "activity", "scenarios", "backups"]);
215
+ const WORKSPACE_TABS = new Set(["overview", "logs", "containers", "env", "backups"]);
216
+ function locationHash() {
217
+ const parts = [VIEW];
218
+ if (VIEW === "workspace" && SELECTED) parts.push(SELECTED, dstate.tab);
219
+ if (VIEW === "cluster" && ctx.CLSTATE) parts.push(ctx.CLSTATE.selected);
220
+ if (VIEW === "activity") parts.push(ctx.ACT_TAB || "running");
221
+ const people = $("#people-dialog");
222
+ return "#/" + parts.map(encodeURIComponent).join("/") + (people && people.open ? "?people=1" : "");
223
+ }
224
+ function saveLocation({ replace = false, restoring = false } = {}) {
225
+ if (restoringLocation) return;
226
+ // A click supersedes any restoration still waiting for a response, even when
227
+ // it chooses the same hash. Only the restoration itself may normalize its URL.
228
+ if (!restoring) locationRead += 1;
229
+ const hash = locationHash();
230
+ if (location.hash === hash) return;
231
+ window.history[replace ? "replaceState" : "pushState"](null, "", hash);
232
+ }
233
+ let locationRead = 0;
234
+ async function restoreLocation() {
235
+ const read = ++locationRead;
236
+ let parts;
237
+ try { parts = location.hash.split("?")[0].replace(/^#\/?/, "").split("/").map(decodeURIComponent); }
238
+ catch (_) { parts = ["home"]; }
239
+ const target = ROUTE_VIEWS.has(parts[0]) ? parts[0] : "home";
240
+ const dispatch = (fn) => {
241
+ // Suppress only this call's synchronous navigation write. Holding the flag
242
+ // across an API read also suppressed real clicks made while it was pending.
243
+ restoringLocation = true;
244
+ try { return fn(); } finally { restoringLocation = false; }
245
+ };
246
+ const people = $("#people-dialog");
247
+ if (people && people.open) {
248
+ people.dataset.navigationClosing = "true";
249
+ people.close();
250
+ }
251
+ if (target !== "workspace") {
252
+ ctx.closeLogs();
253
+ if (dstate.statsTimer) { clearInterval(dstate.statsTimer); dstate.statsTimer = null; }
254
+ }
255
+ if (target === "workspace" && parts[1]) {
256
+ await dispatch(() => ctx.selectRepro(parts[1], WORKSPACE_TABS.has(parts[2]) ? parts[2] : "overview"));
257
+ } else if (target === "clusters") await dispatch(() => ctx.openClusters());
258
+ else if (target === "cluster" && parts[1]) await dispatch(() => ctx.openPlace(parts[1]));
259
+ else if (target === "activity") await dispatch(() => ctx.openJobs(parts[1] === "history" ? "history" : "running"));
260
+ else if (target === "scenarios") dispatch(() => ctx.openScenarios());
261
+ else if (target === "backups") await dispatch(() => ctx.openBackups());
262
+ else dispatch(goHome);
263
+ if (read !== locationRead) return;
264
+ if (location.hash.includes("?people=1") && canAdmin()) await dispatch(() => ctx.openPeople());
265
+ if (read === locationRead) saveLocation({ replace: true, restoring: true });
266
+ }
267
+ // Every view is represented by a hash. Back/Forward and a typed hash both fire
268
+ // this event; pushState from a click already rendered that view and needs no read.
269
+ window.addEventListener("hashchange", () => { restoreLocation(); });
270
+
271
+ // A cached state is useful context, but cannot claim to be current after a failed
272
+ // poll. Keep the records, qualify their state and prevent changes until a real
273
+ // successful read returns. The poll remains active so recovery needs no refresh.
274
+ let SERVER_ONLINE = true;
275
+ let LAST_REPROS_AT = 0;
276
+ function displayRepro(r) {
277
+ if (SERVER_ONLINE) return r;
278
+ return { ...r, state: "?", health: "unknown", uptime: "", containers: (r.containers || []).map((c) =>
279
+ ({ ...c, state: "?", health: "unknown", status: "last known — server unavailable" })) };
280
+ }
281
+ const offlineControls = new WeakMap();
282
+ const MUTATING_CONTROLS = "#btn-new, #btn-prune, #actpane button, .d-actions button:not(.panetoggle), "
283
+ + "#create-submit, #create-stop, #job-stop, #seed-submit, #seed-clear, #upgrade-go, #rollback-go, #owner-go, #restore-go, "
284
+ + "#import-apply, #perf-submit, #cap-submit, #call-send, #passwd-go, #session-all, "
285
+ + "#people-add-btn, #people-body button, #people-body select, #cluster-delete-go";
286
+ function paintAvailability() {
287
+ const message = "Server unavailable — workspace state is unknown. Reconnecting automatically.";
288
+ let banner = $("#server-unavailable");
289
+ if (!SERVER_ONLINE && !banner) {
290
+ banner = el("p", { id: "server-unavailable", class: "banner warn", role: "status" }, message);
291
+ const panel = $("#detail");
292
+ if (panel) panel.prepend(banner);
293
+ }
294
+ if (SERVER_ONLINE && banner) banner.remove();
295
+ if (!SERVER_ONLINE) {
296
+ for (const id of ["#edge-badge", "#cluster-badge"]) { const badge = $(id); if (badge) badge.hidden = true; }
297
+ }
298
+ const controls = [...document.querySelectorAll(MUTATING_CONTROLS)];
299
+ if (VIEW === "workspace" && ["backups", "env"].includes(dstate.tab)) {
300
+ controls.push(...document.querySelectorAll("#d-body button"));
301
+ }
302
+ for (const button of controls) {
303
+ if (!SERVER_ONLINE) {
304
+ if (!offlineControls.has(button)) offlineControls.set(button, button.disabled);
305
+ button.disabled = true;
306
+ } else if (offlineControls.has(button)) {
307
+ button.disabled = offlineControls.get(button);
308
+ offlineControls.delete(button);
309
+ }
310
+ }
311
+ // A log stream keeps its buffer and DOM during an outage. Update just the
312
+ // status chrome rather than closing and rebuilding the stream as a side effect.
313
+ if (VIEW === "workspace" && dstate.detail && dstate.tab === "logs") {
314
+ const d = displayRepro(dstate.detail), pill = $("#detail .d-head .pill"), dot = $("#detail .d-head .dot");
315
+ if (pill) {
316
+ pill.className = "pill " + stateClass(d.state);
317
+ const text = SERVER_ONLINE ? d.state : "state unknown";
318
+ if (pill.textContent !== text) pill.textContent = text;
319
+ }
320
+ if (dot) dot.className = "dot " + stateClass(d.state);
321
+ }
322
+ }
323
+ function setServerOnline(online) {
324
+ const changed = SERVER_ONLINE !== online;
325
+ SERVER_ONLINE = online;
326
+ if (changed) {
327
+ ctx.render();
328
+ if (VIEW === "workspace" && dstate.detail && dstate.tab !== "logs") ctx.renderDetail();
329
+ }
330
+ paintEngines();
331
+ paintAvailability();
332
+ }
333
+ // Dialog builders can finish after the failed poll. Apply the same lock to the
334
+ // controls they add, without resetting controls that were already disabled.
335
+ new MutationObserver(() => { if (!SERVER_ONLINE) paintAvailability(); })
336
+ .observe(document.body, { childList: true, subtree: true });
337
+
338
+ function goHome() {
339
+ SELECTED = null;
340
+ ctx.closeLogs();
341
+ if (dstate.statsTimer) { clearInterval(dstate.statsTimer); dstate.statsTimer = null; }
342
+ dstate.detail = null;
343
+ setView("home");
344
+ ctx.renderHome();
345
+ ctx.render();
346
+ }
347
+ const view = { filter: "", status: "", sort: "name",
348
+ scope: localStorage.getItem("rc_scope") || "all" };
349
+ // lifecycle.list_repros() reports "?" when docker is down, which is not a usable
350
+ // CSS class token (and had no rule), so those cards rendered unstyled.
351
+ const stateClass = (s) => (s === "?" ? "unknown" : s);
352
+ // Colour the health badge from HEALTH, not state: "Up 2 minutes (unhealthy)" is
353
+ // state=running + health=unhealthy, and colouring by state painted it GREEN.
354
+ const HEALTH_TONE = { running: "green", bad: "bad", warn: "warn", stopped: "warn" };
355
+ function healthClass(r) {
356
+ const h = (r.health || "").toLowerCase();
357
+ if (h.includes("unhealthy")) return "bad";
358
+ // AMBER, not green. A degraded workspace is running -- something it needs is not --
359
+ // so falling through to stateClass painted it green, which is this file's word for
360
+ // "fine". Colour is a signal here, never decoration: amber is "wants you".
361
+ if (h === "degraded") return "warn";
362
+ if (h.includes("starting")) return "warn";
363
+ if (h === "healthy" || h === "running") return "running";
364
+ return stateClass(r.state);
365
+ }
366
+ let ME = ""; // the signed-in user, "" when nobody is signed in
367
+ // A job that has not reached a terminal state. "queued" is one: heavy and
368
+ // measurement jobs wait for a slot before they start, and testing only for
369
+ // "running" made every one of them look like it had already finished.
370
+ const jobActive = (s) => s === "running" || s === "queued";
371
+ const dstate = { tab: "overview", detail: null, statsTimer: null, statsRefused: "", points: [], guideTab: "" };
372
+
373
+ // Restart counts already seen, keyed "<workspace>/<pod>". A restart COUNT is
374
+ // cumulative and says nothing about now: a microservices workspace whose
375
+ // ddp-streamer came up before NATS restarts two or three times during a normal boot
376
+ // and is then stable for days. Warning on the total meant "keeps restarting" -- present
377
+ // tense -- sat on a healthy workspace forever, which is how a banner teaches people to
378
+ // ignore it. `src/core/lifecycle/ready.ts`'s own boot watcher already had the right rule
379
+ // (`rc >= 2 && rc > seen.restarts`); this is that rule, on this side.
380
+ const RESTARTS_SEEN = {};
381
+
382
+ function restartsClimbing(workspace, service, count) {
383
+ const key = `${workspace}/${service}`;
384
+ const before = RESTARTS_SEEN[key];
385
+ RESTARTS_SEEN[key] = count;
386
+ return before !== undefined && count > before;
387
+ }
388
+
389
+ // ONE READ AT A TIME. The 4 s timer asked again whether or not the last read had answered,
390
+ // and on Kubernetes a read is several cluster round trips: against a slow cluster the
391
+ // page held eight reads open at once, measured, a queue that grew for as long as a read
392
+ // took more than 4 s. Calls that arrive while one runs share ONE more read after it, and
393
+ // are answered by that one -- they asked after the running read began, so it cannot know
394
+ // what their action changed.
395
+ let reproRead = null;
396
+ let reproNext = null;
397
+ function originOf(url) {
398
+ try { return new URL(url).origin; } catch (_) { return ""; }
399
+ }
400
+ function loadRepros() {
401
+ if (!reproRead) {
402
+ reproRead = readRepros().finally(() => { reproRead = null; });
403
+ return reproRead;
404
+ }
405
+ if (!reproNext) reproNext = reproRead.then(() => { reproNext = null; return loadRepros(); });
406
+ return reproNext;
407
+ }
408
+ async function readRepros() {
409
+ try {
410
+ const [{ repros }, health] = await Promise.all([
411
+ api("/api/repros"), api("/api/health").catch(() => ({ docker: false })),
412
+ ]);
413
+ const was = selectedSeen();
414
+ ALL_REPROS = repros;
415
+ if (GRAFANAS_AT_LOAD === null) {
416
+ GRAFANAS_AT_LOAD = new Set(repros.filter((r) => r.grafana_url).map((r) => originOf(r.grafana_url)));
417
+ }
418
+ LAST_REPROS_AT = Date.now();
419
+ const recovering = !SERVER_ONLINE;
420
+ setServerOnline(true);
421
+ ctx.refreshEdgeBadge(); // its own request: /api/health must stay cheap
422
+ ctx.refreshClusterBadge(); // ditto, and it probes nothing -- see the note there
423
+ // Identity comes from /api/session now, not from a field bolted onto
424
+ // /api/health -- an endpoint left open for uptime checks should not be
425
+ // reading credentials. Empty on a single-user box (no accounts, no login),
426
+ // in which case the chip stays hidden and every card renders as it always has.
427
+ try {
428
+ const me = await api("/api/session");
429
+ ACCOUNTS = !!me.accounts;
430
+ ME = me.user || "";
431
+ MY_ROLE = me.role || "";
432
+ SSO_USER = me.sso_user || "";
433
+ } catch (_) { /* signed out; api() has already redirected */ }
434
+ // The top bar too: "+ New repro" and "Prune down" are member+, so a readonly
435
+ // session should not be offered them at all.
436
+ for (const [sel, ok] of [["#btn-new", canWrite()], ["#btn-prune", canWrite()]]) {
437
+ const b = $(sel); if (b) b.hidden = !ok;
438
+ }
439
+ // Only worth offering once somebody else's workspaces can appear.
440
+ const scope = $("#scope-filter");
441
+ if (scope) {
442
+ scope.hidden = !ME || !ALL_REPROS.some((r) => (r.owner || r.created_by) &&
443
+ (r.owner || r.created_by) !== ME);
444
+ scope.value = view.scope;
445
+ }
446
+ const who = $("#whoami");
447
+ // The houston name first: the chip's "@" is its, and an Okta username is usually
448
+ // an email address, so "@ana.lopez@rocket.chat" read as nobody's.
449
+ who.textContent = ME + (SSO_USER ? ` · ${SSO_USER}` : "")
450
+ + (MY_ROLE && MY_ROLE !== "admin" ? ` · ${MY_ROLE}` : "");
451
+ who.hidden = !ME;
452
+ ctx.DOCKER_OK = !!health.docker;
453
+ paintEngines();
454
+ if (SELECTED && !ALL_REPROS.find((r) => r.name === SELECTED)) ctx.closeDetail();
455
+ ctx.render();
456
+ // The panel is read once, so it was a snapshot: a restart's job ends while Rocket.Chat
457
+ // is still booting, and "Health starting" stayed on screen for minutes beside a rail
458
+ // row that said running. Read it again when THIS workspace's state or health in the
459
+ // list moves between two polls, including an ownership handover -- once per change,
460
+ // not every four seconds: on a cluster a read is several round trips.
461
+ // Only while the panel is the page: on
462
+ // Activity or Scenarios a redraw would put it back over what is being read.
463
+ if (VIEW === "workspace" && dstate.detail && selectedSeen() !== was) ctx.refreshDetail();
464
+ ctx.refreshHome();
465
+ if (recovering) ctx.refreshKube();
466
+ if (recovering && dstate.logsReconnect) dstate.logsReconnect({ serverRecovered: true });
467
+ paintAvailability();
468
+ } catch (e) { setServerOnline(false); toast(e.message); }
469
+ }
470
+
471
+ // What the list says about the selected workspace, as one comparable string.
472
+ function selectedSeen() {
473
+ const r = SELECTED && ALL_REPROS.find((x) => x.name === SELECTED);
474
+ return r ? `${r.state}\n${r.health || ""}\n${r.owner || r.created_by || ""}` : "";
475
+ }
476
+
477
+ // ---- the two engines --------------------------------------------------------
478
+ // `KUBE` is fetched on its own, NOT on the four-second poll: `preflight()` shells out
479
+ // to kubectl several times, and /api/health is the cheap unauthenticated call every
480
+ // open tab makes. Same reasoning as the edge badge, and the same facts `doctor`
481
+ // reports, from the same probe -- so the footer and the report cannot disagree about
482
+ // which cluster you are on.
483
+ let KUBE = null;
484
+ // Whether the probe has answered at all. Until it has, KUBE is null and NOTHING is known:
485
+ // the footer said "k8s: not set up" for the half second before a working k3s was read,
486
+ // and a member opening Create in that window was told its cluster was unavailable.
487
+ let KUBE_READ = false;
488
+
489
+ async function refreshKube() {
490
+ try { KUBE = await api("/api/kubernetes"); }
491
+ catch (_) { KUBE = null; } // no permission, or no gui extra
492
+ KUBE_READ = true;
493
+ paintEngines();
494
+ // The create dialog's cards read it too, and one open while it was in flight said
495
+ // "Reading…" until it was closed and opened again.
496
+ if (ctx.renderDestinations && $("#create-dialog") && $("#create-dialog").open) ctx.renderDestinations();
497
+ }
498
+
499
+ // The footer says what each ENGINE is doing; the header button says what it does.
500
+ // "docker: up" in the header was the whole environment when Docker was the only
501
+ // runtime -- it is one engine of two now, and a workspace can run in either.
502
+ function paintEngines() {
503
+ if (!SERVER_ONLINE) {
504
+ const footer = $("#sb-engines");
505
+ if (footer) footer.textContent = "docker: ? · k8s: ? · server unavailable";
506
+ const badge = $("#doctor-badge");
507
+ if (badge) badge.className = "chip unknown";
508
+ return;
509
+ }
510
+ const k = KUBE || {};
511
+ // Pending is not absent: "?" until the probe answers, as the page ships it.
512
+ const known = KUBE !== null || KUBE_READ;
513
+ // CONTEXTS AND NONE CURRENT is not "not set up": the Clusters page lists them running.
514
+ // Nor is a kubeconfig that could not be READ, which the Clusters page names with its reason.
515
+ const kube = !known ? "?"
516
+ : !k.usable ? (k.unreadable ? "kubeconfig unreadable"
517
+ : k.tools_ready && !k.context && k.contexts ? "no current context" : "not set up")
518
+ : k.reachable ? `${k.distribution || "cluster"} ${k.context || ""}`.trim()
519
+ : k.can_provision ? "no cluster yet" : "no cluster";
520
+ const el = $("#sb-engines");
521
+ if (el) el.textContent = `docker: ${ctx.DOCKER_OK ? "up" : "down"} · k8s: ${kube}`;
522
+ // Red only when NOTHING can run a workspace. Docker being down is not a broken box
523
+ // on a machine whose Kubernetes is up, and saying so would be crying wolf at
524
+ // somebody whose k3s is working perfectly.
525
+ const badge = $("#doctor-badge");
526
+ if (badge) {
527
+ const dead = !ctx.DOCKER_OK && known && !(k.usable && k.reachable);
528
+ badge.className = "chip " + (dead ? "down" : "up");
529
+ badge.title = dead ? "Nothing here can run a workspace — run the environment check"
530
+ : "Run the environment check";
531
+ }
532
+ }
533
+
534
+ Object.defineProperties(ctx, {
535
+ "paintAvailability": { enumerable: true, get: () => paintAvailability },
536
+ "displayRepro": { enumerable: true, get: () => displayRepro },
537
+ "LAST_REPROS_AT": { enumerable: true, get: () => LAST_REPROS_AT },
538
+ "SERVER_ONLINE": { enumerable: true, get: () => SERVER_ONLINE },
539
+ "restoreLocation": { enumerable: true, get: () => restoreLocation },
540
+ "saveLocation": { enumerable: true, get: () => saveLocation },
541
+ "$": { enumerable: true, get: () => $ },
542
+ "el": { enumerable: true, get: () => el },
543
+ "toast": { enumerable: true, get: () => toast },
544
+ "API_TIMEOUT_MS": { enumerable: true, get: () => API_TIMEOUT_MS, set: value => { API_TIMEOUT_MS = value; } },
545
+ "ACCOUNTS": { enumerable: true, get: () => ACCOUNTS, set: value => { ACCOUNTS = value; } },
546
+ "MY_ROLE": { enumerable: true, get: () => MY_ROLE, set: value => { MY_ROLE = value; } },
547
+ "canWrite": { enumerable: true, get: () => canWrite },
548
+ "canAdmin": { enumerable: true, get: () => canAdmin },
549
+ "canChange": { enumerable: true, get: () => canChange },
550
+ "ownerOf": { enumerable: true, get: () => ownerOf },
551
+ "READONLY_WHY": { enumerable: true, get: () => READONLY_WHY },
552
+ "SIGNING_OUT": { enumerable: true, get: () => SIGNING_OUT, set: value => { SIGNING_OUT = value; } },
553
+ "toSignIn": { enumerable: true, get: () => toSignIn },
554
+ "api": { enumerable: true, get: () => api },
555
+ "apiForm": { enumerable: true, get: () => apiForm },
556
+ "LOOPBACK_HOSTS": { enumerable: true, get: () => LOOPBACK_HOSTS },
557
+ "isLoopbackHost": { enumerable: true, get: () => isLoopbackHost },
558
+ "remoteHost": { enumerable: true, get: () => remoteHost },
559
+ "remoteLoopback": { enumerable: true, get: () => remoteLoopback },
560
+ "LOOPBACK_TITLE": { enumerable: true, get: () => LOOPBACK_TITLE },
561
+ "WIDE_BINDS": { enumerable: true, get: () => WIDE_BINDS },
562
+ "ALL_REPROS": { enumerable: true, get: () => ALL_REPROS, set: value => { ALL_REPROS = value; } },
563
+ "GRAFANAS_AT_LOAD": { enumerable: true, get: () => GRAFANAS_AT_LOAD },
564
+ "originOf": { enumerable: true, get: () => originOf },
565
+ "SELECTED": { enumerable: true, get: () => SELECTED, set: value => { SELECTED = value; } },
566
+ "VIEW": { enumerable: true, get: () => VIEW, set: value => { VIEW = value; } },
567
+ "setView": { enumerable: true, get: () => setView },
568
+ "goHome": { enumerable: true, get: () => goHome },
569
+ "view": { enumerable: true, get: () => view },
570
+ "stateClass": { enumerable: true, get: () => stateClass },
571
+ "HEALTH_TONE": { enumerable: true, get: () => HEALTH_TONE },
572
+ "healthClass": { enumerable: true, get: () => healthClass },
573
+ "ME": { enumerable: true, get: () => ME, set: value => { ME = value; } },
574
+ "jobActive": { enumerable: true, get: () => jobActive },
575
+ "dstate": { enumerable: true, get: () => dstate },
576
+ "RESTARTS_SEEN": { enumerable: true, get: () => RESTARTS_SEEN },
577
+ "restartsClimbing": { enumerable: true, get: () => restartsClimbing },
578
+ "loadRepros": { enumerable: true, get: () => loadRepros },
579
+ "KUBE": { enumerable: true, get: () => KUBE, set: value => { KUBE = value; } },
580
+ "KUBE_READ": { enumerable: true, get: () => KUBE_READ },
581
+ "refreshKube": { enumerable: true, get: () => refreshKube },
582
+ "paintEngines": { enumerable: true, get: () => paintEngines },
583
+ });
584
+ export { $, el, toast, ACCOUNTS, MY_ROLE, canWrite, canAdmin, canChange, ownerOf, READONLY_WHY, SIGNING_OUT, toSignIn, api, apiForm, LOOPBACK_HOSTS, isLoopbackHost, remoteHost, remoteLoopback, LOOPBACK_TITLE, WIDE_BINDS, ALL_REPROS, SELECTED, VIEW, setView, goHome, view, stateClass, HEALTH_TONE, healthClass, ME, jobActive, dstate, RESTARTS_SEEN, restartsClimbing, loadRepros, KUBE, refreshKube, paintEngines };