feat(process-ui): stream live process list from websocket
Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
parent
0e4dde9307
commit
9a93ebea66
3 changed files with 406 additions and 240 deletions
525
pkg/api/ui/dist/core-process.js
vendored
525
pkg/api/ui/dist/core-process.js
vendored
|
|
@ -3,10 +3,10 @@
|
|||
* Copyright 2019 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const V = globalThis, se = V.ShadowRoot && (V.ShadyCSS === void 0 || V.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, re = Symbol(), ne = /* @__PURE__ */ new WeakMap();
|
||||
let $e = class {
|
||||
const K = globalThis, se = K.ShadowRoot && (K.ShadyCSS === void 0 || K.ShadyCSS.nativeShadow) && "adoptedStyleSheets" in Document.prototype && "replace" in CSSStyleSheet.prototype, ie = Symbol(), ae = /* @__PURE__ */ new WeakMap();
|
||||
let ye = class {
|
||||
constructor(e, t, i) {
|
||||
if (this._$cssResult$ = !0, i !== re) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
||||
if (this._$cssResult$ = !0, i !== ie) throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");
|
||||
this.cssText = e, this.t = t;
|
||||
}
|
||||
get styleSheet() {
|
||||
|
|
@ -14,7 +14,7 @@ let $e = class {
|
|||
const t = this.t;
|
||||
if (se && e === void 0) {
|
||||
const i = t !== void 0 && t.length === 1;
|
||||
i && (e = ne.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && ne.set(t, e));
|
||||
i && (e = ae.get(t)), e === void 0 && ((this.o = e = new CSSStyleSheet()).replaceSync(this.cssText), i && ae.set(t, e));
|
||||
}
|
||||
return e;
|
||||
}
|
||||
|
|
@ -22,20 +22,20 @@ let $e = class {
|
|||
return this.cssText;
|
||||
}
|
||||
};
|
||||
const Ae = (s) => new $e(typeof s == "string" ? s : s + "", void 0, re), B = (s, ...e) => {
|
||||
const t = s.length === 1 ? s[0] : e.reduce((i, r, n) => i + ((o) => {
|
||||
if (o._$cssResult$ === !0) return o.cssText;
|
||||
if (typeof o == "number") return o;
|
||||
throw Error("Value passed to 'css' function must be a 'css' function result: " + o + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
||||
})(r) + s[n + 1], s[0]);
|
||||
return new $e(t, s, re);
|
||||
const Ae = (s) => new ye(typeof s == "string" ? s : s + "", void 0, ie), q = (s, ...e) => {
|
||||
const t = s.length === 1 ? s[0] : e.reduce((i, o, n) => i + ((r) => {
|
||||
if (r._$cssResult$ === !0) return r.cssText;
|
||||
if (typeof r == "number") return r;
|
||||
throw Error("Value passed to 'css' function must be a 'css' function result: " + r + ". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.");
|
||||
})(o) + s[n + 1], s[0]);
|
||||
return new ye(t, s, ie);
|
||||
}, ke = (s, e) => {
|
||||
if (se) s.adoptedStyleSheets = e.map((t) => t instanceof CSSStyleSheet ? t : t.styleSheet);
|
||||
else for (const t of e) {
|
||||
const i = document.createElement("style"), r = V.litNonce;
|
||||
r !== void 0 && i.setAttribute("nonce", r), i.textContent = t.cssText, s.appendChild(i);
|
||||
const i = document.createElement("style"), o = K.litNonce;
|
||||
o !== void 0 && i.setAttribute("nonce", o), i.textContent = t.cssText, s.appendChild(i);
|
||||
}
|
||||
}, ae = se ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
|
||||
}, le = se ? (s) => s : (s) => s instanceof CSSStyleSheet ? ((e) => {
|
||||
let t = "";
|
||||
for (const i of e.cssRules) t += i.cssText;
|
||||
return Ae(t);
|
||||
|
|
@ -45,7 +45,7 @@ const Ae = (s) => new $e(typeof s == "string" ? s : s + "", void 0, re), B = (s,
|
|||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const { is: Se, defineProperty: Pe, getOwnPropertyDescriptor: Ce, getOwnPropertyNames: Ee, getOwnPropertySymbols: Ue, getPrototypeOf: Oe } = Object, A = globalThis, le = A.trustedTypes, ze = le ? le.emptyScript : "", X = A.reactiveElementPolyfillSupport, j = (s, e) => s, J = { toAttribute(s, e) {
|
||||
const { is: Se, defineProperty: Pe, getOwnPropertyDescriptor: Ce, getOwnPropertyNames: Ee, getOwnPropertySymbols: Ue, getPrototypeOf: Oe } = Object, A = globalThis, ce = A.trustedTypes, ze = ce ? ce.emptyScript : "", X = A.reactiveElementPolyfillSupport, j = (s, e) => s, J = { toAttribute(s, e) {
|
||||
switch (e) {
|
||||
case Boolean:
|
||||
s = s ? ze : null;
|
||||
|
|
@ -73,7 +73,7 @@ const { is: Se, defineProperty: Pe, getOwnPropertyDescriptor: Ce, getOwnProperty
|
|||
}
|
||||
}
|
||||
return t;
|
||||
} }, ie = (s, e) => !Se(s, e), ce = { attribute: !0, type: String, converter: J, reflect: !1, useDefault: !1, hasChanged: ie };
|
||||
} }, oe = (s, e) => !Se(s, e), de = { attribute: !0, type: String, converter: J, reflect: !1, useDefault: !1, hasChanged: oe };
|
||||
Symbol.metadata ?? (Symbol.metadata = Symbol("metadata")), A.litPropertyMetadata ?? (A.litPropertyMetadata = /* @__PURE__ */ new WeakMap());
|
||||
let D = class extends HTMLElement {
|
||||
static addInitializer(e) {
|
||||
|
|
@ -82,25 +82,25 @@ let D = class extends HTMLElement {
|
|||
static get observedAttributes() {
|
||||
return this.finalize(), this._$Eh && [...this._$Eh.keys()];
|
||||
}
|
||||
static createProperty(e, t = ce) {
|
||||
static createProperty(e, t = de) {
|
||||
if (t.state && (t.attribute = !1), this._$Ei(), this.prototype.hasOwnProperty(e) && ((t = Object.create(t)).wrapped = !0), this.elementProperties.set(e, t), !t.noAccessor) {
|
||||
const i = Symbol(), r = this.getPropertyDescriptor(e, i, t);
|
||||
r !== void 0 && Pe(this.prototype, e, r);
|
||||
const i = Symbol(), o = this.getPropertyDescriptor(e, i, t);
|
||||
o !== void 0 && Pe(this.prototype, e, o);
|
||||
}
|
||||
}
|
||||
static getPropertyDescriptor(e, t, i) {
|
||||
const { get: r, set: n } = Ce(this.prototype, e) ?? { get() {
|
||||
const { get: o, set: n } = Ce(this.prototype, e) ?? { get() {
|
||||
return this[t];
|
||||
}, set(o) {
|
||||
this[t] = o;
|
||||
}, set(r) {
|
||||
this[t] = r;
|
||||
} };
|
||||
return { get: r, set(o) {
|
||||
const l = r == null ? void 0 : r.call(this);
|
||||
n == null || n.call(this, o), this.requestUpdate(e, l, i);
|
||||
return { get: o, set(r) {
|
||||
const l = o == null ? void 0 : o.call(this);
|
||||
n == null || n.call(this, r), this.requestUpdate(e, l, i);
|
||||
}, configurable: !0, enumerable: !0 };
|
||||
}
|
||||
static getPropertyOptions(e) {
|
||||
return this.elementProperties.get(e) ?? ce;
|
||||
return this.elementProperties.get(e) ?? de;
|
||||
}
|
||||
static _$Ei() {
|
||||
if (this.hasOwnProperty(j("elementProperties"))) return;
|
||||
|
|
@ -111,17 +111,17 @@ let D = class extends HTMLElement {
|
|||
if (this.hasOwnProperty(j("finalized"))) return;
|
||||
if (this.finalized = !0, this._$Ei(), this.hasOwnProperty(j("properties"))) {
|
||||
const t = this.properties, i = [...Ee(t), ...Ue(t)];
|
||||
for (const r of i) this.createProperty(r, t[r]);
|
||||
for (const o of i) this.createProperty(o, t[o]);
|
||||
}
|
||||
const e = this[Symbol.metadata];
|
||||
if (e !== null) {
|
||||
const t = litPropertyMetadata.get(e);
|
||||
if (t !== void 0) for (const [i, r] of t) this.elementProperties.set(i, r);
|
||||
if (t !== void 0) for (const [i, o] of t) this.elementProperties.set(i, o);
|
||||
}
|
||||
this._$Eh = /* @__PURE__ */ new Map();
|
||||
for (const [t, i] of this.elementProperties) {
|
||||
const r = this._$Eu(t, i);
|
||||
r !== void 0 && this._$Eh.set(r, t);
|
||||
const o = this._$Eu(t, i);
|
||||
o !== void 0 && this._$Eh.set(o, t);
|
||||
}
|
||||
this.elementStyles = this.finalizeStyles(this.styles);
|
||||
}
|
||||
|
|
@ -129,8 +129,8 @@ let D = class extends HTMLElement {
|
|||
const t = [];
|
||||
if (Array.isArray(e)) {
|
||||
const i = new Set(e.flat(1 / 0).reverse());
|
||||
for (const r of i) t.unshift(ae(r));
|
||||
} else e !== void 0 && t.push(ae(e));
|
||||
for (const o of i) t.unshift(le(o));
|
||||
} else e !== void 0 && t.push(le(e));
|
||||
return t;
|
||||
}
|
||||
static _$Eu(e, t) {
|
||||
|
|
@ -182,33 +182,33 @@ let D = class extends HTMLElement {
|
|||
}
|
||||
_$ET(e, t) {
|
||||
var n;
|
||||
const i = this.constructor.elementProperties.get(e), r = this.constructor._$Eu(e, i);
|
||||
if (r !== void 0 && i.reflect === !0) {
|
||||
const o = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : J).toAttribute(t, i.type);
|
||||
this._$Em = e, o == null ? this.removeAttribute(r) : this.setAttribute(r, o), this._$Em = null;
|
||||
const i = this.constructor.elementProperties.get(e), o = this.constructor._$Eu(e, i);
|
||||
if (o !== void 0 && i.reflect === !0) {
|
||||
const r = (((n = i.converter) == null ? void 0 : n.toAttribute) !== void 0 ? i.converter : J).toAttribute(t, i.type);
|
||||
this._$Em = e, r == null ? this.removeAttribute(o) : this.setAttribute(o, r), this._$Em = null;
|
||||
}
|
||||
}
|
||||
_$AK(e, t) {
|
||||
var n, o;
|
||||
const i = this.constructor, r = i._$Eh.get(e);
|
||||
if (r !== void 0 && this._$Em !== r) {
|
||||
const l = i.getPropertyOptions(r), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((n = l.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? l.converter : J;
|
||||
this._$Em = r;
|
||||
var n, r;
|
||||
const i = this.constructor, o = i._$Eh.get(e);
|
||||
if (o !== void 0 && this._$Em !== o) {
|
||||
const l = i.getPropertyOptions(o), a = typeof l.converter == "function" ? { fromAttribute: l.converter } : ((n = l.converter) == null ? void 0 : n.fromAttribute) !== void 0 ? l.converter : J;
|
||||
this._$Em = o;
|
||||
const p = a.fromAttribute(t, l.type);
|
||||
this[r] = p ?? ((o = this._$Ej) == null ? void 0 : o.get(r)) ?? p, this._$Em = null;
|
||||
this[o] = p ?? ((r = this._$Ej) == null ? void 0 : r.get(o)) ?? p, this._$Em = null;
|
||||
}
|
||||
}
|
||||
requestUpdate(e, t, i, r = !1, n) {
|
||||
var o;
|
||||
requestUpdate(e, t, i, o = !1, n) {
|
||||
var r;
|
||||
if (e !== void 0) {
|
||||
const l = this.constructor;
|
||||
if (r === !1 && (n = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? ie)(n, t) || i.useDefault && i.reflect && n === ((o = this._$Ej) == null ? void 0 : o.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
|
||||
if (o === !1 && (n = this[e]), i ?? (i = l.getPropertyOptions(e)), !((i.hasChanged ?? oe)(n, t) || i.useDefault && i.reflect && n === ((r = this._$Ej) == null ? void 0 : r.get(e)) && !this.hasAttribute(l._$Eu(e, i)))) return;
|
||||
this.C(e, t, i);
|
||||
}
|
||||
this.isUpdatePending === !1 && (this._$ES = this._$EP());
|
||||
}
|
||||
C(e, t, { useDefault: i, reflect: r, wrapped: n }, o) {
|
||||
i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, o ?? t ?? this[e]), n !== !0 || o !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), r === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
|
||||
C(e, t, { useDefault: i, reflect: o, wrapped: n }, r) {
|
||||
i && !(this._$Ej ?? (this._$Ej = /* @__PURE__ */ new Map())).has(e) && (this._$Ej.set(e, r ?? t ?? this[e]), n !== !0 || r !== void 0) || (this._$AL.has(e) || (this.hasUpdated || i || (t = void 0), this._$AL.set(e, t)), o === !0 && this._$Em !== e && (this._$Eq ?? (this._$Eq = /* @__PURE__ */ new Set())).add(e));
|
||||
}
|
||||
async _$EP() {
|
||||
this.isUpdatePending = !0;
|
||||
|
|
@ -228,24 +228,24 @@ let D = class extends HTMLElement {
|
|||
if (!this.isUpdatePending) return;
|
||||
if (!this.hasUpdated) {
|
||||
if (this.renderRoot ?? (this.renderRoot = this.createRenderRoot()), this._$Ep) {
|
||||
for (const [n, o] of this._$Ep) this[n] = o;
|
||||
for (const [n, r] of this._$Ep) this[n] = r;
|
||||
this._$Ep = void 0;
|
||||
}
|
||||
const r = this.constructor.elementProperties;
|
||||
if (r.size > 0) for (const [n, o] of r) {
|
||||
const { wrapped: l } = o, a = this[n];
|
||||
l !== !0 || this._$AL.has(n) || a === void 0 || this.C(n, void 0, o, a);
|
||||
const o = this.constructor.elementProperties;
|
||||
if (o.size > 0) for (const [n, r] of o) {
|
||||
const { wrapped: l } = r, a = this[n];
|
||||
l !== !0 || this._$AL.has(n) || a === void 0 || this.C(n, void 0, r, a);
|
||||
}
|
||||
}
|
||||
let e = !1;
|
||||
const t = this._$AL;
|
||||
try {
|
||||
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((r) => {
|
||||
e = this.shouldUpdate(t), e ? (this.willUpdate(t), (i = this._$EO) == null || i.forEach((o) => {
|
||||
var n;
|
||||
return (n = r.hostUpdate) == null ? void 0 : n.call(r);
|
||||
return (n = o.hostUpdate) == null ? void 0 : n.call(o);
|
||||
}), this.update(t)) : this._$EM();
|
||||
} catch (r) {
|
||||
throw e = !1, this._$EM(), r;
|
||||
} catch (o) {
|
||||
throw e = !1, this._$EM(), o;
|
||||
}
|
||||
e && this._$AE(t);
|
||||
}
|
||||
|
|
@ -254,8 +254,8 @@ let D = class extends HTMLElement {
|
|||
_$AE(e) {
|
||||
var t;
|
||||
(t = this._$EO) == null || t.forEach((i) => {
|
||||
var r;
|
||||
return (r = i.hostUpdated) == null ? void 0 : r.call(i);
|
||||
var o;
|
||||
return (o = i.hostUpdated) == null ? void 0 : o.call(i);
|
||||
}), this.hasUpdated || (this.hasUpdated = !0, this.firstUpdated(e)), this.updated(e);
|
||||
}
|
||||
_$EM() {
|
||||
|
|
@ -284,68 +284,68 @@ D.elementStyles = [], D.shadowRootOptions = { mode: "open" }, D[j("elementProper
|
|||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const N = globalThis, de = (s) => s, Z = N.trustedTypes, he = Z ? Z.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ye = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, ve = "?" + x, De = `<${ve}>`, E = document, I = () => E.createComment(""), L = (s) => s === null || typeof s != "object" && typeof s != "function", oe = Array.isArray, Te = (s) => oe(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", Y = `[
|
||||
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, pe = /-->/g, ue = />/g, S = RegExp(`>|${Y}(?:([^\\s"'>=/]+)(${Y}*=${Y}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`, "g"), me = /'/g, fe = /"/g, _e = /^(?:script|style|textarea|title)$/i, Me = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), c = Me(1), T = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), ge = /* @__PURE__ */ new WeakMap(), P = E.createTreeWalker(E, 129);
|
||||
function we(s, e) {
|
||||
if (!oe(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
||||
return he !== void 0 ? he.createHTML(e) : e;
|
||||
const N = globalThis, he = (s) => s, Z = N.trustedTypes, pe = Z ? Z.createPolicy("lit-html", { createHTML: (s) => s }) : void 0, ve = "$lit$", x = `lit$${Math.random().toFixed(9).slice(2)}$`, we = "?" + x, De = `<${we}>`, U = document, I = () => U.createComment(""), L = (s) => s === null || typeof s != "object" && typeof s != "function", re = Array.isArray, Te = (s) => re(s) || typeof (s == null ? void 0 : s[Symbol.iterator]) == "function", Y = `[
|
||||
\f\r]`, H = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g, ue = /-->/g, me = />/g, P = RegExp(`>|${Y}(?:([^\\s"'>=/]+)(${Y}*=${Y}*(?:[^
|
||||
\f\r"'\`<>=]|("|')|))|$)`, "g"), fe = /'/g, ge = /"/g, _e = /^(?:script|style|textarea|title)$/i, Me = (s) => (e, ...t) => ({ _$litType$: s, strings: e, values: t }), c = Me(1), T = Symbol.for("lit-noChange"), d = Symbol.for("lit-nothing"), be = /* @__PURE__ */ new WeakMap(), C = U.createTreeWalker(U, 129);
|
||||
function xe(s, e) {
|
||||
if (!re(s) || !s.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
||||
return pe !== void 0 ? pe.createHTML(e) : e;
|
||||
}
|
||||
const Re = (s, e) => {
|
||||
const t = s.length - 1, i = [];
|
||||
let r, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", o = H;
|
||||
let o, n = e === 2 ? "<svg>" : e === 3 ? "<math>" : "", r = H;
|
||||
for (let l = 0; l < t; l++) {
|
||||
const a = s[l];
|
||||
let p, m, h = -1, b = 0;
|
||||
for (; b < a.length && (o.lastIndex = b, m = o.exec(a), m !== null); ) b = o.lastIndex, o === H ? m[1] === "!--" ? o = pe : m[1] !== void 0 ? o = ue : m[2] !== void 0 ? (_e.test(m[2]) && (r = RegExp("</" + m[2], "g")), o = S) : m[3] !== void 0 && (o = S) : o === S ? m[0] === ">" ? (o = r ?? H, h = -1) : m[1] === void 0 ? h = -2 : (h = o.lastIndex - m[2].length, p = m[1], o = m[3] === void 0 ? S : m[3] === '"' ? fe : me) : o === fe || o === me ? o = S : o === pe || o === ue ? o = H : (o = S, r = void 0);
|
||||
const w = o === S && s[l + 1].startsWith("/>") ? " " : "";
|
||||
n += o === H ? a + De : h >= 0 ? (i.push(p), a.slice(0, h) + ye + a.slice(h) + x + w) : a + x + (h === -2 ? l : w);
|
||||
let p, m, h = -1, $ = 0;
|
||||
for (; $ < a.length && (r.lastIndex = $, m = r.exec(a), m !== null); ) $ = r.lastIndex, r === H ? m[1] === "!--" ? r = ue : m[1] !== void 0 ? r = me : m[2] !== void 0 ? (_e.test(m[2]) && (o = RegExp("</" + m[2], "g")), r = P) : m[3] !== void 0 && (r = P) : r === P ? m[0] === ">" ? (r = o ?? H, h = -1) : m[1] === void 0 ? h = -2 : (h = r.lastIndex - m[2].length, p = m[1], r = m[3] === void 0 ? P : m[3] === '"' ? ge : fe) : r === ge || r === fe ? r = P : r === ue || r === me ? r = H : (r = P, o = void 0);
|
||||
const _ = r === P && s[l + 1].startsWith("/>") ? " " : "";
|
||||
n += r === H ? a + De : h >= 0 ? (i.push(p), a.slice(0, h) + ve + a.slice(h) + x + _) : a + x + (h === -2 ? l : _);
|
||||
}
|
||||
return [we(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
||||
return [xe(s, n + (s[t] || "<?>") + (e === 2 ? "</svg>" : e === 3 ? "</math>" : "")), i];
|
||||
};
|
||||
class q {
|
||||
class W {
|
||||
constructor({ strings: e, _$litType$: t }, i) {
|
||||
let r;
|
||||
let o;
|
||||
this.parts = [];
|
||||
let n = 0, o = 0;
|
||||
let n = 0, r = 0;
|
||||
const l = e.length - 1, a = this.parts, [p, m] = Re(e, t);
|
||||
if (this.el = q.createElement(p, i), P.currentNode = this.el.content, t === 2 || t === 3) {
|
||||
if (this.el = W.createElement(p, i), C.currentNode = this.el.content, t === 2 || t === 3) {
|
||||
const h = this.el.content.firstChild;
|
||||
h.replaceWith(...h.childNodes);
|
||||
}
|
||||
for (; (r = P.nextNode()) !== null && a.length < l; ) {
|
||||
if (r.nodeType === 1) {
|
||||
if (r.hasAttributes()) for (const h of r.getAttributeNames()) if (h.endsWith(ye)) {
|
||||
const b = m[o++], w = r.getAttribute(h).split(x), K = /([.?@])?(.*)/.exec(b);
|
||||
a.push({ type: 1, index: n, name: K[2], strings: w, ctor: K[1] === "." ? je : K[1] === "?" ? Ne : K[1] === "@" ? Ie : G }), r.removeAttribute(h);
|
||||
} else h.startsWith(x) && (a.push({ type: 6, index: n }), r.removeAttribute(h));
|
||||
if (_e.test(r.tagName)) {
|
||||
const h = r.textContent.split(x), b = h.length - 1;
|
||||
if (b > 0) {
|
||||
r.textContent = Z ? Z.emptyScript : "";
|
||||
for (let w = 0; w < b; w++) r.append(h[w], I()), P.nextNode(), a.push({ type: 2, index: ++n });
|
||||
r.append(h[b], I());
|
||||
for (; (o = C.nextNode()) !== null && a.length < l; ) {
|
||||
if (o.nodeType === 1) {
|
||||
if (o.hasAttributes()) for (const h of o.getAttributeNames()) if (h.endsWith(ve)) {
|
||||
const $ = m[r++], _ = o.getAttribute(h).split(x), V = /([.?@])?(.*)/.exec($);
|
||||
a.push({ type: 1, index: n, name: V[2], strings: _, ctor: V[1] === "." ? je : V[1] === "?" ? Ne : V[1] === "@" ? Ie : G }), o.removeAttribute(h);
|
||||
} else h.startsWith(x) && (a.push({ type: 6, index: n }), o.removeAttribute(h));
|
||||
if (_e.test(o.tagName)) {
|
||||
const h = o.textContent.split(x), $ = h.length - 1;
|
||||
if ($ > 0) {
|
||||
o.textContent = Z ? Z.emptyScript : "";
|
||||
for (let _ = 0; _ < $; _++) o.append(h[_], I()), C.nextNode(), a.push({ type: 2, index: ++n });
|
||||
o.append(h[$], I());
|
||||
}
|
||||
}
|
||||
} else if (r.nodeType === 8) if (r.data === ve) a.push({ type: 2, index: n });
|
||||
} else if (o.nodeType === 8) if (o.data === we) a.push({ type: 2, index: n });
|
||||
else {
|
||||
let h = -1;
|
||||
for (; (h = r.data.indexOf(x, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += x.length - 1;
|
||||
for (; (h = o.data.indexOf(x, h + 1)) !== -1; ) a.push({ type: 7, index: n }), h += x.length - 1;
|
||||
}
|
||||
n++;
|
||||
}
|
||||
}
|
||||
static createElement(e, t) {
|
||||
const i = E.createElement("template");
|
||||
const i = U.createElement("template");
|
||||
return i.innerHTML = e, i;
|
||||
}
|
||||
}
|
||||
function M(s, e, t = s, i) {
|
||||
var o, l;
|
||||
var r, l;
|
||||
if (e === T) return e;
|
||||
let r = i !== void 0 ? (o = t._$Co) == null ? void 0 : o[i] : t._$Cl;
|
||||
let o = i !== void 0 ? (r = t._$Co) == null ? void 0 : r[i] : t._$Cl;
|
||||
const n = L(e) ? void 0 : e._$litDirective$;
|
||||
return (r == null ? void 0 : r.constructor) !== n && ((l = r == null ? void 0 : r._$AO) == null || l.call(r, !1), n === void 0 ? r = void 0 : (r = new n(s), r._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = r : t._$Cl = r), r !== void 0 && (e = M(s, r._$AS(s, e.values), r, i)), e;
|
||||
return (o == null ? void 0 : o.constructor) !== n && ((l = o == null ? void 0 : o._$AO) == null || l.call(o, !1), n === void 0 ? o = void 0 : (o = new n(s), o._$AT(s, t, i)), i !== void 0 ? (t._$Co ?? (t._$Co = []))[i] = o : t._$Cl = o), o !== void 0 && (e = M(s, o._$AS(s, e.values), o, i)), e;
|
||||
}
|
||||
class He {
|
||||
constructor(e, t) {
|
||||
|
|
@ -358,30 +358,30 @@ class He {
|
|||
return this._$AM._$AU;
|
||||
}
|
||||
u(e) {
|
||||
const { el: { content: t }, parts: i } = this._$AD, r = ((e == null ? void 0 : e.creationScope) ?? E).importNode(t, !0);
|
||||
P.currentNode = r;
|
||||
let n = P.nextNode(), o = 0, l = 0, a = i[0];
|
||||
const { el: { content: t }, parts: i } = this._$AD, o = ((e == null ? void 0 : e.creationScope) ?? U).importNode(t, !0);
|
||||
C.currentNode = o;
|
||||
let n = C.nextNode(), r = 0, l = 0, a = i[0];
|
||||
for (; a !== void 0; ) {
|
||||
if (o === a.index) {
|
||||
if (r === a.index) {
|
||||
let p;
|
||||
a.type === 2 ? p = new W(n, n.nextSibling, this, e) : a.type === 1 ? p = new a.ctor(n, a.name, a.strings, this, e) : a.type === 6 && (p = new Le(n, this, e)), this._$AV.push(p), a = i[++l];
|
||||
a.type === 2 ? p = new B(n, n.nextSibling, this, e) : a.type === 1 ? p = new a.ctor(n, a.name, a.strings, this, e) : a.type === 6 && (p = new Le(n, this, e)), this._$AV.push(p), a = i[++l];
|
||||
}
|
||||
o !== (a == null ? void 0 : a.index) && (n = P.nextNode(), o++);
|
||||
r !== (a == null ? void 0 : a.index) && (n = C.nextNode(), r++);
|
||||
}
|
||||
return P.currentNode = E, r;
|
||||
return C.currentNode = U, o;
|
||||
}
|
||||
p(e) {
|
||||
let t = 0;
|
||||
for (const i of this._$AV) i !== void 0 && (i.strings !== void 0 ? (i._$AI(e, i, t), t += i.strings.length - 2) : i._$AI(e[t])), t++;
|
||||
}
|
||||
}
|
||||
class W {
|
||||
class B {
|
||||
get _$AU() {
|
||||
var e;
|
||||
return ((e = this._$AM) == null ? void 0 : e._$AU) ?? this._$Cv;
|
||||
}
|
||||
constructor(e, t, i, r) {
|
||||
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = r, this._$Cv = (r == null ? void 0 : r.isConnected) ?? !0;
|
||||
constructor(e, t, i, o) {
|
||||
this.type = 2, this._$AH = d, this._$AN = void 0, this._$AA = e, this._$AB = t, this._$AM = i, this.options = o, this._$Cv = (o == null ? void 0 : o.isConnected) ?? !0;
|
||||
}
|
||||
get parentNode() {
|
||||
let e = this._$AA.parentNode;
|
||||
|
|
@ -404,33 +404,33 @@ class W {
|
|||
this._$AH !== e && (this._$AR(), this._$AH = this.O(e));
|
||||
}
|
||||
_(e) {
|
||||
this._$AH !== d && L(this._$AH) ? this._$AA.nextSibling.data = e : this.T(E.createTextNode(e)), this._$AH = e;
|
||||
this._$AH !== d && L(this._$AH) ? this._$AA.nextSibling.data = e : this.T(U.createTextNode(e)), this._$AH = e;
|
||||
}
|
||||
$(e) {
|
||||
var n;
|
||||
const { values: t, _$litType$: i } = e, r = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = q.createElement(we(i.h, i.h[0]), this.options)), i);
|
||||
if (((n = this._$AH) == null ? void 0 : n._$AD) === r) this._$AH.p(t);
|
||||
const { values: t, _$litType$: i } = e, o = typeof i == "number" ? this._$AC(e) : (i.el === void 0 && (i.el = W.createElement(xe(i.h, i.h[0]), this.options)), i);
|
||||
if (((n = this._$AH) == null ? void 0 : n._$AD) === o) this._$AH.p(t);
|
||||
else {
|
||||
const o = new He(r, this), l = o.u(this.options);
|
||||
o.p(t), this.T(l), this._$AH = o;
|
||||
const r = new He(o, this), l = r.u(this.options);
|
||||
r.p(t), this.T(l), this._$AH = r;
|
||||
}
|
||||
}
|
||||
_$AC(e) {
|
||||
let t = ge.get(e.strings);
|
||||
return t === void 0 && ge.set(e.strings, t = new q(e)), t;
|
||||
let t = be.get(e.strings);
|
||||
return t === void 0 && be.set(e.strings, t = new W(e)), t;
|
||||
}
|
||||
k(e) {
|
||||
oe(this._$AH) || (this._$AH = [], this._$AR());
|
||||
re(this._$AH) || (this._$AH = [], this._$AR());
|
||||
const t = this._$AH;
|
||||
let i, r = 0;
|
||||
for (const n of e) r === t.length ? t.push(i = new W(this.O(I()), this.O(I()), this, this.options)) : i = t[r], i._$AI(n), r++;
|
||||
r < t.length && (this._$AR(i && i._$AB.nextSibling, r), t.length = r);
|
||||
let i, o = 0;
|
||||
for (const n of e) o === t.length ? t.push(i = new B(this.O(I()), this.O(I()), this, this.options)) : i = t[o], i._$AI(n), o++;
|
||||
o < t.length && (this._$AR(i && i._$AB.nextSibling, o), t.length = o);
|
||||
}
|
||||
_$AR(e = this._$AA.nextSibling, t) {
|
||||
var i;
|
||||
for ((i = this._$AP) == null ? void 0 : i.call(this, !1, !0, t); e !== this._$AB; ) {
|
||||
const r = de(e).nextSibling;
|
||||
de(e).remove(), e = r;
|
||||
const o = he(e).nextSibling;
|
||||
he(e).remove(), e = o;
|
||||
}
|
||||
}
|
||||
setConnected(e) {
|
||||
|
|
@ -445,19 +445,19 @@ class G {
|
|||
get _$AU() {
|
||||
return this._$AM._$AU;
|
||||
}
|
||||
constructor(e, t, i, r, n) {
|
||||
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = e, this.name = t, this._$AM = r, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = d;
|
||||
constructor(e, t, i, o, n) {
|
||||
this.type = 1, this._$AH = d, this._$AN = void 0, this.element = e, this.name = t, this._$AM = o, this.options = n, i.length > 2 || i[0] !== "" || i[1] !== "" ? (this._$AH = Array(i.length - 1).fill(new String()), this.strings = i) : this._$AH = d;
|
||||
}
|
||||
_$AI(e, t = this, i, r) {
|
||||
_$AI(e, t = this, i, o) {
|
||||
const n = this.strings;
|
||||
let o = !1;
|
||||
if (n === void 0) e = M(this, e, t, 0), o = !L(e) || e !== this._$AH && e !== T, o && (this._$AH = e);
|
||||
let r = !1;
|
||||
if (n === void 0) e = M(this, e, t, 0), r = !L(e) || e !== this._$AH && e !== T, r && (this._$AH = e);
|
||||
else {
|
||||
const l = e;
|
||||
let a, p;
|
||||
for (e = n[0], a = 0; a < n.length - 1; a++) p = M(this, l[i + a], t, a), p === T && (p = this._$AH[a]), o || (o = !L(p) || p !== this._$AH[a]), p === d ? e = d : e !== d && (e += (p ?? "") + n[a + 1]), this._$AH[a] = p;
|
||||
for (e = n[0], a = 0; a < n.length - 1; a++) p = M(this, l[i + a], t, a), p === T && (p = this._$AH[a]), r || (r = !L(p) || p !== this._$AH[a]), p === d ? e = d : e !== d && (e += (p ?? "") + n[a + 1]), this._$AH[a] = p;
|
||||
}
|
||||
o && !r && this.j(e);
|
||||
r && !o && this.j(e);
|
||||
}
|
||||
j(e) {
|
||||
e === d ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, e ?? "");
|
||||
|
|
@ -480,13 +480,13 @@ class Ne extends G {
|
|||
}
|
||||
}
|
||||
class Ie extends G {
|
||||
constructor(e, t, i, r, n) {
|
||||
super(e, t, i, r, n), this.type = 5;
|
||||
constructor(e, t, i, o, n) {
|
||||
super(e, t, i, o, n), this.type = 5;
|
||||
}
|
||||
_$AI(e, t = this) {
|
||||
if ((e = M(this, e, t, 0) ?? d) === T) return;
|
||||
const i = this._$AH, r = e === d && i !== d || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, n = e !== d && (i === d || r);
|
||||
r && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
||||
const i = this._$AH, o = e === d && i !== d || e.capture !== i.capture || e.once !== i.once || e.passive !== i.passive, n = e !== d && (i === d || o);
|
||||
o && this.element.removeEventListener(this.name, this, i), n && this.element.addEventListener(this.name, this, e), this._$AH = e;
|
||||
}
|
||||
handleEvent(e) {
|
||||
var t;
|
||||
|
|
@ -505,23 +505,23 @@ class Le {
|
|||
}
|
||||
}
|
||||
const ee = N.litHtmlPolyfillSupport;
|
||||
ee == null || ee(q, W), (N.litHtmlVersions ?? (N.litHtmlVersions = [])).push("3.3.2");
|
||||
const qe = (s, e, t) => {
|
||||
ee == null || ee(W, B), (N.litHtmlVersions ?? (N.litHtmlVersions = [])).push("3.3.2");
|
||||
const We = (s, e, t) => {
|
||||
const i = (t == null ? void 0 : t.renderBefore) ?? e;
|
||||
let r = i._$litPart$;
|
||||
if (r === void 0) {
|
||||
let o = i._$litPart$;
|
||||
if (o === void 0) {
|
||||
const n = (t == null ? void 0 : t.renderBefore) ?? null;
|
||||
i._$litPart$ = r = new W(e.insertBefore(I(), n), n, void 0, t ?? {});
|
||||
i._$litPart$ = o = new B(e.insertBefore(I(), n), n, void 0, t ?? {});
|
||||
}
|
||||
return r._$AI(s), r;
|
||||
return o._$AI(s), o;
|
||||
};
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const C = globalThis;
|
||||
class $ extends D {
|
||||
const E = globalThis;
|
||||
class y extends D {
|
||||
constructor() {
|
||||
super(...arguments), this.renderOptions = { host: this }, this._$Do = void 0;
|
||||
}
|
||||
|
|
@ -532,7 +532,7 @@ class $ extends D {
|
|||
}
|
||||
update(e) {
|
||||
const t = this.render();
|
||||
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = qe(t, this.renderRoot, this.renderOptions);
|
||||
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(e), this._$Do = We(t, this.renderRoot, this.renderOptions);
|
||||
}
|
||||
connectedCallback() {
|
||||
var e;
|
||||
|
|
@ -546,11 +546,11 @@ class $ extends D {
|
|||
return T;
|
||||
}
|
||||
}
|
||||
var be;
|
||||
$._$litElement$ = !0, $.finalized = !0, (be = C.litElementHydrateSupport) == null || be.call(C, { LitElement: $ });
|
||||
const te = C.litElementPolyfillSupport;
|
||||
te == null || te({ LitElement: $ });
|
||||
(C.litElementVersions ?? (C.litElementVersions = [])).push("4.2.2");
|
||||
var $e;
|
||||
y._$litElement$ = !0, y.finalized = !0, ($e = E.litElementHydrateSupport) == null || $e.call(E, { LitElement: y });
|
||||
const te = E.litElementPolyfillSupport;
|
||||
te == null || te({ LitElement: y });
|
||||
(E.litElementVersions ?? (E.litElementVersions = [])).push("4.2.2");
|
||||
/**
|
||||
* @license
|
||||
* Copyright 2017 Google LLC
|
||||
|
|
@ -566,31 +566,31 @@ const F = (s) => (e, t) => {
|
|||
* Copyright 2017 Google LLC
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*/
|
||||
const Be = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged: ie }, We = (s = Be, e, t) => {
|
||||
const { kind: i, metadata: r } = t;
|
||||
let n = globalThis.litPropertyMetadata.get(r);
|
||||
if (n === void 0 && globalThis.litPropertyMetadata.set(r, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(t.name, s), i === "accessor") {
|
||||
const { name: o } = t;
|
||||
const qe = { attribute: !0, type: String, converter: J, reflect: !1, hasChanged: oe }, Be = (s = qe, e, t) => {
|
||||
const { kind: i, metadata: o } = t;
|
||||
let n = globalThis.litPropertyMetadata.get(o);
|
||||
if (n === void 0 && globalThis.litPropertyMetadata.set(o, n = /* @__PURE__ */ new Map()), i === "setter" && ((s = Object.create(s)).wrapped = !0), n.set(t.name, s), i === "accessor") {
|
||||
const { name: r } = t;
|
||||
return { set(l) {
|
||||
const a = e.get.call(this);
|
||||
e.set.call(this, l), this.requestUpdate(o, a, s, !0, l);
|
||||
e.set.call(this, l), this.requestUpdate(r, a, s, !0, l);
|
||||
}, init(l) {
|
||||
return l !== void 0 && this.C(o, void 0, s, l), l;
|
||||
return l !== void 0 && this.C(r, void 0, s, l), l;
|
||||
} };
|
||||
}
|
||||
if (i === "setter") {
|
||||
const { name: o } = t;
|
||||
const { name: r } = t;
|
||||
return function(l) {
|
||||
const a = this[o];
|
||||
e.call(this, l), this.requestUpdate(o, a, s, !0, l);
|
||||
const a = this[r];
|
||||
e.call(this, l), this.requestUpdate(r, a, s, !0, l);
|
||||
};
|
||||
}
|
||||
throw Error("Unsupported decorator location: " + i);
|
||||
};
|
||||
function f(s) {
|
||||
return (e, t) => typeof t == "object" ? We(s, e, t) : ((i, r, n) => {
|
||||
const o = r.hasOwnProperty(n);
|
||||
return r.constructor.createProperty(n, i), o ? Object.getOwnPropertyDescriptor(r, n) : void 0;
|
||||
return (e, t) => typeof t == "object" ? Be(s, e, t) : ((i, o, n) => {
|
||||
const r = o.hasOwnProperty(n);
|
||||
return o.constructor.createProperty(n, i), r ? Object.getOwnPropertyDescriptor(o, n) : void 0;
|
||||
})(s, e, t);
|
||||
}
|
||||
/**
|
||||
|
|
@ -601,13 +601,13 @@ function f(s) {
|
|||
function u(s) {
|
||||
return f({ ...s, state: !0, attribute: !1 });
|
||||
}
|
||||
function xe(s, e) {
|
||||
function ne(s, e) {
|
||||
const t = new WebSocket(s);
|
||||
return t.onmessage = (i) => {
|
||||
var r, n, o, l;
|
||||
var o, n, r, l;
|
||||
try {
|
||||
const a = JSON.parse(i.data);
|
||||
((n = (r = a.type) == null ? void 0 : r.startsWith) != null && n.call(r, "process.") || (l = (o = a.channel) == null ? void 0 : o.startsWith) != null && l.call(o, "process.")) && e(a);
|
||||
((n = (o = a.type) == null ? void 0 : o.startsWith) != null && n.call(o, "process.") || (l = (r = a.channel) == null ? void 0 : r.startsWith) != null && l.call(r, "process.")) && e(a);
|
||||
} catch {
|
||||
}
|
||||
}, t;
|
||||
|
|
@ -621,10 +621,10 @@ class Fe {
|
|||
}
|
||||
async request(e, t) {
|
||||
var n;
|
||||
const r = await (await fetch(`${this.base}${e}`, t)).json();
|
||||
if (!r.success)
|
||||
throw new Error(((n = r.error) == null ? void 0 : n.message) ?? "Request failed");
|
||||
return r.data;
|
||||
const o = await (await fetch(`${this.base}${e}`, t)).json();
|
||||
if (!o.success)
|
||||
throw new Error(((n = o.error) == null ? void 0 : n.message) ?? "Request failed");
|
||||
return o.data;
|
||||
}
|
||||
/** List all alive daemons from the registry. */
|
||||
listDaemons() {
|
||||
|
|
@ -645,12 +645,12 @@ class Fe {
|
|||
return this.request(`/daemons/${e}/${t}/health`);
|
||||
}
|
||||
}
|
||||
var Ke = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, k = (s, e, t, i) => {
|
||||
for (var r = i > 1 ? void 0 : i ? Ve(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
||||
(o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
|
||||
return i && r && Ke(e, t, r), r;
|
||||
var Ve = Object.defineProperty, Ke = Object.getOwnPropertyDescriptor, k = (s, e, t, i) => {
|
||||
for (var o = i > 1 ? void 0 : i ? Ke(e, t) : e, n = s.length - 1, r; n >= 0; n--)
|
||||
(r = s[n]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
||||
return i && o && Ve(e, t, o), o;
|
||||
};
|
||||
let g = class extends $ {
|
||||
let g = class extends y {
|
||||
constructor() {
|
||||
super(...arguments), this.apiUrl = "", this.daemons = [], this.loading = !0, this.error = "", this.stopping = /* @__PURE__ */ new Set(), this.checking = /* @__PURE__ */ new Set(), this.healthResults = /* @__PURE__ */ new Map();
|
||||
}
|
||||
|
|
@ -770,7 +770,7 @@ let g = class extends $ {
|
|||
`;
|
||||
}
|
||||
};
|
||||
g.styles = B`
|
||||
g.styles = q`
|
||||
:host {
|
||||
display: block;
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
|
|
@ -947,20 +947,30 @@ k([
|
|||
g = k([
|
||||
F("core-process-daemons")
|
||||
], g);
|
||||
var Je = Object.defineProperty, Ze = Object.getOwnPropertyDescriptor, U = (s, e, t, i) => {
|
||||
for (var r = i > 1 ? void 0 : i ? Ze(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
||||
(o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
|
||||
return i && r && Je(e, t, r), r;
|
||||
var Je = Object.defineProperty, Ze = Object.getOwnPropertyDescriptor, S = (s, e, t, i) => {
|
||||
for (var o = i > 1 ? void 0 : i ? Ze(e, t) : e, n = s.length - 1, r; n >= 0; n--)
|
||||
(r = s[n]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
||||
return i && o && Je(e, t, o), o;
|
||||
};
|
||||
let y = class extends $ {
|
||||
let b = class extends y {
|
||||
constructor() {
|
||||
super(...arguments), this.apiUrl = "", this.selectedId = "", this.processes = [], this.loading = !1, this.error = "", this.killing = /* @__PURE__ */ new Set();
|
||||
super(...arguments), this.apiUrl = "", this.wsUrl = "", this.selectedId = "", this.processes = [], this.loading = !1, this.error = "", this.connected = !1, this.ws = null;
|
||||
}
|
||||
connectedCallback() {
|
||||
super.connectedCallback(), this.loadProcesses();
|
||||
}
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback(), this.disconnect();
|
||||
}
|
||||
updated(s) {
|
||||
s.has("wsUrl") && (this.disconnect(), this.processes = [], this.loadProcesses());
|
||||
}
|
||||
async loadProcesses() {
|
||||
this.loading = !1, this.processes = [];
|
||||
if (this.error = "", this.loading = !1, !this.wsUrl) {
|
||||
this.processes = [];
|
||||
return;
|
||||
}
|
||||
this.connect();
|
||||
}
|
||||
handleSelect(s) {
|
||||
this.dispatchEvent(
|
||||
|
|
@ -981,13 +991,60 @@ let y = class extends $ {
|
|||
return "unknown";
|
||||
}
|
||||
}
|
||||
connect() {
|
||||
this.ws = ne(this.wsUrl, (s) => {
|
||||
this.applyEvent(s);
|
||||
}), this.ws.onopen = () => {
|
||||
this.connected = !0;
|
||||
}, this.ws.onclose = () => {
|
||||
this.connected = !1;
|
||||
};
|
||||
}
|
||||
disconnect() {
|
||||
this.ws && (this.ws.close(), this.ws = null), this.connected = !1;
|
||||
}
|
||||
applyEvent(s) {
|
||||
const e = s.channel ?? s.type ?? "", t = s.data ?? {};
|
||||
if (!t.id)
|
||||
return;
|
||||
const i = new Map(this.processes.map((n) => [n.id, n])), o = i.get(t.id);
|
||||
if (e === "process.started") {
|
||||
i.set(t.id, this.normalizeProcess(t, o, "running")), this.processes = this.sortProcesses(i);
|
||||
return;
|
||||
}
|
||||
if (e === "process.exited") {
|
||||
i.set(t.id, this.normalizeProcess(t, o, "exited")), this.processes = this.sortProcesses(i);
|
||||
return;
|
||||
}
|
||||
if (e === "process.killed") {
|
||||
i.set(t.id, this.normalizeProcess(t, o, "killed")), this.processes = this.sortProcesses(i);
|
||||
return;
|
||||
}
|
||||
}
|
||||
normalizeProcess(s, e, t) {
|
||||
return {
|
||||
id: s.id,
|
||||
command: s.command ?? (e == null ? void 0 : e.command) ?? "",
|
||||
args: s.args ?? (e == null ? void 0 : e.args) ?? [],
|
||||
dir: s.dir ?? (e == null ? void 0 : e.dir) ?? "",
|
||||
startedAt: s.startedAt ?? (e == null ? void 0 : e.startedAt) ?? (/* @__PURE__ */ new Date()).toISOString(),
|
||||
status: t,
|
||||
exitCode: s.exitCode ?? (e == null ? void 0 : e.exitCode) ?? (t === "killed" ? -1 : 0),
|
||||
duration: s.duration ?? (e == null ? void 0 : e.duration) ?? 0,
|
||||
pid: s.pid ?? (e == null ? void 0 : e.pid) ?? 0
|
||||
};
|
||||
}
|
||||
sortProcesses(s) {
|
||||
return [...s.values()].sort(
|
||||
(e, t) => new Date(t.startedAt).getTime() - new Date(e.startedAt).getTime()
|
||||
);
|
||||
}
|
||||
render() {
|
||||
return this.loading ? c`<div class="loading">Loading processes\u2026</div>` : c`
|
||||
${this.error ? c`<div class="error">${this.error}</div>` : d}
|
||||
${this.processes.length === 0 ? c`
|
||||
<div class="info-notice">
|
||||
Process list endpoints are pending. Processes will appear here once
|
||||
the REST API for managed processes is available.
|
||||
${this.wsUrl ? this.connected ? "Waiting for process events from the WebSocket feed." : "Connecting to the process event stream..." : "Set a WebSocket URL to receive live process events."}
|
||||
</div>
|
||||
<div class="empty">No managed processes.</div>
|
||||
` : c`
|
||||
|
|
@ -1019,12 +1076,12 @@ let y = class extends $ {
|
|||
<div class="item-actions">
|
||||
<button
|
||||
class="kill-btn"
|
||||
?disabled=${this.killing.has(s.id)}
|
||||
disabled
|
||||
@click=${(t) => {
|
||||
t.stopPropagation();
|
||||
}}
|
||||
>
|
||||
${this.killing.has(s.id) ? "Killing…" : "Kill"}
|
||||
Live only
|
||||
</button>
|
||||
</div>
|
||||
` : d}
|
||||
|
|
@ -1037,7 +1094,7 @@ let y = class extends $ {
|
|||
`;
|
||||
}
|
||||
};
|
||||
y.styles = B`
|
||||
b.styles = q`
|
||||
:host {
|
||||
display: block;
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
|
|
@ -1201,33 +1258,36 @@ y.styles = B`
|
|||
margin-bottom: 1rem;
|
||||
}
|
||||
`;
|
||||
U([
|
||||
S([
|
||||
f({ attribute: "api-url" })
|
||||
], y.prototype, "apiUrl", 2);
|
||||
U([
|
||||
], b.prototype, "apiUrl", 2);
|
||||
S([
|
||||
f({ attribute: "ws-url" })
|
||||
], b.prototype, "wsUrl", 2);
|
||||
S([
|
||||
f({ attribute: "selected-id" })
|
||||
], y.prototype, "selectedId", 2);
|
||||
U([
|
||||
], b.prototype, "selectedId", 2);
|
||||
S([
|
||||
u()
|
||||
], y.prototype, "processes", 2);
|
||||
U([
|
||||
], b.prototype, "processes", 2);
|
||||
S([
|
||||
u()
|
||||
], y.prototype, "loading", 2);
|
||||
U([
|
||||
], b.prototype, "loading", 2);
|
||||
S([
|
||||
u()
|
||||
], y.prototype, "error", 2);
|
||||
U([
|
||||
], b.prototype, "error", 2);
|
||||
S([
|
||||
u()
|
||||
], y.prototype, "killing", 2);
|
||||
y = U([
|
||||
], b.prototype, "connected", 2);
|
||||
b = S([
|
||||
F("core-process-list")
|
||||
], y);
|
||||
], b);
|
||||
var Ge = Object.defineProperty, Qe = Object.getOwnPropertyDescriptor, O = (s, e, t, i) => {
|
||||
for (var r = i > 1 ? void 0 : i ? Qe(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
||||
(o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
|
||||
return i && r && Ge(e, t, r), r;
|
||||
for (var o = i > 1 ? void 0 : i ? Qe(e, t) : e, n = s.length - 1, r; n >= 0; n--)
|
||||
(r = s[n]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
||||
return i && o && Ge(e, t, o), o;
|
||||
};
|
||||
let v = class extends $ {
|
||||
let v = class extends y {
|
||||
constructor() {
|
||||
super(...arguments), this.apiUrl = "", this.wsUrl = "", this.processId = "", this.lines = [], this.autoScroll = !0, this.connected = !1, this.ws = null;
|
||||
}
|
||||
|
|
@ -1241,7 +1301,7 @@ let v = class extends $ {
|
|||
(s.has("processId") || s.has("wsUrl")) && (this.disconnect(), this.lines = [], this.wsUrl && this.processId && this.connect()), this.autoScroll && this.scrollToBottom();
|
||||
}
|
||||
connect() {
|
||||
this.ws = xe(this.wsUrl, (s) => {
|
||||
this.ws = ne(this.wsUrl, (s) => {
|
||||
const e = s.data;
|
||||
if (!e) return;
|
||||
(s.channel ?? s.type ?? "") === "process.output" && e.id === this.processId && (this.lines = [
|
||||
|
|
@ -1300,7 +1360,7 @@ let v = class extends $ {
|
|||
` : c`<div class="empty">Select a process to view its output.</div>`;
|
||||
}
|
||||
};
|
||||
v.styles = B`
|
||||
v.styles = q`
|
||||
:host {
|
||||
display: block;
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
|
|
@ -1426,11 +1486,11 @@ v = O([
|
|||
F("core-process-output")
|
||||
], v);
|
||||
var Xe = Object.defineProperty, Ye = Object.getOwnPropertyDescriptor, Q = (s, e, t, i) => {
|
||||
for (var r = i > 1 ? void 0 : i ? Ye(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
||||
(o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
|
||||
return i && r && Xe(e, t, r), r;
|
||||
for (var o = i > 1 ? void 0 : i ? Ye(e, t) : e, n = s.length - 1, r; n >= 0; n--)
|
||||
(r = s[n]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
||||
return i && o && Xe(e, t, o), o;
|
||||
};
|
||||
let R = class extends $ {
|
||||
let R = class extends y {
|
||||
constructor() {
|
||||
super(...arguments), this.apiUrl = "", this.result = null, this.expandedOutputs = /* @__PURE__ */ new Set();
|
||||
}
|
||||
|
|
@ -1459,7 +1519,7 @@ let R = class extends $ {
|
|||
</div>
|
||||
<div class="empty">No pipeline results.</div>
|
||||
`;
|
||||
const { results: s, duration: e, passed: t, failed: i, skipped: r, success: n } = this.result;
|
||||
const { results: s, duration: e, passed: t, failed: i, skipped: o, success: n } = this.result;
|
||||
return c`
|
||||
<div class="summary">
|
||||
<span class="overall-badge ${n ? "success" : "failure"}">
|
||||
|
|
@ -1474,7 +1534,7 @@ let R = class extends $ {
|
|||
<span class="summary-label">Failed</span>
|
||||
</div>
|
||||
<div class="summary-stat">
|
||||
<span class="summary-value skipped">${r}</span>
|
||||
<span class="summary-value skipped">${o}</span>
|
||||
<span class="summary-label">Skipped</span>
|
||||
</div>
|
||||
<span class="summary-duration">${this.formatDuration(e)}</span>
|
||||
|
|
@ -1482,24 +1542,24 @@ let R = class extends $ {
|
|||
|
||||
<div class="list">
|
||||
${s.map(
|
||||
(o) => c`
|
||||
(r) => c`
|
||||
<div class="spec">
|
||||
<div class="spec-header">
|
||||
<div class="spec-name">
|
||||
<span>${o.name}</span>
|
||||
<span class="result-badge ${this.resultStatus(o)}">${this.resultStatus(o)}</span>
|
||||
<span>${r.name}</span>
|
||||
<span class="result-badge ${this.resultStatus(r)}">${this.resultStatus(r)}</span>
|
||||
</div>
|
||||
<span class="duration">${this.formatDuration(o.duration)}</span>
|
||||
<span class="duration">${this.formatDuration(r.duration)}</span>
|
||||
</div>
|
||||
<div class="spec-meta">
|
||||
${o.exitCode !== 0 && !o.skipped ? c`<span>exit ${o.exitCode}</span>` : d}
|
||||
${r.exitCode !== 0 && !r.skipped ? c`<span>exit ${r.exitCode}</span>` : d}
|
||||
</div>
|
||||
${o.error ? c`<div class="spec-error">${o.error}</div>` : d}
|
||||
${o.output ? c`
|
||||
<button class="toggle-output" @click=${() => this.toggleOutput(o.name)}>
|
||||
${this.expandedOutputs.has(o.name) ? "Hide output" : "Show output"}
|
||||
${r.error ? c`<div class="spec-error">${r.error}</div>` : d}
|
||||
${r.output ? c`
|
||||
<button class="toggle-output" @click=${() => this.toggleOutput(r.name)}>
|
||||
${this.expandedOutputs.has(r.name) ? "Hide output" : "Show output"}
|
||||
</button>
|
||||
${this.expandedOutputs.has(o.name) ? c`<div class="spec-output">${o.output}</div>` : d}
|
||||
${this.expandedOutputs.has(r.name) ? c`<div class="spec-output">${r.output}</div>` : d}
|
||||
` : d}
|
||||
</div>
|
||||
`
|
||||
|
|
@ -1508,7 +1568,7 @@ let R = class extends $ {
|
|||
`;
|
||||
}
|
||||
};
|
||||
R.styles = B`
|
||||
R.styles = q`
|
||||
:host {
|
||||
display: block;
|
||||
font-family: system-ui, -apple-system, sans-serif;
|
||||
|
|
@ -1716,11 +1776,11 @@ R = Q([
|
|||
F("core-process-runner")
|
||||
], R);
|
||||
var et = Object.defineProperty, tt = Object.getOwnPropertyDescriptor, z = (s, e, t, i) => {
|
||||
for (var r = i > 1 ? void 0 : i ? tt(e, t) : e, n = s.length - 1, o; n >= 0; n--)
|
||||
(o = s[n]) && (r = (i ? o(e, t, r) : o(r)) || r);
|
||||
return i && r && et(e, t, r), r;
|
||||
for (var o = i > 1 ? void 0 : i ? tt(e, t) : e, n = s.length - 1, r; n >= 0; n--)
|
||||
(r = s[n]) && (o = (i ? r(e, t, o) : r(o)) || o);
|
||||
return i && o && et(e, t, o), o;
|
||||
};
|
||||
let _ = class extends $ {
|
||||
let w = class extends y {
|
||||
constructor() {
|
||||
super(...arguments), this.apiUrl = "", this.wsUrl = "", this.activeTab = "daemons", this.wsConnected = !1, this.lastEvent = "", this.selectedProcessId = "", this.ws = null, this.tabs = [
|
||||
{ id: "daemons", label: "Daemons" },
|
||||
|
|
@ -1735,7 +1795,7 @@ let _ = class extends $ {
|
|||
super.disconnectedCallback(), this.ws && (this.ws.close(), this.ws = null);
|
||||
}
|
||||
connectWs() {
|
||||
this.ws = xe(this.wsUrl, (s) => {
|
||||
this.ws = ne(this.wsUrl, (s) => {
|
||||
this.lastEvent = s.channel ?? s.type ?? "", this.requestUpdate();
|
||||
}), this.ws.onopen = () => {
|
||||
this.wsConnected = !0;
|
||||
|
|
@ -1765,6 +1825,7 @@ let _ = class extends $ {
|
|||
return c`
|
||||
<core-process-list
|
||||
api-url=${this.apiUrl}
|
||||
ws-url=${this.wsUrl}
|
||||
@process-selected=${this.handleProcessSelected}
|
||||
></core-process-list>
|
||||
${this.selectedProcessId ? c`<core-process-output
|
||||
|
|
@ -1812,7 +1873,7 @@ let _ = class extends $ {
|
|||
`;
|
||||
}
|
||||
};
|
||||
_.styles = B`
|
||||
w.styles = q`
|
||||
:host {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
|
|
@ -1928,31 +1989,31 @@ _.styles = B`
|
|||
`;
|
||||
z([
|
||||
f({ attribute: "api-url" })
|
||||
], _.prototype, "apiUrl", 2);
|
||||
], w.prototype, "apiUrl", 2);
|
||||
z([
|
||||
f({ attribute: "ws-url" })
|
||||
], _.prototype, "wsUrl", 2);
|
||||
], w.prototype, "wsUrl", 2);
|
||||
z([
|
||||
u()
|
||||
], _.prototype, "activeTab", 2);
|
||||
], w.prototype, "activeTab", 2);
|
||||
z([
|
||||
u()
|
||||
], _.prototype, "wsConnected", 2);
|
||||
], w.prototype, "wsConnected", 2);
|
||||
z([
|
||||
u()
|
||||
], _.prototype, "lastEvent", 2);
|
||||
], w.prototype, "lastEvent", 2);
|
||||
z([
|
||||
u()
|
||||
], _.prototype, "selectedProcessId", 2);
|
||||
_ = z([
|
||||
], w.prototype, "selectedProcessId", 2);
|
||||
w = z([
|
||||
F("core-process-panel")
|
||||
], _);
|
||||
], w);
|
||||
export {
|
||||
Fe as ProcessApi,
|
||||
g as ProcessDaemons,
|
||||
y as ProcessList,
|
||||
b as ProcessList,
|
||||
v as ProcessOutput,
|
||||
_ as ProcessPanel,
|
||||
w as ProcessPanel,
|
||||
R as ProcessRunner,
|
||||
xe as connectProcessEvents
|
||||
ne as connectProcessEvents
|
||||
};
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
import { LitElement, html, css, nothing } from 'lit';
|
||||
import { customElement, property, state } from 'lit/decorators.js';
|
||||
import { connectProcessEvents, type ProcessEvent } from './shared/events.js';
|
||||
import type { ProcessInfo } from './shared/api.js';
|
||||
|
||||
/**
|
||||
|
|
@ -185,23 +186,45 @@ export class ProcessList extends LitElement {
|
|||
`;
|
||||
|
||||
@property({ attribute: 'api-url' }) apiUrl = '';
|
||||
@property({ attribute: 'ws-url' }) wsUrl = '';
|
||||
@property({ attribute: 'selected-id' }) selectedId = '';
|
||||
|
||||
@state() private processes: ProcessInfo[] = [];
|
||||
@state() private loading = false;
|
||||
@state() private error = '';
|
||||
@state() private killing = new Set<string>();
|
||||
@state() private connected = false;
|
||||
|
||||
private ws: WebSocket | null = null;
|
||||
|
||||
connectedCallback() {
|
||||
super.connectedCallback();
|
||||
this.loadProcesses();
|
||||
}
|
||||
|
||||
disconnectedCallback() {
|
||||
super.disconnectedCallback();
|
||||
this.disconnect();
|
||||
}
|
||||
|
||||
updated(changed: Map<string, unknown>) {
|
||||
if (changed.has('wsUrl')) {
|
||||
this.disconnect();
|
||||
this.processes = [];
|
||||
this.loadProcesses();
|
||||
}
|
||||
}
|
||||
|
||||
async loadProcesses() {
|
||||
// Process-level REST endpoints are not yet available.
|
||||
// This element will populate via WS events once endpoints exist.
|
||||
// The process list is built from the shared process event stream.
|
||||
this.error = '';
|
||||
this.loading = false;
|
||||
this.processes = [];
|
||||
|
||||
if (!this.wsUrl) {
|
||||
this.processes = [];
|
||||
return;
|
||||
}
|
||||
|
||||
this.connect();
|
||||
}
|
||||
|
||||
private handleSelect(proc: ProcessInfo) {
|
||||
|
|
@ -228,6 +251,84 @@ export class ProcessList extends LitElement {
|
|||
}
|
||||
}
|
||||
|
||||
private connect() {
|
||||
this.ws = connectProcessEvents(this.wsUrl, (event: ProcessEvent) => {
|
||||
this.applyEvent(event);
|
||||
});
|
||||
|
||||
this.ws.onopen = () => {
|
||||
this.connected = true;
|
||||
};
|
||||
this.ws.onclose = () => {
|
||||
this.connected = false;
|
||||
};
|
||||
}
|
||||
|
||||
private disconnect() {
|
||||
if (this.ws) {
|
||||
this.ws.close();
|
||||
this.ws = null;
|
||||
}
|
||||
this.connected = false;
|
||||
}
|
||||
|
||||
private applyEvent(event: ProcessEvent) {
|
||||
const channel = event.channel ?? event.type ?? '';
|
||||
const data = (event.data ?? {}) as Partial<ProcessInfo> & {
|
||||
id?: string;
|
||||
signal?: string;
|
||||
};
|
||||
|
||||
if (!data.id) {
|
||||
return;
|
||||
}
|
||||
|
||||
const next = new Map(this.processes.map((proc) => [proc.id, proc] as const));
|
||||
const current = next.get(data.id);
|
||||
|
||||
if (channel === 'process.started') {
|
||||
next.set(data.id, this.normalizeProcess(data, current, 'running'));
|
||||
this.processes = this.sortProcesses(next);
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel === 'process.exited') {
|
||||
next.set(data.id, this.normalizeProcess(data, current, 'exited'));
|
||||
this.processes = this.sortProcesses(next);
|
||||
return;
|
||||
}
|
||||
|
||||
if (channel === 'process.killed') {
|
||||
next.set(data.id, this.normalizeProcess(data, current, 'killed'));
|
||||
this.processes = this.sortProcesses(next);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
private normalizeProcess(
|
||||
data: Partial<ProcessInfo> & { id: string; signal?: string },
|
||||
current: ProcessInfo | undefined,
|
||||
status: ProcessInfo['status'],
|
||||
): ProcessInfo {
|
||||
return {
|
||||
id: data.id,
|
||||
command: data.command ?? current?.command ?? '',
|
||||
args: data.args ?? current?.args ?? [],
|
||||
dir: data.dir ?? current?.dir ?? '',
|
||||
startedAt: data.startedAt ?? current?.startedAt ?? new Date().toISOString(),
|
||||
status,
|
||||
exitCode: data.exitCode ?? current?.exitCode ?? (status === 'killed' ? -1 : 0),
|
||||
duration: data.duration ?? current?.duration ?? 0,
|
||||
pid: data.pid ?? current?.pid ?? 0,
|
||||
};
|
||||
}
|
||||
|
||||
private sortProcesses(processes: Map<string, ProcessInfo>): ProcessInfo[] {
|
||||
return [...processes.values()].sort(
|
||||
(a, b) => new Date(b.startedAt).getTime() - new Date(a.startedAt).getTime(),
|
||||
);
|
||||
}
|
||||
|
||||
render() {
|
||||
if (this.loading) {
|
||||
return html`<div class="loading">Loading processes\u2026</div>`;
|
||||
|
|
@ -238,8 +339,11 @@ export class ProcessList extends LitElement {
|
|||
${this.processes.length === 0
|
||||
? html`
|
||||
<div class="info-notice">
|
||||
Process list endpoints are pending. Processes will appear here once
|
||||
the REST API for managed processes is available.
|
||||
${this.wsUrl
|
||||
? this.connected
|
||||
? 'Waiting for process events from the WebSocket feed.'
|
||||
: 'Connecting to the process event stream...'
|
||||
: 'Set a WebSocket URL to receive live process events.'}
|
||||
</div>
|
||||
<div class="empty">No managed processes.</div>
|
||||
`
|
||||
|
|
@ -275,12 +379,12 @@ export class ProcessList extends LitElement {
|
|||
<div class="item-actions">
|
||||
<button
|
||||
class="kill-btn"
|
||||
?disabled=${this.killing.has(proc.id)}
|
||||
disabled
|
||||
@click=${(e: Event) => {
|
||||
e.stopPropagation();
|
||||
}}
|
||||
>
|
||||
${this.killing.has(proc.id) ? 'Killing\u2026' : 'Kill'}
|
||||
Live only
|
||||
</button>
|
||||
</div>
|
||||
`
|
||||
|
|
|
|||
|
|
@ -206,6 +206,7 @@ export class ProcessPanel extends LitElement {
|
|||
return html`
|
||||
<core-process-list
|
||||
api-url=${this.apiUrl}
|
||||
ws-url=${this.wsUrl}
|
||||
@process-selected=${this.handleProcessSelected}
|
||||
></core-process-list>
|
||||
${this.selectedProcessId
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue