@omniviewdev/runtime 0.7.0 → 0.7.2
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.
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import C, { useContext as
|
|
6
|
-
import { Link as
|
|
1
|
+
var mt = Object.defineProperty;
|
|
2
|
+
var Et = (t, e, n) => e in t ? mt(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var L = (t, e, n) => Et(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as R, jsxs as q, Fragment as St } from "react/jsx-runtime";
|
|
5
|
+
import C, { useContext as X, createContext as ue, useState as K, useRef as W, useCallback as M, useSyncExternalStore as vt, useEffect as j, useMemo as Ct } from "react";
|
|
6
|
+
import { Link as _t, useNavigate as wt, useLocation as bt, createMemoryRouter as Rt, RouterProvider as It } from "react-router-dom";
|
|
7
7
|
import "./index-D2mKAO8s.js";
|
|
8
|
-
import { P as
|
|
9
|
-
import { P as
|
|
10
|
-
import { O as
|
|
11
|
-
import { useQueryClient as
|
|
12
|
-
import { useToast as
|
|
13
|
-
import { w as
|
|
14
|
-
const
|
|
8
|
+
import { P as Ot, G as At, V as Tt, S as Dt, a as qe, U as xt, R as Ft, b as Nt, c as $e, d as Pt, L as Lt, e as kt, f as Mt, g as Ut, h as qt, i as $t, j as Wt, C as Gt, k as jt, l as Qt, m as Kt, n as Ht, Q as Bt, o as zt, p as De, q as Vt, r as We, F as Yt, s as Jt, t as Ge, D as je, u as Xt, v as Zt, w as en, x as Qe, y as tn, z as nn, A as Ke, B as rn, E as sn, H as on, I as an, J as cn, K as un, M as xe, N as ln, O as dn, T as fn, W as pn, X as hn } from "./graphservice-CUg1PUsC.js";
|
|
9
|
+
import { P as gn, W as yn, S as mn, C as En, L as Sn, F as vn, a as Cn, U as He, D as Be, G as _n, b as ze, c as Ve, A as Ye } from "./models-4EtitZnM.js";
|
|
10
|
+
import { O as x, a as Je } from "./events-Bcx6NsMp.js";
|
|
11
|
+
import { useQueryClient as B, useMutation as N, useQuery as F, keepPreviousData as Xe, useQueries as wn } from "@tanstack/react-query";
|
|
12
|
+
import { useToast as bn, Card as Rn, Toolbar as Fe, Text as ee, IconButton as ne, EmptyState as In, Button as pe, Code as On } from "@omniviewdev/base-ui";
|
|
13
|
+
import { w as An } from "./legacyEnum-DORXlU_y.js";
|
|
14
|
+
const _e = C.createContext(void 0), D = {
|
|
15
15
|
// Plugin
|
|
16
16
|
PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
|
|
17
17
|
PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
|
|
@@ -46,88 +46,88 @@ const Se = C.createContext(void 0), F = {
|
|
|
46
46
|
INTERNAL: "omniview:internal",
|
|
47
47
|
VALIDATION: "omniview:validation",
|
|
48
48
|
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
49
|
-
},
|
|
50
|
-
INVALID_REQUEST: [
|
|
51
|
-
UNSUPPORTED: [
|
|
52
|
-
FORBIDDEN: [
|
|
53
|
-
UNAUTHORIZED: [
|
|
54
|
-
NOT_FOUND: [
|
|
55
|
-
CONFLICT: [
|
|
56
|
-
ALREADY_EXISTS: [
|
|
57
|
-
CANCELLED: [
|
|
58
|
-
TIMEOUT: [
|
|
59
|
-
UNAVAILABLE: [
|
|
60
|
-
CONNECTION_ERROR: [
|
|
61
|
-
CERTIFICATE_ERROR: [
|
|
62
|
-
RESOURCE_LIMIT: [
|
|
63
|
-
CONTINUATION_EXPIRED: [
|
|
64
|
-
RESET_REQUIRED: [
|
|
65
|
-
PARTIAL_RESULT: [
|
|
66
|
-
PROVIDER_ERROR: [
|
|
67
|
-
INTERNAL: [
|
|
49
|
+
}, Ne = {
|
|
50
|
+
INVALID_REQUEST: [D.VALIDATION, 400, "correctRequest"],
|
|
51
|
+
UNSUPPORTED: [D.NOT_IMPLEMENTED, 501, "refreshContract"],
|
|
52
|
+
FORBIDDEN: [D.RESOURCE_FORBIDDEN, 403, "none"],
|
|
53
|
+
UNAUTHORIZED: [D.RESOURCE_UNAUTHORIZED, 401, "none"],
|
|
54
|
+
NOT_FOUND: [D.RESOURCE_NOT_FOUND, 404, "none"],
|
|
55
|
+
CONFLICT: [D.RESOURCE_CONFLICT, 409, "refreshContract"],
|
|
56
|
+
ALREADY_EXISTS: [D.RESOURCE_CONFLICT, 409, "refreshContract"],
|
|
57
|
+
CANCELLED: [D.CANCELLED, 499, "none"],
|
|
58
|
+
TIMEOUT: [D.RESOURCE_TIMEOUT, 408, "none"],
|
|
59
|
+
UNAVAILABLE: [D.CONNECTION_FAILED, 503, "reconnect"],
|
|
60
|
+
CONNECTION_ERROR: [D.CONNECTION_FAILED, 503, "reconnect"],
|
|
61
|
+
CERTIFICATE_ERROR: [D.CONNECTION_FAILED, 502, "reconnect"],
|
|
62
|
+
RESOURCE_LIMIT: [D.RESOURCE_LIMIT, 429, "correctRequest"],
|
|
63
|
+
CONTINUATION_EXPIRED: [D.RESOURCE_CONTINUATION_EXPIRED, 410, "restartQuery"],
|
|
64
|
+
RESET_REQUIRED: [D.RESOURCE_RESET_REQUIRED, 409, "restartQuery"],
|
|
65
|
+
PARTIAL_RESULT: [D.RESOURCE_PARTIAL, 422, "none"],
|
|
66
|
+
PROVIDER_ERROR: [D.RESOURCE_PROVIDER_ERROR, 502, "none"],
|
|
67
|
+
INTERNAL: [D.INTERNAL, 500, "none"]
|
|
68
68
|
};
|
|
69
|
-
function
|
|
69
|
+
function he(t) {
|
|
70
70
|
return typeof t == "object" && t !== null ? t : void 0;
|
|
71
71
|
}
|
|
72
|
-
function
|
|
72
|
+
function G(t, e) {
|
|
73
73
|
return typeof t == "string" && t.length > 0 && t.length <= e;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
return { type:
|
|
75
|
+
function ge() {
|
|
76
|
+
return { type: D.CANCELLED, code: "CANCELLED", title: "Cancelled", status: 499, detail: "The operation was cancelled.", recovery: "none" };
|
|
77
77
|
}
|
|
78
|
-
function
|
|
78
|
+
function ie(t, e) {
|
|
79
79
|
if (e > 4) return;
|
|
80
|
-
if (t === "cancelled") return
|
|
80
|
+
if (t === "cancelled") return ge();
|
|
81
81
|
if (typeof t == "string") {
|
|
82
82
|
const r = t.trim();
|
|
83
83
|
if (!r.startsWith("{")) return;
|
|
84
84
|
try {
|
|
85
|
-
return
|
|
85
|
+
return ie(JSON.parse(r), e + 1);
|
|
86
86
|
} catch {
|
|
87
87
|
return;
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
const n =
|
|
90
|
+
const n = he(t);
|
|
91
91
|
if (n) {
|
|
92
|
-
if (n.name === "AbortError" || n.name === "CancelError") return
|
|
93
|
-
if (
|
|
92
|
+
if (n.name === "AbortError" || n.name === "CancelError") return ge();
|
|
93
|
+
if (G(n.type, 256) && G(n.title, 256) && typeof n.status == "number" && Number.isInteger(n.status) && n.status >= 100 && n.status <= 599 && typeof n.detail == "string" && n.detail.length <= 4096) {
|
|
94
94
|
const r = { type: n.type, title: n.title, status: n.status, detail: n.detail };
|
|
95
|
-
|
|
96
|
-
const o =
|
|
97
|
-
return !!o && ["navigate", "retry", "open-url", "copy"].includes(String(o.type)) &&
|
|
95
|
+
G(n.code, 64) && (r.code = n.code), G(n.requestId, 256) && (r.requestId = n.requestId), G(n.instance, 512) && (r.instance = n.instance), Array.isArray(n.suggestions) && (r.suggestions = n.suggestions.filter((i) => G(i, 512)).slice(0, 8)), Array.isArray(n.actions) && (r.actions = n.actions.filter((i) => {
|
|
96
|
+
const o = he(i);
|
|
97
|
+
return !!o && ["navigate", "retry", "open-url", "copy"].includes(String(o.type)) && G(o.label, 256) && (o.target === void 0 || G(o.target, 4096));
|
|
98
98
|
}).slice(0, 8)), ["correctRequest", "refreshContract", "restartQuery", "reconnect", "none"].includes(String(n.recovery)) && (r.recovery = n.recovery);
|
|
99
|
-
const s =
|
|
99
|
+
const s = he(n.location);
|
|
100
100
|
return (s == null ? void 0 : s.unit) === "utf8-byte" && typeof s.start == "number" && typeof s.end == "number" && Number.isSafeInteger(s.start) && Number.isSafeInteger(s.end) && s.start >= 0 && s.end >= s.start && (r.location = { start: s.start, end: s.end, unit: "utf8-byte" }), r;
|
|
101
101
|
}
|
|
102
102
|
if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
|
|
103
103
|
let r = n.code;
|
|
104
|
-
if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(
|
|
105
|
-
const [s, i, o] =
|
|
104
|
+
if (r === "PERMISSION_DENIED" && (r = "FORBIDDEN"), ["INVALID_INPUT", "FILTER_UNKNOWN_FIELD", "FILTER_INVALID_OPERATOR"].includes(r) && (r = "INVALID_REQUEST"), Object.prototype.hasOwnProperty.call(Ne, r) || (r = "INTERNAL"), r === "CANCELLED") return ge();
|
|
105
|
+
const [s, i, o] = Ne[r], a = r === "FORBIDDEN" || r === "UNAUTHORIZED" || r === "INTERNAL" || r === "PROVIDER_ERROR";
|
|
106
106
|
return {
|
|
107
107
|
type: s,
|
|
108
108
|
status: i,
|
|
109
109
|
code: r,
|
|
110
110
|
recovery: o,
|
|
111
|
-
title: a ? r === "FORBIDDEN" ? "Access denied" : r === "UNAUTHORIZED" ? "Authentication required" : "Operation failed" :
|
|
112
|
-
detail: a ? "The operation could not be completed." :
|
|
113
|
-
...!a && Array.isArray(n.suggestions) ? { suggestions: n.suggestions.filter((c) =>
|
|
111
|
+
title: a ? r === "FORBIDDEN" ? "Access denied" : r === "UNAUTHORIZED" ? "Authentication required" : "Operation failed" : G(n.title, 256) ? n.title : "Operation failed",
|
|
112
|
+
detail: a ? "The operation could not be completed." : G(n.message, 4096) ? n.message : "The operation could not be completed.",
|
|
113
|
+
...!a && Array.isArray(n.suggestions) ? { suggestions: n.suggestions.filter((c) => G(c, 512)).slice(0, 8) } : {}
|
|
114
114
|
};
|
|
115
115
|
}
|
|
116
|
-
return
|
|
116
|
+
return ie(n.message, e + 1) ?? ie(n.cause, e + 1);
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
|
-
function
|
|
120
|
-
return
|
|
121
|
-
type:
|
|
119
|
+
function H(t) {
|
|
120
|
+
return ie(t, 0) ?? {
|
|
121
|
+
type: D.INTERNAL,
|
|
122
122
|
title: t == null ? "Unknown error" : "Error",
|
|
123
123
|
status: 500,
|
|
124
124
|
detail: t == null ? "An unknown error occurred." : "The operation could not be completed."
|
|
125
125
|
};
|
|
126
126
|
}
|
|
127
|
-
function
|
|
128
|
-
return
|
|
127
|
+
function ae(t) {
|
|
128
|
+
return H(t).type === D.CANCELLED;
|
|
129
129
|
}
|
|
130
|
-
function
|
|
130
|
+
function Tn(t) {
|
|
131
131
|
switch (t.type) {
|
|
132
132
|
case "navigate":
|
|
133
133
|
return {
|
|
@@ -164,7 +164,7 @@ function Cn(t) {
|
|
|
164
164
|
};
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
function
|
|
167
|
+
function Ze(t, e) {
|
|
168
168
|
var s, i;
|
|
169
169
|
const n = [
|
|
170
170
|
t.detail,
|
|
@@ -175,73 +175,73 @@ function Ve(t, e) {
|
|
|
175
175
|
message: e || (t.title !== "Error" ? t.title : "Operation failed"),
|
|
176
176
|
status: "error",
|
|
177
177
|
details: n,
|
|
178
|
-
actions: (i = t.actions) == null ? void 0 : i.map(
|
|
178
|
+
actions: (i = t.actions) == null ? void 0 : i.map(Tn)
|
|
179
179
|
};
|
|
180
180
|
}
|
|
181
|
-
function
|
|
182
|
-
if (
|
|
183
|
-
const r =
|
|
184
|
-
t(
|
|
181
|
+
function z(t, e, n) {
|
|
182
|
+
if (ae(e)) return;
|
|
183
|
+
const r = H(e);
|
|
184
|
+
t(Ze(r, n));
|
|
185
185
|
}
|
|
186
|
-
function
|
|
186
|
+
function U(t, e) {
|
|
187
187
|
return (n) => {
|
|
188
|
-
if (
|
|
189
|
-
const r =
|
|
190
|
-
t(
|
|
188
|
+
if (ae(n)) return;
|
|
189
|
+
const r = H(n);
|
|
190
|
+
t(Ze(r, r.title !== "Error" ? r.title : e));
|
|
191
191
|
};
|
|
192
192
|
}
|
|
193
|
-
function
|
|
194
|
-
const { children: e, pluginId: n } = t, [r, s] = C.useState({}), [i, o] = C.useState(new
|
|
195
|
-
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!
|
|
196
|
-
const
|
|
193
|
+
function cs(t) {
|
|
194
|
+
const { children: e, pluginId: n } = t, [r, s] = C.useState({}), [i, o] = C.useState(new gn()), [a, c] = C.useState(!1), [d, l] = C.useState(null), f = C.useRef(0), h = C.useRef(0);
|
|
195
|
+
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!d });
|
|
196
|
+
const g = C.useCallback(() => {
|
|
197
197
|
if (n === void 0 || n === "")
|
|
198
198
|
return;
|
|
199
|
-
const
|
|
200
|
-
console.debug(`[PluginContextProvider] fetching settings for "${n}"`),
|
|
201
|
-
|
|
202
|
-
}).catch((
|
|
203
|
-
if (
|
|
204
|
-
const p =
|
|
199
|
+
const S = ++f.current;
|
|
200
|
+
console.debug(`[PluginContextProvider] fetching settings for "${n}"`), Ot(n).then((u) => {
|
|
201
|
+
S === f.current && (console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(u)), s(u));
|
|
202
|
+
}).catch((u) => {
|
|
203
|
+
if (S !== f.current) return;
|
|
204
|
+
const p = H(u);
|
|
205
205
|
console.error(`[PluginContextProvider] error fetching settings for "${n}":`, p.detail);
|
|
206
206
|
});
|
|
207
|
-
}, [n]),
|
|
207
|
+
}, [n]), m = C.useCallback(() => {
|
|
208
208
|
if (n === void 0 || n === "") {
|
|
209
209
|
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
210
210
|
return;
|
|
211
211
|
}
|
|
212
|
-
const
|
|
213
|
-
console.debug(`[PluginContextProvider] fetching meta for "${n}"`),
|
|
214
|
-
|
|
215
|
-
}).catch((
|
|
216
|
-
if (
|
|
217
|
-
const p =
|
|
218
|
-
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail),
|
|
212
|
+
const S = ++h.current;
|
|
213
|
+
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), l(null), At(n).then((u) => {
|
|
214
|
+
S === h.current && (console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: u == null ? void 0 : u.name, version: u == null ? void 0 : u.version }), o(u), c(!0));
|
|
215
|
+
}).catch((u) => {
|
|
216
|
+
if (S !== h.current) return;
|
|
217
|
+
const p = H(u);
|
|
218
|
+
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, p.detail), l(p.detail), c(!1);
|
|
219
219
|
});
|
|
220
220
|
}, [n]);
|
|
221
221
|
return C.useEffect(() => {
|
|
222
222
|
if (a) return;
|
|
223
|
-
const
|
|
224
|
-
|
|
225
|
-
},
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
var
|
|
229
|
-
((
|
|
223
|
+
const S = () => {
|
|
224
|
+
g(), m();
|
|
225
|
+
}, u = [
|
|
226
|
+
x("plugin/init_complete", S),
|
|
227
|
+
x("plugin/dev_install_complete", (p) => {
|
|
228
|
+
var _;
|
|
229
|
+
((_ = p.data) == null ? void 0 : _.id) === n && S();
|
|
230
230
|
}),
|
|
231
|
-
|
|
231
|
+
x("plugin/inventory_changed", S)
|
|
232
232
|
];
|
|
233
233
|
return () => {
|
|
234
|
-
for (const p of
|
|
234
|
+
for (const p of u) p();
|
|
235
235
|
};
|
|
236
|
-
}, [n, a,
|
|
237
|
-
++
|
|
238
|
-
}), [n,
|
|
236
|
+
}, [n, a, g, m]), C.useEffect(() => (console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), c(!1), l(null), s({}), g(), m(), () => {
|
|
237
|
+
++f.current, ++h.current;
|
|
238
|
+
}), [n, g, m]), d ? /* @__PURE__ */ R("div", { style: {
|
|
239
239
|
display: "flex",
|
|
240
240
|
flex: 1,
|
|
241
241
|
alignItems: "center",
|
|
242
242
|
justifyContent: "center",
|
|
243
243
|
padding: 24
|
|
244
|
-
}, children: /* @__PURE__ */
|
|
244
|
+
}, children: /* @__PURE__ */ q("div", { style: {
|
|
245
245
|
maxWidth: 480,
|
|
246
246
|
width: "100%",
|
|
247
247
|
border: "1px solid #7F1D1D",
|
|
@@ -250,19 +250,19 @@ function es(t) {
|
|
|
250
250
|
padding: 20,
|
|
251
251
|
fontFamily: '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif'
|
|
252
252
|
}, children: [
|
|
253
|
-
/* @__PURE__ */
|
|
254
|
-
/* @__PURE__ */
|
|
255
|
-
/* @__PURE__ */
|
|
256
|
-
/* @__PURE__ */
|
|
257
|
-
/* @__PURE__ */
|
|
253
|
+
/* @__PURE__ */ q("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
|
|
254
|
+
/* @__PURE__ */ q("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
255
|
+
/* @__PURE__ */ R("circle", { cx: "12", cy: "12", r: "10" }),
|
|
256
|
+
/* @__PURE__ */ R("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
257
|
+
/* @__PURE__ */ R("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
258
258
|
] }),
|
|
259
|
-
/* @__PURE__ */
|
|
259
|
+
/* @__PURE__ */ R("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
|
|
260
260
|
] }),
|
|
261
|
-
/* @__PURE__ */
|
|
262
|
-
/* @__PURE__ */
|
|
261
|
+
/* @__PURE__ */ R("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: d }),
|
|
262
|
+
/* @__PURE__ */ R(
|
|
263
263
|
"button",
|
|
264
264
|
{
|
|
265
|
-
onClick: () =>
|
|
265
|
+
onClick: () => m(),
|
|
266
266
|
style: {
|
|
267
267
|
background: "transparent",
|
|
268
268
|
color: "#F87171",
|
|
@@ -276,13 +276,13 @@ function es(t) {
|
|
|
276
276
|
children: "Retry"
|
|
277
277
|
}
|
|
278
278
|
)
|
|
279
|
-
] }) }) : a ? /* @__PURE__ */
|
|
279
|
+
] }) }) : a ? /* @__PURE__ */ R(_e.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ q("div", { style: {
|
|
280
280
|
display: "flex",
|
|
281
281
|
flex: 1,
|
|
282
282
|
alignItems: "center",
|
|
283
283
|
justifyContent: "center"
|
|
284
284
|
}, children: [
|
|
285
|
-
/* @__PURE__ */
|
|
285
|
+
/* @__PURE__ */ R("div", { style: {
|
|
286
286
|
width: 24,
|
|
287
287
|
height: 24,
|
|
288
288
|
border: "2px solid #3F3F46",
|
|
@@ -290,38 +290,38 @@ function es(t) {
|
|
|
290
290
|
borderRadius: "50%",
|
|
291
291
|
animation: "plugin-spin 0.8s linear infinite"
|
|
292
292
|
} }),
|
|
293
|
-
/* @__PURE__ */
|
|
293
|
+
/* @__PURE__ */ R("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
|
|
294
294
|
] });
|
|
295
295
|
}
|
|
296
|
-
function
|
|
297
|
-
const t =
|
|
296
|
+
function we() {
|
|
297
|
+
const t = X(_e);
|
|
298
298
|
if (!t)
|
|
299
299
|
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
300
300
|
return t;
|
|
301
301
|
}
|
|
302
|
-
function
|
|
303
|
-
return
|
|
302
|
+
function us() {
|
|
303
|
+
return we().settings;
|
|
304
304
|
}
|
|
305
|
-
const
|
|
306
|
-
const [e, n] =
|
|
305
|
+
const et = ue(void 0), ls = ({ children: t }) => {
|
|
306
|
+
const [e, n] = K({}), r = W(0), s = M(() => {
|
|
307
307
|
const o = r.current + 1;
|
|
308
|
-
r.current = o,
|
|
308
|
+
r.current = o, Tt().then((a) => {
|
|
309
309
|
o === r.current && n(a);
|
|
310
310
|
}).catch((a) => {
|
|
311
311
|
o === r.current && console.error("Error fetching settings:", a);
|
|
312
312
|
});
|
|
313
313
|
}, []);
|
|
314
314
|
C.useEffect(() => {
|
|
315
|
-
const o =
|
|
315
|
+
const o = x("settings/changed", () => s());
|
|
316
316
|
return s(), () => {
|
|
317
317
|
r.current += 1, o();
|
|
318
318
|
};
|
|
319
319
|
}, [s]);
|
|
320
|
-
const i =
|
|
320
|
+
const i = M(() => {
|
|
321
321
|
s();
|
|
322
322
|
}, [s]);
|
|
323
|
-
return /* @__PURE__ */
|
|
324
|
-
},
|
|
323
|
+
return /* @__PURE__ */ R(et.Provider, { value: { settings: e, reload: i }, children: t });
|
|
324
|
+
}, Dn = {
|
|
325
325
|
height: 32,
|
|
326
326
|
focused: 0,
|
|
327
327
|
tabs: [],
|
|
@@ -345,22 +345,22 @@ const Ye = ae(void 0), ns = ({ children: t }) => {
|
|
|
345
345
|
},
|
|
346
346
|
fullscreenDrawer: () => {
|
|
347
347
|
}
|
|
348
|
-
},
|
|
348
|
+
}, xn = C.createContext(Dn), Fn = ue(void 0), Nn = C.createContext(void 0), tt = C.createContext(void 0), Pn = 3e4, ds = ({ children: t }) => {
|
|
349
349
|
const [e, n] = C.useState([]), r = C.useCallback((a) => {
|
|
350
350
|
n((c) => [a, ...c]);
|
|
351
351
|
}, []), s = C.useCallback((a, c) => {
|
|
352
352
|
n(
|
|
353
|
-
(
|
|
353
|
+
(d) => d.map((l) => l.id === a ? { ...l, ...c } : l)
|
|
354
354
|
);
|
|
355
355
|
}, []), i = C.useCallback((a) => {
|
|
356
|
-
n((c) => c.filter((
|
|
356
|
+
n((c) => c.filter((d) => d.id !== a));
|
|
357
357
|
}, []);
|
|
358
358
|
C.useEffect(() => {
|
|
359
359
|
const a = [];
|
|
360
360
|
for (const c of e)
|
|
361
361
|
if (c.status !== "running") {
|
|
362
|
-
const
|
|
363
|
-
a.push(setTimeout(() => i(c.id),
|
|
362
|
+
const d = Date.now() - (c.completedAt ?? c.startedAt), l = Math.max(0, Pn - d);
|
|
363
|
+
a.push(setTimeout(() => i(c.id), l));
|
|
364
364
|
}
|
|
365
365
|
return () => a.forEach(clearTimeout);
|
|
366
366
|
}, [e, i]);
|
|
@@ -368,57 +368,57 @@ const Ye = ae(void 0), ns = ({ children: t }) => {
|
|
|
368
368
|
() => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
|
|
369
369
|
[e, r, s, i]
|
|
370
370
|
);
|
|
371
|
-
return /* @__PURE__ */
|
|
371
|
+
return /* @__PURE__ */ R(tt.Provider, { value: o, children: t });
|
|
372
372
|
};
|
|
373
|
-
var
|
|
374
|
-
return
|
|
373
|
+
var Se = function(t, e) {
|
|
374
|
+
return Se = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
375
375
|
n.__proto__ = r;
|
|
376
376
|
} || function(n, r) {
|
|
377
377
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
378
|
-
},
|
|
378
|
+
}, Se(t, e);
|
|
379
379
|
};
|
|
380
|
-
function
|
|
380
|
+
function Ln(t, e) {
|
|
381
381
|
if (typeof e != "function" && e !== null)
|
|
382
382
|
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
383
|
-
|
|
383
|
+
Se(t, e);
|
|
384
384
|
function n() {
|
|
385
385
|
this.constructor = t;
|
|
386
386
|
}
|
|
387
387
|
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
|
|
388
388
|
}
|
|
389
|
-
var
|
|
389
|
+
var ye = "Invariant Violation", Pe = Object.setPrototypeOf, kn = Pe === void 0 ? function(t, e) {
|
|
390
390
|
return t.__proto__ = e, t;
|
|
391
|
-
} :
|
|
391
|
+
} : Pe, Mn = (
|
|
392
392
|
/** @class */
|
|
393
393
|
function(t) {
|
|
394
|
-
|
|
394
|
+
Ln(e, t);
|
|
395
395
|
function e(n) {
|
|
396
|
-
n === void 0 && (n =
|
|
397
|
-
var r = t.call(this, typeof n == "number" ?
|
|
398
|
-
return r.framesToPop = 1, r.name =
|
|
396
|
+
n === void 0 && (n = ye);
|
|
397
|
+
var r = t.call(this, typeof n == "number" ? ye + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
|
|
398
|
+
return r.framesToPop = 1, r.name = ye, kn(r, e.prototype), r;
|
|
399
399
|
}
|
|
400
400
|
return e;
|
|
401
401
|
}(Error)
|
|
402
402
|
);
|
|
403
|
-
function
|
|
403
|
+
function ve(t, e) {
|
|
404
404
|
if (!t)
|
|
405
|
-
throw new
|
|
405
|
+
throw new Mn(e);
|
|
406
406
|
}
|
|
407
|
-
var
|
|
408
|
-
function
|
|
407
|
+
var nt = ["debug", "log", "warn", "error", "silent"], Un = nt.indexOf("log");
|
|
408
|
+
function re(t) {
|
|
409
409
|
return function() {
|
|
410
|
-
if (
|
|
410
|
+
if (nt.indexOf(t) >= Un) {
|
|
411
411
|
var e = console[t] || console.log;
|
|
412
412
|
return e.apply(console, arguments);
|
|
413
413
|
}
|
|
414
414
|
};
|
|
415
415
|
}
|
|
416
416
|
(function(t) {
|
|
417
|
-
t.debug =
|
|
418
|
-
})(
|
|
419
|
-
const
|
|
420
|
-
function
|
|
421
|
-
const e =
|
|
417
|
+
t.debug = re("debug"), t.log = re("log"), t.warn = re("warn"), t.error = re("error");
|
|
418
|
+
})(ve || (ve = {}));
|
|
419
|
+
const rt = ue(void 0), qn = () => X(rt);
|
|
420
|
+
function fs(t) {
|
|
421
|
+
const e = qn(), n = C.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = M(
|
|
422
422
|
(o) => {
|
|
423
423
|
const a = [];
|
|
424
424
|
return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
|
|
@@ -427,13 +427,13 @@ function ss(t) {
|
|
|
427
427
|
};
|
|
428
428
|
},
|
|
429
429
|
[e, t, r]
|
|
430
|
-
), i =
|
|
430
|
+
), i = M(() => {
|
|
431
431
|
const o = e == null ? void 0 : e.getExtensionPoint(t);
|
|
432
432
|
if (!o) {
|
|
433
433
|
if (n.current && n.current.store === void 0)
|
|
434
434
|
return n.current.sentinel;
|
|
435
|
-
const
|
|
436
|
-
return n.current = { store: void 0, version: -1, sentinel:
|
|
435
|
+
const d = {};
|
|
436
|
+
return n.current = { store: void 0, version: -1, sentinel: d }, d;
|
|
437
437
|
}
|
|
438
438
|
const a = n.current;
|
|
439
439
|
if (a && a.store === o && a.version === o.version)
|
|
@@ -441,30 +441,30 @@ function ss(t) {
|
|
|
441
441
|
const c = {};
|
|
442
442
|
return n.current = { store: o, version: o.version, sentinel: c }, c;
|
|
443
443
|
}, [e, t]);
|
|
444
|
-
return
|
|
444
|
+
return vt(s, i), e == null ? void 0 : e.getExtensionPoint(t);
|
|
445
445
|
}
|
|
446
|
-
const
|
|
446
|
+
const ps = ({ registry: t, children: e }) => {
|
|
447
447
|
const n = C.useRef(t);
|
|
448
|
-
return
|
|
448
|
+
return ve(
|
|
449
449
|
n.current === t,
|
|
450
450
|
"You can't change the extension registry after it has been rendered"
|
|
451
|
-
), /* @__PURE__ */
|
|
452
|
-
},
|
|
451
|
+
), /* @__PURE__ */ R(rt.Provider, { value: n.current, children: e });
|
|
452
|
+
}, me = (t) => {
|
|
453
453
|
if (!t || typeof t != "string")
|
|
454
454
|
throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
|
|
455
455
|
return t.trim();
|
|
456
456
|
};
|
|
457
|
-
class
|
|
457
|
+
class $n {
|
|
458
458
|
constructor(e) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
459
|
+
L(this, "id");
|
|
460
|
+
L(this, "mode");
|
|
461
|
+
L(this, "_pluginId");
|
|
462
|
+
L(this, "_version", 0);
|
|
463
|
+
L(this, "_contributions", /* @__PURE__ */ new Map());
|
|
464
|
+
L(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
465
|
+
L(this, "_matcher");
|
|
466
|
+
L(this, "_select");
|
|
467
|
+
L(this, "_listeners", /* @__PURE__ */ new Set());
|
|
468
468
|
this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
|
|
469
469
|
}
|
|
470
470
|
get pluginId() {
|
|
@@ -574,11 +574,11 @@ class Nn {
|
|
|
574
574
|
e();
|
|
575
575
|
}
|
|
576
576
|
}
|
|
577
|
-
class
|
|
577
|
+
class hs {
|
|
578
578
|
constructor(e) {
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
579
|
+
L(this, "_stores", /* @__PURE__ */ new Map());
|
|
580
|
+
L(this, "_storeUnsubs", /* @__PURE__ */ new Map());
|
|
581
|
+
L(this, "_listeners", /* @__PURE__ */ new Set());
|
|
582
582
|
if (e != null && e.initialStores)
|
|
583
583
|
for (const n of e.initialStores)
|
|
584
584
|
this.addExtensionPoint(n);
|
|
@@ -588,28 +588,28 @@ class is {
|
|
|
588
588
|
* Throws if the extension point ID already exists.
|
|
589
589
|
*/
|
|
590
590
|
addExtensionPoint(e) {
|
|
591
|
-
const n =
|
|
591
|
+
const n = me(e.id);
|
|
592
592
|
if (this._stores.has(n)) {
|
|
593
593
|
const s = this._stores.get(n);
|
|
594
594
|
throw new Error(
|
|
595
595
|
`Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
|
|
596
596
|
);
|
|
597
597
|
}
|
|
598
|
-
const r = new
|
|
598
|
+
const r = new $n({ ...e, id: n });
|
|
599
599
|
this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
|
|
600
600
|
}
|
|
601
601
|
/**
|
|
602
602
|
* Get an extension point store by ID.
|
|
603
603
|
*/
|
|
604
604
|
getExtensionPoint(e) {
|
|
605
|
-
const n =
|
|
605
|
+
const n = me(e);
|
|
606
606
|
return this._stores.get(n);
|
|
607
607
|
}
|
|
608
608
|
/**
|
|
609
609
|
* Check if an extension point exists.
|
|
610
610
|
*/
|
|
611
611
|
hasExtensionPoint(e) {
|
|
612
|
-
const n =
|
|
612
|
+
const n = me(e);
|
|
613
613
|
return this._stores.has(n);
|
|
614
614
|
}
|
|
615
615
|
/**
|
|
@@ -650,151 +650,296 @@ class is {
|
|
|
650
650
|
e();
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
const
|
|
653
|
+
const $ = {
|
|
654
|
+
Panel: {
|
|
655
|
+
position: "fixed",
|
|
656
|
+
right: "var(--ov-space-3)",
|
|
657
|
+
bottom: 36,
|
|
658
|
+
zIndex: "calc(var(--ov-z-toast, 9999) + 1)",
|
|
659
|
+
width: "min(480px, calc(100vw - 24px))",
|
|
660
|
+
minWidth: 0,
|
|
661
|
+
maxHeight: "min(560px, calc(100dvh - 64px))",
|
|
662
|
+
display: "flex",
|
|
663
|
+
flexDirection: "column",
|
|
664
|
+
overflow: "hidden",
|
|
665
|
+
padding: 0
|
|
666
|
+
},
|
|
667
|
+
Header: {
|
|
668
|
+
flex: "none",
|
|
669
|
+
gap: "var(--ov-space-2)",
|
|
670
|
+
paddingInline: "var(--ov-space-3)",
|
|
671
|
+
background: "var(--ov-color-bg-surface-raised)",
|
|
672
|
+
borderBottom: "1px solid var(--ov-color-border-muted)"
|
|
673
|
+
},
|
|
674
|
+
HeaderActions: { marginLeft: "auto" },
|
|
675
|
+
List: { minHeight: 0, overflowY: "auto", overscrollBehavior: "contain" },
|
|
676
|
+
Notice: { borderTop: "1px solid var(--ov-color-border-muted)" },
|
|
677
|
+
Row: {
|
|
678
|
+
display: "flex",
|
|
679
|
+
alignItems: "center",
|
|
680
|
+
gap: "var(--ov-space-1)",
|
|
681
|
+
padding: "var(--ov-space-2) var(--ov-space-2) var(--ov-space-2) var(--ov-space-3)"
|
|
682
|
+
},
|
|
683
|
+
ErrorIcon: { flex: "none", color: "var(--ov-color-danger)" },
|
|
684
|
+
Message: { flex: 1, minWidth: 0, justifyContent: "flex-start", textAlign: "left" },
|
|
685
|
+
MessageText: { minWidth: 0, overflowWrap: "anywhere" },
|
|
686
|
+
Details: { padding: "0 var(--ov-space-3) var(--ov-space-3) 36px" },
|
|
687
|
+
Code: {
|
|
688
|
+
display: "block",
|
|
689
|
+
margin: "var(--ov-space-2) 0",
|
|
690
|
+
padding: "var(--ov-space-3)",
|
|
691
|
+
maxHeight: 240,
|
|
692
|
+
overflow: "auto",
|
|
693
|
+
whiteSpace: "pre-wrap",
|
|
694
|
+
overflowWrap: "anywhere",
|
|
695
|
+
lineHeight: 1.5,
|
|
696
|
+
userSelect: "text"
|
|
697
|
+
},
|
|
698
|
+
Actions: { display: "flex", flexWrap: "wrap", gap: "var(--ov-space-2)" },
|
|
699
|
+
CopyError: {
|
|
700
|
+
margin: 0,
|
|
701
|
+
padding: "var(--ov-space-3)",
|
|
702
|
+
borderTop: "1px solid var(--ov-color-border-muted)"
|
|
703
|
+
}
|
|
704
|
+
}, st = ue(void 0), Wn = {
|
|
654
705
|
default: "info",
|
|
655
706
|
info: "info",
|
|
656
707
|
success: "success",
|
|
657
708
|
warning: "warning",
|
|
658
709
|
error: "danger"
|
|
659
|
-
},
|
|
660
|
-
const { toast: e } =
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
710
|
+
}, gs = ({ children: t }) => {
|
|
711
|
+
const { toast: e } = bn(), [n, r] = C.useState([]), [s, i] = C.useState([]), [o, a] = C.useState(!1), [c, d] = C.useState(), [l, f] = C.useState(""), h = C.useRef(Date.now()), g = C.useRef(null);
|
|
712
|
+
C.useEffect(() => {
|
|
713
|
+
var _;
|
|
714
|
+
if (!o)
|
|
715
|
+
return;
|
|
716
|
+
const u = document.activeElement;
|
|
717
|
+
(_ = g.current) == null || _.focus();
|
|
718
|
+
const p = (y) => {
|
|
719
|
+
y.key === "Escape" && (y.stopPropagation(), a(!1));
|
|
720
|
+
};
|
|
721
|
+
return document.addEventListener("keydown", p), () => {
|
|
722
|
+
document.removeEventListener("keydown", p), u instanceof HTMLElement && u.isConnected && u.focus();
|
|
723
|
+
};
|
|
724
|
+
}, [o]);
|
|
725
|
+
const m = (u) => {
|
|
726
|
+
r((p) => [...p, u]);
|
|
727
|
+
}, S = (u, p, _) => {
|
|
728
|
+
const y = typeof u == "object";
|
|
729
|
+
let E = "", w = "info", v, b = 5e3, I;
|
|
730
|
+
if (y) {
|
|
731
|
+
if (E = u.message, u.showOnce) {
|
|
732
|
+
if (n.includes(E))
|
|
668
733
|
return;
|
|
669
|
-
|
|
734
|
+
m(E);
|
|
670
735
|
}
|
|
671
|
-
|
|
736
|
+
w = u.status, v = u.details, b = u.autoHideDuration ?? 5e3, I = u.actions;
|
|
672
737
|
} else
|
|
673
|
-
|
|
674
|
-
let
|
|
675
|
-
if (
|
|
676
|
-
const
|
|
677
|
-
id: ++
|
|
678
|
-
message:
|
|
679
|
-
details:
|
|
738
|
+
E = u, w = p, v = _;
|
|
739
|
+
let A;
|
|
740
|
+
if (w === "error") {
|
|
741
|
+
const k = {
|
|
742
|
+
id: ++h.current,
|
|
743
|
+
message: E,
|
|
744
|
+
details: v,
|
|
680
745
|
created: (/* @__PURE__ */ new Date()).toISOString(),
|
|
681
|
-
actions:
|
|
746
|
+
actions: I
|
|
682
747
|
};
|
|
683
|
-
i((
|
|
684
|
-
|
|
748
|
+
i((P) => [...P, k].slice(-20)), A = { label: "Details", onClick: () => {
|
|
749
|
+
d(k.id), a(!0);
|
|
685
750
|
} };
|
|
686
751
|
}
|
|
687
|
-
e(
|
|
688
|
-
severity:
|
|
689
|
-
title:
|
|
690
|
-
duration:
|
|
691
|
-
action:
|
|
752
|
+
e(w === "error" ? E : v ?? E, {
|
|
753
|
+
severity: Wn[w] ?? "info",
|
|
754
|
+
title: w !== "error" && v ? E : void 0,
|
|
755
|
+
duration: b,
|
|
756
|
+
action: A ?? (I == null ? void 0 : I[0])
|
|
692
757
|
});
|
|
693
758
|
};
|
|
694
|
-
return /* @__PURE__ */
|
|
759
|
+
return /* @__PURE__ */ q(st.Provider, { value: { showSnackbar: S, openNotifications: () => {
|
|
760
|
+
a(!0);
|
|
761
|
+
}, notificationCount: s.length }, children: [
|
|
695
762
|
t,
|
|
696
|
-
o && /* @__PURE__ */
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
763
|
+
o && /* @__PURE__ */ q(
|
|
764
|
+
Rn,
|
|
765
|
+
{
|
|
766
|
+
ref: g,
|
|
767
|
+
style: $.Panel,
|
|
768
|
+
size: "sm",
|
|
769
|
+
variant: "outline",
|
|
770
|
+
surface: "overlay",
|
|
771
|
+
elevation: 3,
|
|
772
|
+
"aria-label": "Notifications",
|
|
773
|
+
tabIndex: -1,
|
|
774
|
+
children: [
|
|
775
|
+
/* @__PURE__ */ q(Fe, { size: "sm", style: $.Header, children: [
|
|
776
|
+
/* @__PURE__ */ R(ee, { size: "sm", weight: "semibold", children: "Notifications" }),
|
|
777
|
+
/* @__PURE__ */ R(ee, { size: "xs", tone: "muted", children: s.length }),
|
|
778
|
+
/* @__PURE__ */ q(Fe.Group, { style: $.HeaderActions, children: [
|
|
779
|
+
/* @__PURE__ */ R(
|
|
780
|
+
ne,
|
|
781
|
+
{
|
|
782
|
+
size: "sm",
|
|
783
|
+
variant: "ghost",
|
|
784
|
+
"aria-label": "Clear history",
|
|
785
|
+
title: "Clear history",
|
|
786
|
+
disabled: s.length === 0,
|
|
787
|
+
onClick: () => {
|
|
788
|
+
i([]), d(void 0), f("");
|
|
789
|
+
},
|
|
790
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: "m3 3 6 6m0-6L3 9M13 6h8M3 14h18M3 20h18" }) })
|
|
791
|
+
}
|
|
792
|
+
),
|
|
793
|
+
/* @__PURE__ */ R(
|
|
794
|
+
ne,
|
|
795
|
+
{
|
|
796
|
+
size: "sm",
|
|
797
|
+
variant: "ghost",
|
|
798
|
+
"aria-label": "Close notifications",
|
|
799
|
+
title: "Close notifications",
|
|
800
|
+
onClick: () => {
|
|
801
|
+
a(!1);
|
|
802
|
+
},
|
|
803
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: "m6 9 6 6 6-6" }) })
|
|
804
|
+
}
|
|
805
|
+
)
|
|
806
|
+
] })
|
|
725
807
|
] }),
|
|
726
|
-
/* @__PURE__ */
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
808
|
+
/* @__PURE__ */ q("div", { style: $.List, children: [
|
|
809
|
+
s.length === 0 && /* @__PURE__ */ R(In, { size: "sm", title: "No recent errors", description: "Error details will appear here." }),
|
|
810
|
+
s.slice().reverse().map((u) => {
|
|
811
|
+
var _, y;
|
|
812
|
+
const p = c === u.id;
|
|
813
|
+
return /* @__PURE__ */ q("div", { style: $.Notice, children: [
|
|
814
|
+
/* @__PURE__ */ q("div", { style: $.Row, children: [
|
|
815
|
+
/* @__PURE__ */ q("svg", { style: $.ErrorIcon, width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-label": "Error", role: "img", children: [
|
|
816
|
+
/* @__PURE__ */ R("circle", { cx: "12", cy: "12", r: "9" }),
|
|
817
|
+
/* @__PURE__ */ R("path", { d: "m9 9 6 6m0-6-6 6" })
|
|
818
|
+
] }),
|
|
819
|
+
/* @__PURE__ */ R(
|
|
820
|
+
pe,
|
|
821
|
+
{
|
|
822
|
+
size: "sm",
|
|
823
|
+
variant: "ghost",
|
|
824
|
+
style: $.Message,
|
|
825
|
+
"aria-expanded": p,
|
|
826
|
+
"aria-controls": `notification-${u.id}`,
|
|
827
|
+
title: u.message,
|
|
828
|
+
onClick: () => {
|
|
829
|
+
d(p ? void 0 : u.id), f("");
|
|
830
|
+
},
|
|
831
|
+
children: /* @__PURE__ */ R(ee, { size: "sm", style: $.MessageText, truncate: !p, children: u.message })
|
|
832
|
+
}
|
|
833
|
+
),
|
|
834
|
+
/* @__PURE__ */ R(
|
|
835
|
+
ne,
|
|
836
|
+
{
|
|
837
|
+
size: "sm",
|
|
838
|
+
variant: "ghost",
|
|
839
|
+
"aria-label": p ? "Collapse details" : "Expand details",
|
|
840
|
+
title: p ? "Collapse details" : "Expand details",
|
|
841
|
+
"aria-expanded": p,
|
|
842
|
+
"aria-controls": `notification-${u.id}`,
|
|
843
|
+
onClick: () => {
|
|
844
|
+
d(p ? void 0 : u.id), f("");
|
|
845
|
+
},
|
|
846
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: p ? "m6 15 6-6 6 6" : "m6 9 6 6 6-6" }) })
|
|
847
|
+
}
|
|
848
|
+
),
|
|
849
|
+
/* @__PURE__ */ R(
|
|
850
|
+
ne,
|
|
851
|
+
{
|
|
852
|
+
size: "sm",
|
|
853
|
+
variant: "ghost",
|
|
854
|
+
"aria-label": `Dismiss ${u.message}`,
|
|
855
|
+
title: "Dismiss notification",
|
|
856
|
+
onClick: () => {
|
|
857
|
+
i((E) => E.filter((w) => w.id !== u.id)), p && (d(void 0), f(""));
|
|
858
|
+
},
|
|
859
|
+
children: /* @__PURE__ */ R("svg", { width: "16", height: "16", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "1.5", "aria-hidden": "true", children: /* @__PURE__ */ R("path", { d: "m6 6 12 12m0-12L6 18" }) })
|
|
860
|
+
}
|
|
861
|
+
)
|
|
862
|
+
] }),
|
|
863
|
+
/* @__PURE__ */ R("div", { id: `notification-${u.id}`, hidden: !p, style: $.Details, children: p && /* @__PURE__ */ q(St, { children: [
|
|
864
|
+
/* @__PURE__ */ R(ee, { size: "xs", tone: "muted", children: /* @__PURE__ */ R("time", { dateTime: u.created, children: new Date(u.created).toLocaleString() }) }),
|
|
865
|
+
/* @__PURE__ */ R(On, { size: "sm", style: $.Code, children: (_ = u.details) != null && _.length ? u.details : u.message }),
|
|
866
|
+
/* @__PURE__ */ q("div", { style: $.Actions, children: [
|
|
867
|
+
/* @__PURE__ */ R(pe, { size: "sm", variant: "ghost", onClick: async () => {
|
|
868
|
+
f("");
|
|
869
|
+
try {
|
|
870
|
+
await navigator.clipboard.writeText(`${u.message}
|
|
871
|
+
${u.created}
|
|
872
|
+
${u.details ?? ""}`);
|
|
873
|
+
} catch {
|
|
874
|
+
f("Copy failed. Select the diagnostic text and copy it manually.");
|
|
875
|
+
}
|
|
876
|
+
}, children: "Copy details" }),
|
|
877
|
+
(y = u.actions) == null ? void 0 : y.map((E, w) => /* @__PURE__ */ R(pe, { size: "sm", variant: "outline", onClick: E.onClick, children: E.label }, `${E.label}-${w}`))
|
|
878
|
+
] })
|
|
879
|
+
] }) })
|
|
880
|
+
] }, u.id);
|
|
881
|
+
})
|
|
882
|
+
] }),
|
|
883
|
+
l && /* @__PURE__ */ R(ee, { as: "p", size: "sm", role: "status", style: $.CopyError, children: l })
|
|
884
|
+
]
|
|
885
|
+
}
|
|
886
|
+
)
|
|
742
887
|
] });
|
|
743
|
-
},
|
|
744
|
-
const t =
|
|
888
|
+
}, Q = () => {
|
|
889
|
+
const t = X(st);
|
|
745
890
|
if (t === void 0)
|
|
746
891
|
throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
|
|
747
892
|
return t;
|
|
748
893
|
};
|
|
749
894
|
function T(t) {
|
|
750
|
-
const e =
|
|
895
|
+
const e = X(_e), n = (e == null ? void 0 : e.pluginId) ?? t;
|
|
751
896
|
if (!n)
|
|
752
897
|
throw new Error(
|
|
753
898
|
"pluginID must be provided either via PluginContext or as an explicit parameter"
|
|
754
899
|
);
|
|
755
900
|
return n;
|
|
756
901
|
}
|
|
757
|
-
const
|
|
758
|
-
const n = T(t), r =
|
|
759
|
-
mutationFn: async () =>
|
|
760
|
-
onSuccess(
|
|
761
|
-
r.setQueryData(i,
|
|
902
|
+
const ys = ({ pluginID: t, connectionID: e }) => {
|
|
903
|
+
const n = T(t), r = B(), { showSnackbar: s } = Q(), i = [n, "connection", "detail", e], { mutateAsync: o } = N({
|
|
904
|
+
mutationFn: async () => Dt(n, e),
|
|
905
|
+
onSuccess(f) {
|
|
906
|
+
r.setQueryData(i, f), r.invalidateQueries({
|
|
762
907
|
queryKey: ["EDITOR_SCHEMAS", n, e]
|
|
763
908
|
});
|
|
764
909
|
},
|
|
765
|
-
onError:
|
|
766
|
-
}), { mutateAsync: a } =
|
|
767
|
-
mutationFn: async () =>
|
|
768
|
-
onSuccess(
|
|
769
|
-
r.setQueryData(i,
|
|
910
|
+
onError: U(s, "Failed to start connection")
|
|
911
|
+
}), { mutateAsync: a } = N({
|
|
912
|
+
mutationFn: async () => qe(n, e),
|
|
913
|
+
onSuccess(f) {
|
|
914
|
+
r.setQueryData(i, f);
|
|
770
915
|
},
|
|
771
|
-
onError:
|
|
772
|
-
}), { mutateAsync: c } =
|
|
773
|
-
mutationFn: async (
|
|
774
|
-
onSuccess(
|
|
775
|
-
s({ message: `Connection ${
|
|
916
|
+
onError: U(s, "Failed to stop connection")
|
|
917
|
+
}), { mutateAsync: c } = N({
|
|
918
|
+
mutationFn: async (f) => xt(n, f),
|
|
919
|
+
onSuccess(f, { name: h }) {
|
|
920
|
+
s({ message: `Connection ${h} successfully updated`, status: "success" }), r.setQueryData(i, f), r.setQueriesData(
|
|
776
921
|
{ queryKey: [n, "connection", "list"] },
|
|
777
|
-
(
|
|
922
|
+
(g) => g == null ? void 0 : g.map((m) => m.id === e ? f : m)
|
|
778
923
|
);
|
|
779
924
|
},
|
|
780
|
-
onError:
|
|
781
|
-
}), { mutateAsync:
|
|
782
|
-
mutationFn: async () =>
|
|
925
|
+
onError: U(s, "Failed to update connection")
|
|
926
|
+
}), { mutateAsync: d } = N({
|
|
927
|
+
mutationFn: async () => Ft(n, e),
|
|
783
928
|
onSuccess() {
|
|
784
929
|
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
|
|
785
930
|
{ queryKey: [n, "connection", "list"] },
|
|
786
|
-
(
|
|
931
|
+
(f) => f == null ? void 0 : f.filter((h) => h.id !== e)
|
|
787
932
|
);
|
|
788
933
|
},
|
|
789
|
-
onError:
|
|
934
|
+
onError: U(s, "Failed to remove connection")
|
|
790
935
|
});
|
|
791
936
|
return {
|
|
792
937
|
/**
|
|
793
938
|
* Get the connection
|
|
794
939
|
*/
|
|
795
|
-
connection:
|
|
940
|
+
connection: F({
|
|
796
941
|
queryKey: i,
|
|
797
|
-
queryFn: async () =>
|
|
942
|
+
queryFn: async () => Nt(n, e)
|
|
798
943
|
}),
|
|
799
944
|
/**
|
|
800
945
|
* Start the connection
|
|
@@ -811,61 +956,61 @@ const cs = ({ pluginID: t, connectionID: e }) => {
|
|
|
811
956
|
/**
|
|
812
957
|
* Delete the connection
|
|
813
958
|
*/
|
|
814
|
-
deleteConnection:
|
|
959
|
+
deleteConnection: d
|
|
815
960
|
};
|
|
816
|
-
},
|
|
817
|
-
const e = T(t), n =
|
|
818
|
-
mutationFn: async (
|
|
819
|
-
onError:
|
|
820
|
-
}), { mutateAsync: o } =
|
|
821
|
-
mutationFn: async (
|
|
822
|
-
onError:
|
|
823
|
-
}), a = C.useCallback((
|
|
824
|
-
const
|
|
825
|
-
console.log("got update to connections",
|
|
961
|
+
}, Gn = (t) => [t, "connection", "list"], ms = ({ plugin: t }) => {
|
|
962
|
+
const e = T(t), n = B(), { showSnackbar: r } = Q(), s = Gn(e), { mutateAsync: i } = N({
|
|
963
|
+
mutationFn: async (d) => $e(e, d.id),
|
|
964
|
+
onError: U(r, "Failed to start connection watch")
|
|
965
|
+
}), { mutateAsync: o } = N({
|
|
966
|
+
mutationFn: async (d) => Pt(e, d.id),
|
|
967
|
+
onError: U(r, "Failed to stop connection watch")
|
|
968
|
+
}), a = C.useCallback((d) => {
|
|
969
|
+
const l = d.data;
|
|
970
|
+
console.log("got update to connections", l), n.setQueryData(s, l);
|
|
826
971
|
}, [n, s]);
|
|
827
972
|
return C.useEffect(() => {
|
|
828
|
-
const
|
|
973
|
+
const d = x(`${e}/connection/sync`, a);
|
|
829
974
|
return () => {
|
|
830
|
-
|
|
975
|
+
d();
|
|
831
976
|
};
|
|
832
977
|
}, [e, a]), {
|
|
833
|
-
connections:
|
|
978
|
+
connections: F({
|
|
834
979
|
queryKey: s,
|
|
835
980
|
queryFn: async () => {
|
|
836
981
|
try {
|
|
837
|
-
return await
|
|
838
|
-
} catch (
|
|
839
|
-
console.log(
|
|
982
|
+
return await Lt(e);
|
|
983
|
+
} catch (d) {
|
|
984
|
+
console.log(d), U(r, "Failed to load connections")(d);
|
|
840
985
|
}
|
|
841
986
|
return [];
|
|
842
987
|
},
|
|
843
988
|
staleTime: 3e4,
|
|
844
|
-
placeholderData:
|
|
989
|
+
placeholderData: Xe
|
|
845
990
|
}),
|
|
846
991
|
startWatch: i,
|
|
847
992
|
stopWatch: o
|
|
848
993
|
};
|
|
849
|
-
},
|
|
994
|
+
}, Es = ({ pluginID: t, connectionID: e }) => {
|
|
850
995
|
const n = T(t);
|
|
851
996
|
return {
|
|
852
997
|
/**
|
|
853
998
|
* Get the connection
|
|
854
999
|
*/
|
|
855
|
-
namespaces:
|
|
1000
|
+
namespaces: F({
|
|
856
1001
|
queryKey: [n, "connection", "namespaces", e],
|
|
857
|
-
queryFn: async () =>
|
|
1002
|
+
queryFn: async () => kt(n, e)
|
|
858
1003
|
})
|
|
859
1004
|
};
|
|
860
|
-
},
|
|
861
|
-
function
|
|
1005
|
+
}, O = An(yn, "WatchState");
|
|
1006
|
+
function Ce(t) {
|
|
862
1007
|
const e = Object.values(t.states), n = e.length;
|
|
863
1008
|
let r = 0, s = 0, i = 0, o = 0;
|
|
864
|
-
for (const
|
|
865
|
-
|
|
1009
|
+
for (const l of e)
|
|
1010
|
+
l === O.WatchStateSynced && r++, (l === O.WatchStateError || l === O.WatchStateFailed) && s++, l === O.WatchStateForbidden && i++, l === O.WatchStateSkipped && o++;
|
|
866
1011
|
const a = n - o, c = e.filter(
|
|
867
|
-
(
|
|
868
|
-
).length,
|
|
1012
|
+
(l) => l === O.WatchStateSynced || l === O.WatchStateError || l === O.WatchStateStopped || l === O.WatchStateFailed || l === O.WatchStateForbidden
|
|
1013
|
+
).length, d = a > 0 ? c / a : 0;
|
|
869
1014
|
return {
|
|
870
1015
|
pluginID: t.pluginID,
|
|
871
1016
|
connectionID: t.connectionID,
|
|
@@ -876,24 +1021,24 @@ function Ee(t) {
|
|
|
876
1021
|
forbiddenCount: i,
|
|
877
1022
|
skippedCount: o,
|
|
878
1023
|
doneCount: c,
|
|
879
|
-
progress:
|
|
1024
|
+
progress: d
|
|
880
1025
|
};
|
|
881
1026
|
}
|
|
882
|
-
function
|
|
1027
|
+
function ce(t) {
|
|
883
1028
|
return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
|
|
884
1029
|
}
|
|
885
|
-
function
|
|
886
|
-
return t.some((e) => !
|
|
1030
|
+
function ot(t) {
|
|
1031
|
+
return t.some((e) => !ce(e));
|
|
887
1032
|
}
|
|
888
|
-
function
|
|
1033
|
+
function it(t) {
|
|
889
1034
|
const e = t.reduce((r, s) => r + s.watchedTotal, 0);
|
|
890
1035
|
return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
|
|
891
1036
|
}
|
|
892
|
-
function
|
|
1037
|
+
function be(t) {
|
|
893
1038
|
return `${t.pluginId}/${t.connection}`;
|
|
894
1039
|
}
|
|
895
|
-
function
|
|
896
|
-
const n =
|
|
1040
|
+
function at(t, e) {
|
|
1041
|
+
const n = be(e);
|
|
897
1042
|
t.has(n) || t.set(n, {
|
|
898
1043
|
states: {},
|
|
899
1044
|
pluginID: e.pluginId,
|
|
@@ -902,163 +1047,163 @@ function rt(t, e) {
|
|
|
902
1047
|
const r = t.get(n);
|
|
903
1048
|
return r.states[e.resourceKey] = e.state, r;
|
|
904
1049
|
}
|
|
905
|
-
function
|
|
906
|
-
const [t, e] =
|
|
907
|
-
|
|
908
|
-
const
|
|
909
|
-
const
|
|
910
|
-
|
|
911
|
-
const
|
|
912
|
-
return
|
|
1050
|
+
function Ss() {
|
|
1051
|
+
const [t, e] = K(/* @__PURE__ */ new Set()), [n, r] = K({}), [s, i] = K(/* @__PURE__ */ new Map()), o = W(/* @__PURE__ */ new Map()), [a, c] = K(/* @__PURE__ */ new Map());
|
|
1052
|
+
j(() => {
|
|
1053
|
+
const y = x("plugin/crash_recovery_failed", (w) => {
|
|
1054
|
+
const v = w.data, b = v == null ? void 0 : v.pluginID;
|
|
1055
|
+
b && c((I) => {
|
|
1056
|
+
const A = new Map(I);
|
|
1057
|
+
return A.set(b, v.error ?? "Crash recovery failed"), A;
|
|
913
1058
|
});
|
|
914
|
-
}),
|
|
915
|
-
const
|
|
916
|
-
|
|
917
|
-
if (!
|
|
918
|
-
const
|
|
919
|
-
return
|
|
1059
|
+
}), E = x("plugin/recovered", (w) => {
|
|
1060
|
+
const v = w.data, b = v == null ? void 0 : v.pluginID;
|
|
1061
|
+
b && c((I) => {
|
|
1062
|
+
if (!I.has(b)) return I;
|
|
1063
|
+
const A = new Map(I);
|
|
1064
|
+
return A.delete(b), A;
|
|
920
1065
|
});
|
|
921
1066
|
});
|
|
922
1067
|
return () => {
|
|
923
|
-
|
|
1068
|
+
y(), E();
|
|
924
1069
|
};
|
|
925
|
-
}, []),
|
|
926
|
-
|
|
927
|
-
if (!
|
|
928
|
-
const
|
|
929
|
-
for (const [
|
|
930
|
-
if (
|
|
931
|
-
|
|
932
|
-
for (const
|
|
933
|
-
if (!
|
|
934
|
-
const
|
|
935
|
-
|
|
936
|
-
const
|
|
937
|
-
pluginID:
|
|
938
|
-
connectionID:
|
|
1070
|
+
}, []), j(() => {
|
|
1071
|
+
Mt().then((y) => {
|
|
1072
|
+
if (!y) return;
|
|
1073
|
+
const E = {}, w = /* @__PURE__ */ new Set(), v = /* @__PURE__ */ new Map();
|
|
1074
|
+
for (const [b, I] of Object.entries(y))
|
|
1075
|
+
if (I) {
|
|
1076
|
+
E[b] = I.map((A) => A.connection);
|
|
1077
|
+
for (const A of I) {
|
|
1078
|
+
if (!A.started) continue;
|
|
1079
|
+
const k = `${b}/${A.connection.id}`;
|
|
1080
|
+
w.add(k);
|
|
1081
|
+
const P = {
|
|
1082
|
+
pluginID: b,
|
|
1083
|
+
connectionID: A.connection.id,
|
|
939
1084
|
states: {}
|
|
940
1085
|
};
|
|
941
|
-
if (
|
|
942
|
-
for (const [
|
|
943
|
-
|
|
944
|
-
o.current.set(
|
|
1086
|
+
if (A.resources)
|
|
1087
|
+
for (const [fe, yt] of Object.entries(A.resources))
|
|
1088
|
+
P.states[fe] = yt;
|
|
1089
|
+
o.current.set(k, P), v.set(k, Ce(P));
|
|
945
1090
|
}
|
|
946
1091
|
}
|
|
947
|
-
r(
|
|
1092
|
+
r(E), e(w), i(v);
|
|
948
1093
|
}).catch(() => {
|
|
949
1094
|
});
|
|
950
|
-
}, []),
|
|
951
|
-
const
|
|
952
|
-
|
|
953
|
-
const
|
|
954
|
-
return
|
|
955
|
-
}), i((
|
|
956
|
-
const
|
|
957
|
-
return
|
|
958
|
-
}), o.current.delete(
|
|
959
|
-
const
|
|
960
|
-
return
|
|
961
|
-
}),
|
|
962
|
-
if (!
|
|
963
|
-
const
|
|
964
|
-
for (const [
|
|
965
|
-
|
|
966
|
-
r(
|
|
1095
|
+
}, []), j(() => x("connection/status", (E) => {
|
|
1096
|
+
const w = E.data, v = `${w.pluginID}/${w.connectionID}`;
|
|
1097
|
+
w.status === "DISCONNECTED" ? (e((b) => {
|
|
1098
|
+
const I = new Set(b);
|
|
1099
|
+
return I.delete(v), I;
|
|
1100
|
+
}), i((b) => {
|
|
1101
|
+
const I = new Map(b);
|
|
1102
|
+
return I.delete(v), I;
|
|
1103
|
+
}), o.current.delete(v)) : e((b) => {
|
|
1104
|
+
const I = new Set(b);
|
|
1105
|
+
return I.add(v), I;
|
|
1106
|
+
}), qt().then((b) => {
|
|
1107
|
+
if (!b) return;
|
|
1108
|
+
const I = {};
|
|
1109
|
+
for (const [A, k] of Object.entries(b))
|
|
1110
|
+
k != null && (I[A] = k);
|
|
1111
|
+
r(I);
|
|
967
1112
|
}).catch(() => {
|
|
968
1113
|
});
|
|
969
1114
|
}), []);
|
|
970
|
-
const
|
|
971
|
-
const
|
|
972
|
-
e((
|
|
973
|
-
if (
|
|
974
|
-
const
|
|
975
|
-
return
|
|
1115
|
+
const d = M((y) => {
|
|
1116
|
+
const E = y.data, w = be(E);
|
|
1117
|
+
e((I) => {
|
|
1118
|
+
if (I.has(w)) return I;
|
|
1119
|
+
const A = new Set(I);
|
|
1120
|
+
return A.add(w), A;
|
|
976
1121
|
});
|
|
977
|
-
const
|
|
978
|
-
i((
|
|
979
|
-
const
|
|
980
|
-
return
|
|
1122
|
+
const v = at(o.current, E), b = Ce(v);
|
|
1123
|
+
i((I) => {
|
|
1124
|
+
const A = new Map(I);
|
|
1125
|
+
return A.set(w, b), A;
|
|
981
1126
|
});
|
|
982
1127
|
}, []);
|
|
983
|
-
|
|
984
|
-
const
|
|
985
|
-
await
|
|
986
|
-
}, []),
|
|
987
|
-
await
|
|
988
|
-
}, []),
|
|
989
|
-
const
|
|
990
|
-
c((
|
|
991
|
-
if (!
|
|
992
|
-
const
|
|
993
|
-
return
|
|
1128
|
+
j(() => x("watch/STATE", d), [d]);
|
|
1129
|
+
const l = M(async (y, E) => {
|
|
1130
|
+
await qe(y, E);
|
|
1131
|
+
}, []), f = M(async (y, E) => {
|
|
1132
|
+
await $e(y, E);
|
|
1133
|
+
}, []), h = M(async (y) => {
|
|
1134
|
+
const E = a.get(y);
|
|
1135
|
+
c((w) => {
|
|
1136
|
+
if (!w.has(y)) return w;
|
|
1137
|
+
const v = new Map(w);
|
|
1138
|
+
return v.delete(y), v;
|
|
994
1139
|
});
|
|
995
1140
|
try {
|
|
996
|
-
await
|
|
997
|
-
} catch (
|
|
998
|
-
throw c((
|
|
999
|
-
const
|
|
1000
|
-
return
|
|
1001
|
-
}),
|
|
1141
|
+
await Ut(y);
|
|
1142
|
+
} catch (w) {
|
|
1143
|
+
throw c((v) => {
|
|
1144
|
+
const b = new Map(v);
|
|
1145
|
+
return b.set(y, E ?? "Reload failed"), b;
|
|
1146
|
+
}), w;
|
|
1002
1147
|
}
|
|
1003
|
-
}, [a]),
|
|
1004
|
-
for (const
|
|
1005
|
-
const [
|
|
1006
|
-
|
|
1007
|
-
pluginID:
|
|
1008
|
-
connectionID:
|
|
1009
|
-
name: (
|
|
1010
|
-
avatar: (
|
|
1148
|
+
}, [a]), g = [];
|
|
1149
|
+
for (const y of t) {
|
|
1150
|
+
const [E, w] = y.split("/", 2), b = (n[E] ?? []).find((fe) => fe.id === w), I = s.get(y), A = I != null && !ce(I), k = I != null && I.errorCount > 0, P = a.get(E);
|
|
1151
|
+
g.push({
|
|
1152
|
+
pluginID: E,
|
|
1153
|
+
connectionID: w,
|
|
1154
|
+
name: (b == null ? void 0 : b.name) ?? w,
|
|
1155
|
+
avatar: (b == null ? void 0 : b.avatar) ?? "",
|
|
1011
1156
|
isStarted: !0,
|
|
1012
|
-
sync:
|
|
1013
|
-
isSyncing:
|
|
1014
|
-
hasErrors:
|
|
1015
|
-
pluginFailed:
|
|
1016
|
-
pluginError:
|
|
1157
|
+
sync: I,
|
|
1158
|
+
isSyncing: A,
|
|
1159
|
+
hasErrors: k || P != null,
|
|
1160
|
+
pluginFailed: P != null,
|
|
1161
|
+
pluginError: P
|
|
1017
1162
|
});
|
|
1018
1163
|
}
|
|
1019
|
-
const
|
|
1020
|
-
for (const
|
|
1021
|
-
const
|
|
1022
|
-
|
|
1164
|
+
const m = /* @__PURE__ */ new Map();
|
|
1165
|
+
for (const y of g) {
|
|
1166
|
+
const E = m.get(y.pluginID) ?? [];
|
|
1167
|
+
E.push(y), m.set(y.pluginID, E);
|
|
1023
1168
|
}
|
|
1024
|
-
const
|
|
1169
|
+
const S = Array.from(s.values()), u = g.filter((y) => y.isSyncing), p = g.filter((y) => y.hasErrors), _ = g.filter((y) => y.pluginFailed);
|
|
1025
1170
|
return {
|
|
1026
|
-
entries:
|
|
1027
|
-
grouped:
|
|
1028
|
-
connectedCount:
|
|
1029
|
-
syncingCount:
|
|
1171
|
+
entries: g,
|
|
1172
|
+
grouped: m,
|
|
1173
|
+
connectedCount: g.length,
|
|
1174
|
+
syncingCount: u.length,
|
|
1030
1175
|
errorCount: p.length,
|
|
1031
|
-
failedCount:
|
|
1032
|
-
hasSyncing:
|
|
1033
|
-
aggregateProgress:
|
|
1034
|
-
disconnect:
|
|
1035
|
-
retryWatch:
|
|
1036
|
-
retryPlugin:
|
|
1176
|
+
failedCount: _.length,
|
|
1177
|
+
hasSyncing: ot(S),
|
|
1178
|
+
aggregateProgress: it(S),
|
|
1179
|
+
disconnect: l,
|
|
1180
|
+
retryWatch: f,
|
|
1181
|
+
retryPlugin: h
|
|
1037
1182
|
};
|
|
1038
1183
|
}
|
|
1039
|
-
function
|
|
1184
|
+
function jn(t, e) {
|
|
1040
1185
|
return e === null ? t === null : Array.isArray(e) ? Array.isArray(t) : typeof e == "object" ? typeof t == "object" && t !== null && !Array.isArray(t) : typeof t == typeof e;
|
|
1041
1186
|
}
|
|
1042
|
-
function
|
|
1043
|
-
const r = T(t), s =
|
|
1187
|
+
function vs(t, e, n) {
|
|
1188
|
+
const r = T(t), s = B(), i = [r, "data", e], o = F({
|
|
1044
1189
|
queryKey: i,
|
|
1045
1190
|
queryFn: async () => {
|
|
1046
|
-
const c = await
|
|
1047
|
-
return c == null ? n :
|
|
1191
|
+
const c = await $t(r, e);
|
|
1192
|
+
return c == null ? n : jn(c, n) ? c : (console.warn(
|
|
1048
1193
|
`[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
|
|
1049
1194
|
), n);
|
|
1050
1195
|
}
|
|
1051
|
-
}), a =
|
|
1196
|
+
}), a = N({
|
|
1052
1197
|
mutationFn: async (c) => {
|
|
1053
|
-
await
|
|
1198
|
+
await Wt(r, e, c);
|
|
1054
1199
|
},
|
|
1055
1200
|
onMutate: async (c) => {
|
|
1056
1201
|
await s.cancelQueries({ queryKey: i });
|
|
1057
|
-
const
|
|
1058
|
-
return s.setQueryData(i, c), { previous:
|
|
1202
|
+
const d = s.getQueryData(i);
|
|
1203
|
+
return s.setQueryData(i, c), { previous: d };
|
|
1059
1204
|
},
|
|
1060
|
-
onError: (c,
|
|
1061
|
-
(
|
|
1205
|
+
onError: (c, d, l) => {
|
|
1206
|
+
(l == null ? void 0 : l.previous) !== void 0 && s.setQueryData(i, l.previous);
|
|
1062
1207
|
},
|
|
1063
1208
|
onSettled: () => {
|
|
1064
1209
|
s.invalidateQueries({ queryKey: i });
|
|
@@ -1072,23 +1217,23 @@ function fs(t, e, n) {
|
|
|
1072
1217
|
isLoading: o.isLoading
|
|
1073
1218
|
};
|
|
1074
1219
|
}
|
|
1075
|
-
const
|
|
1076
|
-
const t =
|
|
1220
|
+
const Cs = () => {
|
|
1221
|
+
const t = X(Fn);
|
|
1077
1222
|
if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
|
|
1078
1223
|
return t;
|
|
1079
|
-
},
|
|
1080
|
-
const t =
|
|
1224
|
+
}, ct = () => {
|
|
1225
|
+
const t = X(xn);
|
|
1081
1226
|
if (t === void 0)
|
|
1082
1227
|
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
1083
1228
|
return t;
|
|
1084
|
-
},
|
|
1085
|
-
const e = T(t), { showSnackbar: n } =
|
|
1229
|
+
}, _s = ({ pluginID: t }) => {
|
|
1230
|
+
const e = T(t), { showSnackbar: n } = Q(), { createTab: r, updateTab: s } = ct();
|
|
1086
1231
|
return {
|
|
1087
|
-
createSession:
|
|
1088
|
-
mutationFn: async ({ connectionID: o, icon: a, label: c, opts:
|
|
1089
|
-
const
|
|
1232
|
+
createSession: N({
|
|
1233
|
+
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: d }) => {
|
|
1234
|
+
const l = `pending-${crypto.randomUUID()}`;
|
|
1090
1235
|
r({
|
|
1091
|
-
id:
|
|
1236
|
+
id: l,
|
|
1092
1237
|
title: c ?? "Connecting...",
|
|
1093
1238
|
variant: "terminal",
|
|
1094
1239
|
icon: a ?? "LuSquareTerminal",
|
|
@@ -1096,97 +1241,97 @@ const ps = () => {
|
|
|
1096
1241
|
status: "connecting",
|
|
1097
1242
|
pluginID: e,
|
|
1098
1243
|
connectionID: o,
|
|
1099
|
-
opts: { ...
|
|
1244
|
+
opts: { ...d }
|
|
1100
1245
|
}
|
|
1101
1246
|
});
|
|
1102
|
-
const
|
|
1247
|
+
const f = mn.createFrom({
|
|
1103
1248
|
command: ["/bin/bash"],
|
|
1104
1249
|
tty: !0,
|
|
1105
|
-
...
|
|
1250
|
+
...d
|
|
1106
1251
|
});
|
|
1107
1252
|
try {
|
|
1108
|
-
const
|
|
1109
|
-
if (!
|
|
1253
|
+
const h = await Gt(e, o, f);
|
|
1254
|
+
if (!h) throw new Error("Failed to create session: null response");
|
|
1110
1255
|
s(
|
|
1111
|
-
{ id:
|
|
1256
|
+
{ id: l },
|
|
1112
1257
|
{
|
|
1113
|
-
id:
|
|
1114
|
-
title: c ?? `Session ${
|
|
1115
|
-
properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...
|
|
1258
|
+
id: h.id,
|
|
1259
|
+
title: c ?? `Session ${h.id.substring(0, 8)}`,
|
|
1260
|
+
properties: { status: "connected", pluginID: e, connectionID: o, opts: { ...d } }
|
|
1116
1261
|
}
|
|
1117
1262
|
);
|
|
1118
|
-
} catch (
|
|
1119
|
-
const
|
|
1263
|
+
} catch (h) {
|
|
1264
|
+
const g = H(h);
|
|
1120
1265
|
s(
|
|
1121
|
-
{ id:
|
|
1266
|
+
{ id: l },
|
|
1122
1267
|
{
|
|
1123
|
-
properties: { status: "error", error:
|
|
1268
|
+
properties: { status: "error", error: g.detail, pluginID: e, connectionID: o, opts: { ...d } }
|
|
1124
1269
|
}
|
|
1125
|
-
),
|
|
1270
|
+
), z(n, h, "Failed to start session");
|
|
1126
1271
|
}
|
|
1127
1272
|
}
|
|
1128
1273
|
}).mutateAsync
|
|
1129
1274
|
};
|
|
1130
|
-
},
|
|
1131
|
-
const e = T(t), { showSnackbar: n } =
|
|
1275
|
+
}, ws = ({ pluginID: t }) => {
|
|
1276
|
+
const e = T(t), { showSnackbar: n } = Q(), { createTab: r } = ct(), s = N({
|
|
1132
1277
|
mutationFn: async ({
|
|
1133
1278
|
connectionID: o,
|
|
1134
1279
|
resourceKey: a,
|
|
1135
1280
|
resourceID: c,
|
|
1136
|
-
resourceData:
|
|
1137
|
-
icon:
|
|
1138
|
-
label:
|
|
1139
|
-
target:
|
|
1140
|
-
follow:
|
|
1141
|
-
tailLines:
|
|
1142
|
-
params:
|
|
1281
|
+
resourceData: d,
|
|
1282
|
+
icon: l,
|
|
1283
|
+
label: f,
|
|
1284
|
+
target: h,
|
|
1285
|
+
follow: g = !0,
|
|
1286
|
+
tailLines: m = 1e3,
|
|
1287
|
+
params: S
|
|
1143
1288
|
}) => {
|
|
1144
|
-
const
|
|
1289
|
+
const u = En.createFrom({
|
|
1145
1290
|
resource_key: a,
|
|
1146
1291
|
resource_id: c,
|
|
1147
|
-
resource_data:
|
|
1148
|
-
options:
|
|
1149
|
-
target:
|
|
1150
|
-
follow:
|
|
1292
|
+
resource_data: d,
|
|
1293
|
+
options: Sn.createFrom({
|
|
1294
|
+
target: h ?? "",
|
|
1295
|
+
follow: g,
|
|
1151
1296
|
include_previous: !1,
|
|
1152
1297
|
include_timestamps: !0,
|
|
1153
|
-
tail_lines:
|
|
1298
|
+
tail_lines: m,
|
|
1154
1299
|
since_seconds: 0,
|
|
1155
1300
|
limit_bytes: 0,
|
|
1156
1301
|
include_source_events: !0,
|
|
1157
|
-
params:
|
|
1302
|
+
params: S ?? {}
|
|
1158
1303
|
})
|
|
1159
|
-
}), p = await
|
|
1304
|
+
}), p = await jt(e, o, u);
|
|
1160
1305
|
if (!p) throw new Error("Failed to create log session: null response");
|
|
1161
1306
|
return r({
|
|
1162
1307
|
id: p.id,
|
|
1163
|
-
title:
|
|
1308
|
+
title: f ?? `Logs ${p.id.substring(0, 8)}`,
|
|
1164
1309
|
variant: "logs",
|
|
1165
|
-
icon:
|
|
1310
|
+
icon: l ?? "LuLogs"
|
|
1166
1311
|
}), p;
|
|
1167
1312
|
},
|
|
1168
|
-
onError:
|
|
1169
|
-
}), i =
|
|
1313
|
+
onError: U(n, "Failed to start log session")
|
|
1314
|
+
}), i = N({
|
|
1170
1315
|
mutationFn: async (o) => {
|
|
1171
|
-
await
|
|
1316
|
+
await Qt(o);
|
|
1172
1317
|
},
|
|
1173
|
-
onError:
|
|
1318
|
+
onError: U(n, "Failed to close log session")
|
|
1174
1319
|
});
|
|
1175
1320
|
return {
|
|
1176
1321
|
createLogSession: s.mutateAsync,
|
|
1177
1322
|
closeLogSession: i.mutateAsync
|
|
1178
1323
|
};
|
|
1179
|
-
},
|
|
1324
|
+
}, bs = () => F({
|
|
1180
1325
|
queryKey: ["metric", "providers"],
|
|
1181
|
-
queryFn:
|
|
1326
|
+
queryFn: Kt,
|
|
1182
1327
|
staleTime: 3e4
|
|
1183
|
-
}),
|
|
1328
|
+
}), Qn = (t) => F({
|
|
1184
1329
|
queryKey: ["metric", "providers", t],
|
|
1185
|
-
queryFn: () =>
|
|
1330
|
+
queryFn: () => Ht(t),
|
|
1186
1331
|
enabled: !!t,
|
|
1187
1332
|
staleTime: 3e4
|
|
1188
|
-
}),
|
|
1189
|
-
var
|
|
1333
|
+
}), Rs = (t) => {
|
|
1334
|
+
var u, p;
|
|
1190
1335
|
const {
|
|
1191
1336
|
connectionID: e,
|
|
1192
1337
|
resourceKey: n,
|
|
@@ -1197,15 +1342,15 @@ const ps = () => {
|
|
|
1197
1342
|
shape: a = 0,
|
|
1198
1343
|
// CURRENT
|
|
1199
1344
|
timeRange: c,
|
|
1200
|
-
refreshInterval:
|
|
1201
|
-
enabled:
|
|
1345
|
+
refreshInterval: d = 0,
|
|
1346
|
+
enabled: l = !0
|
|
1202
1347
|
} = t, {
|
|
1203
|
-
data:
|
|
1204
|
-
isLoading:
|
|
1205
|
-
} =
|
|
1348
|
+
data: f,
|
|
1349
|
+
isLoading: h
|
|
1350
|
+
} = Qn(n), g = f ?? [], m = c ? Math.max(
|
|
1206
1351
|
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
1207
1352
|
15e3
|
|
1208
|
-
) * 1e6 : 0,
|
|
1353
|
+
) * 1e6 : 0, S = F({
|
|
1209
1354
|
queryKey: [
|
|
1210
1355
|
"metric",
|
|
1211
1356
|
"query",
|
|
@@ -1215,11 +1360,11 @@ const ps = () => {
|
|
|
1215
1360
|
s,
|
|
1216
1361
|
o,
|
|
1217
1362
|
a,
|
|
1218
|
-
(
|
|
1363
|
+
(u = c == null ? void 0 : c.start) == null ? void 0 : u.getTime(),
|
|
1219
1364
|
(p = c == null ? void 0 : c.end) == null ? void 0 : p.getTime()
|
|
1220
1365
|
],
|
|
1221
1366
|
queryFn: async () => {
|
|
1222
|
-
const
|
|
1367
|
+
const _ = await Bt(
|
|
1223
1368
|
e,
|
|
1224
1369
|
n,
|
|
1225
1370
|
r,
|
|
@@ -1229,27 +1374,27 @@ const ps = () => {
|
|
|
1229
1374
|
a,
|
|
1230
1375
|
((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1231
1376
|
((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1232
|
-
|
|
1233
|
-
),
|
|
1234
|
-
for (const [
|
|
1235
|
-
|
|
1236
|
-
return
|
|
1377
|
+
m
|
|
1378
|
+
), y = {};
|
|
1379
|
+
for (const [E, w] of Object.entries(_))
|
|
1380
|
+
w != null && (y[E] = w);
|
|
1381
|
+
return y;
|
|
1237
1382
|
},
|
|
1238
|
-
enabled:
|
|
1239
|
-
refetchInterval:
|
|
1383
|
+
enabled: l && !!e && !!n && (n.startsWith("cluster::") || !!r) && g.length > 0,
|
|
1384
|
+
refetchInterval: d > 0 ? d : void 0,
|
|
1240
1385
|
staleTime: 5e3,
|
|
1241
1386
|
// Keep previous data visible while fetching new data (e.g. on time range change)
|
|
1242
1387
|
// to prevent the chart from blinking empty.
|
|
1243
|
-
placeholderData:
|
|
1388
|
+
placeholderData: Xe
|
|
1244
1389
|
});
|
|
1245
1390
|
return {
|
|
1246
|
-
data:
|
|
1247
|
-
providers:
|
|
1248
|
-
isLoading:
|
|
1249
|
-
error:
|
|
1250
|
-
refetch:
|
|
1391
|
+
data: S.data ?? void 0,
|
|
1392
|
+
providers: g,
|
|
1393
|
+
isLoading: h || S.isLoading,
|
|
1394
|
+
error: S.error,
|
|
1395
|
+
refetch: S.refetch
|
|
1251
1396
|
};
|
|
1252
|
-
},
|
|
1397
|
+
}, Is = (t) => {
|
|
1253
1398
|
const {
|
|
1254
1399
|
pluginID: e,
|
|
1255
1400
|
connectionID: n,
|
|
@@ -1259,11 +1404,11 @@ const ps = () => {
|
|
|
1259
1404
|
resourceData: o = {},
|
|
1260
1405
|
metricIDs: a = [],
|
|
1261
1406
|
interval: c = 1e4,
|
|
1262
|
-
enabled:
|
|
1263
|
-
} = t,
|
|
1264
|
-
if (!(!
|
|
1407
|
+
enabled: d = !0
|
|
1408
|
+
} = t, l = T(e), [f, h] = K(null), [g, m] = K(null), [S, u] = K(!1), [p, _] = K(null), y = W(null), E = M(async () => {
|
|
1409
|
+
if (!(!d || !l || !n || !r || !s))
|
|
1265
1410
|
try {
|
|
1266
|
-
const
|
|
1411
|
+
const v = await zt(l, n, {
|
|
1267
1412
|
resource_key: r,
|
|
1268
1413
|
resource_id: s,
|
|
1269
1414
|
resource_namespace: i,
|
|
@@ -1272,177 +1417,177 @@ const ps = () => {
|
|
|
1272
1417
|
interval: c * 1e6
|
|
1273
1418
|
// ms to nanoseconds for Go time.Duration
|
|
1274
1419
|
});
|
|
1275
|
-
|
|
1276
|
-
const
|
|
1277
|
-
const
|
|
1420
|
+
m(v), u(!0), _(null);
|
|
1421
|
+
const b = x(`core/metrics/data/${v}`, (A) => {
|
|
1422
|
+
const k = A.data;
|
|
1278
1423
|
try {
|
|
1279
|
-
const
|
|
1280
|
-
|
|
1281
|
-
} catch (
|
|
1282
|
-
console.error("Failed to parse metric stream data:",
|
|
1424
|
+
const P = JSON.parse(k);
|
|
1425
|
+
P.results && h(P.results);
|
|
1426
|
+
} catch (P) {
|
|
1427
|
+
console.error("Failed to parse metric stream data:", P);
|
|
1283
1428
|
}
|
|
1284
|
-
}),
|
|
1285
|
-
const
|
|
1429
|
+
}), I = x(`core/metrics/error/${v}`, (A) => {
|
|
1430
|
+
const k = A.data;
|
|
1286
1431
|
try {
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1432
|
+
const P = JSON.parse(k);
|
|
1433
|
+
_(P.error || "Unknown error");
|
|
1289
1434
|
} catch {
|
|
1290
|
-
|
|
1435
|
+
_("Failed to parse metric stream error");
|
|
1291
1436
|
}
|
|
1292
1437
|
});
|
|
1293
|
-
|
|
1294
|
-
|
|
1438
|
+
y.current = () => {
|
|
1439
|
+
b(), I();
|
|
1295
1440
|
};
|
|
1296
|
-
} catch (
|
|
1297
|
-
|
|
1441
|
+
} catch (v) {
|
|
1442
|
+
_(v instanceof Error ? v.message : String(v));
|
|
1298
1443
|
}
|
|
1299
|
-
}, [
|
|
1300
|
-
if (
|
|
1444
|
+
}, [l, n, r, s, i, a, c, d]), w = M(async () => {
|
|
1445
|
+
if (g)
|
|
1301
1446
|
try {
|
|
1302
|
-
await
|
|
1303
|
-
} catch (
|
|
1304
|
-
console.error("Failed to unsubscribe:",
|
|
1447
|
+
await De(g);
|
|
1448
|
+
} catch (v) {
|
|
1449
|
+
console.error("Failed to unsubscribe:", v);
|
|
1305
1450
|
}
|
|
1306
|
-
|
|
1307
|
-
}, [
|
|
1308
|
-
return
|
|
1309
|
-
|
|
1310
|
-
}, [
|
|
1311
|
-
data:
|
|
1312
|
-
subscriptionID:
|
|
1313
|
-
isStreaming:
|
|
1451
|
+
y.current && (y.current(), y.current = null), m(null), u(!1);
|
|
1452
|
+
}, [g]);
|
|
1453
|
+
return j(() => () => {
|
|
1454
|
+
g && De(g).catch(console.error), y.current && y.current();
|
|
1455
|
+
}, [g]), {
|
|
1456
|
+
data: f,
|
|
1457
|
+
subscriptionID: g,
|
|
1458
|
+
isStreaming: S,
|
|
1314
1459
|
error: p,
|
|
1315
|
-
start:
|
|
1316
|
-
stop:
|
|
1460
|
+
start: E,
|
|
1461
|
+
stop: w
|
|
1317
1462
|
};
|
|
1318
|
-
},
|
|
1319
|
-
function
|
|
1320
|
-
const { showSnackbar: t } =
|
|
1321
|
-
queryKey: [...
|
|
1322
|
-
queryFn: async () =>
|
|
1323
|
-
if (
|
|
1463
|
+
}, J = ["networker", "portforward", "all-sessions"];
|
|
1464
|
+
function Os() {
|
|
1465
|
+
const { showSnackbar: t } = Q(), e = B(), n = F({
|
|
1466
|
+
queryKey: [...J],
|
|
1467
|
+
queryFn: async () => Vt().catch((i) => {
|
|
1468
|
+
if (H(i).detail.includes("not found")) return [];
|
|
1324
1469
|
throw i;
|
|
1325
1470
|
}),
|
|
1326
1471
|
retry: !1
|
|
1327
1472
|
});
|
|
1328
|
-
|
|
1329
|
-
const i =
|
|
1330
|
-
e.invalidateQueries({ queryKey: [...
|
|
1331
|
-
}), o =
|
|
1332
|
-
e.invalidateQueries({ queryKey: [...
|
|
1473
|
+
j(() => {
|
|
1474
|
+
const i = x("core/networker/portforward/created", () => {
|
|
1475
|
+
e.invalidateQueries({ queryKey: [...J] });
|
|
1476
|
+
}), o = x("core/networker/portforward/closed", () => {
|
|
1477
|
+
e.invalidateQueries({ queryKey: [...J] });
|
|
1333
1478
|
});
|
|
1334
1479
|
return () => {
|
|
1335
1480
|
i(), o();
|
|
1336
1481
|
};
|
|
1337
1482
|
}, [e]);
|
|
1338
|
-
const r = n.data ?? [], s =
|
|
1339
|
-
mutationFn: async (i) =>
|
|
1340
|
-
onError:
|
|
1483
|
+
const r = n.data ?? [], s = N({
|
|
1484
|
+
mutationFn: async (i) => We(i),
|
|
1485
|
+
onError: U(t, "Failed to close port forwarding session"),
|
|
1341
1486
|
onSuccess: async () => {
|
|
1342
|
-
await e.invalidateQueries({ queryKey: [...
|
|
1487
|
+
await e.invalidateQueries({ queryKey: [...J] });
|
|
1343
1488
|
}
|
|
1344
1489
|
});
|
|
1345
1490
|
return {
|
|
1346
1491
|
sessions: n,
|
|
1347
1492
|
activeSessions: r,
|
|
1348
1493
|
closeSession: s.mutateAsync,
|
|
1349
|
-
openInBrowser: (i) =>
|
|
1494
|
+
openInBrowser: (i) => Je(`http://localhost:${i}`)
|
|
1350
1495
|
};
|
|
1351
1496
|
}
|
|
1352
|
-
function
|
|
1353
|
-
const r = T(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } =
|
|
1497
|
+
function As({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
1498
|
+
const r = T(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = Q(), o = B(), a = F({
|
|
1354
1499
|
queryKey: s,
|
|
1355
|
-
queryFn: async () =>
|
|
1500
|
+
queryFn: async () => Yt(r, e, vn.createFrom({
|
|
1356
1501
|
resource_id: n,
|
|
1357
1502
|
connection_id: e
|
|
1358
|
-
})).catch((
|
|
1359
|
-
const
|
|
1360
|
-
return
|
|
1503
|
+
})).catch((l) => {
|
|
1504
|
+
const f = H(l);
|
|
1505
|
+
return f.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: f.detail }), []);
|
|
1361
1506
|
}),
|
|
1362
1507
|
retry: !1
|
|
1363
|
-
}), c =
|
|
1364
|
-
mutationFn: async ({ opts:
|
|
1365
|
-
const
|
|
1366
|
-
local_port:
|
|
1367
|
-
remote_port:
|
|
1368
|
-
protocol:
|
|
1508
|
+
}), c = N({
|
|
1509
|
+
mutationFn: async ({ opts: l }) => {
|
|
1510
|
+
const f = Cn.createFrom({
|
|
1511
|
+
local_port: l.localPort || 0,
|
|
1512
|
+
remote_port: l.remotePort,
|
|
1513
|
+
protocol: l.protocol || "TCP",
|
|
1369
1514
|
connection_type: "RESOURCE",
|
|
1370
1515
|
connection: {
|
|
1371
|
-
resource_data:
|
|
1516
|
+
resource_data: l.resource,
|
|
1372
1517
|
connection_id: e,
|
|
1373
1518
|
plugin_id: r,
|
|
1374
|
-
resource_id:
|
|
1375
|
-
resource_key:
|
|
1519
|
+
resource_id: l.resourceId,
|
|
1520
|
+
resource_key: l.resourceKey
|
|
1376
1521
|
},
|
|
1377
|
-
labels:
|
|
1378
|
-
params:
|
|
1379
|
-
}),
|
|
1380
|
-
if (!
|
|
1381
|
-
return
|
|
1522
|
+
labels: l.labels ?? {},
|
|
1523
|
+
params: l.parameters ?? {}
|
|
1524
|
+
}), h = await Jt(r, e, f);
|
|
1525
|
+
if (!h) throw new Error("Failed to start port forwarding: null response");
|
|
1526
|
+
return l.openInBrowser && Je(`http://localhost:${h.local_port}`), h;
|
|
1382
1527
|
},
|
|
1383
|
-
onError:
|
|
1528
|
+
onError: U(i, "Failed to start port forwarding session"),
|
|
1384
1529
|
onSuccess: async () => {
|
|
1385
1530
|
await Promise.all([
|
|
1386
1531
|
o.invalidateQueries({ queryKey: s }),
|
|
1387
|
-
o.invalidateQueries({ queryKey: [...
|
|
1532
|
+
o.invalidateQueries({ queryKey: [...J] })
|
|
1388
1533
|
]);
|
|
1389
1534
|
}
|
|
1390
|
-
}),
|
|
1391
|
-
mutationFn: async ({ opts:
|
|
1392
|
-
onError:
|
|
1535
|
+
}), d = N({
|
|
1536
|
+
mutationFn: async ({ opts: l }) => We(l.sessionID),
|
|
1537
|
+
onError: U(i, "Failed to close port forwarding session"),
|
|
1393
1538
|
onSuccess: async () => {
|
|
1394
1539
|
await Promise.all([
|
|
1395
1540
|
o.invalidateQueries({ queryKey: s }),
|
|
1396
|
-
o.invalidateQueries({ queryKey: [...
|
|
1541
|
+
o.invalidateQueries({ queryKey: [...J] })
|
|
1397
1542
|
]);
|
|
1398
1543
|
}
|
|
1399
1544
|
});
|
|
1400
1545
|
return {
|
|
1401
1546
|
sessions: a,
|
|
1402
1547
|
forward: c.mutateAsync,
|
|
1403
|
-
close:
|
|
1548
|
+
close: d.mutateAsync
|
|
1404
1549
|
};
|
|
1405
1550
|
}
|
|
1406
|
-
const
|
|
1407
|
-
const t = C.useContext(
|
|
1551
|
+
const Ts = () => {
|
|
1552
|
+
const t = C.useContext(Nn);
|
|
1408
1553
|
if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1409
1554
|
return t;
|
|
1410
|
-
},
|
|
1555
|
+
}, Ds = ({
|
|
1411
1556
|
pluginID: t,
|
|
1412
1557
|
connectionID: e,
|
|
1413
1558
|
resourceKey: n,
|
|
1414
1559
|
resourceID: r,
|
|
1415
1560
|
namespace: s = ""
|
|
1416
1561
|
}) => {
|
|
1417
|
-
const i = T(t), o =
|
|
1418
|
-
mutationFn: async (
|
|
1419
|
-
input:
|
|
1562
|
+
const i = T(t), o = B(), { showSnackbar: a } = Q(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: d } = N({
|
|
1563
|
+
mutationFn: async (h) => Ge(i, e, n, He.createFrom({
|
|
1564
|
+
input: h.input,
|
|
1420
1565
|
id: r,
|
|
1421
1566
|
namespace: s
|
|
1422
1567
|
})),
|
|
1423
1568
|
onSuccess: async () => {
|
|
1424
1569
|
a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1425
1570
|
},
|
|
1426
|
-
onError:
|
|
1427
|
-
}), { mutateAsync:
|
|
1428
|
-
mutationFn: async (
|
|
1571
|
+
onError: U(a, `Failed to update resource ${r}`)
|
|
1572
|
+
}), { mutateAsync: l } = N({
|
|
1573
|
+
mutationFn: async (h = {}) => je(i, e, n, Be.createFrom({
|
|
1429
1574
|
id: r,
|
|
1430
1575
|
namespace: s,
|
|
1431
|
-
gracePeriodSeconds:
|
|
1576
|
+
gracePeriodSeconds: h.gracePeriodSeconds
|
|
1432
1577
|
})),
|
|
1433
1578
|
onSuccess: async () => {
|
|
1434
1579
|
a(`Resource ${r} deleted`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1435
1580
|
},
|
|
1436
|
-
onError:
|
|
1581
|
+
onError: U(a, `Failed to delete resource ${r}`)
|
|
1437
1582
|
});
|
|
1438
1583
|
return {
|
|
1439
1584
|
/**
|
|
1440
1585
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1441
1586
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1442
1587
|
*/
|
|
1443
|
-
resource:
|
|
1588
|
+
resource: F({
|
|
1444
1589
|
queryKey: c,
|
|
1445
|
-
queryFn: async () =>
|
|
1590
|
+
queryFn: async () => Xt(i, e, n, _n.createFrom({
|
|
1446
1591
|
id: r,
|
|
1447
1592
|
namespace: s
|
|
1448
1593
|
})),
|
|
@@ -1454,49 +1599,49 @@ const Cs = () => {
|
|
|
1454
1599
|
*
|
|
1455
1600
|
* @params opts Optional parameters to pass to the resource update
|
|
1456
1601
|
*/
|
|
1457
|
-
update:
|
|
1602
|
+
update: d,
|
|
1458
1603
|
/**
|
|
1459
1604
|
* Delete an existing resource. A set of optional parameters can be passed to customize the delete behavior,
|
|
1460
1605
|
* which if specified, will add additional default behavior set via the hook options.
|
|
1461
1606
|
*
|
|
1462
1607
|
* @params {object} opts Optional parameters to pass to the resource delete
|
|
1463
1608
|
*/
|
|
1464
|
-
remove:
|
|
1609
|
+
remove: l
|
|
1465
1610
|
};
|
|
1466
|
-
},
|
|
1611
|
+
}, xs = (t) => {
|
|
1467
1612
|
const e = ["component", t.plugin, t.resource, t.area];
|
|
1468
1613
|
return {
|
|
1469
1614
|
/**
|
|
1470
1615
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1471
1616
|
* when the resource is updated or deleted via the returned update and remove mutation functions.
|
|
1472
1617
|
*/
|
|
1473
|
-
component:
|
|
1618
|
+
component: F({
|
|
1474
1619
|
queryKey: e,
|
|
1475
|
-
queryFn: async () =>
|
|
1620
|
+
queryFn: async () => Zt(t)
|
|
1476
1621
|
})
|
|
1477
1622
|
};
|
|
1478
|
-
},
|
|
1623
|
+
}, Fs = ({ pluginID: t, connectionID: e }) => {
|
|
1479
1624
|
const n = T(t);
|
|
1480
1625
|
return {
|
|
1481
1626
|
/**
|
|
1482
1627
|
* The resource groups for the given plugin and connection.
|
|
1483
1628
|
*/
|
|
1484
|
-
groups:
|
|
1629
|
+
groups: F({
|
|
1485
1630
|
queryKey: [n, "resource_groups", "list"],
|
|
1486
|
-
queryFn: async () =>
|
|
1631
|
+
queryFn: async () => en(n, e),
|
|
1487
1632
|
retry: !1
|
|
1488
1633
|
})
|
|
1489
1634
|
};
|
|
1490
|
-
},
|
|
1635
|
+
}, Ns = ({
|
|
1491
1636
|
pluginID: t,
|
|
1492
1637
|
connectionID: e,
|
|
1493
1638
|
searches: n
|
|
1494
1639
|
}) => {
|
|
1495
1640
|
const r = T(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
|
|
1496
|
-
return
|
|
1641
|
+
return wn({
|
|
1497
1642
|
queries: n.map((o) => ({
|
|
1498
1643
|
queryKey: s(o),
|
|
1499
|
-
queryFn: async () =>
|
|
1644
|
+
queryFn: async () => Qe(r, e, o.key, ze.createFrom({
|
|
1500
1645
|
order: [{ field: "name", descending: !1 }],
|
|
1501
1646
|
pagination: { page: 1, pageSize: 200 },
|
|
1502
1647
|
namespaces: o.namespaces
|
|
@@ -1504,40 +1649,40 @@ const Cs = () => {
|
|
|
1504
1649
|
retry: !1
|
|
1505
1650
|
}))
|
|
1506
1651
|
});
|
|
1507
|
-
},
|
|
1652
|
+
}, Ps = ({ pluginID: t, resourceKey: e }) => {
|
|
1508
1653
|
const n = T(t);
|
|
1509
1654
|
return {
|
|
1510
1655
|
/**
|
|
1511
1656
|
* The current settings from the provider.
|
|
1512
1657
|
*/
|
|
1513
|
-
resourceType:
|
|
1658
|
+
resourceType: F({
|
|
1514
1659
|
queryKey: [n, "resources", e],
|
|
1515
|
-
queryFn: async () =>
|
|
1660
|
+
queryFn: async () => tn(n, e),
|
|
1516
1661
|
retry: !1
|
|
1517
1662
|
})
|
|
1518
1663
|
};
|
|
1519
|
-
},
|
|
1664
|
+
}, Ls = ({ pluginID: t, connectionID: e }) => {
|
|
1520
1665
|
const n = T(t);
|
|
1521
1666
|
return {
|
|
1522
1667
|
/**
|
|
1523
1668
|
* The resource types for the given plugin and connection.
|
|
1524
1669
|
*/
|
|
1525
|
-
types:
|
|
1670
|
+
types: F({
|
|
1526
1671
|
queryKey: [n, "resources", "list", e],
|
|
1527
|
-
queryFn: async () =>
|
|
1672
|
+
queryFn: async () => nn(n, e),
|
|
1528
1673
|
retry: !1
|
|
1529
1674
|
})
|
|
1530
1675
|
};
|
|
1531
1676
|
};
|
|
1532
|
-
var
|
|
1533
|
-
function
|
|
1677
|
+
var se = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1678
|
+
function Kn(t) {
|
|
1534
1679
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
1535
1680
|
}
|
|
1536
|
-
var
|
|
1537
|
-
function
|
|
1681
|
+
var Hn = "Expected a function", ut = "__lodash_hash_undefined__", Bn = "[object Function]", zn = "[object GeneratorFunction]", Vn = "[object Symbol]", Yn = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Jn = /^\w*$/, Xn = /^\./, Zn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, er = /[\\^$.*+?()[\]{}|]/g, tr = /\\(\\)?/g, nr = /^\[object .+?Constructor\]$/, rr = typeof se == "object" && se && se.Object === Object && se, sr = typeof self == "object" && self && self.Object === Object && self, Re = rr || sr || Function("return this")();
|
|
1682
|
+
function or(t, e) {
|
|
1538
1683
|
return t == null ? void 0 : t[e];
|
|
1539
1684
|
}
|
|
1540
|
-
function
|
|
1685
|
+
function ir(t) {
|
|
1541
1686
|
var e = !1;
|
|
1542
1687
|
if (t != null && typeof t.toString != "function")
|
|
1543
1688
|
try {
|
|
@@ -1546,177 +1691,177 @@ function Xn(t) {
|
|
|
1546
1691
|
}
|
|
1547
1692
|
return e;
|
|
1548
1693
|
}
|
|
1549
|
-
var
|
|
1550
|
-
var t = /[^.]+$/.exec(
|
|
1694
|
+
var ar = Array.prototype, cr = Function.prototype, lt = Object.prototype, Ee = Re["__core-js_shared__"], Le = function() {
|
|
1695
|
+
var t = /[^.]+$/.exec(Ee && Ee.keys && Ee.keys.IE_PROTO || "");
|
|
1551
1696
|
return t ? "Symbol(src)_1." + t : "";
|
|
1552
|
-
}(),
|
|
1553
|
-
"^" +
|
|
1554
|
-
),
|
|
1555
|
-
function
|
|
1697
|
+
}(), dt = cr.toString, Ie = lt.hasOwnProperty, ft = lt.toString, ur = RegExp(
|
|
1698
|
+
"^" + dt.call(Ie).replace(er, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1699
|
+
), ke = Re.Symbol, lr = ar.splice, dr = pt(Re, "Map"), te = pt(Object, "create"), Me = ke ? ke.prototype : void 0, Ue = Me ? Me.toString : void 0;
|
|
1700
|
+
function V(t) {
|
|
1556
1701
|
var e = -1, n = t ? t.length : 0;
|
|
1557
1702
|
for (this.clear(); ++e < n; ) {
|
|
1558
1703
|
var r = t[e];
|
|
1559
1704
|
this.set(r[0], r[1]);
|
|
1560
1705
|
}
|
|
1561
1706
|
}
|
|
1562
|
-
function
|
|
1563
|
-
this.__data__ =
|
|
1707
|
+
function fr() {
|
|
1708
|
+
this.__data__ = te ? te(null) : {};
|
|
1564
1709
|
}
|
|
1565
|
-
function
|
|
1710
|
+
function pr(t) {
|
|
1566
1711
|
return this.has(t) && delete this.__data__[t];
|
|
1567
1712
|
}
|
|
1568
|
-
function
|
|
1713
|
+
function hr(t) {
|
|
1569
1714
|
var e = this.__data__;
|
|
1570
|
-
if (
|
|
1715
|
+
if (te) {
|
|
1571
1716
|
var n = e[t];
|
|
1572
|
-
return n ===
|
|
1717
|
+
return n === ut ? void 0 : n;
|
|
1573
1718
|
}
|
|
1574
|
-
return
|
|
1719
|
+
return Ie.call(e, t) ? e[t] : void 0;
|
|
1575
1720
|
}
|
|
1576
|
-
function
|
|
1721
|
+
function gr(t) {
|
|
1577
1722
|
var e = this.__data__;
|
|
1578
|
-
return
|
|
1723
|
+
return te ? e[t] !== void 0 : Ie.call(e, t);
|
|
1579
1724
|
}
|
|
1580
|
-
function
|
|
1725
|
+
function yr(t, e) {
|
|
1581
1726
|
var n = this.__data__;
|
|
1582
|
-
return n[t] =
|
|
1583
|
-
}
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
function
|
|
1727
|
+
return n[t] = te && e === void 0 ? ut : e, this;
|
|
1728
|
+
}
|
|
1729
|
+
V.prototype.clear = fr;
|
|
1730
|
+
V.prototype.delete = pr;
|
|
1731
|
+
V.prototype.get = hr;
|
|
1732
|
+
V.prototype.has = gr;
|
|
1733
|
+
V.prototype.set = yr;
|
|
1734
|
+
function Z(t) {
|
|
1590
1735
|
var e = -1, n = t ? t.length : 0;
|
|
1591
1736
|
for (this.clear(); ++e < n; ) {
|
|
1592
1737
|
var r = t[e];
|
|
1593
1738
|
this.set(r[0], r[1]);
|
|
1594
1739
|
}
|
|
1595
1740
|
}
|
|
1596
|
-
function
|
|
1741
|
+
function mr() {
|
|
1597
1742
|
this.__data__ = [];
|
|
1598
1743
|
}
|
|
1599
|
-
function
|
|
1600
|
-
var e = this.__data__, n =
|
|
1744
|
+
function Er(t) {
|
|
1745
|
+
var e = this.__data__, n = le(e, t);
|
|
1601
1746
|
if (n < 0)
|
|
1602
1747
|
return !1;
|
|
1603
1748
|
var r = e.length - 1;
|
|
1604
|
-
return n == r ? e.pop() :
|
|
1749
|
+
return n == r ? e.pop() : lr.call(e, n, 1), !0;
|
|
1605
1750
|
}
|
|
1606
|
-
function
|
|
1607
|
-
var e = this.__data__, n =
|
|
1751
|
+
function Sr(t) {
|
|
1752
|
+
var e = this.__data__, n = le(e, t);
|
|
1608
1753
|
return n < 0 ? void 0 : e[n][1];
|
|
1609
1754
|
}
|
|
1610
|
-
function
|
|
1611
|
-
return
|
|
1755
|
+
function vr(t) {
|
|
1756
|
+
return le(this.__data__, t) > -1;
|
|
1612
1757
|
}
|
|
1613
|
-
function
|
|
1614
|
-
var n = this.__data__, r =
|
|
1758
|
+
function Cr(t, e) {
|
|
1759
|
+
var n = this.__data__, r = le(n, t);
|
|
1615
1760
|
return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
|
|
1616
1761
|
}
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
function
|
|
1762
|
+
Z.prototype.clear = mr;
|
|
1763
|
+
Z.prototype.delete = Er;
|
|
1764
|
+
Z.prototype.get = Sr;
|
|
1765
|
+
Z.prototype.has = vr;
|
|
1766
|
+
Z.prototype.set = Cr;
|
|
1767
|
+
function Y(t) {
|
|
1623
1768
|
var e = -1, n = t ? t.length : 0;
|
|
1624
1769
|
for (this.clear(); ++e < n; ) {
|
|
1625
1770
|
var r = t[e];
|
|
1626
1771
|
this.set(r[0], r[1]);
|
|
1627
1772
|
}
|
|
1628
1773
|
}
|
|
1629
|
-
function
|
|
1774
|
+
function _r() {
|
|
1630
1775
|
this.__data__ = {
|
|
1631
|
-
hash: new
|
|
1632
|
-
map: new (
|
|
1633
|
-
string: new
|
|
1776
|
+
hash: new V(),
|
|
1777
|
+
map: new (dr || Z)(),
|
|
1778
|
+
string: new V()
|
|
1634
1779
|
};
|
|
1635
1780
|
}
|
|
1636
|
-
function
|
|
1637
|
-
return
|
|
1781
|
+
function wr(t) {
|
|
1782
|
+
return de(this, t).delete(t);
|
|
1638
1783
|
}
|
|
1639
|
-
function
|
|
1640
|
-
return
|
|
1784
|
+
function br(t) {
|
|
1785
|
+
return de(this, t).get(t);
|
|
1641
1786
|
}
|
|
1642
|
-
function
|
|
1643
|
-
return
|
|
1787
|
+
function Rr(t) {
|
|
1788
|
+
return de(this, t).has(t);
|
|
1644
1789
|
}
|
|
1645
|
-
function
|
|
1646
|
-
return
|
|
1790
|
+
function Ir(t, e) {
|
|
1791
|
+
return de(this, t).set(t, e), this;
|
|
1647
1792
|
}
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
1652
|
-
|
|
1653
|
-
function
|
|
1793
|
+
Y.prototype.clear = _r;
|
|
1794
|
+
Y.prototype.delete = wr;
|
|
1795
|
+
Y.prototype.get = br;
|
|
1796
|
+
Y.prototype.has = Rr;
|
|
1797
|
+
Y.prototype.set = Ir;
|
|
1798
|
+
function le(t, e) {
|
|
1654
1799
|
for (var n = t.length; n--; )
|
|
1655
|
-
if (
|
|
1800
|
+
if (Mr(t[n][0], e))
|
|
1656
1801
|
return n;
|
|
1657
1802
|
return -1;
|
|
1658
1803
|
}
|
|
1659
|
-
function
|
|
1660
|
-
e =
|
|
1804
|
+
function Or(t, e) {
|
|
1805
|
+
e = xr(e, t) ? [e] : Dr(e);
|
|
1661
1806
|
for (var n = 0, r = e.length; t != null && n < r; )
|
|
1662
|
-
t = t[
|
|
1807
|
+
t = t[Lr(e[n++])];
|
|
1663
1808
|
return n && n == r ? t : void 0;
|
|
1664
1809
|
}
|
|
1665
|
-
function
|
|
1666
|
-
if (!
|
|
1810
|
+
function Ar(t) {
|
|
1811
|
+
if (!gt(t) || Nr(t))
|
|
1667
1812
|
return !1;
|
|
1668
|
-
var e =
|
|
1669
|
-
return e.test(
|
|
1813
|
+
var e = Ur(t) || ir(t) ? ur : nr;
|
|
1814
|
+
return e.test(kr(t));
|
|
1670
1815
|
}
|
|
1671
|
-
function
|
|
1816
|
+
function Tr(t) {
|
|
1672
1817
|
if (typeof t == "string")
|
|
1673
1818
|
return t;
|
|
1674
|
-
if (
|
|
1675
|
-
return
|
|
1819
|
+
if (Ae(t))
|
|
1820
|
+
return Ue ? Ue.call(t) : "";
|
|
1676
1821
|
var e = t + "";
|
|
1677
1822
|
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
1678
1823
|
}
|
|
1679
|
-
function
|
|
1680
|
-
return
|
|
1824
|
+
function Dr(t) {
|
|
1825
|
+
return ht(t) ? t : Pr(t);
|
|
1681
1826
|
}
|
|
1682
|
-
function
|
|
1827
|
+
function de(t, e) {
|
|
1683
1828
|
var n = t.__data__;
|
|
1684
|
-
return
|
|
1829
|
+
return Fr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
1685
1830
|
}
|
|
1686
|
-
function
|
|
1687
|
-
var n =
|
|
1688
|
-
return
|
|
1831
|
+
function pt(t, e) {
|
|
1832
|
+
var n = or(t, e);
|
|
1833
|
+
return Ar(n) ? n : void 0;
|
|
1689
1834
|
}
|
|
1690
|
-
function
|
|
1691
|
-
if (
|
|
1835
|
+
function xr(t, e) {
|
|
1836
|
+
if (ht(t))
|
|
1692
1837
|
return !1;
|
|
1693
1838
|
var n = typeof t;
|
|
1694
|
-
return n == "number" || n == "symbol" || n == "boolean" || t == null ||
|
|
1839
|
+
return n == "number" || n == "symbol" || n == "boolean" || t == null || Ae(t) ? !0 : Jn.test(t) || !Yn.test(t) || e != null && t in Object(e);
|
|
1695
1840
|
}
|
|
1696
|
-
function
|
|
1841
|
+
function Fr(t) {
|
|
1697
1842
|
var e = typeof t;
|
|
1698
1843
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
1699
1844
|
}
|
|
1700
|
-
function
|
|
1701
|
-
return !!
|
|
1845
|
+
function Nr(t) {
|
|
1846
|
+
return !!Le && Le in t;
|
|
1702
1847
|
}
|
|
1703
|
-
var
|
|
1704
|
-
t =
|
|
1848
|
+
var Pr = Oe(function(t) {
|
|
1849
|
+
t = $r(t);
|
|
1705
1850
|
var e = [];
|
|
1706
|
-
return
|
|
1707
|
-
e.push(s ? i.replace(
|
|
1851
|
+
return Xn.test(t) && e.push(""), t.replace(Zn, function(n, r, s, i) {
|
|
1852
|
+
e.push(s ? i.replace(tr, "$1") : r || n);
|
|
1708
1853
|
}), e;
|
|
1709
1854
|
});
|
|
1710
|
-
function
|
|
1711
|
-
if (typeof t == "string" ||
|
|
1855
|
+
function Lr(t) {
|
|
1856
|
+
if (typeof t == "string" || Ae(t))
|
|
1712
1857
|
return t;
|
|
1713
1858
|
var e = t + "";
|
|
1714
1859
|
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
1715
1860
|
}
|
|
1716
|
-
function
|
|
1861
|
+
function kr(t) {
|
|
1717
1862
|
if (t != null) {
|
|
1718
1863
|
try {
|
|
1719
|
-
return
|
|
1864
|
+
return dt.call(t);
|
|
1720
1865
|
} catch {
|
|
1721
1866
|
}
|
|
1722
1867
|
try {
|
|
@@ -1726,9 +1871,9 @@ function Ar(t) {
|
|
|
1726
1871
|
}
|
|
1727
1872
|
return "";
|
|
1728
1873
|
}
|
|
1729
|
-
function
|
|
1874
|
+
function Oe(t, e) {
|
|
1730
1875
|
if (typeof t != "function" || e && typeof e != "function")
|
|
1731
|
-
throw new TypeError(
|
|
1876
|
+
throw new TypeError(Hn);
|
|
1732
1877
|
var n = function() {
|
|
1733
1878
|
var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
|
|
1734
1879
|
if (i.has(s))
|
|
@@ -1736,52 +1881,52 @@ function be(t, e) {
|
|
|
1736
1881
|
var o = t.apply(this, r);
|
|
1737
1882
|
return n.cache = i.set(s, o), o;
|
|
1738
1883
|
};
|
|
1739
|
-
return n.cache = new (
|
|
1884
|
+
return n.cache = new (Oe.Cache || Y)(), n;
|
|
1740
1885
|
}
|
|
1741
|
-
|
|
1742
|
-
function
|
|
1886
|
+
Oe.Cache = Y;
|
|
1887
|
+
function Mr(t, e) {
|
|
1743
1888
|
return t === e || t !== t && e !== e;
|
|
1744
1889
|
}
|
|
1745
|
-
var
|
|
1746
|
-
function
|
|
1747
|
-
var e =
|
|
1748
|
-
return e ==
|
|
1890
|
+
var ht = Array.isArray;
|
|
1891
|
+
function Ur(t) {
|
|
1892
|
+
var e = gt(t) ? ft.call(t) : "";
|
|
1893
|
+
return e == Bn || e == zn;
|
|
1749
1894
|
}
|
|
1750
|
-
function
|
|
1895
|
+
function gt(t) {
|
|
1751
1896
|
var e = typeof t;
|
|
1752
1897
|
return !!t && (e == "object" || e == "function");
|
|
1753
1898
|
}
|
|
1754
|
-
function
|
|
1899
|
+
function qr(t) {
|
|
1755
1900
|
return !!t && typeof t == "object";
|
|
1756
1901
|
}
|
|
1757
|
-
function
|
|
1758
|
-
return typeof t == "symbol" ||
|
|
1902
|
+
function Ae(t) {
|
|
1903
|
+
return typeof t == "symbol" || qr(t) && ft.call(t) == Vn;
|
|
1759
1904
|
}
|
|
1760
|
-
function
|
|
1761
|
-
return t == null ? "" :
|
|
1905
|
+
function $r(t) {
|
|
1906
|
+
return t == null ? "" : Tr(t);
|
|
1762
1907
|
}
|
|
1763
|
-
function
|
|
1764
|
-
var r = t == null ? void 0 :
|
|
1908
|
+
function Wr(t, e, n) {
|
|
1909
|
+
var r = t == null ? void 0 : Or(t, e);
|
|
1765
1910
|
return r === void 0 ? n : r;
|
|
1766
1911
|
}
|
|
1767
|
-
var
|
|
1768
|
-
const
|
|
1769
|
-
function
|
|
1912
|
+
var Gr = Wr;
|
|
1913
|
+
const oe = /* @__PURE__ */ Kn(Gr);
|
|
1914
|
+
function jr(t, e, n) {
|
|
1770
1915
|
const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
|
|
1771
1916
|
for (const i of e) {
|
|
1772
|
-
const o =
|
|
1917
|
+
const o = oe(i.payload.data, n);
|
|
1773
1918
|
switch (i.type) {
|
|
1774
1919
|
case "ADD": {
|
|
1775
|
-
s.findIndex((c) =>
|
|
1920
|
+
s.findIndex((c) => oe(c, n) === o) === -1 && s.push(i.payload.data);
|
|
1776
1921
|
break;
|
|
1777
1922
|
}
|
|
1778
1923
|
case "UPDATE": {
|
|
1779
|
-
const a = s.findIndex((c) =>
|
|
1924
|
+
const a = s.findIndex((c) => oe(c, n) === o);
|
|
1780
1925
|
a !== -1 && (s[a] = i.payload.data);
|
|
1781
1926
|
break;
|
|
1782
1927
|
}
|
|
1783
1928
|
case "DELETE": {
|
|
1784
|
-
const a = s.findIndex((c) =>
|
|
1929
|
+
const a = s.findIndex((c) => oe(c, n) === o);
|
|
1785
1930
|
a !== -1 && s.splice(a, 1);
|
|
1786
1931
|
break;
|
|
1787
1932
|
}
|
|
@@ -1789,126 +1934,126 @@ function Lr(t, e, n) {
|
|
|
1789
1934
|
}
|
|
1790
1935
|
return { ...r, result: s };
|
|
1791
1936
|
}
|
|
1792
|
-
function
|
|
1793
|
-
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a =
|
|
1794
|
-
|
|
1795
|
-
const
|
|
1796
|
-
const
|
|
1797
|
-
if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null),
|
|
1937
|
+
function Qr(t, e, n, r, s, i) {
|
|
1938
|
+
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = W([]), c = W(null), d = W(null), l = W(s);
|
|
1939
|
+
l.current = s;
|
|
1940
|
+
const f = M(() => {
|
|
1941
|
+
const g = a.current;
|
|
1942
|
+
if (a.current = [], c.current !== null && (clearTimeout(c.current), c.current = null), d.current !== null && (cancelAnimationFrame(d.current), d.current = null), !(g.length === 0 || !r)) {
|
|
1798
1943
|
t.setQueryData(
|
|
1799
1944
|
e,
|
|
1800
|
-
(
|
|
1945
|
+
(m) => jr(m, g, r)
|
|
1801
1946
|
);
|
|
1802
|
-
for (const
|
|
1803
|
-
(
|
|
1804
|
-
n(
|
|
1805
|
-
{ result:
|
|
1947
|
+
for (const m of g)
|
|
1948
|
+
(m.type === "ADD" || m.type === "UPDATE") && t.setQueryData(
|
|
1949
|
+
n(m.payload.id, m.payload.namespace),
|
|
1950
|
+
{ result: m.payload.data }
|
|
1806
1951
|
);
|
|
1807
1952
|
}
|
|
1808
|
-
}, [t, e, n, r]),
|
|
1809
|
-
(
|
|
1810
|
-
a.current.push(
|
|
1953
|
+
}, [t, e, n, r]), h = M(
|
|
1954
|
+
(g) => {
|
|
1955
|
+
a.current.push(g), !(c.current !== null || d.current !== null) && (c.current = setTimeout(f, o), l.current !== 1 && (d.current = requestAnimationFrame(f)));
|
|
1811
1956
|
},
|
|
1812
|
-
[
|
|
1957
|
+
[f, o]
|
|
1813
1958
|
);
|
|
1814
|
-
return
|
|
1815
|
-
c.current !== null && (clearTimeout(c.current), c.current = null),
|
|
1816
|
-
}, []),
|
|
1959
|
+
return j(() => () => {
|
|
1960
|
+
c.current !== null && (clearTimeout(c.current), c.current = null), d.current !== null && (cancelAnimationFrame(d.current), d.current = null);
|
|
1961
|
+
}, []), h;
|
|
1817
1962
|
}
|
|
1818
|
-
const
|
|
1963
|
+
const ks = ({
|
|
1819
1964
|
pluginID: t,
|
|
1820
1965
|
connectionID: e,
|
|
1821
1966
|
resourceKey: n,
|
|
1822
1967
|
idAccessor: r,
|
|
1823
1968
|
namespaces: s
|
|
1824
1969
|
}) => {
|
|
1825
|
-
const i = T(t), o =
|
|
1970
|
+
const i = T(t), o = B(), { showSnackbar: a } = Q(), c = C.useMemo(() => s ?? [], [s]), d = C.useMemo(
|
|
1826
1971
|
() => [i, e, n, c, "list"],
|
|
1827
1972
|
[i, e, n, c]
|
|
1828
|
-
),
|
|
1829
|
-
(
|
|
1973
|
+
), l = C.useCallback(
|
|
1974
|
+
(u, p) => [i, e, n, p, u],
|
|
1830
1975
|
[i, e, n]
|
|
1831
|
-
), { mutateAsync:
|
|
1832
|
-
mutationFn: async (
|
|
1833
|
-
input:
|
|
1834
|
-
namespace:
|
|
1976
|
+
), { mutateAsync: f } = N({
|
|
1977
|
+
mutationFn: async (u) => Ke(i, e, n, Ve.createFrom({
|
|
1978
|
+
input: u.input,
|
|
1979
|
+
namespace: u.namespace ?? (c.length === 1 ? c[0] : "")
|
|
1835
1980
|
})),
|
|
1836
|
-
onSuccess: async (
|
|
1837
|
-
var
|
|
1838
|
-
const p =
|
|
1839
|
-
let
|
|
1840
|
-
(
|
|
1841
|
-
const
|
|
1842
|
-
a(
|
|
1981
|
+
onSuccess: async (u) => {
|
|
1982
|
+
var E;
|
|
1983
|
+
const p = u == null ? void 0 : u.result;
|
|
1984
|
+
let _ = "";
|
|
1985
|
+
(E = p == null ? void 0 : p.metadata) != null && E.name ? _ = p.metadata.name : p != null && p.id ? _ = p.id : p != null && p.name ? _ = p.name : p != null && p.ID ? _ = p.ID : p != null && p.Name && (_ = p.Name);
|
|
1986
|
+
const y = _ ? `Resource ${_} created` : "Resource created";
|
|
1987
|
+
a(y, "success"), await o.invalidateQueries({ queryKey: d });
|
|
1843
1988
|
},
|
|
1844
|
-
onError:
|
|
1845
|
-
}),
|
|
1846
|
-
queryKey:
|
|
1847
|
-
queryFn: async () =>
|
|
1989
|
+
onError: U(a, "Failed to create resource")
|
|
1990
|
+
}), h = F({
|
|
1991
|
+
queryKey: d,
|
|
1992
|
+
queryFn: async () => Qe(i, e, n, ze.createFrom({
|
|
1848
1993
|
order: [{ field: "name", descending: !1 }],
|
|
1849
1994
|
pagination: { page: 1, pageSize: 200 },
|
|
1850
1995
|
namespaces: c
|
|
1851
1996
|
})),
|
|
1852
|
-
placeholderData: (
|
|
1997
|
+
placeholderData: (u, p) => u,
|
|
1853
1998
|
retry: !1
|
|
1854
|
-
}), [
|
|
1855
|
-
|
|
1999
|
+
}), [g, m] = C.useState(
|
|
2000
|
+
O.WatchStateIdle
|
|
1856
2001
|
);
|
|
1857
|
-
C.useEffect(() =>
|
|
2002
|
+
C.useEffect(() => x(
|
|
1858
2003
|
`${i}/${e}/watch/STATE`,
|
|
1859
2004
|
(p) => {
|
|
1860
|
-
const
|
|
1861
|
-
|
|
2005
|
+
const _ = p.data;
|
|
2006
|
+
_.resourceKey === n && m(_.state);
|
|
1862
2007
|
}
|
|
1863
2008
|
), [i, e, n]);
|
|
1864
|
-
const
|
|
2009
|
+
const S = Qr(o, d, l, r, g);
|
|
1865
2010
|
return C.useEffect(() => {
|
|
1866
2011
|
if (!r)
|
|
1867
2012
|
return;
|
|
1868
|
-
|
|
1869
|
-
const
|
|
2013
|
+
rn(i, e, n);
|
|
2014
|
+
const u = x(
|
|
1870
2015
|
`${i}/${e}/${n}/ADD`,
|
|
1871
|
-
(
|
|
1872
|
-
), p =
|
|
2016
|
+
(y) => S({ type: "ADD", payload: y.data })
|
|
2017
|
+
), p = x(
|
|
1873
2018
|
`${i}/${e}/${n}/UPDATE`,
|
|
1874
|
-
(
|
|
1875
|
-
),
|
|
2019
|
+
(y) => S({ type: "UPDATE", payload: y.data })
|
|
2020
|
+
), _ = x(
|
|
1876
2021
|
`${i}/${e}/${n}/DELETE`,
|
|
1877
|
-
(
|
|
2022
|
+
(y) => S({ type: "DELETE", payload: y.data })
|
|
1878
2023
|
);
|
|
1879
2024
|
return () => {
|
|
1880
|
-
|
|
2025
|
+
u(), p(), _(), sn(i, e, n);
|
|
1881
2026
|
};
|
|
1882
|
-
}, [i, e, n,
|
|
2027
|
+
}, [i, e, n, S]), {
|
|
1883
2028
|
/**
|
|
1884
2029
|
* Fetch result for the resource. The client will automatically cache the result, and update the cache
|
|
1885
2030
|
* when the resources are updated or deleted via the returned create and remove mutation functions, or
|
|
1886
2031
|
* the per-resource hook mutation functions.
|
|
1887
2032
|
*/
|
|
1888
|
-
resources:
|
|
2033
|
+
resources: h,
|
|
1889
2034
|
/**
|
|
1890
2035
|
* Create a new resource. A set of optional parameters can be passed to customize the create behavior,
|
|
1891
2036
|
* which if specified, will add additional default behavior set via the hook options.
|
|
1892
2037
|
*
|
|
1893
2038
|
* @params opts Optional parameters to pass to the resource create operation
|
|
1894
2039
|
*/
|
|
1895
|
-
create:
|
|
2040
|
+
create: f,
|
|
1896
2041
|
/** Current watch state for this resource type */
|
|
1897
|
-
watchState:
|
|
2042
|
+
watchState: g,
|
|
1898
2043
|
/** Whether the watch is currently syncing */
|
|
1899
|
-
isSyncing:
|
|
2044
|
+
isSyncing: g === O.WatchStateSyncing,
|
|
1900
2045
|
/** Whether the watch has fully synced */
|
|
1901
|
-
isSynced:
|
|
2046
|
+
isSynced: g === O.WatchStateSynced,
|
|
1902
2047
|
/** Whether the watch encountered an error */
|
|
1903
|
-
watchError:
|
|
2048
|
+
watchError: g === O.WatchStateError
|
|
1904
2049
|
};
|
|
1905
|
-
},
|
|
1906
|
-
const e = T(t), { showSnackbar: n } =
|
|
1907
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2050
|
+
}, Ms = ({ pluginID: t }) => {
|
|
2051
|
+
const e = T(t), { showSnackbar: n } = Q(), r = N({
|
|
2052
|
+
mutationFn: async ({ opts: o, input: a }) => Ke(
|
|
1908
2053
|
e,
|
|
1909
2054
|
o.connectionID,
|
|
1910
2055
|
o.resourceKey,
|
|
1911
|
-
|
|
2056
|
+
Ve.createFrom({
|
|
1912
2057
|
input: a.input,
|
|
1913
2058
|
namespace: a.namespace ?? o.namespace ?? ""
|
|
1914
2059
|
})
|
|
@@ -1917,14 +2062,14 @@ const As = ({
|
|
|
1917
2062
|
n(`Resource ${a.resourceID} created`, "success");
|
|
1918
2063
|
},
|
|
1919
2064
|
onError(o, { opts: a }) {
|
|
1920
|
-
|
|
2065
|
+
z(n, o, `Failed to create resource ${a.resourceID}`);
|
|
1921
2066
|
}
|
|
1922
|
-
}), s =
|
|
1923
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2067
|
+
}), s = N({
|
|
2068
|
+
mutationFn: async ({ opts: o, input: a }) => Ge(
|
|
1924
2069
|
e,
|
|
1925
2070
|
o.connectionID,
|
|
1926
2071
|
o.resourceKey,
|
|
1927
|
-
|
|
2072
|
+
He.createFrom({
|
|
1928
2073
|
input: a.input,
|
|
1929
2074
|
id: o.resourceID,
|
|
1930
2075
|
namespace: o.namespace ?? ""
|
|
@@ -1934,14 +2079,14 @@ const As = ({
|
|
|
1934
2079
|
n(`Resource ${a.resourceID} updated`, "success");
|
|
1935
2080
|
},
|
|
1936
2081
|
onError(o, { opts: a }) {
|
|
1937
|
-
|
|
2082
|
+
z(n, o, `Failed to update resource ${a.resourceID}`);
|
|
1938
2083
|
}
|
|
1939
|
-
}), i =
|
|
1940
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
2084
|
+
}), i = N({
|
|
2085
|
+
mutationFn: async ({ opts: o, input: a }) => je(
|
|
1941
2086
|
e,
|
|
1942
2087
|
o.connectionID,
|
|
1943
2088
|
o.resourceKey,
|
|
1944
|
-
|
|
2089
|
+
Be.createFrom({
|
|
1945
2090
|
id: o.resourceID,
|
|
1946
2091
|
namespace: o.namespace ?? "",
|
|
1947
2092
|
gracePeriodSeconds: a.gracePeriodSeconds
|
|
@@ -1951,7 +2096,7 @@ const As = ({
|
|
|
1951
2096
|
n(`Resource ${a.resourceID} deleted`, "success");
|
|
1952
2097
|
},
|
|
1953
2098
|
onError(o, { opts: a }) {
|
|
1954
|
-
|
|
2099
|
+
z(n, o, `Failed to delete resource ${a.resourceID}`);
|
|
1955
2100
|
}
|
|
1956
2101
|
});
|
|
1957
2102
|
return {
|
|
@@ -1959,15 +2104,15 @@ const As = ({
|
|
|
1959
2104
|
update: s.mutateAsync,
|
|
1960
2105
|
remove: i.mutateAsync
|
|
1961
2106
|
};
|
|
1962
|
-
},
|
|
2107
|
+
}, Us = ({
|
|
1963
2108
|
pluginID: t,
|
|
1964
2109
|
connectionID: e,
|
|
1965
2110
|
resourceKey: n,
|
|
1966
2111
|
enabled: r = !0
|
|
1967
2112
|
}) => {
|
|
1968
|
-
const s = T(t), i =
|
|
2113
|
+
const s = T(t), i = F({
|
|
1969
2114
|
queryKey: ["RESOURCE_ACTIONS", s, e, n],
|
|
1970
|
-
queryFn: () =>
|
|
2115
|
+
queryFn: () => on(s, e, n),
|
|
1971
2116
|
enabled: r && !!s && !!e && !!n,
|
|
1972
2117
|
staleTime: 5 * 60 * 1e3
|
|
1973
2118
|
// actions don't change often
|
|
@@ -1977,18 +2122,18 @@ const As = ({
|
|
|
1977
2122
|
isLoading: i.isLoading,
|
|
1978
2123
|
error: i.error
|
|
1979
2124
|
};
|
|
1980
|
-
},
|
|
2125
|
+
}, qs = ({
|
|
1981
2126
|
pluginID: t,
|
|
1982
2127
|
connectionID: e,
|
|
1983
2128
|
resourceKey: n
|
|
1984
2129
|
}) => {
|
|
1985
|
-
const r = T(t), s =
|
|
1986
|
-
mutationFn: async ({ actionID: a, id: c = "", namespace:
|
|
2130
|
+
const r = T(t), s = B(), { showSnackbar: i } = Q(), o = N({
|
|
2131
|
+
mutationFn: async ({ actionID: a, id: c = "", namespace: d = "", params: l = {} }) => an(
|
|
1987
2132
|
r,
|
|
1988
2133
|
e,
|
|
1989
2134
|
n,
|
|
1990
2135
|
a,
|
|
1991
|
-
|
|
2136
|
+
Ye.createFrom({ id: c, namespace: d, params: l })
|
|
1992
2137
|
),
|
|
1993
2138
|
onSuccess: (a) => {
|
|
1994
2139
|
a != null && a.message && i(a.message, "success"), s.invalidateQueries({
|
|
@@ -1996,7 +2141,7 @@ const As = ({
|
|
|
1996
2141
|
});
|
|
1997
2142
|
},
|
|
1998
2143
|
onError: (a, c) => {
|
|
1999
|
-
|
|
2144
|
+
z(i, a, `Failed to execute action "${c.actionID}"`);
|
|
2000
2145
|
}
|
|
2001
2146
|
});
|
|
2002
2147
|
return {
|
|
@@ -2004,14 +2149,14 @@ const As = ({
|
|
|
2004
2149
|
isExecuting: o.isPending,
|
|
2005
2150
|
error: o.error
|
|
2006
2151
|
};
|
|
2007
|
-
},
|
|
2152
|
+
}, $s = ({
|
|
2008
2153
|
pluginID: t,
|
|
2009
2154
|
connectionID: e,
|
|
2010
2155
|
enabled: n = !0
|
|
2011
2156
|
}) => {
|
|
2012
|
-
const r = T(t), s =
|
|
2157
|
+
const r = T(t), s = F({
|
|
2013
2158
|
queryKey: ["EDITOR_SCHEMAS", r, e],
|
|
2014
|
-
queryFn: () =>
|
|
2159
|
+
queryFn: () => cn(r, e),
|
|
2015
2160
|
enabled: n && !!r && !!e,
|
|
2016
2161
|
staleTime: 10 * 60 * 1e3,
|
|
2017
2162
|
// schemas are fairly stable per connection
|
|
@@ -2023,115 +2168,115 @@ const As = ({
|
|
|
2023
2168
|
error: s.error,
|
|
2024
2169
|
refetch: s.refetch
|
|
2025
2170
|
};
|
|
2026
|
-
},
|
|
2171
|
+
}, Ws = ({
|
|
2027
2172
|
pluginID: t,
|
|
2028
2173
|
connectionID: e,
|
|
2029
2174
|
enabled: n = !0
|
|
2030
2175
|
}) => {
|
|
2031
|
-
const r = T(t), s =
|
|
2032
|
-
s.setQueryData(i, (
|
|
2033
|
-
if (!
|
|
2034
|
-
const
|
|
2035
|
-
let
|
|
2036
|
-
for (const
|
|
2037
|
-
|
|
2038
|
-
return { ...
|
|
2176
|
+
const r = T(t), s = B(), i = [r, e, "watch-state"], o = W([]), a = W(!1), c = M((h) => {
|
|
2177
|
+
s.setQueryData(i, (g) => {
|
|
2178
|
+
if (!g) return g;
|
|
2179
|
+
const m = { ...g.resources, [h.resourceKey]: h.state }, S = { ...g.resourceCounts, [h.resourceKey]: h.resourceCount };
|
|
2180
|
+
let u = 0, p = 0;
|
|
2181
|
+
for (const _ of Object.values(m))
|
|
2182
|
+
_ === O.WatchStateSynced && u++, (_ === O.WatchStateError || _ === O.WatchStateFailed) && p++;
|
|
2183
|
+
return { ...g, resources: m, resourceCounts: S, totalResources: Object.keys(m).length, syncedCount: u, errorCount: p };
|
|
2039
2184
|
});
|
|
2040
|
-
}, [s, r, e]),
|
|
2185
|
+
}, [s, r, e]), d = F({
|
|
2041
2186
|
queryKey: i,
|
|
2042
2187
|
queryFn: async () => {
|
|
2043
|
-
const
|
|
2044
|
-
if (!
|
|
2045
|
-
const
|
|
2046
|
-
let
|
|
2047
|
-
for (const [p,
|
|
2048
|
-
|
|
2049
|
-
const
|
|
2050
|
-
for (const [p,
|
|
2051
|
-
|
|
2188
|
+
const h = await un(r, e);
|
|
2189
|
+
if (!h) throw new Error("Failed to get watch state: null response");
|
|
2190
|
+
const g = {};
|
|
2191
|
+
let m = 0, S = 0;
|
|
2192
|
+
for (const [p, _] of Object.entries(h.resources ?? {}))
|
|
2193
|
+
_ != null && (g[p] = _, _ === O.WatchStateSynced && m++, _ === O.WatchStateError && S++);
|
|
2194
|
+
const u = {};
|
|
2195
|
+
for (const [p, _] of Object.entries(h.resourceCounts ?? {}))
|
|
2196
|
+
_ != null && (u[p] = _);
|
|
2052
2197
|
return {
|
|
2053
|
-
connection:
|
|
2054
|
-
resources:
|
|
2055
|
-
resourceCounts:
|
|
2056
|
-
totalResources: Object.keys(
|
|
2057
|
-
syncedCount:
|
|
2058
|
-
errorCount:
|
|
2198
|
+
connection: h.connectionId,
|
|
2199
|
+
resources: g,
|
|
2200
|
+
resourceCounts: u,
|
|
2201
|
+
totalResources: Object.keys(g).length,
|
|
2202
|
+
syncedCount: m,
|
|
2203
|
+
errorCount: S
|
|
2059
2204
|
};
|
|
2060
2205
|
},
|
|
2061
2206
|
enabled: n && !!r && !!e,
|
|
2062
|
-
refetchInterval: (
|
|
2063
|
-
const
|
|
2064
|
-
if (!
|
|
2065
|
-
let
|
|
2066
|
-
for (const
|
|
2067
|
-
(
|
|
2068
|
-
return
|
|
2207
|
+
refetchInterval: (h) => {
|
|
2208
|
+
const g = h.state.data;
|
|
2209
|
+
if (!g || g.totalResources === 0) return 3e3;
|
|
2210
|
+
let m = 0;
|
|
2211
|
+
for (const S of Object.values(g.resources))
|
|
2212
|
+
(S === O.WatchStateSynced || S === O.WatchStateError || S === O.WatchStateStopped || S === O.WatchStateFailed || S === O.WatchStateForbidden || S === O.WatchStateSkipped) && m++;
|
|
2213
|
+
return m >= g.totalResources ? !1 : 3e3;
|
|
2069
2214
|
}
|
|
2070
2215
|
});
|
|
2071
|
-
|
|
2072
|
-
if (!
|
|
2216
|
+
j(() => {
|
|
2217
|
+
if (!d.data || a.current) return;
|
|
2073
2218
|
a.current = !0;
|
|
2074
|
-
const
|
|
2219
|
+
const h = o.current;
|
|
2075
2220
|
o.current = [];
|
|
2076
|
-
for (const
|
|
2077
|
-
c(
|
|
2078
|
-
}, [
|
|
2221
|
+
for (const g of h)
|
|
2222
|
+
c(g);
|
|
2223
|
+
}, [d.data, c]), j(() => {
|
|
2079
2224
|
if (!n || !r || !e)
|
|
2080
2225
|
return;
|
|
2081
2226
|
a.current = !1, o.current = [];
|
|
2082
|
-
const
|
|
2227
|
+
const h = x(
|
|
2083
2228
|
`${r}/${e}/watch/STATE`,
|
|
2084
|
-
(
|
|
2085
|
-
const
|
|
2086
|
-
a.current ? c(
|
|
2229
|
+
(g) => {
|
|
2230
|
+
const m = g.data;
|
|
2231
|
+
a.current ? c(m) : o.current.push(m);
|
|
2087
2232
|
}
|
|
2088
2233
|
);
|
|
2089
2234
|
return () => {
|
|
2090
|
-
|
|
2235
|
+
h(), a.current = !1, o.current = [];
|
|
2091
2236
|
};
|
|
2092
2237
|
}, [r, e, n, c]);
|
|
2093
|
-
const
|
|
2094
|
-
let
|
|
2095
|
-
if (
|
|
2096
|
-
for (const
|
|
2097
|
-
(
|
|
2238
|
+
const l = d.data;
|
|
2239
|
+
let f = 0;
|
|
2240
|
+
if (l != null && l.resources)
|
|
2241
|
+
for (const h of Object.values(l.resources))
|
|
2242
|
+
(h === O.WatchStateSynced || h === O.WatchStateError || h === O.WatchStateStopped || h === O.WatchStateFailed || h === O.WatchStateForbidden || h === O.WatchStateSkipped) && f++;
|
|
2098
2243
|
return {
|
|
2099
2244
|
/** Full summary query result */
|
|
2100
|
-
summary:
|
|
2245
|
+
summary: d,
|
|
2101
2246
|
/** Get the state of a specific resource type's watch */
|
|
2102
|
-
getResourceState: (
|
|
2247
|
+
getResourceState: (h) => l == null ? void 0 : l.resources[h],
|
|
2103
2248
|
/** Whether all registered watches have reached a terminal state */
|
|
2104
|
-
isFullySynced:
|
|
2249
|
+
isFullySynced: l ? l.totalResources > 0 && f === l.totalResources : !1,
|
|
2105
2250
|
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
2106
|
-
syncProgress:
|
|
2251
|
+
syncProgress: l && l.totalResources > 0 ? f / l.totalResources : 0,
|
|
2107
2252
|
/** Number of watches that encountered errors */
|
|
2108
|
-
errorCount: (
|
|
2253
|
+
errorCount: (l == null ? void 0 : l.errorCount) ?? 0
|
|
2109
2254
|
};
|
|
2110
|
-
},
|
|
2111
|
-
const [t, e] =
|
|
2112
|
-
const
|
|
2113
|
-
if (e((
|
|
2114
|
-
const
|
|
2115
|
-
return
|
|
2116
|
-
}), r.current.has(
|
|
2117
|
-
const
|
|
2118
|
-
e((
|
|
2119
|
-
const
|
|
2120
|
-
return
|
|
2121
|
-
}), n.current.delete(
|
|
2255
|
+
}, Gs = () => {
|
|
2256
|
+
const [t, e] = K(/* @__PURE__ */ new Map()), n = W(/* @__PURE__ */ new Map()), r = W(/* @__PURE__ */ new Map()), s = M((d) => {
|
|
2257
|
+
const l = d.data, f = be(l), h = at(n.current, l), g = Ce(h);
|
|
2258
|
+
if (e((m) => {
|
|
2259
|
+
const S = new Map(m);
|
|
2260
|
+
return S.set(f, g), S;
|
|
2261
|
+
}), r.current.has(f) && (clearTimeout(r.current.get(f)), r.current.delete(f)), ce(g)) {
|
|
2262
|
+
const m = setTimeout(() => {
|
|
2263
|
+
e((S) => {
|
|
2264
|
+
const u = new Map(S);
|
|
2265
|
+
return u.delete(f), u;
|
|
2266
|
+
}), n.current.delete(f), r.current.delete(f);
|
|
2122
2267
|
}, 5e3);
|
|
2123
|
-
r.current.set(
|
|
2268
|
+
r.current.set(f, m);
|
|
2124
2269
|
}
|
|
2125
2270
|
}, []);
|
|
2126
|
-
|
|
2127
|
-
const
|
|
2271
|
+
j(() => {
|
|
2272
|
+
const d = x("watch/STATE", s);
|
|
2128
2273
|
return () => {
|
|
2129
|
-
|
|
2130
|
-
for (const
|
|
2131
|
-
clearTimeout(
|
|
2274
|
+
d();
|
|
2275
|
+
for (const l of r.current.values())
|
|
2276
|
+
clearTimeout(l);
|
|
2132
2277
|
};
|
|
2133
2278
|
}, [s]);
|
|
2134
|
-
const i = Array.from(t.values()), o =
|
|
2279
|
+
const i = Array.from(t.values()), o = ot(i), a = i.find((d) => !ce(d)) ?? i[0] ?? null, c = it(i);
|
|
2135
2280
|
return {
|
|
2136
2281
|
/** All tracked syncs */
|
|
2137
2282
|
syncs: i,
|
|
@@ -2142,73 +2287,73 @@ const As = ({
|
|
|
2142
2287
|
/** Aggregate progress across all connections (0-1) */
|
|
2143
2288
|
aggregateProgress: c
|
|
2144
2289
|
};
|
|
2145
|
-
},
|
|
2146
|
-
const t = C.useContext(
|
|
2290
|
+
}, Kr = () => {
|
|
2291
|
+
const t = C.useContext(tt);
|
|
2147
2292
|
if (!t) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2148
2293
|
return t;
|
|
2149
|
-
},
|
|
2150
|
-
const r = T(t), { showSnackbar: s } =
|
|
2151
|
-
var
|
|
2152
|
-
|
|
2153
|
-
}),
|
|
2294
|
+
}, js = ({ pluginID: t, connectionID: e, resourceKey: n }) => {
|
|
2295
|
+
const r = T(t), { showSnackbar: s } = Q(), { addOperation: i, updateOperation: o } = Kr(), a = C.useRef(/* @__PURE__ */ new Set()), c = C.useCallback((f, h = !1) => {
|
|
2296
|
+
var g, m, S;
|
|
2297
|
+
f.disposed || (f.disposed = !0, (g = f.unsubscribe) == null || g.call(f), (m = f.open) == null || m.cancel(), (S = f.attach) == null || S.cancel(), f.handle && (xe(f.handle).catch(() => {
|
|
2298
|
+
}), h && o(f.handle, { status: "cancelled", message: "Cancelled", completedAt: Date.now() })), a.current.delete(f));
|
|
2154
2299
|
}, [o]);
|
|
2155
2300
|
C.useEffect(() => () => {
|
|
2156
|
-
for (const
|
|
2301
|
+
for (const f of a.current) c(f, !0);
|
|
2157
2302
|
}, [r, e, n, c]);
|
|
2158
|
-
const
|
|
2159
|
-
const
|
|
2160
|
-
a.current.add(
|
|
2303
|
+
const d = C.useCallback(async ({ actionID: f, id: h, namespace: g, label: m, params: S = {} }) => {
|
|
2304
|
+
const u = { disposed: !1, terminal: !1, sequence: 0 };
|
|
2305
|
+
a.current.add(u);
|
|
2161
2306
|
try {
|
|
2162
|
-
|
|
2163
|
-
const p = await
|
|
2164
|
-
if (
|
|
2165
|
-
return
|
|
2307
|
+
u.open = ln(r, e, n, f, Ye.createFrom({ id: h, namespace: g, params: S }));
|
|
2308
|
+
const p = await u.open;
|
|
2309
|
+
if (u.open = void 0, u.disposed)
|
|
2310
|
+
return xe(p).catch(() => {
|
|
2166
2311
|
}), p;
|
|
2167
|
-
|
|
2168
|
-
const
|
|
2169
|
-
if (
|
|
2170
|
-
|
|
2171
|
-
const
|
|
2172
|
-
if (
|
|
2173
|
-
|
|
2174
|
-
const
|
|
2175
|
-
o(p, { status:
|
|
2176
|
-
} else if (
|
|
2177
|
-
|
|
2178
|
-
const
|
|
2179
|
-
o(p, { status: "completed", message:
|
|
2312
|
+
u.handle = p, i({ id: p, label: m, resourceKey: n, resourceName: h, namespace: g, connectionID: e, status: "running", startedAt: Date.now() });
|
|
2313
|
+
const _ = (E) => {
|
|
2314
|
+
if (u.disposed || !Number.isSafeInteger(E.sequence) || E.sequence <= u.sequence) return;
|
|
2315
|
+
u.sequence = E.sequence;
|
|
2316
|
+
const w = E.event, v = w.data ?? {};
|
|
2317
|
+
if (w.type === "error") {
|
|
2318
|
+
u.terminal = !0;
|
|
2319
|
+
const b = H(w.error);
|
|
2320
|
+
o(p, { status: ae(b) ? "cancelled" : "error", message: b.title, completedAt: Date.now() }), z(s, b, m), c(u);
|
|
2321
|
+
} else if (w.type === "complete") {
|
|
2322
|
+
u.terminal = !0;
|
|
2323
|
+
const b = typeof v.message == "string" ? v.message : `${m} completed`;
|
|
2324
|
+
o(p, { status: "completed", message: b, completedAt: Date.now() }), s(b, "success"), c(u);
|
|
2180
2325
|
} else
|
|
2181
2326
|
o(p, {
|
|
2182
|
-
message: typeof
|
|
2183
|
-
progress: typeof
|
|
2327
|
+
message: typeof v.message == "string" ? v.message : void 0,
|
|
2328
|
+
progress: typeof v.ready == "number" && typeof v.desired == "number" ? { ready: v.ready, desired: v.desired } : void 0
|
|
2184
2329
|
});
|
|
2185
2330
|
};
|
|
2186
|
-
|
|
2187
|
-
const
|
|
2188
|
-
return
|
|
2331
|
+
u.unsubscribe = x(`action/stream/${p}`, (E) => _(E.data)), u.attach = dn(p);
|
|
2332
|
+
const y = await u.attach;
|
|
2333
|
+
return u.attach = void 0, _(y), p;
|
|
2189
2334
|
} catch (p) {
|
|
2190
|
-
if (
|
|
2191
|
-
throw
|
|
2335
|
+
if (u.terminal && u.handle) return u.handle;
|
|
2336
|
+
throw u.disposed || (u.handle && o(u.handle, { status: ae(p) ? "cancelled" : "error", message: H(p).title, completedAt: Date.now() }), z(s, p, `Failed to start "${f}"`)), c(u), p;
|
|
2192
2337
|
}
|
|
2193
|
-
}, [r, e, n, i, o, s, c]),
|
|
2194
|
-
for (const
|
|
2195
|
-
c(
|
|
2338
|
+
}, [r, e, n, i, o, s, c]), l = C.useCallback((f) => {
|
|
2339
|
+
for (const h of a.current) if (h.handle === f) {
|
|
2340
|
+
c(h, !0);
|
|
2196
2341
|
return;
|
|
2197
2342
|
}
|
|
2198
2343
|
}, [c]);
|
|
2199
|
-
return { startStreamAction:
|
|
2344
|
+
return { startStreamAction: d, cancelStreamAction: l };
|
|
2200
2345
|
};
|
|
2201
|
-
function
|
|
2346
|
+
function Hr(t, e) {
|
|
2202
2347
|
return `${t}/${e}/graph/CHANGED`;
|
|
2203
2348
|
}
|
|
2204
|
-
function
|
|
2205
|
-
const s =
|
|
2349
|
+
function Te(t, e, n, r) {
|
|
2350
|
+
const s = B(), i = W(n);
|
|
2206
2351
|
i.current = n;
|
|
2207
2352
|
const o = JSON.stringify(n);
|
|
2208
|
-
|
|
2353
|
+
j(() => {
|
|
2209
2354
|
if (!r || !t || !e)
|
|
2210
2355
|
return;
|
|
2211
|
-
const a =
|
|
2356
|
+
const a = x(Hr(t, e), () => {
|
|
2212
2357
|
s.invalidateQueries({ queryKey: i.current, exact: !0 });
|
|
2213
2358
|
});
|
|
2214
2359
|
return () => {
|
|
@@ -2216,7 +2361,7 @@ function Ie(t, e, n, r) {
|
|
|
2216
2361
|
};
|
|
2217
2362
|
}, [s, t, e, o, r]);
|
|
2218
2363
|
}
|
|
2219
|
-
const
|
|
2364
|
+
const Br = {
|
|
2220
2365
|
owns: { outgoing: "Owns", incoming: "Owned by" },
|
|
2221
2366
|
runs_on: { outgoing: "Runs on", incoming: "Running here" },
|
|
2222
2367
|
uses: { outgoing: "Uses", incoming: "Used by" },
|
|
@@ -2225,19 +2370,19 @@ const Mr = {
|
|
|
2225
2370
|
member_of: { outgoing: "Member of", incoming: "Members" },
|
|
2226
2371
|
selects: { outgoing: "Selects", incoming: "Selected by" }
|
|
2227
2372
|
};
|
|
2228
|
-
function
|
|
2229
|
-
const n =
|
|
2373
|
+
function Qs(t, e) {
|
|
2374
|
+
const n = Br[t];
|
|
2230
2375
|
if (n)
|
|
2231
2376
|
return n[e];
|
|
2232
2377
|
const r = t.replace(/_/g, " ");
|
|
2233
2378
|
return e === "outgoing" ? r : `${r} (incoming)`;
|
|
2234
2379
|
}
|
|
2235
|
-
function
|
|
2380
|
+
function zr(t, e) {
|
|
2236
2381
|
return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
|
|
2237
2382
|
}
|
|
2238
|
-
function
|
|
2383
|
+
function Vr(t, e) {
|
|
2239
2384
|
return e.map((n) => {
|
|
2240
|
-
const r =
|
|
2385
|
+
const r = zr(n.source, t);
|
|
2241
2386
|
return {
|
|
2242
2387
|
resource: r ? n.target : n.source,
|
|
2243
2388
|
type: n.type,
|
|
@@ -2246,7 +2391,7 @@ function Wr(t, e) {
|
|
|
2246
2391
|
};
|
|
2247
2392
|
});
|
|
2248
2393
|
}
|
|
2249
|
-
const
|
|
2394
|
+
const Ks = ({
|
|
2250
2395
|
pluginID: t,
|
|
2251
2396
|
connectionID: e,
|
|
2252
2397
|
resourceKey: n,
|
|
@@ -2257,31 +2402,31 @@ const ks = ({
|
|
|
2257
2402
|
enabled: a = !0,
|
|
2258
2403
|
refetchInterval: c = !1
|
|
2259
2404
|
}) => {
|
|
2260
|
-
const
|
|
2261
|
-
|
|
2262
|
-
const
|
|
2263
|
-
queryKey:
|
|
2264
|
-
queryFn: async () =>
|
|
2265
|
-
enabled:
|
|
2405
|
+
const d = T(t), l = ["RESOURCE_RELATED", d, e, n, s, r, i, o ?? null], f = a && !!d && !!e && !!n && !!r;
|
|
2406
|
+
Te(d, e, l, f);
|
|
2407
|
+
const h = F({
|
|
2408
|
+
queryKey: l,
|
|
2409
|
+
queryFn: async () => fn(d, e, n, s, r, i, o ?? null),
|
|
2410
|
+
enabled: f,
|
|
2266
2411
|
refetchInterval: c
|
|
2267
|
-
}),
|
|
2268
|
-
pluginId:
|
|
2412
|
+
}), g = {
|
|
2413
|
+
pluginId: d,
|
|
2269
2414
|
connectionId: e,
|
|
2270
2415
|
resourceKey: n,
|
|
2271
2416
|
id: r,
|
|
2272
2417
|
namespace: s
|
|
2273
|
-
},
|
|
2418
|
+
}, m = h.data ?? [];
|
|
2274
2419
|
return {
|
|
2275
2420
|
/** One entry per edge, from the viewed resource's side. */
|
|
2276
|
-
related:
|
|
2421
|
+
related: Vr(g, m),
|
|
2277
2422
|
/** The raw graph edges. */
|
|
2278
|
-
edges:
|
|
2279
|
-
isLoading:
|
|
2280
|
-
isFetching:
|
|
2281
|
-
error:
|
|
2282
|
-
refetch:
|
|
2423
|
+
edges: m,
|
|
2424
|
+
isLoading: h.isLoading,
|
|
2425
|
+
isFetching: h.isFetching,
|
|
2426
|
+
error: h.error,
|
|
2427
|
+
refetch: h.refetch
|
|
2283
2428
|
};
|
|
2284
|
-
},
|
|
2429
|
+
}, Hs = ({
|
|
2285
2430
|
pluginID: t,
|
|
2286
2431
|
connectionID: e,
|
|
2287
2432
|
resourceKey: n,
|
|
@@ -2291,22 +2436,22 @@ const ks = ({
|
|
|
2291
2436
|
enabled: o = !0,
|
|
2292
2437
|
refetchInterval: a = !1
|
|
2293
2438
|
}) => {
|
|
2294
|
-
const c = T(t),
|
|
2295
|
-
|
|
2296
|
-
const
|
|
2297
|
-
queryKey:
|
|
2298
|
-
queryFn: async () =>
|
|
2299
|
-
enabled:
|
|
2439
|
+
const c = T(t), d = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], l = o && !!c && !!e && !!n && !!r;
|
|
2440
|
+
Te(c, e, d, l);
|
|
2441
|
+
const f = F({
|
|
2442
|
+
queryKey: d,
|
|
2443
|
+
queryFn: async () => pn(c, e, n, s, r, i),
|
|
2444
|
+
enabled: l,
|
|
2300
2445
|
refetchInterval: a
|
|
2301
2446
|
});
|
|
2302
2447
|
return {
|
|
2303
|
-
tree:
|
|
2304
|
-
isLoading:
|
|
2305
|
-
isFetching:
|
|
2306
|
-
error:
|
|
2307
|
-
refetch:
|
|
2448
|
+
tree: f.data ?? null,
|
|
2449
|
+
isLoading: f.isLoading,
|
|
2450
|
+
isFetching: f.isFetching,
|
|
2451
|
+
error: f.error,
|
|
2452
|
+
refetch: f.refetch
|
|
2308
2453
|
};
|
|
2309
|
-
},
|
|
2454
|
+
}, Bs = ({
|
|
2310
2455
|
pluginID: t,
|
|
2311
2456
|
connectionID: e,
|
|
2312
2457
|
resourceKey: n,
|
|
@@ -2316,53 +2461,53 @@ const ks = ({
|
|
|
2316
2461
|
downDepth: o = 3,
|
|
2317
2462
|
enabled: a = !0
|
|
2318
2463
|
}) => {
|
|
2319
|
-
const c = T(t),
|
|
2320
|
-
|
|
2321
|
-
const
|
|
2322
|
-
queryKey:
|
|
2323
|
-
queryFn: async () =>
|
|
2324
|
-
enabled:
|
|
2464
|
+
const c = T(t), d = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], l = a && !!c && !!e && !!n && !!r;
|
|
2465
|
+
Te(c, e, d, l);
|
|
2466
|
+
const f = F({
|
|
2467
|
+
queryKey: d,
|
|
2468
|
+
queryFn: async () => hn(c, e, n, s, r, i, o),
|
|
2469
|
+
enabled: l
|
|
2325
2470
|
});
|
|
2326
2471
|
return {
|
|
2327
|
-
graph:
|
|
2328
|
-
isLoading:
|
|
2329
|
-
isFetching:
|
|
2330
|
-
error:
|
|
2331
|
-
refetch:
|
|
2472
|
+
graph: f.data ?? null,
|
|
2473
|
+
isLoading: f.isLoading,
|
|
2474
|
+
isFetching: f.isFetching,
|
|
2475
|
+
error: f.error,
|
|
2476
|
+
refetch: f.refetch
|
|
2332
2477
|
};
|
|
2333
|
-
},
|
|
2334
|
-
const t = C.useContext(
|
|
2478
|
+
}, zs = () => {
|
|
2479
|
+
const t = C.useContext(et);
|
|
2335
2480
|
if (!t)
|
|
2336
2481
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2337
2482
|
return t;
|
|
2338
|
-
},
|
|
2339
|
-
const { pluginId: r } =
|
|
2483
|
+
}, Vs = ({ to: t, withinContext: e, ...n }) => {
|
|
2484
|
+
const { pluginId: r } = we();
|
|
2340
2485
|
r || console.error("Link used outside of a plugin context");
|
|
2341
2486
|
const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
|
|
2342
|
-
return C.useMemo(() => /* @__PURE__ */
|
|
2487
|
+
return C.useMemo(() => /* @__PURE__ */ R(_t, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
|
|
2343
2488
|
};
|
|
2344
|
-
function
|
|
2345
|
-
const t =
|
|
2489
|
+
function Ys() {
|
|
2490
|
+
const t = wt(), e = bt(), { pluginId: n } = we();
|
|
2346
2491
|
n || console.error("usePluginRouter used outside of a plugin context");
|
|
2347
|
-
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i =
|
|
2492
|
+
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = M((o, a) => {
|
|
2348
2493
|
const { ...c } = a ?? {};
|
|
2349
2494
|
o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
|
|
2350
2495
|
}, [t, r]);
|
|
2351
|
-
return
|
|
2496
|
+
return Ct(() => ({
|
|
2352
2497
|
location: e,
|
|
2353
2498
|
navigate: i,
|
|
2354
2499
|
pluginPath: s
|
|
2355
2500
|
}), [e, i, s]);
|
|
2356
2501
|
}
|
|
2357
|
-
class
|
|
2502
|
+
class Js {
|
|
2358
2503
|
}
|
|
2359
|
-
class
|
|
2504
|
+
class Xs {
|
|
2360
2505
|
constructor() {
|
|
2361
|
-
|
|
2506
|
+
L(this, "_extensions");
|
|
2362
2507
|
/**
|
|
2363
2508
|
* The root component to render for the application window.
|
|
2364
2509
|
*/
|
|
2365
|
-
|
|
2510
|
+
L(this, "root");
|
|
2366
2511
|
/**
|
|
2367
2512
|
* Various pages to render under the root component. These can be navigated to using
|
|
2368
2513
|
* the built-in navigation system both programatically and through Links.
|
|
@@ -2392,8 +2537,8 @@ class Qs {
|
|
|
2392
2537
|
* ```
|
|
2393
2538
|
*
|
|
2394
2539
|
*/
|
|
2395
|
-
|
|
2396
|
-
|
|
2540
|
+
L(this, "pages");
|
|
2541
|
+
L(this, "_routes");
|
|
2397
2542
|
}
|
|
2398
2543
|
get extensions() {
|
|
2399
2544
|
return this._extensions || [];
|
|
@@ -2415,9 +2560,9 @@ class Qs {
|
|
|
2415
2560
|
*/
|
|
2416
2561
|
get Window() {
|
|
2417
2562
|
if (!this._routes && this.root)
|
|
2418
|
-
return /* @__PURE__ */
|
|
2419
|
-
const e =
|
|
2420
|
-
return /* @__PURE__ */
|
|
2563
|
+
return /* @__PURE__ */ R(this.root, {});
|
|
2564
|
+
const e = Rt(this._routes || []);
|
|
2565
|
+
return /* @__PURE__ */ R(It, { router: e });
|
|
2421
2566
|
}
|
|
2422
2567
|
/**
|
|
2423
2568
|
* Register extension points for other plugins to extend the functionality
|
|
@@ -2449,91 +2594,91 @@ class Qs {
|
|
|
2449
2594
|
return this._routes = e, this;
|
|
2450
2595
|
}
|
|
2451
2596
|
}
|
|
2452
|
-
var
|
|
2453
|
-
const
|
|
2597
|
+
var Yr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Yr || {});
|
|
2598
|
+
const Zs = (t) => {
|
|
2454
2599
|
const e = t.split("::");
|
|
2455
2600
|
return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
|
|
2456
2601
|
group: e[0] || "core",
|
|
2457
2602
|
version: e[1] || "",
|
|
2458
2603
|
kind: e[2] || e[0]
|
|
2459
2604
|
};
|
|
2460
|
-
},
|
|
2605
|
+
}, eo = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
2461
2606
|
export {
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2482
|
-
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2487
|
-
|
|
2488
|
-
|
|
2489
|
-
|
|
2490
|
-
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2501
|
-
|
|
2502
|
-
|
|
2503
|
-
|
|
2504
|
-
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
|
|
2508
|
-
|
|
2509
|
-
|
|
2510
|
-
|
|
2511
|
-
|
|
2512
|
-
|
|
2513
|
-
|
|
2514
|
-
|
|
2515
|
-
|
|
2516
|
-
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2607
|
+
J as ALL_SESSIONS_KEY,
|
|
2608
|
+
xn as BottomDrawerContext,
|
|
2609
|
+
Nn as ConfirmationModalContext,
|
|
2610
|
+
D as ErrorTypes,
|
|
2611
|
+
hs as ExtensionPointRegistry,
|
|
2612
|
+
$n as ExtensionPointStore,
|
|
2613
|
+
ps as ExtensionProvider,
|
|
2614
|
+
Vs as Link,
|
|
2615
|
+
tt as OperationsContext,
|
|
2616
|
+
ds as OperationsProvider,
|
|
2617
|
+
_e as PluginContext,
|
|
2618
|
+
cs as PluginContextProvider,
|
|
2619
|
+
Yr as PluginErrorCode,
|
|
2620
|
+
Xs as PluginWindow,
|
|
2621
|
+
Js as PluginWindowRootProps,
|
|
2622
|
+
Fn as RightDrawerContext,
|
|
2623
|
+
et as SettingsContext,
|
|
2624
|
+
ls as SettingsProvider,
|
|
2625
|
+
gs as SnackbarProvider,
|
|
2626
|
+
O as WatchState,
|
|
2627
|
+
Tn as actionToSnackbar,
|
|
2628
|
+
jr as applyBatch,
|
|
2629
|
+
Gn as connectionListQueryKey,
|
|
2630
|
+
U as createErrorHandler,
|
|
2631
|
+
Dn as defaultState,
|
|
2632
|
+
eo as formatGroup,
|
|
2633
|
+
Hr as graphChangedEvent,
|
|
2634
|
+
ae as isCancelledError,
|
|
2635
|
+
H as parseAppError,
|
|
2636
|
+
Zs as parseResourceKey,
|
|
2637
|
+
Qs as relationshipLabel,
|
|
2638
|
+
z as showAppError,
|
|
2639
|
+
Vr as toRelatedResources,
|
|
2640
|
+
Gs as useActiveSyncs,
|
|
2641
|
+
ct as useBottomDrawer,
|
|
2642
|
+
Ts as useConfirmationModal,
|
|
2643
|
+
ys as useConnection,
|
|
2644
|
+
Es as useConnectionNamespaces,
|
|
2645
|
+
Ss as useConnectionStatus,
|
|
2646
|
+
ms as useConnections,
|
|
2647
|
+
Hs as useDependencyTree,
|
|
2648
|
+
$s as useEditorSchemas,
|
|
2649
|
+
Qr as useEventBatcher,
|
|
2650
|
+
_s as useExec,
|
|
2651
|
+
qs as useExecuteAction,
|
|
2652
|
+
fs as useExtensionPoint,
|
|
2653
|
+
qn as useExtensionRegistry,
|
|
2654
|
+
ws as useLogs,
|
|
2655
|
+
bs as useMetricProviders,
|
|
2656
|
+
Qn as useMetricProvidersForResource,
|
|
2657
|
+
Is as useMetricStream,
|
|
2658
|
+
Kr as useOperations,
|
|
2659
|
+
we as usePluginContext,
|
|
2660
|
+
vs as usePluginData,
|
|
2661
|
+
Ys as usePluginRouter,
|
|
2662
|
+
us as usePluginSettings,
|
|
2663
|
+
Os as usePortForwardSessions,
|
|
2664
|
+
Te as useRefetchOnGraphChange,
|
|
2665
|
+
Ks as useRelatedResources,
|
|
2521
2666
|
T as useResolvedPluginId,
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
|
|
2528
|
-
|
|
2529
|
-
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2667
|
+
Ds as useResource,
|
|
2668
|
+
Us as useResourceActions,
|
|
2669
|
+
xs as useResourceAreaComponent,
|
|
2670
|
+
Bs as useResourceGraph,
|
|
2671
|
+
Fs as useResourceGroups,
|
|
2672
|
+
Rs as useResourceMetrics,
|
|
2673
|
+
Ms as useResourceMutations,
|
|
2674
|
+
As as useResourcePortForwarder,
|
|
2675
|
+
Ns as useResourceSearch,
|
|
2676
|
+
Ps as useResourceType,
|
|
2677
|
+
Ls as useResourceTypes,
|
|
2678
|
+
ks as useResources,
|
|
2679
|
+
Cs as useRightDrawer,
|
|
2680
|
+
zs as useSettings,
|
|
2681
|
+
Q as useSnackbar,
|
|
2682
|
+
js as useStreamAction,
|
|
2683
|
+
Ws as useWatchState
|
|
2539
2684
|
};
|