@omniviewdev/runtime 0.4.0 → 0.4.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/api.cjs +1 -1
- package/dist/api.d.ts +1 -0
- package/dist/api.js +28 -27
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/index.d.ts +1 -1
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/models.d.ts +27 -0
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/index.d.ts +1 -1
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graph/models.d.ts +36 -0
- package/dist/bindings/github.com/omniviewdev/omniview/backend/pkg/plugin/resource/graphservice.d.ts +6 -0
- package/dist/graphservice-2kgAuCnt.cjs +1 -0
- package/dist/graphservice-5kuEPkCT.js +731 -0
- package/dist/hooks/resource/index.d.ts +4 -0
- package/dist/hooks/resource/useDependencyTree.d.ts +41 -0
- package/dist/hooks/resource/useRefetchOnGraphChange.d.ts +11 -0
- package/dist/hooks/resource/useRelatedResources.d.ts +81 -0
- package/dist/hooks/resource/useResourceGraph.d.ts +46 -0
- package/dist/index.cjs +2 -2
- package/dist/index.js +787 -647
- package/dist/{models-B8OVRhdT.js → models-3V1aa9YT.js} +1 -1
- package/dist/{models-BVKsY9u1.js → models-B97zjrHu.js} +565 -452
- package/dist/{models-CExSuVU2.cjs → models-BPmIMpct.cjs} +1 -1
- package/dist/models-sJV1iQbd.cjs +1 -0
- package/dist/models.cjs +1 -1
- package/dist/models.d.ts +1 -0
- package/dist/models.js +90 -84
- package/package.json +1 -1
- package/dist/models-DdAWPDgz.cjs +0 -1
- package/dist/servicewrapper-BH5omp-N.js +0 -708
- package/dist/servicewrapper-dDhyC68C.cjs +0 -1
package/dist/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { jsx as
|
|
5
|
-
import
|
|
6
|
-
import { Link as
|
|
7
|
-
import { P as ht, G as
|
|
8
|
-
import { P as
|
|
9
|
-
import { useQueryClient as j, useMutation as
|
|
10
|
-
import { useToast as
|
|
1
|
+
var at = Object.defineProperty;
|
|
2
|
+
var ct = (t, e, n) => e in t ? at(t, e, { enumerable: !0, configurable: !0, writable: !0, value: n }) : t[e] = n;
|
|
3
|
+
var A = (t, e, n) => ct(t, typeof e != "symbol" ? e + "" : e, n);
|
|
4
|
+
import { jsx as x, jsxs as X } from "react/jsx-runtime";
|
|
5
|
+
import b, { useContext as Y, createContext as re, useState as G, useCallback as L, useSyncExternalStore as ut, useRef as q, useEffect as U, useMemo as lt } from "react";
|
|
6
|
+
import { Link as dt, useNavigate as ft, useLocation as pt, createMemoryRouter as yt, RouterProvider as gt } from "react-router-dom";
|
|
7
|
+
import { P as ht, G as mt, V as St, S as _t, a as Pe, U as Et, R as wt, b as Ct, c as Oe, d as bt, L as vt, e as Rt, f as Ft, g as It, h as Pt, i as Ot, j as Tt, C as At, k as xt, l as Dt, m as Nt, n as kt, Q as Lt, o as Mt, p as Ce, q as $t, r as Te, F as qt, s as Ut, t as Ae, D as xe, u as Wt, v as Gt, w as jt, x as De, y as Qt, z as Kt, A as Ne, B as Ht, E as Bt, H as zt, I as Yt, J as Jt, K as Zt, M as Xt, N as Vt, O as en, T as tn } from "./graphservice-5kuEPkCT.js";
|
|
8
|
+
import { P as nn, W as rn, S as sn, C as on, L as an, F as cn, a as un, U as ke, D as Le, G as ln, b as Me, c as $e, A as qe } from "./models-B97zjrHu.js";
|
|
9
|
+
import { useQueryClient as j, useMutation as T, useQuery as O, keepPreviousData as Ue, useQueries as dn } from "@tanstack/react-query";
|
|
10
|
+
import { useToast as fn } from "@omniviewdev/base-ui";
|
|
11
11
|
import "./index-D2mKAO8s.js";
|
|
12
|
-
import { O as
|
|
13
|
-
import { w as
|
|
14
|
-
const ye =
|
|
12
|
+
import { O as D, a as We, b as ae } from "./events-DDTGFACO.js";
|
|
13
|
+
import { w as pn } from "./legacyEnum-DORXlU_y.js";
|
|
14
|
+
const ye = b.createContext(void 0), $ = {
|
|
15
15
|
// Plugin
|
|
16
16
|
PLUGIN_NOT_FOUND: "omniview:plugin/not-found",
|
|
17
17
|
PLUGIN_NOT_LOADED: "omniview:plugin/not-loaded",
|
|
@@ -42,7 +42,7 @@ const ye = v.createContext(void 0), $ = {
|
|
|
42
42
|
VALIDATION: "omniview:validation",
|
|
43
43
|
NOT_IMPLEMENTED: "omniview:not-implemented"
|
|
44
44
|
};
|
|
45
|
-
function
|
|
45
|
+
function yn(t) {
|
|
46
46
|
switch (t) {
|
|
47
47
|
case "NOT_FOUND":
|
|
48
48
|
return { typeUri: $.RESOURCE_NOT_FOUND, status: 404 };
|
|
@@ -78,7 +78,7 @@ function Q(t) {
|
|
|
78
78
|
if (typeof n.type == "string" && typeof n.title == "string" && typeof n.status == "number" && typeof n.detail == "string")
|
|
79
79
|
return n;
|
|
80
80
|
if (typeof n.code == "string" && typeof n.title == "string" && typeof n.message == "string") {
|
|
81
|
-
const { typeUri: r, status: s } =
|
|
81
|
+
const { typeUri: r, status: s } = yn(n.code);
|
|
82
82
|
return {
|
|
83
83
|
type: r,
|
|
84
84
|
title: n.title,
|
|
@@ -96,10 +96,10 @@ function Q(t) {
|
|
|
96
96
|
detail: e
|
|
97
97
|
};
|
|
98
98
|
}
|
|
99
|
-
function
|
|
99
|
+
function Ge(t) {
|
|
100
100
|
return t == null ? !1 : (typeof t == "string" ? t : t instanceof Error ? t.message : String(t)) === "cancelled" ? !0 : Q(t).type === $.CANCELLED;
|
|
101
101
|
}
|
|
102
|
-
function
|
|
102
|
+
function gn(t) {
|
|
103
103
|
switch (t.type) {
|
|
104
104
|
case "navigate":
|
|
105
105
|
return {
|
|
@@ -136,7 +136,7 @@ function dn(t) {
|
|
|
136
136
|
};
|
|
137
137
|
}
|
|
138
138
|
}
|
|
139
|
-
function
|
|
139
|
+
function je(t, e) {
|
|
140
140
|
var s, i;
|
|
141
141
|
const n = [
|
|
142
142
|
t.detail,
|
|
@@ -147,46 +147,46 @@ function Ge(t, e) {
|
|
|
147
147
|
message: e || (t.title !== "Error" ? t.title : "Operation failed"),
|
|
148
148
|
status: "error",
|
|
149
149
|
details: n,
|
|
150
|
-
actions: (i = t.actions) == null ? void 0 : i.map(
|
|
150
|
+
actions: (i = t.actions) == null ? void 0 : i.map(gn)
|
|
151
151
|
};
|
|
152
152
|
}
|
|
153
153
|
function z(t, e, n) {
|
|
154
|
-
if (
|
|
154
|
+
if (Ge(e)) return;
|
|
155
155
|
const r = Q(e);
|
|
156
|
-
t(
|
|
156
|
+
t(je(r, n));
|
|
157
157
|
}
|
|
158
158
|
function k(t, e) {
|
|
159
159
|
return (n) => {
|
|
160
|
-
if (
|
|
160
|
+
if (Ge(n)) return;
|
|
161
161
|
const r = Q(n);
|
|
162
|
-
t(
|
|
162
|
+
t(je(r, r.title !== "Error" ? r.title : e));
|
|
163
163
|
};
|
|
164
164
|
}
|
|
165
|
-
function
|
|
166
|
-
const { children: e, pluginId: n } = t, [r, s] =
|
|
165
|
+
function zr(t) {
|
|
166
|
+
const { children: e, pluginId: n } = t, [r, s] = b.useState({}), [i, o] = b.useState(new nn()), [a, c] = b.useState(!1), [l, u] = b.useState(null);
|
|
167
167
|
console.debug("[PluginContextProvider] render", { pluginId: n, metaLoaded: a, metaError: !!l });
|
|
168
|
-
const
|
|
168
|
+
const p = () => {
|
|
169
169
|
n === void 0 || n === "" || (console.debug(`[PluginContextProvider] fetching settings for "${n}"`), ht(n).then((d) => {
|
|
170
170
|
console.debug(`[PluginContextProvider] settings loaded for "${n}"`, Object.keys(d)), s(d);
|
|
171
171
|
}).catch((d) => {
|
|
172
|
-
const
|
|
173
|
-
console.error(`[PluginContextProvider] error fetching settings for "${n}":`,
|
|
172
|
+
const y = Q(d);
|
|
173
|
+
console.error(`[PluginContextProvider] error fetching settings for "${n}":`, y.detail);
|
|
174
174
|
}));
|
|
175
175
|
}, f = () => {
|
|
176
176
|
if (n === void 0 || n === "") {
|
|
177
177
|
console.debug("[PluginContextProvider] skipping meta fetch — empty pluginId");
|
|
178
178
|
return;
|
|
179
179
|
}
|
|
180
|
-
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null),
|
|
180
|
+
console.debug(`[PluginContextProvider] fetching meta for "${n}"`), u(null), mt(n).then((d) => {
|
|
181
181
|
console.debug(`[PluginContextProvider] meta loaded for "${n}"`, { name: d == null ? void 0 : d.name, version: d == null ? void 0 : d.version }), o(d), c(!0);
|
|
182
182
|
}).catch((d) => {
|
|
183
|
-
const
|
|
184
|
-
console.error(`[PluginContextProvider] error fetching meta for "${n}":`,
|
|
183
|
+
const y = Q(d);
|
|
184
|
+
console.error(`[PluginContextProvider] error fetching meta for "${n}":`, y.detail), u(y.detail), c(!1);
|
|
185
185
|
});
|
|
186
186
|
};
|
|
187
|
-
return
|
|
188
|
-
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`),
|
|
189
|
-
}, [n]), l ? /* @__PURE__ */
|
|
187
|
+
return b.useEffect(() => {
|
|
188
|
+
console.debug(`[PluginContextProvider] useEffect — pluginId changed to "${n}"`), p(), f();
|
|
189
|
+
}, [n]), l ? /* @__PURE__ */ x("div", { style: {
|
|
190
190
|
display: "flex",
|
|
191
191
|
flex: 1,
|
|
192
192
|
alignItems: "center",
|
|
@@ -203,14 +203,14 @@ function qr(t) {
|
|
|
203
203
|
}, children: [
|
|
204
204
|
/* @__PURE__ */ X("div", { style: { display: "flex", alignItems: "center", gap: 8, marginBottom: 12 }, children: [
|
|
205
205
|
/* @__PURE__ */ X("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "#EF4444", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
|
|
206
|
-
/* @__PURE__ */
|
|
207
|
-
/* @__PURE__ */
|
|
208
|
-
/* @__PURE__ */
|
|
206
|
+
/* @__PURE__ */ x("circle", { cx: "12", cy: "12", r: "10" }),
|
|
207
|
+
/* @__PURE__ */ x("line", { x1: "12", y1: "8", x2: "12", y2: "12" }),
|
|
208
|
+
/* @__PURE__ */ x("line", { x1: "12", y1: "16", x2: "12.01", y2: "16" })
|
|
209
209
|
] }),
|
|
210
|
-
/* @__PURE__ */
|
|
210
|
+
/* @__PURE__ */ x("span", { style: { fontSize: 14, fontWeight: 600, color: "#FECACA" }, children: "Plugin failed to load" })
|
|
211
211
|
] }),
|
|
212
|
-
/* @__PURE__ */
|
|
213
|
-
/* @__PURE__ */
|
|
212
|
+
/* @__PURE__ */ x("p", { style: { fontSize: 13, color: "#A1A1AA", margin: "0 0 16px" }, children: l }),
|
|
213
|
+
/* @__PURE__ */ x(
|
|
214
214
|
"button",
|
|
215
215
|
{
|
|
216
216
|
onClick: () => f(),
|
|
@@ -227,13 +227,13 @@ function qr(t) {
|
|
|
227
227
|
children: "Retry"
|
|
228
228
|
}
|
|
229
229
|
)
|
|
230
|
-
] }) }) : a ? /* @__PURE__ */
|
|
230
|
+
] }) }) : a ? /* @__PURE__ */ x(ye.Provider, { value: { pluginId: n, settings: r, meta: i }, children: e }) : /* @__PURE__ */ X("div", { style: {
|
|
231
231
|
display: "flex",
|
|
232
232
|
flex: 1,
|
|
233
233
|
alignItems: "center",
|
|
234
234
|
justifyContent: "center"
|
|
235
235
|
}, children: [
|
|
236
|
-
/* @__PURE__ */
|
|
236
|
+
/* @__PURE__ */ x("div", { style: {
|
|
237
237
|
width: 24,
|
|
238
238
|
height: 24,
|
|
239
239
|
border: "2px solid #3F3F46",
|
|
@@ -241,34 +241,34 @@ function qr(t) {
|
|
|
241
241
|
borderRadius: "50%",
|
|
242
242
|
animation: "plugin-spin 0.8s linear infinite"
|
|
243
243
|
} }),
|
|
244
|
-
/* @__PURE__ */
|
|
244
|
+
/* @__PURE__ */ x("style", { children: "@keyframes plugin-spin { to { transform: rotate(360deg); } }" })
|
|
245
245
|
] });
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function ge() {
|
|
248
248
|
const t = Y(ye);
|
|
249
249
|
if (!t)
|
|
250
250
|
throw new Error("usePluginContext must be used within a PluginContextProvider");
|
|
251
251
|
return t;
|
|
252
252
|
}
|
|
253
|
-
function
|
|
254
|
-
return
|
|
253
|
+
function Yr() {
|
|
254
|
+
return ge().settings;
|
|
255
255
|
}
|
|
256
|
-
const
|
|
257
|
-
const [e, n] =
|
|
258
|
-
|
|
256
|
+
const Qe = re(void 0), Jr = ({ children: t }) => {
|
|
257
|
+
const [e, n] = G({}), r = () => {
|
|
258
|
+
St().then((i) => {
|
|
259
259
|
console.log("Fetched settings:", i), n(i);
|
|
260
260
|
}).catch((i) => {
|
|
261
261
|
console.error("Error fetching settings:", i);
|
|
262
262
|
});
|
|
263
263
|
};
|
|
264
|
-
|
|
264
|
+
b.useEffect(() => {
|
|
265
265
|
r();
|
|
266
266
|
}, []);
|
|
267
267
|
const s = () => {
|
|
268
268
|
r();
|
|
269
269
|
};
|
|
270
|
-
return /* @__PURE__ */
|
|
271
|
-
},
|
|
270
|
+
return /* @__PURE__ */ x(Qe.Provider, { value: { settings: e, reload: s }, children: t });
|
|
271
|
+
}, hn = {
|
|
272
272
|
height: 32,
|
|
273
273
|
focused: 0,
|
|
274
274
|
tabs: [],
|
|
@@ -292,30 +292,30 @@ const je = re(void 0), Gr = ({ children: t }) => {
|
|
|
292
292
|
},
|
|
293
293
|
fullscreenDrawer: () => {
|
|
294
294
|
}
|
|
295
|
-
},
|
|
296
|
-
const [e, n] =
|
|
295
|
+
}, mn = b.createContext(hn), Sn = re(void 0), _n = b.createContext(void 0), Ke = b.createContext(void 0), En = 3e4, Zr = ({ children: t }) => {
|
|
296
|
+
const [e, n] = b.useState([]), r = b.useCallback((a) => {
|
|
297
297
|
n((c) => [a, ...c]);
|
|
298
|
-
}, []), s =
|
|
298
|
+
}, []), s = b.useCallback((a, c) => {
|
|
299
299
|
n(
|
|
300
300
|
(l) => l.map((u) => u.id === a ? { ...u, ...c } : u)
|
|
301
301
|
);
|
|
302
|
-
}, []), i =
|
|
302
|
+
}, []), i = b.useCallback((a) => {
|
|
303
303
|
n((c) => c.filter((l) => l.id !== a));
|
|
304
304
|
}, []);
|
|
305
|
-
|
|
305
|
+
b.useEffect(() => {
|
|
306
306
|
const a = [];
|
|
307
307
|
for (const c of e)
|
|
308
308
|
if (c.status === "completed" || c.status === "error") {
|
|
309
|
-
const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0,
|
|
309
|
+
const l = Date.now() - (c.completedAt ?? c.startedAt), u = Math.max(0, En - l);
|
|
310
310
|
a.push(setTimeout(() => i(c.id), u));
|
|
311
311
|
}
|
|
312
312
|
return () => a.forEach(clearTimeout);
|
|
313
313
|
}, [e, i]);
|
|
314
|
-
const o =
|
|
314
|
+
const o = b.useMemo(
|
|
315
315
|
() => ({ operations: e, addOperation: r, updateOperation: s, removeOperation: i }),
|
|
316
316
|
[e, r, s, i]
|
|
317
317
|
);
|
|
318
|
-
return /* @__PURE__ */
|
|
318
|
+
return /* @__PURE__ */ x(Ke.Provider, { value: o, children: t });
|
|
319
319
|
};
|
|
320
320
|
var de = function(t, e) {
|
|
321
321
|
return de = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
@@ -324,7 +324,7 @@ var de = function(t, e) {
|
|
|
324
324
|
for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (n[s] = r[s]);
|
|
325
325
|
}, de(t, e);
|
|
326
326
|
};
|
|
327
|
-
function
|
|
327
|
+
function wn(t, e) {
|
|
328
328
|
if (typeof e != "function" && e !== null)
|
|
329
329
|
throw new TypeError("Class extends value " + String(e) + " is not a constructor or null");
|
|
330
330
|
de(t, e);
|
|
@@ -333,28 +333,28 @@ function mn(t, e) {
|
|
|
333
333
|
}
|
|
334
334
|
t.prototype = e === null ? Object.create(e) : (n.prototype = e.prototype, new n());
|
|
335
335
|
}
|
|
336
|
-
var ce = "Invariant Violation",
|
|
336
|
+
var ce = "Invariant Violation", be = Object.setPrototypeOf, Cn = be === void 0 ? function(t, e) {
|
|
337
337
|
return t.__proto__ = e, t;
|
|
338
|
-
} :
|
|
338
|
+
} : be, bn = (
|
|
339
339
|
/** @class */
|
|
340
340
|
function(t) {
|
|
341
|
-
|
|
341
|
+
wn(e, t);
|
|
342
342
|
function e(n) {
|
|
343
343
|
n === void 0 && (n = ce);
|
|
344
344
|
var r = t.call(this, typeof n == "number" ? ce + ": " + n + " (see https://github.com/apollographql/invariant-packages)" : n) || this;
|
|
345
|
-
return r.framesToPop = 1, r.name = ce,
|
|
345
|
+
return r.framesToPop = 1, r.name = ce, Cn(r, e.prototype), r;
|
|
346
346
|
}
|
|
347
347
|
return e;
|
|
348
348
|
}(Error)
|
|
349
349
|
);
|
|
350
350
|
function fe(t, e) {
|
|
351
351
|
if (!t)
|
|
352
|
-
throw new
|
|
352
|
+
throw new bn(e);
|
|
353
353
|
}
|
|
354
|
-
var
|
|
354
|
+
var He = ["debug", "log", "warn", "error", "silent"], vn = He.indexOf("log");
|
|
355
355
|
function V(t) {
|
|
356
356
|
return function() {
|
|
357
|
-
if (
|
|
357
|
+
if (He.indexOf(t) >= vn) {
|
|
358
358
|
var e = console[t] || console.log;
|
|
359
359
|
return e.apply(console, arguments);
|
|
360
360
|
}
|
|
@@ -363,9 +363,9 @@ function V(t) {
|
|
|
363
363
|
(function(t) {
|
|
364
364
|
t.debug = V("debug"), t.log = V("log"), t.warn = V("warn"), t.error = V("error");
|
|
365
365
|
})(fe || (fe = {}));
|
|
366
|
-
const Be = re(void 0),
|
|
367
|
-
function
|
|
368
|
-
const e =
|
|
366
|
+
const Be = re(void 0), Rn = () => Y(Be);
|
|
367
|
+
function Xr(t) {
|
|
368
|
+
const e = Rn(), n = b.useRef(null), r = e == null ? void 0 : e.getExtensionPoint(t), s = L(
|
|
369
369
|
(o) => {
|
|
370
370
|
const a = [];
|
|
371
371
|
return e && a.push(e.subscribe(o)), r && a.push(r.subscribe(o)), () => {
|
|
@@ -374,7 +374,7 @@ function Qr(t) {
|
|
|
374
374
|
};
|
|
375
375
|
},
|
|
376
376
|
[e, t, r]
|
|
377
|
-
), i =
|
|
377
|
+
), i = L(() => {
|
|
378
378
|
const o = e == null ? void 0 : e.getExtensionPoint(t);
|
|
379
379
|
if (!o) {
|
|
380
380
|
if (n.current && n.current.store === void 0)
|
|
@@ -388,30 +388,30 @@ function Qr(t) {
|
|
|
388
388
|
const c = {};
|
|
389
389
|
return n.current = { store: o, version: o.version, sentinel: c }, c;
|
|
390
390
|
}, [e, t]);
|
|
391
|
-
return
|
|
391
|
+
return ut(s, i), e == null ? void 0 : e.getExtensionPoint(t);
|
|
392
392
|
}
|
|
393
|
-
const
|
|
394
|
-
const n =
|
|
393
|
+
const Vr = ({ registry: t, children: e }) => {
|
|
394
|
+
const n = b.useRef(t);
|
|
395
395
|
return fe(
|
|
396
396
|
n.current === t,
|
|
397
397
|
"You can't change the extension registry after it has been rendered"
|
|
398
|
-
), /* @__PURE__ */
|
|
398
|
+
), /* @__PURE__ */ x(Be.Provider, { value: n.current, children: e });
|
|
399
399
|
}, ue = (t) => {
|
|
400
400
|
if (!t || typeof t != "string")
|
|
401
401
|
throw new TypeError(`extensionName is required to be a string and can't be: "${t}" (${typeof t})`);
|
|
402
402
|
return t.trim();
|
|
403
403
|
};
|
|
404
|
-
class
|
|
404
|
+
class Fn {
|
|
405
405
|
constructor(e) {
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
406
|
+
A(this, "id");
|
|
407
|
+
A(this, "mode");
|
|
408
|
+
A(this, "_pluginId");
|
|
409
|
+
A(this, "_version", 0);
|
|
410
|
+
A(this, "_contributions", /* @__PURE__ */ new Map());
|
|
411
|
+
A(this, "_lookupCache", /* @__PURE__ */ new Map());
|
|
412
|
+
A(this, "_matcher");
|
|
413
|
+
A(this, "_select");
|
|
414
|
+
A(this, "_listeners", /* @__PURE__ */ new Set());
|
|
415
415
|
this.id = e.id, this.mode = e.mode ?? "multiple", this._pluginId = e.pluginId, this._matcher = e.matcher, this._select = e.select;
|
|
416
416
|
}
|
|
417
417
|
get pluginId() {
|
|
@@ -521,11 +521,11 @@ class Cn {
|
|
|
521
521
|
e();
|
|
522
522
|
}
|
|
523
523
|
}
|
|
524
|
-
class
|
|
524
|
+
class es {
|
|
525
525
|
constructor(e) {
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
526
|
+
A(this, "_stores", /* @__PURE__ */ new Map());
|
|
527
|
+
A(this, "_storeUnsubs", /* @__PURE__ */ new Map());
|
|
528
|
+
A(this, "_listeners", /* @__PURE__ */ new Set());
|
|
529
529
|
if (e != null && e.initialStores)
|
|
530
530
|
for (const n of e.initialStores)
|
|
531
531
|
this.addExtensionPoint(n);
|
|
@@ -542,7 +542,7 @@ class Br {
|
|
|
542
542
|
`Extension point "${n}" already exists (owned by "${s.pluginId ?? "unknown"}")`
|
|
543
543
|
);
|
|
544
544
|
}
|
|
545
|
-
const r = new
|
|
545
|
+
const r = new Fn({ ...e, id: n });
|
|
546
546
|
this._stores.set(n, r), this._storeUnsubs.set(n, r.subscribe(() => this._notify())), this._notify();
|
|
547
547
|
}
|
|
548
548
|
/**
|
|
@@ -597,37 +597,37 @@ class Br {
|
|
|
597
597
|
e();
|
|
598
598
|
}
|
|
599
599
|
}
|
|
600
|
-
const
|
|
600
|
+
const ze = re(void 0), In = {
|
|
601
601
|
default: "info",
|
|
602
602
|
info: "info",
|
|
603
603
|
success: "success",
|
|
604
604
|
warning: "warning",
|
|
605
605
|
error: "danger"
|
|
606
|
-
},
|
|
607
|
-
const { toast: e } =
|
|
606
|
+
}, ts = ({ children: t }) => {
|
|
607
|
+
const { toast: e } = fn(), [n, r] = b.useState([]), s = (o) => {
|
|
608
608
|
r((a) => [...a, o]);
|
|
609
609
|
}, i = (o, a, c) => {
|
|
610
610
|
const l = typeof o == "object";
|
|
611
|
-
let u = "",
|
|
611
|
+
let u = "", p = "info", f, d = 5e3, y;
|
|
612
612
|
if (l) {
|
|
613
613
|
if (u = o.message, o.showOnce) {
|
|
614
614
|
if (n.includes(u))
|
|
615
615
|
return;
|
|
616
616
|
s(u);
|
|
617
617
|
}
|
|
618
|
-
|
|
618
|
+
p = o.status, f = o.details, d = o.autoHideDuration ?? 5e3, y = o.actions;
|
|
619
619
|
} else
|
|
620
|
-
u = o,
|
|
620
|
+
u = o, p = a, f = c;
|
|
621
621
|
e(f ?? u, {
|
|
622
|
-
severity:
|
|
622
|
+
severity: In[p] ?? "info",
|
|
623
623
|
title: f ? u : void 0,
|
|
624
624
|
duration: d,
|
|
625
|
-
action:
|
|
625
|
+
action: y == null ? void 0 : y[0]
|
|
626
626
|
});
|
|
627
627
|
};
|
|
628
|
-
return /* @__PURE__ */
|
|
629
|
-
},
|
|
630
|
-
const t = Y(
|
|
628
|
+
return /* @__PURE__ */ x(ze.Provider, { value: { showSnackbar: i }, children: t });
|
|
629
|
+
}, W = () => {
|
|
630
|
+
const t = Y(ze);
|
|
631
631
|
if (t === void 0)
|
|
632
632
|
throw new Error("useCustomSnackbar must be used within a CustomSnackbarProvider");
|
|
633
633
|
return t;
|
|
@@ -640,36 +640,36 @@ function P(t) {
|
|
|
640
640
|
);
|
|
641
641
|
return n;
|
|
642
642
|
}
|
|
643
|
-
const
|
|
644
|
-
const n = P(t), r = j(), { showSnackbar: s } =
|
|
645
|
-
mutationFn: async () =>
|
|
646
|
-
onSuccess(
|
|
647
|
-
r.setQueryData(i,
|
|
643
|
+
const ns = ({ pluginID: t, connectionID: e }) => {
|
|
644
|
+
const n = P(t), r = j(), { showSnackbar: s } = W(), i = [n, "connection", "detail", e], { mutateAsync: o } = T({
|
|
645
|
+
mutationFn: async () => _t(n, e),
|
|
646
|
+
onSuccess(p) {
|
|
647
|
+
r.setQueryData(i, p), r.invalidateQueries({
|
|
648
648
|
queryKey: ["EDITOR_SCHEMAS", n, e]
|
|
649
649
|
});
|
|
650
650
|
},
|
|
651
651
|
onError: k(s, "Failed to start connection")
|
|
652
|
-
}), { mutateAsync: a } =
|
|
653
|
-
mutationFn: async () =>
|
|
654
|
-
onSuccess(
|
|
655
|
-
r.setQueryData(i,
|
|
652
|
+
}), { mutateAsync: a } = T({
|
|
653
|
+
mutationFn: async () => Pe(n, e),
|
|
654
|
+
onSuccess(p) {
|
|
655
|
+
r.setQueryData(i, p);
|
|
656
656
|
},
|
|
657
657
|
onError: k(s, "Failed to stop connection")
|
|
658
|
-
}), { mutateAsync: c } =
|
|
659
|
-
mutationFn: async (
|
|
660
|
-
onSuccess(
|
|
661
|
-
s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i,
|
|
658
|
+
}), { mutateAsync: c } = T({
|
|
659
|
+
mutationFn: async (p) => Et(n, p),
|
|
660
|
+
onSuccess(p, { name: f }) {
|
|
661
|
+
s({ message: `Connection ${f} successfully updated`, status: "success" }), r.setQueryData(i, p), r.setQueriesData(
|
|
662
662
|
{ queryKey: [n, "connection", "list"] },
|
|
663
|
-
(d) => d == null ? void 0 : d.map((
|
|
663
|
+
(d) => d == null ? void 0 : d.map((y) => y.id === e ? p : y)
|
|
664
664
|
);
|
|
665
665
|
},
|
|
666
666
|
onError: k(s, "Failed to update connection")
|
|
667
|
-
}), { mutateAsync: l } =
|
|
667
|
+
}), { mutateAsync: l } = T({
|
|
668
668
|
mutationFn: async () => wt(n, e),
|
|
669
669
|
onSuccess() {
|
|
670
670
|
s({ message: "Connection successfully removed", status: "success" }), r.setQueryData(i, void 0), r.setQueriesData(
|
|
671
671
|
{ queryKey: [n, "connection", "list"] },
|
|
672
|
-
(
|
|
672
|
+
(p) => p == null ? void 0 : p.filter((f) => f.id !== e)
|
|
673
673
|
);
|
|
674
674
|
},
|
|
675
675
|
onError: k(s, "Failed to remove connection")
|
|
@@ -680,7 +680,7 @@ const zr = ({ pluginID: t, connectionID: e }) => {
|
|
|
680
680
|
*/
|
|
681
681
|
connection: O({
|
|
682
682
|
queryKey: i,
|
|
683
|
-
queryFn: async () =>
|
|
683
|
+
queryFn: async () => Ct(n, e)
|
|
684
684
|
}),
|
|
685
685
|
/**
|
|
686
686
|
* Start the connection
|
|
@@ -699,19 +699,19 @@ const zr = ({ pluginID: t, connectionID: e }) => {
|
|
|
699
699
|
*/
|
|
700
700
|
deleteConnection: l
|
|
701
701
|
};
|
|
702
|
-
},
|
|
703
|
-
const e = P(t), n = j(), { showSnackbar: r } =
|
|
704
|
-
mutationFn: async (l) =>
|
|
702
|
+
}, Pn = (t) => [t, "connection", "list"], rs = ({ plugin: t }) => {
|
|
703
|
+
const e = P(t), n = j(), { showSnackbar: r } = W(), s = Pn(e), { mutateAsync: i } = T({
|
|
704
|
+
mutationFn: async (l) => Oe(e, l.id),
|
|
705
705
|
onError: k(r, "Failed to start connection watch")
|
|
706
|
-
}), { mutateAsync: o } =
|
|
707
|
-
mutationFn: async (l) =>
|
|
706
|
+
}), { mutateAsync: o } = T({
|
|
707
|
+
mutationFn: async (l) => bt(e, l.id),
|
|
708
708
|
onError: k(r, "Failed to stop connection watch")
|
|
709
|
-
}), a =
|
|
709
|
+
}), a = b.useCallback((l) => {
|
|
710
710
|
const u = l.data;
|
|
711
711
|
console.log("got update to connections", u), n.setQueryData(s, u);
|
|
712
712
|
}, [n, s]);
|
|
713
|
-
return
|
|
714
|
-
const l =
|
|
713
|
+
return b.useEffect(() => {
|
|
714
|
+
const l = D(`${e}/connection/sync`, a);
|
|
715
715
|
return () => {
|
|
716
716
|
l();
|
|
717
717
|
};
|
|
@@ -732,7 +732,7 @@ const zr = ({ pluginID: t, connectionID: e }) => {
|
|
|
732
732
|
startWatch: i,
|
|
733
733
|
stopWatch: o
|
|
734
734
|
};
|
|
735
|
-
},
|
|
735
|
+
}, ss = ({ pluginID: t, connectionID: e }) => {
|
|
736
736
|
const n = P(t);
|
|
737
737
|
return {
|
|
738
738
|
/**
|
|
@@ -740,17 +740,17 @@ const zr = ({ pluginID: t, connectionID: e }) => {
|
|
|
740
740
|
*/
|
|
741
741
|
namespaces: O({
|
|
742
742
|
queryKey: [n, "connection", "namespaces", e],
|
|
743
|
-
queryFn: async () =>
|
|
743
|
+
queryFn: async () => Rt(n, e)
|
|
744
744
|
})
|
|
745
745
|
};
|
|
746
|
-
},
|
|
746
|
+
}, F = pn(rn, "WatchState");
|
|
747
747
|
function pe(t) {
|
|
748
748
|
const e = Object.values(t.states), n = e.length;
|
|
749
749
|
let r = 0, s = 0, i = 0, o = 0;
|
|
750
750
|
for (const u of e)
|
|
751
|
-
u ===
|
|
751
|
+
u === F.WatchStateSynced && r++, (u === F.WatchStateError || u === F.WatchStateFailed) && s++, u === F.WatchStateForbidden && i++, u === F.WatchStateSkipped && o++;
|
|
752
752
|
const a = n - o, c = e.filter(
|
|
753
|
-
(u) => u ===
|
|
753
|
+
(u) => u === F.WatchStateSynced || u === F.WatchStateError || u === F.WatchStateStopped || u === F.WatchStateFailed || u === F.WatchStateForbidden
|
|
754
754
|
).length, l = a > 0 ? c / a : 0;
|
|
755
755
|
return {
|
|
756
756
|
pluginID: t.pluginID,
|
|
@@ -768,18 +768,18 @@ function pe(t) {
|
|
|
768
768
|
function ne(t) {
|
|
769
769
|
return t.watchedTotal > 0 && t.doneCount >= t.watchedTotal;
|
|
770
770
|
}
|
|
771
|
-
function
|
|
771
|
+
function Ye(t) {
|
|
772
772
|
return t.some((e) => !ne(e));
|
|
773
773
|
}
|
|
774
|
-
function
|
|
774
|
+
function Je(t) {
|
|
775
775
|
const e = t.reduce((r, s) => r + s.watchedTotal, 0);
|
|
776
776
|
return e === 0 ? 0 : t.reduce((r, s) => r + s.doneCount, 0) / e;
|
|
777
777
|
}
|
|
778
|
-
function
|
|
778
|
+
function he(t) {
|
|
779
779
|
return `${t.pluginId}/${t.connection}`;
|
|
780
780
|
}
|
|
781
|
-
function
|
|
782
|
-
const n =
|
|
781
|
+
function Ze(t, e) {
|
|
782
|
+
const n = he(e);
|
|
783
783
|
t.has(n) || t.set(n, {
|
|
784
784
|
states: {},
|
|
785
785
|
pluginID: e.pluginId,
|
|
@@ -788,155 +788,155 @@ function Je(t, e) {
|
|
|
788
788
|
const r = t.get(n);
|
|
789
789
|
return r.states[e.resourceKey] = e.state, r;
|
|
790
790
|
}
|
|
791
|
-
function
|
|
792
|
-
const [t, e] =
|
|
793
|
-
|
|
794
|
-
const
|
|
795
|
-
const
|
|
796
|
-
S && c((
|
|
797
|
-
const
|
|
798
|
-
return
|
|
791
|
+
function os() {
|
|
792
|
+
const [t, e] = G(/* @__PURE__ */ new Set()), [n, r] = G({}), [s, i] = G(/* @__PURE__ */ new Map()), o = q(/* @__PURE__ */ new Map()), [a, c] = G(/* @__PURE__ */ new Map());
|
|
793
|
+
U(() => {
|
|
794
|
+
const g = D("plugin/crash_recovery_failed", (R) => {
|
|
795
|
+
const E = R.data, S = E == null ? void 0 : E.pluginID;
|
|
796
|
+
S && c((w) => {
|
|
797
|
+
const I = new Map(w);
|
|
798
|
+
return I.set(S, E.error ?? "Crash recovery failed"), I;
|
|
799
799
|
});
|
|
800
|
-
}),
|
|
801
|
-
const
|
|
802
|
-
S && c((
|
|
803
|
-
if (!
|
|
804
|
-
const
|
|
805
|
-
return
|
|
800
|
+
}), v = D("plugin/recovered", (R) => {
|
|
801
|
+
const E = R.data, S = E == null ? void 0 : E.pluginID;
|
|
802
|
+
S && c((w) => {
|
|
803
|
+
if (!w.has(S)) return w;
|
|
804
|
+
const I = new Map(w);
|
|
805
|
+
return I.delete(S), I;
|
|
806
806
|
});
|
|
807
807
|
});
|
|
808
808
|
return () => {
|
|
809
|
-
|
|
809
|
+
g(), v();
|
|
810
810
|
};
|
|
811
|
-
}, []),
|
|
812
|
-
Ft().then((
|
|
813
|
-
if (!
|
|
814
|
-
const
|
|
815
|
-
for (const [S,
|
|
816
|
-
if (
|
|
817
|
-
|
|
818
|
-
for (const
|
|
819
|
-
if (!
|
|
820
|
-
const
|
|
821
|
-
|
|
811
|
+
}, []), U(() => {
|
|
812
|
+
Ft().then((g) => {
|
|
813
|
+
if (!g) return;
|
|
814
|
+
const v = {}, R = /* @__PURE__ */ new Set(), E = /* @__PURE__ */ new Map();
|
|
815
|
+
for (const [S, w] of Object.entries(g))
|
|
816
|
+
if (w) {
|
|
817
|
+
v[S] = w.map((I) => I.connection);
|
|
818
|
+
for (const I of w) {
|
|
819
|
+
if (!I.started) continue;
|
|
820
|
+
const M = `${S}/${I.connection.id}`;
|
|
821
|
+
R.add(M);
|
|
822
822
|
const N = {
|
|
823
823
|
pluginID: S,
|
|
824
|
-
connectionID:
|
|
824
|
+
connectionID: I.connection.id,
|
|
825
825
|
states: {}
|
|
826
826
|
};
|
|
827
|
-
if (
|
|
828
|
-
for (const [ie,
|
|
829
|
-
N.states[ie] =
|
|
830
|
-
o.current.set(
|
|
827
|
+
if (I.resources)
|
|
828
|
+
for (const [ie, it] of Object.entries(I.resources))
|
|
829
|
+
N.states[ie] = it;
|
|
830
|
+
o.current.set(M, N), E.set(M, pe(N));
|
|
831
831
|
}
|
|
832
832
|
}
|
|
833
|
-
r(
|
|
833
|
+
r(v), e(R), i(E);
|
|
834
834
|
}).catch(() => {
|
|
835
835
|
});
|
|
836
|
-
}, []),
|
|
837
|
-
const
|
|
838
|
-
|
|
839
|
-
const
|
|
840
|
-
return
|
|
836
|
+
}, []), U(() => D("connection/status", (v) => {
|
|
837
|
+
const R = v.data, E = `${R.pluginID}/${R.connectionID}`;
|
|
838
|
+
R.status === "DISCONNECTED" ? (e((S) => {
|
|
839
|
+
const w = new Set(S);
|
|
840
|
+
return w.delete(E), w;
|
|
841
841
|
}), i((S) => {
|
|
842
|
-
const
|
|
843
|
-
return
|
|
844
|
-
}), o.current.delete(
|
|
845
|
-
const
|
|
846
|
-
return
|
|
847
|
-
}),
|
|
842
|
+
const w = new Map(S);
|
|
843
|
+
return w.delete(E), w;
|
|
844
|
+
}), o.current.delete(E)) : e((S) => {
|
|
845
|
+
const w = new Set(S);
|
|
846
|
+
return w.add(E), w;
|
|
847
|
+
}), Pt().then((S) => {
|
|
848
848
|
if (!S) return;
|
|
849
|
-
const
|
|
850
|
-
for (const [
|
|
851
|
-
|
|
852
|
-
r(
|
|
849
|
+
const w = {};
|
|
850
|
+
for (const [I, M] of Object.entries(S))
|
|
851
|
+
M != null && (w[I] = M);
|
|
852
|
+
r(w);
|
|
853
853
|
}).catch(() => {
|
|
854
854
|
});
|
|
855
855
|
}), []);
|
|
856
|
-
const l =
|
|
857
|
-
const
|
|
858
|
-
e((
|
|
859
|
-
if (
|
|
860
|
-
const
|
|
861
|
-
return
|
|
856
|
+
const l = L((g) => {
|
|
857
|
+
const v = g.data, R = he(v);
|
|
858
|
+
e((w) => {
|
|
859
|
+
if (w.has(R)) return w;
|
|
860
|
+
const I = new Set(w);
|
|
861
|
+
return I.add(R), I;
|
|
862
862
|
});
|
|
863
|
-
const
|
|
864
|
-
i((
|
|
865
|
-
const
|
|
866
|
-
return
|
|
863
|
+
const E = Ze(o.current, v), S = pe(E);
|
|
864
|
+
i((w) => {
|
|
865
|
+
const I = new Map(w);
|
|
866
|
+
return I.set(R, S), I;
|
|
867
867
|
});
|
|
868
868
|
}, []);
|
|
869
|
-
|
|
870
|
-
const u =
|
|
871
|
-
await
|
|
872
|
-
}, []),
|
|
873
|
-
await
|
|
874
|
-
}, []), f =
|
|
875
|
-
const
|
|
876
|
-
c((
|
|
877
|
-
if (!
|
|
878
|
-
const
|
|
879
|
-
return
|
|
869
|
+
U(() => D("watch/STATE", l), [l]);
|
|
870
|
+
const u = L(async (g, v) => {
|
|
871
|
+
await Pe(g, v);
|
|
872
|
+
}, []), p = L(async (g, v) => {
|
|
873
|
+
await Oe(g, v);
|
|
874
|
+
}, []), f = L(async (g) => {
|
|
875
|
+
const v = a.get(g);
|
|
876
|
+
c((R) => {
|
|
877
|
+
if (!R.has(g)) return R;
|
|
878
|
+
const E = new Map(R);
|
|
879
|
+
return E.delete(g), E;
|
|
880
880
|
});
|
|
881
881
|
try {
|
|
882
|
-
await It(
|
|
883
|
-
} catch (
|
|
884
|
-
throw c((
|
|
885
|
-
const S = new Map(
|
|
886
|
-
return S.set(
|
|
887
|
-
}),
|
|
882
|
+
await It(g);
|
|
883
|
+
} catch (R) {
|
|
884
|
+
throw c((E) => {
|
|
885
|
+
const S = new Map(E);
|
|
886
|
+
return S.set(g, v ?? "Reload failed"), S;
|
|
887
|
+
}), R;
|
|
888
888
|
}
|
|
889
889
|
}, [a]), d = [];
|
|
890
|
-
for (const
|
|
891
|
-
const [
|
|
890
|
+
for (const g of t) {
|
|
891
|
+
const [v, R] = g.split("/", 2), S = (n[v] ?? []).find((ie) => ie.id === R), w = s.get(g), I = w != null && !ne(w), M = w != null && w.errorCount > 0, N = a.get(v);
|
|
892
892
|
d.push({
|
|
893
|
-
pluginID:
|
|
894
|
-
connectionID:
|
|
895
|
-
name: (S == null ? void 0 : S.name) ??
|
|
893
|
+
pluginID: v,
|
|
894
|
+
connectionID: R,
|
|
895
|
+
name: (S == null ? void 0 : S.name) ?? R,
|
|
896
896
|
avatar: (S == null ? void 0 : S.avatar) ?? "",
|
|
897
897
|
isStarted: !0,
|
|
898
|
-
sync:
|
|
899
|
-
isSyncing:
|
|
900
|
-
hasErrors:
|
|
898
|
+
sync: w,
|
|
899
|
+
isSyncing: I,
|
|
900
|
+
hasErrors: M || N != null,
|
|
901
901
|
pluginFailed: N != null,
|
|
902
902
|
pluginError: N
|
|
903
903
|
});
|
|
904
904
|
}
|
|
905
|
-
const
|
|
906
|
-
for (const
|
|
907
|
-
const
|
|
908
|
-
|
|
905
|
+
const y = /* @__PURE__ */ new Map();
|
|
906
|
+
for (const g of d) {
|
|
907
|
+
const v = y.get(g.pluginID) ?? [];
|
|
908
|
+
v.push(g), y.set(g.pluginID, v);
|
|
909
909
|
}
|
|
910
|
-
const _ = Array.from(s.values()), C = d.filter((
|
|
910
|
+
const _ = Array.from(s.values()), C = d.filter((g) => g.isSyncing), h = d.filter((g) => g.hasErrors), m = d.filter((g) => g.pluginFailed);
|
|
911
911
|
return {
|
|
912
912
|
entries: d,
|
|
913
|
-
grouped:
|
|
913
|
+
grouped: y,
|
|
914
914
|
connectedCount: d.length,
|
|
915
915
|
syncingCount: C.length,
|
|
916
|
-
errorCount:
|
|
916
|
+
errorCount: h.length,
|
|
917
917
|
failedCount: m.length,
|
|
918
|
-
hasSyncing:
|
|
919
|
-
aggregateProgress:
|
|
918
|
+
hasSyncing: Ye(_),
|
|
919
|
+
aggregateProgress: Je(_),
|
|
920
920
|
disconnect: u,
|
|
921
|
-
retryWatch:
|
|
921
|
+
retryWatch: p,
|
|
922
922
|
retryPlugin: f
|
|
923
923
|
};
|
|
924
924
|
}
|
|
925
|
-
function
|
|
925
|
+
function On(t, e) {
|
|
926
926
|
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;
|
|
927
927
|
}
|
|
928
|
-
function
|
|
928
|
+
function is(t, e, n) {
|
|
929
929
|
const r = P(t), s = j(), i = [r, "data", e], o = O({
|
|
930
930
|
queryKey: i,
|
|
931
931
|
queryFn: async () => {
|
|
932
|
-
const c = await
|
|
933
|
-
return c == null ? n :
|
|
932
|
+
const c = await Ot(r, e);
|
|
933
|
+
return c == null ? n : On(c, n) ? c : (console.warn(
|
|
934
934
|
`[usePluginData] stored value for "${e}" has unexpected type (expected ${Array.isArray(n) ? "array" : typeof n}, got ${Array.isArray(c) ? "array" : typeof c}). Using default.`
|
|
935
935
|
), n);
|
|
936
936
|
}
|
|
937
|
-
}), a =
|
|
937
|
+
}), a = T({
|
|
938
938
|
mutationFn: async (c) => {
|
|
939
|
-
await
|
|
939
|
+
await Tt(r, e, c);
|
|
940
940
|
},
|
|
941
941
|
onMutate: async (c) => {
|
|
942
942
|
await s.cancelQueries({ queryKey: i });
|
|
@@ -958,19 +958,19 @@ function Xr(t, e, n) {
|
|
|
958
958
|
isLoading: o.isLoading
|
|
959
959
|
};
|
|
960
960
|
}
|
|
961
|
-
const
|
|
962
|
-
const t = Y(
|
|
961
|
+
const as = () => {
|
|
962
|
+
const t = Y(Sn);
|
|
963
963
|
if (!t) throw new Error("useRightDrawer must be used within a RightDrawerProvider");
|
|
964
964
|
return t;
|
|
965
|
-
},
|
|
966
|
-
const t = Y(
|
|
965
|
+
}, Xe = () => {
|
|
966
|
+
const t = Y(mn);
|
|
967
967
|
if (t === void 0)
|
|
968
968
|
throw new Error("useBottomDrawer must be used within a BottomDrawerProvider");
|
|
969
969
|
return t;
|
|
970
|
-
},
|
|
971
|
-
const e = P(t), { showSnackbar: n } =
|
|
970
|
+
}, cs = ({ pluginID: t }) => {
|
|
971
|
+
const e = P(t), { showSnackbar: n } = W(), { createTab: r, updateTab: s } = Xe();
|
|
972
972
|
return {
|
|
973
|
-
createSession:
|
|
973
|
+
createSession: T({
|
|
974
974
|
mutationFn: async ({ connectionID: o, icon: a, label: c, opts: l }) => {
|
|
975
975
|
const u = `pending-${crypto.randomUUID()}`;
|
|
976
976
|
r({
|
|
@@ -985,13 +985,13 @@ const Vr = () => {
|
|
|
985
985
|
opts: { ...l }
|
|
986
986
|
}
|
|
987
987
|
});
|
|
988
|
-
const
|
|
988
|
+
const p = sn.createFrom({
|
|
989
989
|
command: ["/bin/bash"],
|
|
990
990
|
tty: !0,
|
|
991
991
|
...l
|
|
992
992
|
});
|
|
993
993
|
try {
|
|
994
|
-
const f = await
|
|
994
|
+
const f = await At(e, o, p);
|
|
995
995
|
if (!f) throw new Error("Failed to create session: null response");
|
|
996
996
|
s(
|
|
997
997
|
{ id: u },
|
|
@@ -1013,48 +1013,48 @@ const Vr = () => {
|
|
|
1013
1013
|
}
|
|
1014
1014
|
}).mutateAsync
|
|
1015
1015
|
};
|
|
1016
|
-
},
|
|
1017
|
-
const e = P(t), { showSnackbar: n } =
|
|
1016
|
+
}, us = ({ pluginID: t }) => {
|
|
1017
|
+
const e = P(t), { showSnackbar: n } = W(), { createTab: r } = Xe(), s = T({
|
|
1018
1018
|
mutationFn: async ({
|
|
1019
1019
|
connectionID: o,
|
|
1020
1020
|
resourceKey: a,
|
|
1021
1021
|
resourceID: c,
|
|
1022
1022
|
resourceData: l,
|
|
1023
1023
|
icon: u,
|
|
1024
|
-
label:
|
|
1024
|
+
label: p,
|
|
1025
1025
|
target: f,
|
|
1026
1026
|
follow: d = !0,
|
|
1027
|
-
tailLines:
|
|
1027
|
+
tailLines: y = 1e3,
|
|
1028
1028
|
params: _
|
|
1029
1029
|
}) => {
|
|
1030
|
-
const C =
|
|
1030
|
+
const C = on.createFrom({
|
|
1031
1031
|
resource_key: a,
|
|
1032
1032
|
resource_id: c,
|
|
1033
1033
|
resource_data: l,
|
|
1034
|
-
options:
|
|
1034
|
+
options: an.createFrom({
|
|
1035
1035
|
target: f ?? "",
|
|
1036
1036
|
follow: d,
|
|
1037
1037
|
include_previous: !1,
|
|
1038
1038
|
include_timestamps: !0,
|
|
1039
|
-
tail_lines:
|
|
1039
|
+
tail_lines: y,
|
|
1040
1040
|
since_seconds: 0,
|
|
1041
1041
|
limit_bytes: 0,
|
|
1042
1042
|
include_source_events: !0,
|
|
1043
1043
|
params: _ ?? {}
|
|
1044
1044
|
})
|
|
1045
|
-
}),
|
|
1046
|
-
if (!
|
|
1045
|
+
}), h = await xt(e, o, C);
|
|
1046
|
+
if (!h) throw new Error("Failed to create log session: null response");
|
|
1047
1047
|
return r({
|
|
1048
|
-
id:
|
|
1049
|
-
title:
|
|
1048
|
+
id: h.id,
|
|
1049
|
+
title: p ?? `Logs ${h.id.substring(0, 8)}`,
|
|
1050
1050
|
variant: "logs",
|
|
1051
1051
|
icon: u ?? "LuLogs"
|
|
1052
|
-
}),
|
|
1052
|
+
}), h;
|
|
1053
1053
|
},
|
|
1054
1054
|
onError: k(n, "Failed to start log session")
|
|
1055
|
-
}), i =
|
|
1055
|
+
}), i = T({
|
|
1056
1056
|
mutationFn: async (o) => {
|
|
1057
|
-
await
|
|
1057
|
+
await Dt(o);
|
|
1058
1058
|
},
|
|
1059
1059
|
onError: k(n, "Failed to close log session")
|
|
1060
1060
|
});
|
|
@@ -1062,17 +1062,17 @@ const Vr = () => {
|
|
|
1062
1062
|
createLogSession: s.mutateAsync,
|
|
1063
1063
|
closeLogSession: i.mutateAsync
|
|
1064
1064
|
};
|
|
1065
|
-
},
|
|
1065
|
+
}, ls = () => O({
|
|
1066
1066
|
queryKey: ["metric", "providers"],
|
|
1067
|
-
queryFn:
|
|
1067
|
+
queryFn: Nt,
|
|
1068
1068
|
staleTime: 3e4
|
|
1069
|
-
}),
|
|
1069
|
+
}), Tn = (t) => O({
|
|
1070
1070
|
queryKey: ["metric", "providers", t],
|
|
1071
|
-
queryFn: () =>
|
|
1071
|
+
queryFn: () => kt(t),
|
|
1072
1072
|
enabled: !!t,
|
|
1073
1073
|
staleTime: 3e4
|
|
1074
|
-
}),
|
|
1075
|
-
var C,
|
|
1074
|
+
}), ds = (t) => {
|
|
1075
|
+
var C, h;
|
|
1076
1076
|
const {
|
|
1077
1077
|
connectionID: e,
|
|
1078
1078
|
resourceKey: n,
|
|
@@ -1086,9 +1086,9 @@ const Vr = () => {
|
|
|
1086
1086
|
refreshInterval: l = 0,
|
|
1087
1087
|
enabled: u = !0
|
|
1088
1088
|
} = t, {
|
|
1089
|
-
data:
|
|
1089
|
+
data: p,
|
|
1090
1090
|
isLoading: f
|
|
1091
|
-
} =
|
|
1091
|
+
} = Tn(n), d = p ?? [], y = c ? Math.max(
|
|
1092
1092
|
Math.floor((c.end.getTime() - c.start.getTime()) / 250),
|
|
1093
1093
|
15e3
|
|
1094
1094
|
) * 1e6 : 0, _ = O({
|
|
@@ -1102,10 +1102,10 @@ const Vr = () => {
|
|
|
1102
1102
|
o,
|
|
1103
1103
|
a,
|
|
1104
1104
|
(C = c == null ? void 0 : c.start) == null ? void 0 : C.getTime(),
|
|
1105
|
-
(
|
|
1105
|
+
(h = c == null ? void 0 : c.end) == null ? void 0 : h.getTime()
|
|
1106
1106
|
],
|
|
1107
1107
|
queryFn: async () => {
|
|
1108
|
-
const m = await
|
|
1108
|
+
const m = await Lt(
|
|
1109
1109
|
e,
|
|
1110
1110
|
n,
|
|
1111
1111
|
r,
|
|
@@ -1115,11 +1115,11 @@ const Vr = () => {
|
|
|
1115
1115
|
a,
|
|
1116
1116
|
((c == null ? void 0 : c.start) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1117
1117
|
((c == null ? void 0 : c.end) ?? /* @__PURE__ */ new Date(0)).toISOString(),
|
|
1118
|
-
|
|
1119
|
-
),
|
|
1120
|
-
for (const [
|
|
1121
|
-
|
|
1122
|
-
return
|
|
1118
|
+
y
|
|
1119
|
+
), g = {};
|
|
1120
|
+
for (const [v, R] of Object.entries(m))
|
|
1121
|
+
R != null && (g[v] = R);
|
|
1122
|
+
return g;
|
|
1123
1123
|
},
|
|
1124
1124
|
enabled: u && !!e && !!n && (n.startsWith("cluster::") || !!r) && d.length > 0,
|
|
1125
1125
|
refetchInterval: l > 0 ? l : void 0,
|
|
@@ -1135,7 +1135,7 @@ const Vr = () => {
|
|
|
1135
1135
|
error: _.error,
|
|
1136
1136
|
refetch: _.refetch
|
|
1137
1137
|
};
|
|
1138
|
-
},
|
|
1138
|
+
}, fs = (t) => {
|
|
1139
1139
|
const {
|
|
1140
1140
|
pluginID: e,
|
|
1141
1141
|
connectionID: n,
|
|
@@ -1146,10 +1146,10 @@ const Vr = () => {
|
|
|
1146
1146
|
metricIDs: a = [],
|
|
1147
1147
|
interval: c = 1e4,
|
|
1148
1148
|
enabled: l = !0
|
|
1149
|
-
} = t, u = P(e), [
|
|
1149
|
+
} = t, u = P(e), [p, f] = G(null), [d, y] = G(null), [_, C] = G(!1), [h, m] = G(null), g = q(null), v = L(async () => {
|
|
1150
1150
|
if (!(!l || !u || !n || !r || !s))
|
|
1151
1151
|
try {
|
|
1152
|
-
const
|
|
1152
|
+
const E = await Mt(u, n, {
|
|
1153
1153
|
resource_key: r,
|
|
1154
1154
|
resource_id: s,
|
|
1155
1155
|
resource_namespace: i,
|
|
@@ -1158,97 +1158,97 @@ const Vr = () => {
|
|
|
1158
1158
|
interval: c * 1e6
|
|
1159
1159
|
// ms to nanoseconds for Go time.Duration
|
|
1160
1160
|
});
|
|
1161
|
-
|
|
1162
|
-
const S =
|
|
1163
|
-
const
|
|
1161
|
+
y(E), C(!0), m(null);
|
|
1162
|
+
const S = D(`core/metrics/data/${E}`, (I) => {
|
|
1163
|
+
const M = I.data;
|
|
1164
1164
|
try {
|
|
1165
|
-
const N = JSON.parse(
|
|
1165
|
+
const N = JSON.parse(M);
|
|
1166
1166
|
N.results && f(N.results);
|
|
1167
1167
|
} catch (N) {
|
|
1168
1168
|
console.error("Failed to parse metric stream data:", N);
|
|
1169
1169
|
}
|
|
1170
|
-
}),
|
|
1171
|
-
const
|
|
1170
|
+
}), w = D(`core/metrics/error/${E}`, (I) => {
|
|
1171
|
+
const M = I.data;
|
|
1172
1172
|
try {
|
|
1173
|
-
const N = JSON.parse(
|
|
1173
|
+
const N = JSON.parse(M);
|
|
1174
1174
|
m(N.error || "Unknown error");
|
|
1175
1175
|
} catch {
|
|
1176
1176
|
m("Failed to parse metric stream error");
|
|
1177
1177
|
}
|
|
1178
1178
|
});
|
|
1179
|
-
|
|
1180
|
-
S(),
|
|
1179
|
+
g.current = () => {
|
|
1180
|
+
S(), w();
|
|
1181
1181
|
};
|
|
1182
|
-
} catch (
|
|
1183
|
-
m(
|
|
1182
|
+
} catch (E) {
|
|
1183
|
+
m(E instanceof Error ? E.message : String(E));
|
|
1184
1184
|
}
|
|
1185
|
-
}, [u, n, r, s, i, a, c, l]),
|
|
1185
|
+
}, [u, n, r, s, i, a, c, l]), R = L(async () => {
|
|
1186
1186
|
if (d)
|
|
1187
1187
|
try {
|
|
1188
|
-
await
|
|
1189
|
-
} catch (
|
|
1190
|
-
console.error("Failed to unsubscribe:",
|
|
1188
|
+
await Ce(d);
|
|
1189
|
+
} catch (E) {
|
|
1190
|
+
console.error("Failed to unsubscribe:", E);
|
|
1191
1191
|
}
|
|
1192
|
-
|
|
1192
|
+
g.current && (g.current(), g.current = null), y(null), C(!1);
|
|
1193
1193
|
}, [d]);
|
|
1194
|
-
return
|
|
1195
|
-
d &&
|
|
1194
|
+
return U(() => () => {
|
|
1195
|
+
d && Ce(d).catch(console.error), g.current && g.current();
|
|
1196
1196
|
}, [d]), {
|
|
1197
|
-
data:
|
|
1197
|
+
data: p,
|
|
1198
1198
|
subscriptionID: d,
|
|
1199
1199
|
isStreaming: _,
|
|
1200
|
-
error:
|
|
1201
|
-
start:
|
|
1202
|
-
stop:
|
|
1200
|
+
error: h,
|
|
1201
|
+
start: v,
|
|
1202
|
+
stop: R
|
|
1203
1203
|
};
|
|
1204
|
-
},
|
|
1205
|
-
function
|
|
1206
|
-
const { showSnackbar: t } =
|
|
1207
|
-
queryKey: [...
|
|
1208
|
-
queryFn: async () =>
|
|
1204
|
+
}, B = ["networker", "portforward", "all-sessions"];
|
|
1205
|
+
function ps() {
|
|
1206
|
+
const { showSnackbar: t } = W(), e = j(), n = O({
|
|
1207
|
+
queryKey: [...B],
|
|
1208
|
+
queryFn: async () => $t().catch((i) => {
|
|
1209
1209
|
if (Q(i).detail.includes("not found")) return [];
|
|
1210
1210
|
throw i;
|
|
1211
1211
|
}),
|
|
1212
1212
|
retry: !1
|
|
1213
1213
|
});
|
|
1214
|
-
|
|
1215
|
-
const i =
|
|
1216
|
-
e.invalidateQueries({ queryKey: [...
|
|
1217
|
-
}), o =
|
|
1218
|
-
e.invalidateQueries({ queryKey: [...
|
|
1214
|
+
U(() => {
|
|
1215
|
+
const i = D("core/networker/portforward/created", () => {
|
|
1216
|
+
e.invalidateQueries({ queryKey: [...B] });
|
|
1217
|
+
}), o = D("core/networker/portforward/closed", () => {
|
|
1218
|
+
e.invalidateQueries({ queryKey: [...B] });
|
|
1219
1219
|
});
|
|
1220
1220
|
return () => {
|
|
1221
1221
|
i(), o();
|
|
1222
1222
|
};
|
|
1223
1223
|
}, [e]);
|
|
1224
|
-
const r = n.data ?? [], s =
|
|
1225
|
-
mutationFn: async (i) =>
|
|
1224
|
+
const r = n.data ?? [], s = T({
|
|
1225
|
+
mutationFn: async (i) => Te(i),
|
|
1226
1226
|
onError: k(t, "Failed to close port forwarding session"),
|
|
1227
1227
|
onSuccess: async () => {
|
|
1228
|
-
await e.invalidateQueries({ queryKey: [...
|
|
1228
|
+
await e.invalidateQueries({ queryKey: [...B] });
|
|
1229
1229
|
}
|
|
1230
1230
|
});
|
|
1231
1231
|
return {
|
|
1232
1232
|
sessions: n,
|
|
1233
1233
|
activeSessions: r,
|
|
1234
1234
|
closeSession: s.mutateAsync,
|
|
1235
|
-
openInBrowser: (i) =>
|
|
1235
|
+
openInBrowser: (i) => We(`http://localhost:${i}`)
|
|
1236
1236
|
};
|
|
1237
1237
|
}
|
|
1238
|
-
function
|
|
1239
|
-
const r = P(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } =
|
|
1238
|
+
function ys({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
1239
|
+
const r = P(t), s = ["networker", "portforward", "sessions", r, e, n], { showSnackbar: i } = W(), o = j(), a = O({
|
|
1240
1240
|
queryKey: s,
|
|
1241
|
-
queryFn: async () =>
|
|
1241
|
+
queryFn: async () => qt(r, e, cn.createFrom({
|
|
1242
1242
|
resource_id: n,
|
|
1243
1243
|
connection_id: e
|
|
1244
1244
|
})).catch((u) => {
|
|
1245
|
-
const
|
|
1246
|
-
return
|
|
1245
|
+
const p = Q(u);
|
|
1246
|
+
return p.detail.includes("not found") ? [] : (i({ message: "Failed to fetch port forward sessions", status: "error", details: p.detail }), []);
|
|
1247
1247
|
}),
|
|
1248
1248
|
retry: !1
|
|
1249
|
-
}), c =
|
|
1249
|
+
}), c = T({
|
|
1250
1250
|
mutationFn: async ({ opts: u }) => {
|
|
1251
|
-
const
|
|
1251
|
+
const p = un.createFrom({
|
|
1252
1252
|
local_port: u.localPort || 0,
|
|
1253
1253
|
remote_port: u.remotePort,
|
|
1254
1254
|
protocol: u.protocol || "TCP",
|
|
@@ -1262,24 +1262,24 @@ function is({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
|
1262
1262
|
},
|
|
1263
1263
|
labels: u.labels ?? {},
|
|
1264
1264
|
params: u.parameters ?? {}
|
|
1265
|
-
}), f = await Ut(r, e,
|
|
1265
|
+
}), f = await Ut(r, e, p);
|
|
1266
1266
|
if (!f) throw new Error("Failed to start port forwarding: null response");
|
|
1267
|
-
return u.openInBrowser &&
|
|
1267
|
+
return u.openInBrowser && We(`http://localhost:${f.local_port}`), f;
|
|
1268
1268
|
},
|
|
1269
1269
|
onError: k(i, "Failed to start port forwarding session"),
|
|
1270
1270
|
onSuccess: async () => {
|
|
1271
1271
|
await Promise.all([
|
|
1272
1272
|
o.invalidateQueries({ queryKey: s }),
|
|
1273
|
-
o.invalidateQueries({ queryKey: [...
|
|
1273
|
+
o.invalidateQueries({ queryKey: [...B] })
|
|
1274
1274
|
]);
|
|
1275
1275
|
}
|
|
1276
|
-
}), l =
|
|
1277
|
-
mutationFn: async ({ opts: u }) =>
|
|
1276
|
+
}), l = T({
|
|
1277
|
+
mutationFn: async ({ opts: u }) => Te(u.sessionID),
|
|
1278
1278
|
onError: k(i, "Failed to close port forwarding session"),
|
|
1279
1279
|
onSuccess: async () => {
|
|
1280
1280
|
await Promise.all([
|
|
1281
1281
|
o.invalidateQueries({ queryKey: s }),
|
|
1282
|
-
o.invalidateQueries({ queryKey: [...
|
|
1282
|
+
o.invalidateQueries({ queryKey: [...B] })
|
|
1283
1283
|
]);
|
|
1284
1284
|
}
|
|
1285
1285
|
});
|
|
@@ -1289,19 +1289,19 @@ function is({ pluginID: t, connectionID: e, resourceID: n }) {
|
|
|
1289
1289
|
close: l.mutateAsync
|
|
1290
1290
|
};
|
|
1291
1291
|
}
|
|
1292
|
-
const
|
|
1293
|
-
const t =
|
|
1292
|
+
const gs = () => {
|
|
1293
|
+
const t = b.useContext(_n);
|
|
1294
1294
|
if (!t) throw new Error("useConfirmationModal must be used within a ConfirmationModalProvider");
|
|
1295
1295
|
return t;
|
|
1296
|
-
},
|
|
1296
|
+
}, hs = ({
|
|
1297
1297
|
pluginID: t,
|
|
1298
1298
|
connectionID: e,
|
|
1299
1299
|
resourceKey: n,
|
|
1300
1300
|
resourceID: r,
|
|
1301
1301
|
namespace: s = ""
|
|
1302
1302
|
}) => {
|
|
1303
|
-
const i = P(t), o = j(), { showSnackbar: a } =
|
|
1304
|
-
mutationFn: async (f) =>
|
|
1303
|
+
const i = P(t), o = j(), { showSnackbar: a } = W(), c = ["RESOURCE", i, e, n, r, s], { mutateAsync: l } = T({
|
|
1304
|
+
mutationFn: async (f) => Ae(i, e, n, ke.createFrom({
|
|
1305
1305
|
input: f.input,
|
|
1306
1306
|
id: r,
|
|
1307
1307
|
namespace: s
|
|
@@ -1310,8 +1310,8 @@ const as = () => {
|
|
|
1310
1310
|
a(`Resource ${r} updated`, "success"), await o.invalidateQueries({ queryKey: c });
|
|
1311
1311
|
},
|
|
1312
1312
|
onError: k(a, `Failed to update resource ${r}`)
|
|
1313
|
-
}), { mutateAsync: u } =
|
|
1314
|
-
mutationFn: async (f = {}) =>
|
|
1313
|
+
}), { mutateAsync: u } = T({
|
|
1314
|
+
mutationFn: async (f = {}) => xe(i, e, n, Le.createFrom({
|
|
1315
1315
|
id: r,
|
|
1316
1316
|
namespace: s,
|
|
1317
1317
|
gracePeriodSeconds: f.gracePeriodSeconds
|
|
@@ -1328,7 +1328,7 @@ const as = () => {
|
|
|
1328
1328
|
*/
|
|
1329
1329
|
resource: O({
|
|
1330
1330
|
queryKey: c,
|
|
1331
|
-
queryFn: async () =>
|
|
1331
|
+
queryFn: async () => Wt(i, e, n, ln.createFrom({
|
|
1332
1332
|
id: r,
|
|
1333
1333
|
namespace: s
|
|
1334
1334
|
})),
|
|
@@ -1349,7 +1349,7 @@ const as = () => {
|
|
|
1349
1349
|
*/
|
|
1350
1350
|
remove: u
|
|
1351
1351
|
};
|
|
1352
|
-
},
|
|
1352
|
+
}, ms = (t) => {
|
|
1353
1353
|
const e = ["component", t.plugin, t.resource, t.area];
|
|
1354
1354
|
return {
|
|
1355
1355
|
/**
|
|
@@ -1358,10 +1358,10 @@ const as = () => {
|
|
|
1358
1358
|
*/
|
|
1359
1359
|
component: O({
|
|
1360
1360
|
queryKey: e,
|
|
1361
|
-
queryFn: async () =>
|
|
1361
|
+
queryFn: async () => Gt(t)
|
|
1362
1362
|
})
|
|
1363
1363
|
};
|
|
1364
|
-
},
|
|
1364
|
+
}, Ss = ({ pluginID: t, connectionID: e }) => {
|
|
1365
1365
|
const n = P(t);
|
|
1366
1366
|
return {
|
|
1367
1367
|
/**
|
|
@@ -1369,20 +1369,20 @@ const as = () => {
|
|
|
1369
1369
|
*/
|
|
1370
1370
|
groups: O({
|
|
1371
1371
|
queryKey: [n, "resource_groups", "list"],
|
|
1372
|
-
queryFn: async () =>
|
|
1372
|
+
queryFn: async () => jt(n, e),
|
|
1373
1373
|
retry: !1
|
|
1374
1374
|
})
|
|
1375
1375
|
};
|
|
1376
|
-
},
|
|
1376
|
+
}, _s = ({
|
|
1377
1377
|
pluginID: t,
|
|
1378
1378
|
connectionID: e,
|
|
1379
1379
|
searches: n
|
|
1380
1380
|
}) => {
|
|
1381
1381
|
const r = P(t), s = (o) => [r, e, o.key, o.namespaces, "list"];
|
|
1382
|
-
return
|
|
1382
|
+
return dn({
|
|
1383
1383
|
queries: n.map((o) => ({
|
|
1384
1384
|
queryKey: s(o),
|
|
1385
|
-
queryFn: async () =>
|
|
1385
|
+
queryFn: async () => De(r, e, o.key, Me.createFrom({
|
|
1386
1386
|
order: [{ field: "name", descending: !1 }],
|
|
1387
1387
|
pagination: { page: 1, pageSize: 200 },
|
|
1388
1388
|
namespaces: o.namespaces
|
|
@@ -1390,7 +1390,7 @@ const as = () => {
|
|
|
1390
1390
|
retry: !1
|
|
1391
1391
|
}))
|
|
1392
1392
|
});
|
|
1393
|
-
},
|
|
1393
|
+
}, Es = ({ pluginID: t, resourceKey: e }) => {
|
|
1394
1394
|
const n = P(t);
|
|
1395
1395
|
return {
|
|
1396
1396
|
/**
|
|
@@ -1398,11 +1398,11 @@ const as = () => {
|
|
|
1398
1398
|
*/
|
|
1399
1399
|
resourceType: O({
|
|
1400
1400
|
queryKey: [n, "resources", e],
|
|
1401
|
-
queryFn: async () =>
|
|
1401
|
+
queryFn: async () => Qt(n, e),
|
|
1402
1402
|
retry: !1
|
|
1403
1403
|
})
|
|
1404
1404
|
};
|
|
1405
|
-
},
|
|
1405
|
+
}, ws = ({ pluginID: t, connectionID: e }) => {
|
|
1406
1406
|
const n = P(t);
|
|
1407
1407
|
return {
|
|
1408
1408
|
/**
|
|
@@ -1410,20 +1410,20 @@ const as = () => {
|
|
|
1410
1410
|
*/
|
|
1411
1411
|
types: O({
|
|
1412
1412
|
queryKey: [n, "resources", "list", e],
|
|
1413
|
-
queryFn: async () =>
|
|
1413
|
+
queryFn: async () => Kt(n, e),
|
|
1414
1414
|
retry: !1
|
|
1415
1415
|
})
|
|
1416
1416
|
};
|
|
1417
1417
|
};
|
|
1418
1418
|
var ee = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1419
|
-
function
|
|
1419
|
+
function An(t) {
|
|
1420
1420
|
return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
|
|
1421
1421
|
}
|
|
1422
|
-
var
|
|
1423
|
-
function
|
|
1422
|
+
var xn = "Expected a function", Ve = "__lodash_hash_undefined__", Dn = "[object Function]", Nn = "[object GeneratorFunction]", kn = "[object Symbol]", Ln = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Mn = /^\w*$/, $n = /^\./, qn = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Un = /[\\^$.*+?()[\]{}|]/g, Wn = /\\(\\)?/g, Gn = /^\[object .+?Constructor\]$/, jn = typeof ee == "object" && ee && ee.Object === Object && ee, Qn = typeof self == "object" && self && self.Object === Object && self, me = jn || Qn || Function("return this")();
|
|
1423
|
+
function Kn(t, e) {
|
|
1424
1424
|
return t == null ? void 0 : t[e];
|
|
1425
1425
|
}
|
|
1426
|
-
function
|
|
1426
|
+
function Hn(t) {
|
|
1427
1427
|
var e = !1;
|
|
1428
1428
|
if (t != null && typeof t.toString != "function")
|
|
1429
1429
|
try {
|
|
@@ -1432,12 +1432,12 @@ function Gn(t) {
|
|
|
1432
1432
|
}
|
|
1433
1433
|
return e;
|
|
1434
1434
|
}
|
|
1435
|
-
var
|
|
1435
|
+
var Bn = Array.prototype, zn = Function.prototype, et = Object.prototype, le = me["__core-js_shared__"], ve = function() {
|
|
1436
1436
|
var t = /[^.]+$/.exec(le && le.keys && le.keys.IE_PROTO || "");
|
|
1437
1437
|
return t ? "Symbol(src)_1." + t : "";
|
|
1438
|
-
}(),
|
|
1439
|
-
"^" +
|
|
1440
|
-
),
|
|
1438
|
+
}(), tt = zn.toString, Se = et.hasOwnProperty, nt = et.toString, Yn = RegExp(
|
|
1439
|
+
"^" + tt.call(Se).replace(Un, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$"
|
|
1440
|
+
), Re = me.Symbol, Jn = Bn.splice, Zn = rt(me, "Map"), Z = rt(Object, "create"), Fe = Re ? Re.prototype : void 0, Ie = Fe ? Fe.toString : void 0;
|
|
1441
1441
|
function K(t) {
|
|
1442
1442
|
var e = -1, n = t ? t.length : 0;
|
|
1443
1443
|
for (this.clear(); ++e < n; ) {
|
|
@@ -1445,33 +1445,33 @@ function K(t) {
|
|
|
1445
1445
|
this.set(r[0], r[1]);
|
|
1446
1446
|
}
|
|
1447
1447
|
}
|
|
1448
|
-
function
|
|
1448
|
+
function Xn() {
|
|
1449
1449
|
this.__data__ = Z ? Z(null) : {};
|
|
1450
1450
|
}
|
|
1451
|
-
function
|
|
1451
|
+
function Vn(t) {
|
|
1452
1452
|
return this.has(t) && delete this.__data__[t];
|
|
1453
1453
|
}
|
|
1454
|
-
function
|
|
1454
|
+
function er(t) {
|
|
1455
1455
|
var e = this.__data__;
|
|
1456
1456
|
if (Z) {
|
|
1457
1457
|
var n = e[t];
|
|
1458
|
-
return n ===
|
|
1458
|
+
return n === Ve ? void 0 : n;
|
|
1459
1459
|
}
|
|
1460
1460
|
return Se.call(e, t) ? e[t] : void 0;
|
|
1461
1461
|
}
|
|
1462
|
-
function
|
|
1462
|
+
function tr(t) {
|
|
1463
1463
|
var e = this.__data__;
|
|
1464
1464
|
return Z ? e[t] !== void 0 : Se.call(e, t);
|
|
1465
1465
|
}
|
|
1466
|
-
function
|
|
1466
|
+
function nr(t, e) {
|
|
1467
1467
|
var n = this.__data__;
|
|
1468
|
-
return n[t] = Z && e === void 0 ?
|
|
1468
|
+
return n[t] = Z && e === void 0 ? Ve : e, this;
|
|
1469
1469
|
}
|
|
1470
|
-
K.prototype.clear =
|
|
1471
|
-
K.prototype.delete =
|
|
1472
|
-
K.prototype.get =
|
|
1473
|
-
K.prototype.has =
|
|
1474
|
-
K.prototype.set =
|
|
1470
|
+
K.prototype.clear = Xn;
|
|
1471
|
+
K.prototype.delete = Vn;
|
|
1472
|
+
K.prototype.get = er;
|
|
1473
|
+
K.prototype.has = tr;
|
|
1474
|
+
K.prototype.set = nr;
|
|
1475
1475
|
function J(t) {
|
|
1476
1476
|
var e = -1, n = t ? t.length : 0;
|
|
1477
1477
|
for (this.clear(); ++e < n; ) {
|
|
@@ -1479,130 +1479,130 @@ function J(t) {
|
|
|
1479
1479
|
this.set(r[0], r[1]);
|
|
1480
1480
|
}
|
|
1481
1481
|
}
|
|
1482
|
-
function
|
|
1482
|
+
function rr() {
|
|
1483
1483
|
this.__data__ = [];
|
|
1484
1484
|
}
|
|
1485
|
-
function
|
|
1485
|
+
function sr(t) {
|
|
1486
1486
|
var e = this.__data__, n = se(e, t);
|
|
1487
1487
|
if (n < 0)
|
|
1488
1488
|
return !1;
|
|
1489
1489
|
var r = e.length - 1;
|
|
1490
|
-
return n == r ? e.pop() :
|
|
1490
|
+
return n == r ? e.pop() : Jn.call(e, n, 1), !0;
|
|
1491
1491
|
}
|
|
1492
|
-
function
|
|
1492
|
+
function or(t) {
|
|
1493
1493
|
var e = this.__data__, n = se(e, t);
|
|
1494
1494
|
return n < 0 ? void 0 : e[n][1];
|
|
1495
1495
|
}
|
|
1496
|
-
function
|
|
1496
|
+
function ir(t) {
|
|
1497
1497
|
return se(this.__data__, t) > -1;
|
|
1498
1498
|
}
|
|
1499
|
-
function
|
|
1499
|
+
function ar(t, e) {
|
|
1500
1500
|
var n = this.__data__, r = se(n, t);
|
|
1501
1501
|
return r < 0 ? n.push([t, e]) : n[r][1] = e, this;
|
|
1502
1502
|
}
|
|
1503
|
-
J.prototype.clear =
|
|
1504
|
-
J.prototype.delete =
|
|
1505
|
-
J.prototype.get =
|
|
1506
|
-
J.prototype.has =
|
|
1507
|
-
J.prototype.set =
|
|
1508
|
-
function
|
|
1503
|
+
J.prototype.clear = rr;
|
|
1504
|
+
J.prototype.delete = sr;
|
|
1505
|
+
J.prototype.get = or;
|
|
1506
|
+
J.prototype.has = ir;
|
|
1507
|
+
J.prototype.set = ar;
|
|
1508
|
+
function H(t) {
|
|
1509
1509
|
var e = -1, n = t ? t.length : 0;
|
|
1510
1510
|
for (this.clear(); ++e < n; ) {
|
|
1511
1511
|
var r = t[e];
|
|
1512
1512
|
this.set(r[0], r[1]);
|
|
1513
1513
|
}
|
|
1514
1514
|
}
|
|
1515
|
-
function
|
|
1515
|
+
function cr() {
|
|
1516
1516
|
this.__data__ = {
|
|
1517
1517
|
hash: new K(),
|
|
1518
|
-
map: new (
|
|
1518
|
+
map: new (Zn || J)(),
|
|
1519
1519
|
string: new K()
|
|
1520
1520
|
};
|
|
1521
1521
|
}
|
|
1522
|
-
function
|
|
1522
|
+
function ur(t) {
|
|
1523
1523
|
return oe(this, t).delete(t);
|
|
1524
1524
|
}
|
|
1525
|
-
function
|
|
1525
|
+
function lr(t) {
|
|
1526
1526
|
return oe(this, t).get(t);
|
|
1527
1527
|
}
|
|
1528
|
-
function
|
|
1528
|
+
function dr(t) {
|
|
1529
1529
|
return oe(this, t).has(t);
|
|
1530
1530
|
}
|
|
1531
|
-
function
|
|
1531
|
+
function fr(t, e) {
|
|
1532
1532
|
return oe(this, t).set(t, e), this;
|
|
1533
1533
|
}
|
|
1534
|
-
|
|
1535
|
-
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1534
|
+
H.prototype.clear = cr;
|
|
1535
|
+
H.prototype.delete = ur;
|
|
1536
|
+
H.prototype.get = lr;
|
|
1537
|
+
H.prototype.has = dr;
|
|
1538
|
+
H.prototype.set = fr;
|
|
1539
1539
|
function se(t, e) {
|
|
1540
1540
|
for (var n = t.length; n--; )
|
|
1541
|
-
if (
|
|
1541
|
+
if (br(t[n][0], e))
|
|
1542
1542
|
return n;
|
|
1543
1543
|
return -1;
|
|
1544
1544
|
}
|
|
1545
|
-
function
|
|
1546
|
-
e =
|
|
1545
|
+
function pr(t, e) {
|
|
1546
|
+
e = mr(e, t) ? [e] : hr(e);
|
|
1547
1547
|
for (var n = 0, r = e.length; t != null && n < r; )
|
|
1548
|
-
t = t[
|
|
1548
|
+
t = t[wr(e[n++])];
|
|
1549
1549
|
return n && n == r ? t : void 0;
|
|
1550
1550
|
}
|
|
1551
|
-
function
|
|
1552
|
-
if (!
|
|
1551
|
+
function yr(t) {
|
|
1552
|
+
if (!ot(t) || _r(t))
|
|
1553
1553
|
return !1;
|
|
1554
|
-
var e =
|
|
1555
|
-
return e.test(
|
|
1554
|
+
var e = vr(t) || Hn(t) ? Yn : Gn;
|
|
1555
|
+
return e.test(Cr(t));
|
|
1556
1556
|
}
|
|
1557
|
-
function
|
|
1557
|
+
function gr(t) {
|
|
1558
1558
|
if (typeof t == "string")
|
|
1559
1559
|
return t;
|
|
1560
|
-
if (
|
|
1560
|
+
if (Ee(t))
|
|
1561
1561
|
return Ie ? Ie.call(t) : "";
|
|
1562
1562
|
var e = t + "";
|
|
1563
1563
|
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
1564
1564
|
}
|
|
1565
|
-
function
|
|
1566
|
-
return
|
|
1565
|
+
function hr(t) {
|
|
1566
|
+
return st(t) ? t : Er(t);
|
|
1567
1567
|
}
|
|
1568
1568
|
function oe(t, e) {
|
|
1569
1569
|
var n = t.__data__;
|
|
1570
|
-
return
|
|
1570
|
+
return Sr(e) ? n[typeof e == "string" ? "string" : "hash"] : n.map;
|
|
1571
1571
|
}
|
|
1572
|
-
function
|
|
1573
|
-
var n =
|
|
1574
|
-
return
|
|
1572
|
+
function rt(t, e) {
|
|
1573
|
+
var n = Kn(t, e);
|
|
1574
|
+
return yr(n) ? n : void 0;
|
|
1575
1575
|
}
|
|
1576
|
-
function
|
|
1577
|
-
if (
|
|
1576
|
+
function mr(t, e) {
|
|
1577
|
+
if (st(t))
|
|
1578
1578
|
return !1;
|
|
1579
1579
|
var n = typeof t;
|
|
1580
|
-
return n == "number" || n == "symbol" || n == "boolean" || t == null ||
|
|
1580
|
+
return n == "number" || n == "symbol" || n == "boolean" || t == null || Ee(t) ? !0 : Mn.test(t) || !Ln.test(t) || e != null && t in Object(e);
|
|
1581
1581
|
}
|
|
1582
|
-
function
|
|
1582
|
+
function Sr(t) {
|
|
1583
1583
|
var e = typeof t;
|
|
1584
1584
|
return e == "string" || e == "number" || e == "symbol" || e == "boolean" ? t !== "__proto__" : t === null;
|
|
1585
1585
|
}
|
|
1586
|
-
function
|
|
1586
|
+
function _r(t) {
|
|
1587
1587
|
return !!ve && ve in t;
|
|
1588
1588
|
}
|
|
1589
|
-
var
|
|
1590
|
-
t =
|
|
1589
|
+
var Er = _e(function(t) {
|
|
1590
|
+
t = Fr(t);
|
|
1591
1591
|
var e = [];
|
|
1592
|
-
return
|
|
1593
|
-
e.push(s ? i.replace(
|
|
1592
|
+
return $n.test(t) && e.push(""), t.replace(qn, function(n, r, s, i) {
|
|
1593
|
+
e.push(s ? i.replace(Wn, "$1") : r || n);
|
|
1594
1594
|
}), e;
|
|
1595
1595
|
});
|
|
1596
|
-
function
|
|
1597
|
-
if (typeof t == "string" ||
|
|
1596
|
+
function wr(t) {
|
|
1597
|
+
if (typeof t == "string" || Ee(t))
|
|
1598
1598
|
return t;
|
|
1599
1599
|
var e = t + "";
|
|
1600
1600
|
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function Cr(t) {
|
|
1603
1603
|
if (t != null) {
|
|
1604
1604
|
try {
|
|
1605
|
-
return
|
|
1605
|
+
return tt.call(t);
|
|
1606
1606
|
} catch {
|
|
1607
1607
|
}
|
|
1608
1608
|
try {
|
|
@@ -1614,7 +1614,7 @@ function Sr(t) {
|
|
|
1614
1614
|
}
|
|
1615
1615
|
function _e(t, e) {
|
|
1616
1616
|
if (typeof t != "function" || e && typeof e != "function")
|
|
1617
|
-
throw new TypeError(
|
|
1617
|
+
throw new TypeError(xn);
|
|
1618
1618
|
var n = function() {
|
|
1619
1619
|
var r = arguments, s = e ? e.apply(this, r) : r[0], i = n.cache;
|
|
1620
1620
|
if (i.has(s))
|
|
@@ -1622,37 +1622,37 @@ function _e(t, e) {
|
|
|
1622
1622
|
var o = t.apply(this, r);
|
|
1623
1623
|
return n.cache = i.set(s, o), o;
|
|
1624
1624
|
};
|
|
1625
|
-
return n.cache = new (_e.Cache ||
|
|
1625
|
+
return n.cache = new (_e.Cache || H)(), n;
|
|
1626
1626
|
}
|
|
1627
|
-
_e.Cache =
|
|
1628
|
-
function
|
|
1627
|
+
_e.Cache = H;
|
|
1628
|
+
function br(t, e) {
|
|
1629
1629
|
return t === e || t !== t && e !== e;
|
|
1630
1630
|
}
|
|
1631
|
-
var
|
|
1632
|
-
function
|
|
1633
|
-
var e =
|
|
1634
|
-
return e ==
|
|
1631
|
+
var st = Array.isArray;
|
|
1632
|
+
function vr(t) {
|
|
1633
|
+
var e = ot(t) ? nt.call(t) : "";
|
|
1634
|
+
return e == Dn || e == Nn;
|
|
1635
1635
|
}
|
|
1636
|
-
function
|
|
1636
|
+
function ot(t) {
|
|
1637
1637
|
var e = typeof t;
|
|
1638
1638
|
return !!t && (e == "object" || e == "function");
|
|
1639
1639
|
}
|
|
1640
|
-
function
|
|
1640
|
+
function Rr(t) {
|
|
1641
1641
|
return !!t && typeof t == "object";
|
|
1642
1642
|
}
|
|
1643
|
-
function
|
|
1644
|
-
return typeof t == "symbol" ||
|
|
1643
|
+
function Ee(t) {
|
|
1644
|
+
return typeof t == "symbol" || Rr(t) && nt.call(t) == kn;
|
|
1645
1645
|
}
|
|
1646
|
-
function
|
|
1647
|
-
return t == null ? "" :
|
|
1646
|
+
function Fr(t) {
|
|
1647
|
+
return t == null ? "" : gr(t);
|
|
1648
1648
|
}
|
|
1649
|
-
function
|
|
1650
|
-
var r = t == null ? void 0 :
|
|
1649
|
+
function Ir(t, e, n) {
|
|
1650
|
+
var r = t == null ? void 0 : pr(t, e);
|
|
1651
1651
|
return r === void 0 ? n : r;
|
|
1652
1652
|
}
|
|
1653
|
-
var
|
|
1654
|
-
const te = /* @__PURE__ */
|
|
1655
|
-
function
|
|
1653
|
+
var Pr = Ir;
|
|
1654
|
+
const te = /* @__PURE__ */ An(Pr);
|
|
1655
|
+
function Or(t, e, n) {
|
|
1656
1656
|
const r = t ?? { result: [], success: !0, totalCount: 0 }, s = [...r.result ?? []];
|
|
1657
1657
|
for (const i of e) {
|
|
1658
1658
|
const o = te(i.payload.data, n);
|
|
@@ -1675,95 +1675,95 @@ function Fr(t, e, n) {
|
|
|
1675
1675
|
}
|
|
1676
1676
|
return { ...r, result: s };
|
|
1677
1677
|
}
|
|
1678
|
-
function
|
|
1679
|
-
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a =
|
|
1678
|
+
function Tr(t, e, n, r, s, i) {
|
|
1679
|
+
const o = (i == null ? void 0 : i.syncWindowMs) ?? 500, a = q([]), c = q(null), l = q(null), u = q(s);
|
|
1680
1680
|
u.current = s;
|
|
1681
|
-
const
|
|
1681
|
+
const p = L(() => {
|
|
1682
1682
|
const d = a.current;
|
|
1683
1683
|
if (a.current = [], c.current = null, l.current = null, !(d.length === 0 || !r)) {
|
|
1684
1684
|
t.setQueryData(
|
|
1685
1685
|
e,
|
|
1686
|
-
(
|
|
1686
|
+
(y) => Or(y, d, r)
|
|
1687
1687
|
);
|
|
1688
|
-
for (const
|
|
1689
|
-
(
|
|
1690
|
-
n(
|
|
1691
|
-
{ result:
|
|
1688
|
+
for (const y of d)
|
|
1689
|
+
(y.type === "ADD" || y.type === "UPDATE") && t.setQueryData(
|
|
1690
|
+
n(y.payload.id, y.payload.namespace),
|
|
1691
|
+
{ result: y.payload.data }
|
|
1692
1692
|
);
|
|
1693
1693
|
}
|
|
1694
|
-
}, [t, e, n, r]), f =
|
|
1694
|
+
}, [t, e, n, r]), f = L(
|
|
1695
1695
|
(d) => {
|
|
1696
|
-
a.current.push(d), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(
|
|
1696
|
+
a.current.push(d), !(c.current !== null || l.current !== null) && (u.current === 1 ? c.current = setTimeout(p, o) : l.current = requestAnimationFrame(p));
|
|
1697
1697
|
},
|
|
1698
|
-
[
|
|
1698
|
+
[p, o]
|
|
1699
1699
|
);
|
|
1700
|
-
return
|
|
1700
|
+
return U(() => () => {
|
|
1701
1701
|
c.current !== null && (clearTimeout(c.current), c.current = null), l.current !== null && (cancelAnimationFrame(l.current), l.current = null);
|
|
1702
1702
|
}, []), f;
|
|
1703
1703
|
}
|
|
1704
|
-
const
|
|
1704
|
+
const Cs = ({
|
|
1705
1705
|
pluginID: t,
|
|
1706
1706
|
connectionID: e,
|
|
1707
1707
|
resourceKey: n,
|
|
1708
1708
|
idAccessor: r,
|
|
1709
1709
|
namespaces: s
|
|
1710
1710
|
}) => {
|
|
1711
|
-
const i = P(t), o = j(), { showSnackbar: a } =
|
|
1711
|
+
const i = P(t), o = j(), { showSnackbar: a } = W(), c = b.useMemo(() => s ?? [], [s]), l = b.useMemo(
|
|
1712
1712
|
() => [i, e, n, c, "list"],
|
|
1713
1713
|
[i, e, n, c]
|
|
1714
|
-
), u =
|
|
1715
|
-
(C,
|
|
1714
|
+
), u = b.useCallback(
|
|
1715
|
+
(C, h) => [i, e, n, h, C],
|
|
1716
1716
|
[i, e, n]
|
|
1717
|
-
), { mutateAsync:
|
|
1718
|
-
mutationFn: async (C) =>
|
|
1717
|
+
), { mutateAsync: p } = T({
|
|
1718
|
+
mutationFn: async (C) => Ne(i, e, n, $e.createFrom({
|
|
1719
1719
|
input: C.input,
|
|
1720
1720
|
namespace: C.namespace ?? (c.length === 1 ? c[0] : "")
|
|
1721
1721
|
})),
|
|
1722
1722
|
onSuccess: async (C) => {
|
|
1723
|
-
var
|
|
1724
|
-
const
|
|
1723
|
+
var v;
|
|
1724
|
+
const h = C == null ? void 0 : C.result;
|
|
1725
1725
|
let m = "";
|
|
1726
|
-
(
|
|
1727
|
-
const
|
|
1728
|
-
a(
|
|
1726
|
+
(v = h == null ? void 0 : h.metadata) != null && v.name ? m = h.metadata.name : h != null && h.id ? m = h.id : h != null && h.name ? m = h.name : h != null && h.ID ? m = h.ID : h != null && h.Name && (m = h.Name);
|
|
1727
|
+
const g = m ? `Resource ${m} created` : "Resource created";
|
|
1728
|
+
a(g, "success"), await o.invalidateQueries({ queryKey: l });
|
|
1729
1729
|
},
|
|
1730
1730
|
onError: k(a, "Failed to create resource")
|
|
1731
1731
|
}), f = O({
|
|
1732
1732
|
queryKey: l,
|
|
1733
|
-
queryFn: async () =>
|
|
1733
|
+
queryFn: async () => De(i, e, n, Me.createFrom({
|
|
1734
1734
|
order: [{ field: "name", descending: !1 }],
|
|
1735
1735
|
pagination: { page: 1, pageSize: 200 },
|
|
1736
1736
|
namespaces: c
|
|
1737
1737
|
})),
|
|
1738
|
-
placeholderData: (C,
|
|
1738
|
+
placeholderData: (C, h) => C,
|
|
1739
1739
|
retry: !1
|
|
1740
|
-
}), [d,
|
|
1741
|
-
|
|
1740
|
+
}), [d, y] = b.useState(
|
|
1741
|
+
F.WatchStateIdle
|
|
1742
1742
|
);
|
|
1743
|
-
|
|
1743
|
+
b.useEffect(() => D(
|
|
1744
1744
|
`${i}/${e}/watch/STATE`,
|
|
1745
|
-
(
|
|
1746
|
-
const m =
|
|
1747
|
-
m.resourceKey === n &&
|
|
1745
|
+
(h) => {
|
|
1746
|
+
const m = h.data;
|
|
1747
|
+
m.resourceKey === n && y(m.state);
|
|
1748
1748
|
}
|
|
1749
1749
|
), [i, e, n]);
|
|
1750
|
-
const _ =
|
|
1751
|
-
return
|
|
1750
|
+
const _ = Tr(o, l, u, r, d);
|
|
1751
|
+
return b.useEffect(() => {
|
|
1752
1752
|
if (!r)
|
|
1753
1753
|
return;
|
|
1754
|
-
|
|
1755
|
-
const C =
|
|
1754
|
+
Ht(i, e, n);
|
|
1755
|
+
const C = D(
|
|
1756
1756
|
`${i}/${e}/${n}/ADD`,
|
|
1757
|
-
(
|
|
1758
|
-
),
|
|
1757
|
+
(g) => _({ type: "ADD", payload: g.data })
|
|
1758
|
+
), h = D(
|
|
1759
1759
|
`${i}/${e}/${n}/UPDATE`,
|
|
1760
|
-
(
|
|
1761
|
-
), m =
|
|
1760
|
+
(g) => _({ type: "UPDATE", payload: g.data })
|
|
1761
|
+
), m = D(
|
|
1762
1762
|
`${i}/${e}/${n}/DELETE`,
|
|
1763
|
-
(
|
|
1763
|
+
(g) => _({ type: "DELETE", payload: g.data })
|
|
1764
1764
|
);
|
|
1765
1765
|
return () => {
|
|
1766
|
-
C(),
|
|
1766
|
+
C(), h(), m(), Bt(i, e, n);
|
|
1767
1767
|
};
|
|
1768
1768
|
}, [i, e, n, _]), {
|
|
1769
1769
|
/**
|
|
@@ -1778,23 +1778,23 @@ const ys = ({
|
|
|
1778
1778
|
*
|
|
1779
1779
|
* @params opts Optional parameters to pass to the resource create operation
|
|
1780
1780
|
*/
|
|
1781
|
-
create:
|
|
1781
|
+
create: p,
|
|
1782
1782
|
/** Current watch state for this resource type */
|
|
1783
1783
|
watchState: d,
|
|
1784
1784
|
/** Whether the watch is currently syncing */
|
|
1785
|
-
isSyncing: d ===
|
|
1785
|
+
isSyncing: d === F.WatchStateSyncing,
|
|
1786
1786
|
/** Whether the watch has fully synced */
|
|
1787
|
-
isSynced: d ===
|
|
1787
|
+
isSynced: d === F.WatchStateSynced,
|
|
1788
1788
|
/** Whether the watch encountered an error */
|
|
1789
|
-
watchError: d ===
|
|
1789
|
+
watchError: d === F.WatchStateError
|
|
1790
1790
|
};
|
|
1791
|
-
},
|
|
1792
|
-
const e = P(t), { showSnackbar: n } =
|
|
1793
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
1791
|
+
}, bs = ({ pluginID: t }) => {
|
|
1792
|
+
const e = P(t), { showSnackbar: n } = W(), r = T({
|
|
1793
|
+
mutationFn: async ({ opts: o, input: a }) => Ne(
|
|
1794
1794
|
e,
|
|
1795
1795
|
o.connectionID,
|
|
1796
1796
|
o.resourceKey,
|
|
1797
|
-
|
|
1797
|
+
$e.createFrom({
|
|
1798
1798
|
input: a.input,
|
|
1799
1799
|
namespace: a.namespace ?? o.namespace ?? ""
|
|
1800
1800
|
})
|
|
@@ -1805,12 +1805,12 @@ const ys = ({
|
|
|
1805
1805
|
onError(o, { opts: a }) {
|
|
1806
1806
|
z(n, o, `Failed to create resource ${a.resourceID}`);
|
|
1807
1807
|
}
|
|
1808
|
-
}), s =
|
|
1809
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
1808
|
+
}), s = T({
|
|
1809
|
+
mutationFn: async ({ opts: o, input: a }) => Ae(
|
|
1810
1810
|
e,
|
|
1811
1811
|
o.connectionID,
|
|
1812
1812
|
o.resourceKey,
|
|
1813
|
-
|
|
1813
|
+
ke.createFrom({
|
|
1814
1814
|
input: a.input,
|
|
1815
1815
|
id: o.resourceID,
|
|
1816
1816
|
namespace: o.namespace ?? ""
|
|
@@ -1822,12 +1822,12 @@ const ys = ({
|
|
|
1822
1822
|
onError(o, { opts: a }) {
|
|
1823
1823
|
z(n, o, `Failed to update resource ${a.resourceID}`);
|
|
1824
1824
|
}
|
|
1825
|
-
}), i =
|
|
1826
|
-
mutationFn: async ({ opts: o, input: a }) =>
|
|
1825
|
+
}), i = T({
|
|
1826
|
+
mutationFn: async ({ opts: o, input: a }) => xe(
|
|
1827
1827
|
e,
|
|
1828
1828
|
o.connectionID,
|
|
1829
1829
|
o.resourceKey,
|
|
1830
|
-
|
|
1830
|
+
Le.createFrom({
|
|
1831
1831
|
id: o.resourceID,
|
|
1832
1832
|
namespace: o.namespace ?? "",
|
|
1833
1833
|
gracePeriodSeconds: a.gracePeriodSeconds
|
|
@@ -1845,7 +1845,7 @@ const ys = ({
|
|
|
1845
1845
|
update: s.mutateAsync,
|
|
1846
1846
|
remove: i.mutateAsync
|
|
1847
1847
|
};
|
|
1848
|
-
},
|
|
1848
|
+
}, vs = ({
|
|
1849
1849
|
pluginID: t,
|
|
1850
1850
|
connectionID: e,
|
|
1851
1851
|
resourceKey: n,
|
|
@@ -1853,7 +1853,7 @@ const ys = ({
|
|
|
1853
1853
|
}) => {
|
|
1854
1854
|
const s = P(t), i = O({
|
|
1855
1855
|
queryKey: ["RESOURCE_ACTIONS", s, e, n],
|
|
1856
|
-
queryFn: () =>
|
|
1856
|
+
queryFn: () => zt(s, e, n),
|
|
1857
1857
|
enabled: r && !!s && !!e && !!n,
|
|
1858
1858
|
staleTime: 5 * 60 * 1e3
|
|
1859
1859
|
// actions don't change often
|
|
@@ -1863,18 +1863,18 @@ const ys = ({
|
|
|
1863
1863
|
isLoading: i.isLoading,
|
|
1864
1864
|
error: i.error
|
|
1865
1865
|
};
|
|
1866
|
-
},
|
|
1866
|
+
}, Rs = ({
|
|
1867
1867
|
pluginID: t,
|
|
1868
1868
|
connectionID: e,
|
|
1869
1869
|
resourceKey: n
|
|
1870
1870
|
}) => {
|
|
1871
|
-
const r = P(t), s = j(), { showSnackbar: i } =
|
|
1872
|
-
mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) =>
|
|
1871
|
+
const r = P(t), s = j(), { showSnackbar: i } = W(), o = T({
|
|
1872
|
+
mutationFn: async ({ actionID: a, id: c = "", namespace: l = "", params: u = {} }) => Yt(
|
|
1873
1873
|
r,
|
|
1874
1874
|
e,
|
|
1875
1875
|
n,
|
|
1876
1876
|
a,
|
|
1877
|
-
|
|
1877
|
+
qe.createFrom({ id: c, namespace: l, params: u })
|
|
1878
1878
|
),
|
|
1879
1879
|
onSuccess: (a) => {
|
|
1880
1880
|
a != null && a.message && i(a.message, "success"), s.invalidateQueries({
|
|
@@ -1890,14 +1890,14 @@ const ys = ({
|
|
|
1890
1890
|
isExecuting: o.isPending,
|
|
1891
1891
|
error: o.error
|
|
1892
1892
|
};
|
|
1893
|
-
},
|
|
1893
|
+
}, Fs = ({
|
|
1894
1894
|
pluginID: t,
|
|
1895
1895
|
connectionID: e,
|
|
1896
1896
|
enabled: n = !0
|
|
1897
1897
|
}) => {
|
|
1898
1898
|
const r = P(t), s = O({
|
|
1899
1899
|
queryKey: ["EDITOR_SCHEMAS", r, e],
|
|
1900
|
-
queryFn: () =>
|
|
1900
|
+
queryFn: () => Jt(r, e),
|
|
1901
1901
|
enabled: n && !!r && !!e,
|
|
1902
1902
|
staleTime: 10 * 60 * 1e3,
|
|
1903
1903
|
// schemas are fairly stable per connection
|
|
@@ -1909,38 +1909,38 @@ const ys = ({
|
|
|
1909
1909
|
error: s.error,
|
|
1910
1910
|
refetch: s.refetch
|
|
1911
1911
|
};
|
|
1912
|
-
},
|
|
1912
|
+
}, Is = ({
|
|
1913
1913
|
pluginID: t,
|
|
1914
1914
|
connectionID: e,
|
|
1915
1915
|
enabled: n = !0
|
|
1916
1916
|
}) => {
|
|
1917
|
-
const r = P(t), s = j(), i = [r, e, "watch-state"], o =
|
|
1917
|
+
const r = P(t), s = j(), i = [r, e, "watch-state"], o = q([]), a = q(!1), c = L((f) => {
|
|
1918
1918
|
s.setQueryData(i, (d) => {
|
|
1919
1919
|
if (!d) return d;
|
|
1920
|
-
const
|
|
1921
|
-
let C = 0,
|
|
1922
|
-
for (const m of Object.values(
|
|
1923
|
-
m ===
|
|
1924
|
-
return { ...d, resources:
|
|
1920
|
+
const y = { ...d.resources, [f.resourceKey]: f.state }, _ = { ...d.resourceCounts, [f.resourceKey]: f.resourceCount };
|
|
1921
|
+
let C = 0, h = 0;
|
|
1922
|
+
for (const m of Object.values(y))
|
|
1923
|
+
m === F.WatchStateSynced && C++, (m === F.WatchStateError || m === F.WatchStateFailed) && h++;
|
|
1924
|
+
return { ...d, resources: y, resourceCounts: _, totalResources: Object.keys(y).length, syncedCount: C, errorCount: h };
|
|
1925
1925
|
});
|
|
1926
1926
|
}, [s, r, e]), l = O({
|
|
1927
1927
|
queryKey: i,
|
|
1928
1928
|
queryFn: async () => {
|
|
1929
|
-
const f = await
|
|
1929
|
+
const f = await Zt(r, e);
|
|
1930
1930
|
if (!f) throw new Error("Failed to get watch state: null response");
|
|
1931
1931
|
const d = {};
|
|
1932
|
-
let
|
|
1933
|
-
for (const [
|
|
1934
|
-
m != null && (d[
|
|
1932
|
+
let y = 0, _ = 0;
|
|
1933
|
+
for (const [h, m] of Object.entries(f.resources ?? {}))
|
|
1934
|
+
m != null && (d[h] = m, m === F.WatchStateSynced && y++, m === F.WatchStateError && _++);
|
|
1935
1935
|
const C = {};
|
|
1936
|
-
for (const [
|
|
1937
|
-
m != null && (C[
|
|
1936
|
+
for (const [h, m] of Object.entries(f.resourceCounts ?? {}))
|
|
1937
|
+
m != null && (C[h] = m);
|
|
1938
1938
|
return {
|
|
1939
1939
|
connection: f.connectionId,
|
|
1940
1940
|
resources: d,
|
|
1941
1941
|
resourceCounts: C,
|
|
1942
1942
|
totalResources: Object.keys(d).length,
|
|
1943
|
-
syncedCount:
|
|
1943
|
+
syncedCount: y,
|
|
1944
1944
|
errorCount: _
|
|
1945
1945
|
};
|
|
1946
1946
|
},
|
|
@@ -1948,28 +1948,28 @@ const ys = ({
|
|
|
1948
1948
|
refetchInterval: (f) => {
|
|
1949
1949
|
const d = f.state.data;
|
|
1950
1950
|
if (!d || d.totalResources === 0) return 3e3;
|
|
1951
|
-
let
|
|
1951
|
+
let y = 0;
|
|
1952
1952
|
for (const _ of Object.values(d.resources))
|
|
1953
|
-
(_ ===
|
|
1954
|
-
return
|
|
1953
|
+
(_ === F.WatchStateSynced || _ === F.WatchStateError || _ === F.WatchStateStopped || _ === F.WatchStateFailed || _ === F.WatchStateForbidden || _ === F.WatchStateSkipped) && y++;
|
|
1954
|
+
return y >= d.totalResources ? !1 : 3e3;
|
|
1955
1955
|
}
|
|
1956
1956
|
});
|
|
1957
|
-
|
|
1957
|
+
U(() => {
|
|
1958
1958
|
if (!l.data || a.current) return;
|
|
1959
1959
|
a.current = !0;
|
|
1960
1960
|
const f = o.current;
|
|
1961
1961
|
o.current = [];
|
|
1962
1962
|
for (const d of f)
|
|
1963
1963
|
c(d);
|
|
1964
|
-
}, [l.data, c]),
|
|
1964
|
+
}, [l.data, c]), U(() => {
|
|
1965
1965
|
if (!n || !r || !e)
|
|
1966
1966
|
return;
|
|
1967
1967
|
a.current = !1, o.current = [];
|
|
1968
|
-
const f =
|
|
1968
|
+
const f = D(
|
|
1969
1969
|
`${r}/${e}/watch/STATE`,
|
|
1970
1970
|
(d) => {
|
|
1971
|
-
const
|
|
1972
|
-
a.current ? c(
|
|
1971
|
+
const y = d.data;
|
|
1972
|
+
a.current ? c(y) : o.current.push(y);
|
|
1973
1973
|
}
|
|
1974
1974
|
);
|
|
1975
1975
|
return () => {
|
|
@@ -1977,47 +1977,47 @@ const ys = ({
|
|
|
1977
1977
|
};
|
|
1978
1978
|
}, [r, e, n, c]);
|
|
1979
1979
|
const u = l.data;
|
|
1980
|
-
let
|
|
1980
|
+
let p = 0;
|
|
1981
1981
|
if (u != null && u.resources)
|
|
1982
1982
|
for (const f of Object.values(u.resources))
|
|
1983
|
-
(f ===
|
|
1983
|
+
(f === F.WatchStateSynced || f === F.WatchStateError || f === F.WatchStateStopped || f === F.WatchStateFailed || f === F.WatchStateForbidden || f === F.WatchStateSkipped) && p++;
|
|
1984
1984
|
return {
|
|
1985
1985
|
/** Full summary query result */
|
|
1986
1986
|
summary: l,
|
|
1987
1987
|
/** Get the state of a specific resource type's watch */
|
|
1988
1988
|
getResourceState: (f) => u == null ? void 0 : u.resources[f],
|
|
1989
1989
|
/** Whether all registered watches have reached a terminal state */
|
|
1990
|
-
isFullySynced: u ? u.totalResources > 0 &&
|
|
1990
|
+
isFullySynced: u ? u.totalResources > 0 && p === u.totalResources : !1,
|
|
1991
1991
|
/** Sync progress as a 0-1 fraction (terminal states / total) */
|
|
1992
|
-
syncProgress: u && u.totalResources > 0 ?
|
|
1992
|
+
syncProgress: u && u.totalResources > 0 ? p / u.totalResources : 0,
|
|
1993
1993
|
/** Number of watches that encountered errors */
|
|
1994
1994
|
errorCount: (u == null ? void 0 : u.errorCount) ?? 0
|
|
1995
1995
|
};
|
|
1996
|
-
},
|
|
1997
|
-
const [t, e] =
|
|
1998
|
-
const u = l.data,
|
|
1999
|
-
if (e((
|
|
2000
|
-
const _ = new Map(
|
|
2001
|
-
return _.set(
|
|
2002
|
-
}), r.current.has(
|
|
2003
|
-
const
|
|
1996
|
+
}, Ps = () => {
|
|
1997
|
+
const [t, e] = G(/* @__PURE__ */ new Map()), n = q(/* @__PURE__ */ new Map()), r = q(/* @__PURE__ */ new Map()), s = L((l) => {
|
|
1998
|
+
const u = l.data, p = he(u), f = Ze(n.current, u), d = pe(f);
|
|
1999
|
+
if (e((y) => {
|
|
2000
|
+
const _ = new Map(y);
|
|
2001
|
+
return _.set(p, d), _;
|
|
2002
|
+
}), r.current.has(p) && (clearTimeout(r.current.get(p)), r.current.delete(p)), ne(d)) {
|
|
2003
|
+
const y = setTimeout(() => {
|
|
2004
2004
|
e((_) => {
|
|
2005
2005
|
const C = new Map(_);
|
|
2006
|
-
return C.delete(
|
|
2007
|
-
}), n.current.delete(
|
|
2006
|
+
return C.delete(p), C;
|
|
2007
|
+
}), n.current.delete(p), r.current.delete(p);
|
|
2008
2008
|
}, 5e3);
|
|
2009
|
-
r.current.set(
|
|
2009
|
+
r.current.set(p, y);
|
|
2010
2010
|
}
|
|
2011
2011
|
}, []);
|
|
2012
|
-
|
|
2013
|
-
const l =
|
|
2012
|
+
U(() => {
|
|
2013
|
+
const l = D("watch/STATE", s);
|
|
2014
2014
|
return () => {
|
|
2015
2015
|
l();
|
|
2016
2016
|
for (const u of r.current.values())
|
|
2017
2017
|
clearTimeout(u);
|
|
2018
2018
|
};
|
|
2019
2019
|
}, [s]);
|
|
2020
|
-
const i = Array.from(t.values()), o =
|
|
2020
|
+
const i = Array.from(t.values()), o = Ye(i), a = i.find((l) => !ne(l)) ?? i[0] ?? null, c = Je(i);
|
|
2021
2021
|
return {
|
|
2022
2022
|
/** All tracked syncs */
|
|
2023
2023
|
syncs: i,
|
|
@@ -2028,108 +2028,241 @@ const ys = ({
|
|
|
2028
2028
|
/** Aggregate progress across all connections (0-1) */
|
|
2029
2029
|
aggregateProgress: c
|
|
2030
2030
|
};
|
|
2031
|
-
},
|
|
2032
|
-
const t =
|
|
2031
|
+
}, Ar = () => {
|
|
2032
|
+
const t = b.useContext(Ke);
|
|
2033
2033
|
if (!t) throw new Error("useOperations must be used within an OperationsProvider");
|
|
2034
2034
|
return t;
|
|
2035
|
-
},
|
|
2035
|
+
}, Os = ({
|
|
2036
2036
|
pluginID: t,
|
|
2037
2037
|
connectionID: e,
|
|
2038
2038
|
resourceKey: n
|
|
2039
2039
|
}) => {
|
|
2040
|
-
const r = P(t), { showSnackbar: s } =
|
|
2041
|
-
return
|
|
2040
|
+
const r = P(t), { showSnackbar: s } = W(), { addOperation: i, updateOperation: o } = Ar(), a = b.useRef([]);
|
|
2041
|
+
return b.useEffect(() => () => {
|
|
2042
2042
|
a.current.forEach((l) => l());
|
|
2043
|
-
}, []), { startStreamAction:
|
|
2044
|
-
async ({ actionID: l, id: u, namespace:
|
|
2043
|
+
}, []), { startStreamAction: b.useCallback(
|
|
2044
|
+
async ({ actionID: l, id: u, namespace: p, label: f, params: d = {} }) => {
|
|
2045
2045
|
try {
|
|
2046
|
-
const
|
|
2046
|
+
const y = await Xt(
|
|
2047
2047
|
r,
|
|
2048
2048
|
e,
|
|
2049
2049
|
n,
|
|
2050
2050
|
l,
|
|
2051
|
-
|
|
2051
|
+
qe.createFrom({ id: u, namespace: p, params: d })
|
|
2052
2052
|
);
|
|
2053
2053
|
i({
|
|
2054
|
-
id:
|
|
2054
|
+
id: y,
|
|
2055
2055
|
label: f,
|
|
2056
2056
|
resourceKey: n,
|
|
2057
2057
|
resourceName: u,
|
|
2058
|
-
namespace:
|
|
2058
|
+
namespace: p,
|
|
2059
2059
|
connectionID: e,
|
|
2060
2060
|
status: "running",
|
|
2061
2061
|
startedAt: Date.now()
|
|
2062
2062
|
});
|
|
2063
|
-
const _ = `action/stream/${
|
|
2064
|
-
var
|
|
2065
|
-
const m =
|
|
2063
|
+
const _ = `action/stream/${y}`, C = D(_, (h) => {
|
|
2064
|
+
var g, v, R, E;
|
|
2065
|
+
const m = h.data;
|
|
2066
2066
|
switch (m.type) {
|
|
2067
2067
|
case "progress": {
|
|
2068
2068
|
const S = m.data ?? {};
|
|
2069
|
-
o(
|
|
2069
|
+
o(y, {
|
|
2070
2070
|
message: S.message,
|
|
2071
2071
|
progress: S.ready !== void 0 && S.desired !== void 0 ? { ready: S.ready, desired: S.desired } : void 0
|
|
2072
2072
|
});
|
|
2073
2073
|
break;
|
|
2074
2074
|
}
|
|
2075
2075
|
case "complete":
|
|
2076
|
-
o(
|
|
2076
|
+
o(y, {
|
|
2077
2077
|
status: "completed",
|
|
2078
|
-
message: ((
|
|
2078
|
+
message: ((g = m.data) == null ? void 0 : g.message) ?? "Completed",
|
|
2079
2079
|
completedAt: Date.now()
|
|
2080
|
-
}), s(((
|
|
2080
|
+
}), s(((v = m.data) == null ? void 0 : v.message) ?? f + " completed", "success"), ae(_);
|
|
2081
2081
|
break;
|
|
2082
2082
|
case "error":
|
|
2083
|
-
o(
|
|
2083
|
+
o(y, {
|
|
2084
2084
|
status: "error",
|
|
2085
|
-
message: ((
|
|
2085
|
+
message: ((R = m.data) == null ? void 0 : R.message) ?? "Failed",
|
|
2086
2086
|
completedAt: Date.now()
|
|
2087
|
-
}), s(((
|
|
2087
|
+
}), s(((E = m.data) == null ? void 0 : E.message) ?? f + " failed", "error"), ae(_);
|
|
2088
2088
|
break;
|
|
2089
2089
|
}
|
|
2090
2090
|
});
|
|
2091
2091
|
return a.current.push(() => {
|
|
2092
2092
|
C(), ae(_);
|
|
2093
|
-
}),
|
|
2094
|
-
} catch (
|
|
2095
|
-
throw z(s,
|
|
2093
|
+
}), y;
|
|
2094
|
+
} catch (y) {
|
|
2095
|
+
throw z(s, y, `Failed to start "${l}"`), y;
|
|
2096
2096
|
}
|
|
2097
2097
|
},
|
|
2098
2098
|
[r, e, n, i, o, s]
|
|
2099
2099
|
) };
|
|
2100
|
-
}
|
|
2101
|
-
|
|
2100
|
+
};
|
|
2101
|
+
function xr(t, e) {
|
|
2102
|
+
return `${t}/${e}/graph/CHANGED`;
|
|
2103
|
+
}
|
|
2104
|
+
function we(t, e, n, r) {
|
|
2105
|
+
const s = j(), i = q(n);
|
|
2106
|
+
i.current = n;
|
|
2107
|
+
const o = JSON.stringify(n);
|
|
2108
|
+
U(() => {
|
|
2109
|
+
if (!r || !t || !e)
|
|
2110
|
+
return;
|
|
2111
|
+
const a = D(xr(t, e), () => {
|
|
2112
|
+
s.invalidateQueries({ queryKey: i.current, exact: !0 });
|
|
2113
|
+
});
|
|
2114
|
+
return () => {
|
|
2115
|
+
a();
|
|
2116
|
+
};
|
|
2117
|
+
}, [s, t, e, o, r]);
|
|
2118
|
+
}
|
|
2119
|
+
const Dr = {
|
|
2120
|
+
owns: { outgoing: "Owns", incoming: "Owned by" },
|
|
2121
|
+
runs_on: { outgoing: "Runs on", incoming: "Running here" },
|
|
2122
|
+
uses: { outgoing: "Uses", incoming: "Used by" },
|
|
2123
|
+
exposes: { outgoing: "Exposes", incoming: "Exposed by" },
|
|
2124
|
+
manages: { outgoing: "Manages", incoming: "Managed by" },
|
|
2125
|
+
member_of: { outgoing: "Member of", incoming: "Members" },
|
|
2126
|
+
selects: { outgoing: "Selects", incoming: "Selected by" }
|
|
2127
|
+
};
|
|
2128
|
+
function Ts(t, e) {
|
|
2129
|
+
const n = Dr[t];
|
|
2130
|
+
if (n)
|
|
2131
|
+
return n[e];
|
|
2132
|
+
const r = t.replace(/_/g, " ");
|
|
2133
|
+
return e === "outgoing" ? r : `${r} (incoming)`;
|
|
2134
|
+
}
|
|
2135
|
+
function Nr(t, e) {
|
|
2136
|
+
return t.pluginId === e.pluginId && t.connectionId === e.connectionId && t.resourceKey === e.resourceKey && t.id === e.id && (t.namespace ?? "") === (e.namespace ?? "");
|
|
2137
|
+
}
|
|
2138
|
+
function kr(t, e) {
|
|
2139
|
+
return e.map((n) => {
|
|
2140
|
+
const r = Nr(n.source, t);
|
|
2141
|
+
return {
|
|
2142
|
+
resource: r ? n.target : n.source,
|
|
2143
|
+
type: n.type,
|
|
2144
|
+
direction: r ? "outgoing" : "incoming",
|
|
2145
|
+
label: n.label
|
|
2146
|
+
};
|
|
2147
|
+
});
|
|
2148
|
+
}
|
|
2149
|
+
const As = ({
|
|
2150
|
+
pluginID: t,
|
|
2151
|
+
connectionID: e,
|
|
2152
|
+
resourceKey: n,
|
|
2153
|
+
resourceID: r,
|
|
2154
|
+
namespace: s = "",
|
|
2155
|
+
direction: i = "both",
|
|
2156
|
+
relationshipType: o,
|
|
2157
|
+
enabled: a = !0,
|
|
2158
|
+
refetchInterval: c = !1
|
|
2159
|
+
}) => {
|
|
2160
|
+
const l = P(t), u = ["RESOURCE_RELATED", l, e, n, s, r, i, o ?? null], p = a && !!l && !!e && !!n && !!r;
|
|
2161
|
+
we(l, e, u, p);
|
|
2162
|
+
const f = O({
|
|
2163
|
+
queryKey: u,
|
|
2164
|
+
queryFn: async () => Vt(l, e, n, s, r, i, o ?? null),
|
|
2165
|
+
enabled: p,
|
|
2166
|
+
refetchInterval: c
|
|
2167
|
+
}), d = {
|
|
2168
|
+
pluginId: l,
|
|
2169
|
+
connectionId: e,
|
|
2170
|
+
resourceKey: n,
|
|
2171
|
+
id: r,
|
|
2172
|
+
namespace: s
|
|
2173
|
+
}, y = f.data ?? [];
|
|
2174
|
+
return {
|
|
2175
|
+
/** One entry per edge, from the viewed resource's side. */
|
|
2176
|
+
related: kr(d, y),
|
|
2177
|
+
/** The raw graph edges. */
|
|
2178
|
+
edges: y,
|
|
2179
|
+
isLoading: f.isLoading,
|
|
2180
|
+
isFetching: f.isFetching,
|
|
2181
|
+
error: f.error,
|
|
2182
|
+
refetch: f.refetch
|
|
2183
|
+
};
|
|
2184
|
+
}, xs = ({
|
|
2185
|
+
pluginID: t,
|
|
2186
|
+
connectionID: e,
|
|
2187
|
+
resourceKey: n,
|
|
2188
|
+
resourceID: r,
|
|
2189
|
+
namespace: s = "",
|
|
2190
|
+
maxDepth: i = 3,
|
|
2191
|
+
enabled: o = !0,
|
|
2192
|
+
refetchInterval: a = !1
|
|
2193
|
+
}) => {
|
|
2194
|
+
const c = P(t), l = ["RESOURCE_DEPENDENCY_TREE", c, e, n, s, r, i], u = o && !!c && !!e && !!n && !!r;
|
|
2195
|
+
we(c, e, l, u);
|
|
2196
|
+
const p = O({
|
|
2197
|
+
queryKey: l,
|
|
2198
|
+
queryFn: async () => en(c, e, n, s, r, i),
|
|
2199
|
+
enabled: u,
|
|
2200
|
+
refetchInterval: a
|
|
2201
|
+
});
|
|
2202
|
+
return {
|
|
2203
|
+
tree: p.data ?? null,
|
|
2204
|
+
isLoading: p.isLoading,
|
|
2205
|
+
isFetching: p.isFetching,
|
|
2206
|
+
error: p.error,
|
|
2207
|
+
refetch: p.refetch
|
|
2208
|
+
};
|
|
2209
|
+
}, Ds = ({
|
|
2210
|
+
pluginID: t,
|
|
2211
|
+
connectionID: e,
|
|
2212
|
+
resourceKey: n,
|
|
2213
|
+
resourceID: r,
|
|
2214
|
+
namespace: s = "",
|
|
2215
|
+
upDepth: i = 2,
|
|
2216
|
+
downDepth: o = 3,
|
|
2217
|
+
enabled: a = !0
|
|
2218
|
+
}) => {
|
|
2219
|
+
const c = P(t), l = ["RESOURCE_GRAPH", c, e, n, s, r, i, o], u = a && !!c && !!e && !!n && !!r;
|
|
2220
|
+
we(c, e, l, u);
|
|
2221
|
+
const p = O({
|
|
2222
|
+
queryKey: l,
|
|
2223
|
+
queryFn: async () => tn(c, e, n, s, r, i, o),
|
|
2224
|
+
enabled: u
|
|
2225
|
+
});
|
|
2226
|
+
return {
|
|
2227
|
+
graph: p.data ?? null,
|
|
2228
|
+
isLoading: p.isLoading,
|
|
2229
|
+
isFetching: p.isFetching,
|
|
2230
|
+
error: p.error,
|
|
2231
|
+
refetch: p.refetch
|
|
2232
|
+
};
|
|
2233
|
+
}, Ns = () => {
|
|
2234
|
+
const t = b.useContext(Qe);
|
|
2102
2235
|
if (!t)
|
|
2103
2236
|
throw new Error("useSettings must be used within a SettingsProvider");
|
|
2104
2237
|
return t;
|
|
2105
|
-
},
|
|
2106
|
-
const { pluginId: r } =
|
|
2238
|
+
}, ks = ({ to: t, withinContext: e, ...n }) => {
|
|
2239
|
+
const { pluginId: r } = ge();
|
|
2107
2240
|
r || console.error("Link used outside of a plugin context");
|
|
2108
2241
|
const s = `/_plugin/${r}${t.startsWith("/") ? "" : "/"}${t}`;
|
|
2109
|
-
return
|
|
2242
|
+
return b.useMemo(() => /* @__PURE__ */ x(dt, { style: { textDecoration: "none", color: "inherit" }, ...n, to: s }), [n, s]);
|
|
2110
2243
|
};
|
|
2111
|
-
function
|
|
2112
|
-
const t =
|
|
2244
|
+
function Ls() {
|
|
2245
|
+
const t = ft(), e = pt(), { pluginId: n } = ge();
|
|
2113
2246
|
n || console.error("usePluginRouter used outside of a plugin context");
|
|
2114
|
-
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i =
|
|
2247
|
+
const r = `/_plugin/${n}`, s = e.pathname.startsWith(r) ? e.pathname.slice(r.length) || "/" : e.pathname, i = L((o, a) => {
|
|
2115
2248
|
const { ...c } = a ?? {};
|
|
2116
2249
|
o.startsWith("/") ? t(`${r}${o}`, c) : t(o, c);
|
|
2117
2250
|
}, [t, r]);
|
|
2118
|
-
return
|
|
2251
|
+
return lt(() => ({
|
|
2119
2252
|
location: e,
|
|
2120
2253
|
navigate: i,
|
|
2121
2254
|
pluginPath: s
|
|
2122
2255
|
}), [e, i, s]);
|
|
2123
2256
|
}
|
|
2124
|
-
class
|
|
2257
|
+
class Ms {
|
|
2125
2258
|
}
|
|
2126
|
-
class
|
|
2259
|
+
class $s {
|
|
2127
2260
|
constructor() {
|
|
2128
|
-
|
|
2261
|
+
A(this, "_extensions");
|
|
2129
2262
|
/**
|
|
2130
2263
|
* The root component to render for the application window.
|
|
2131
2264
|
*/
|
|
2132
|
-
|
|
2265
|
+
A(this, "root");
|
|
2133
2266
|
/**
|
|
2134
2267
|
* Various pages to render under the root component. These can be navigated to using
|
|
2135
2268
|
* the built-in navigation system both programatically and through Links.
|
|
@@ -2159,8 +2292,8 @@ class Is {
|
|
|
2159
2292
|
* ```
|
|
2160
2293
|
*
|
|
2161
2294
|
*/
|
|
2162
|
-
|
|
2163
|
-
|
|
2295
|
+
A(this, "pages");
|
|
2296
|
+
A(this, "_routes");
|
|
2164
2297
|
}
|
|
2165
2298
|
get extensions() {
|
|
2166
2299
|
return this._extensions || [];
|
|
@@ -2182,9 +2315,9 @@ class Is {
|
|
|
2182
2315
|
*/
|
|
2183
2316
|
get Window() {
|
|
2184
2317
|
if (!this._routes && this.root)
|
|
2185
|
-
return /* @__PURE__ */
|
|
2186
|
-
const e =
|
|
2187
|
-
return /* @__PURE__ */
|
|
2318
|
+
return /* @__PURE__ */ x(this.root, {});
|
|
2319
|
+
const e = yt(this._routes || []);
|
|
2320
|
+
return /* @__PURE__ */ x(gt, { router: e });
|
|
2188
2321
|
}
|
|
2189
2322
|
/**
|
|
2190
2323
|
* Register extension points for other plugins to extend the functionality
|
|
@@ -2216,84 +2349,91 @@ class Is {
|
|
|
2216
2349
|
return this._routes = e, this;
|
|
2217
2350
|
}
|
|
2218
2351
|
}
|
|
2219
|
-
var
|
|
2220
|
-
const
|
|
2352
|
+
var Lr = /* @__PURE__ */ ((t) => (t.MISSING_MANIFEST = "MISSING_MANIFEST", t.MISSING_PLUGIN = "MISSING_PLUGIN", t.MISSING_ENTRYPOINT = "MISSING_ENTRYPOINT", t))(Lr || {});
|
|
2353
|
+
const qs = (t) => {
|
|
2221
2354
|
const e = t.split("::");
|
|
2222
2355
|
return e.length === 1 ? { group: "core", version: "", kind: e[0] } : {
|
|
2223
2356
|
group: e[0] || "core",
|
|
2224
2357
|
version: e[1] || "",
|
|
2225
2358
|
kind: e[2] || e[0]
|
|
2226
2359
|
};
|
|
2227
|
-
},
|
|
2360
|
+
}, Us = (t) => !t || t === "core" ? "Core" : t.charAt(0).toUpperCase() + t.slice(1);
|
|
2228
2361
|
export {
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2362
|
+
B as ALL_SESSIONS_KEY,
|
|
2363
|
+
mn as BottomDrawerContext,
|
|
2364
|
+
_n as ConfirmationModalContext,
|
|
2232
2365
|
$ as ErrorTypes,
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2366
|
+
es as ExtensionPointRegistry,
|
|
2367
|
+
Fn as ExtensionPointStore,
|
|
2368
|
+
Vr as ExtensionProvider,
|
|
2369
|
+
ks as Link,
|
|
2370
|
+
Ke as OperationsContext,
|
|
2371
|
+
Zr as OperationsProvider,
|
|
2239
2372
|
ye as PluginContext,
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2373
|
+
zr as PluginContextProvider,
|
|
2374
|
+
Lr as PluginErrorCode,
|
|
2375
|
+
$s as PluginWindow,
|
|
2376
|
+
Ms as PluginWindowRootProps,
|
|
2377
|
+
Sn as RightDrawerContext,
|
|
2378
|
+
Qe as SettingsContext,
|
|
2379
|
+
Jr as SettingsProvider,
|
|
2380
|
+
ts as SnackbarProvider,
|
|
2381
|
+
F as WatchState,
|
|
2382
|
+
gn as actionToSnackbar,
|
|
2383
|
+
Or as applyBatch,
|
|
2384
|
+
Pn as connectionListQueryKey,
|
|
2252
2385
|
k as createErrorHandler,
|
|
2253
|
-
|
|
2254
|
-
|
|
2255
|
-
|
|
2386
|
+
hn as defaultState,
|
|
2387
|
+
Us as formatGroup,
|
|
2388
|
+
xr as graphChangedEvent,
|
|
2389
|
+
Ge as isCancelledError,
|
|
2256
2390
|
Q as parseAppError,
|
|
2257
|
-
|
|
2391
|
+
qs as parseResourceKey,
|
|
2392
|
+
Ts as relationshipLabel,
|
|
2258
2393
|
z as showAppError,
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
|
|
2273
|
-
|
|
2274
|
-
|
|
2275
|
-
|
|
2276
|
-
|
|
2277
|
-
|
|
2278
|
-
|
|
2279
|
-
|
|
2280
|
-
|
|
2281
|
-
|
|
2394
|
+
kr as toRelatedResources,
|
|
2395
|
+
Ps as useActiveSyncs,
|
|
2396
|
+
Xe as useBottomDrawer,
|
|
2397
|
+
gs as useConfirmationModal,
|
|
2398
|
+
ns as useConnection,
|
|
2399
|
+
ss as useConnectionNamespaces,
|
|
2400
|
+
os as useConnectionStatus,
|
|
2401
|
+
rs as useConnections,
|
|
2402
|
+
xs as useDependencyTree,
|
|
2403
|
+
Fs as useEditorSchemas,
|
|
2404
|
+
Tr as useEventBatcher,
|
|
2405
|
+
cs as useExec,
|
|
2406
|
+
Rs as useExecuteAction,
|
|
2407
|
+
Xr as useExtensionPoint,
|
|
2408
|
+
Rn as useExtensionRegistry,
|
|
2409
|
+
us as useLogs,
|
|
2410
|
+
ls as useMetricProviders,
|
|
2411
|
+
Tn as useMetricProvidersForResource,
|
|
2412
|
+
fs as useMetricStream,
|
|
2413
|
+
Ar as useOperations,
|
|
2414
|
+
ge as usePluginContext,
|
|
2415
|
+
is as usePluginData,
|
|
2416
|
+
Ls as usePluginRouter,
|
|
2417
|
+
Yr as usePluginSettings,
|
|
2418
|
+
ps as usePortForwardSessions,
|
|
2419
|
+
we as useRefetchOnGraphChange,
|
|
2420
|
+
As as useRelatedResources,
|
|
2282
2421
|
P as useResolvedPluginId,
|
|
2283
|
-
|
|
2284
|
-
|
|
2285
|
-
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
|
|
2298
|
-
|
|
2422
|
+
hs as useResource,
|
|
2423
|
+
vs as useResourceActions,
|
|
2424
|
+
ms as useResourceAreaComponent,
|
|
2425
|
+
Ds as useResourceGraph,
|
|
2426
|
+
Ss as useResourceGroups,
|
|
2427
|
+
ds as useResourceMetrics,
|
|
2428
|
+
bs as useResourceMutations,
|
|
2429
|
+
ys as useResourcePortForwarder,
|
|
2430
|
+
_s as useResourceSearch,
|
|
2431
|
+
Es as useResourceType,
|
|
2432
|
+
ws as useResourceTypes,
|
|
2433
|
+
Cs as useResources,
|
|
2434
|
+
as as useRightDrawer,
|
|
2435
|
+
Ns as useSettings,
|
|
2436
|
+
W as useSnackbar,
|
|
2437
|
+
Os as useStreamAction,
|
|
2438
|
+
Is as useWatchState
|
|
2299
2439
|
};
|