@nvent-addon/app 0.5.15 → 1.0.0-alpha.10
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/module.json +1 -1
- package/dist/module.mjs +3 -2
- package/dist/runtime/app/components/DashboardCard.d.vue.ts +1 -1
- package/dist/runtime/app/components/DashboardCard.vue.d.ts +1 -1
- package/dist/runtime/app/composables/useWorkers.d.ts +57 -0
- package/dist/runtime/app/composables/useWorkers.js +42 -0
- package/dist/runtime/app/pages/dashboard.vue +1 -654
- package/dist/runtime/app/pages/index.vue +25 -41
- package/dist/runtime/app/pages/workers.vue +458 -0
- package/dist/runtime/server/api/_workers/index.get.d.ts +8 -0
- package/dist/runtime/server/api/_workers/index.get.js +14 -0
- package/package.json +13 -12
- package/dist/runtime/app/components/ComponentRouter.d.vue.ts +0 -46
- package/dist/runtime/app/components/ComponentRouter.vue +0 -26
- package/dist/runtime/app/components/ComponentRouter.vue.d.ts +0 -46
- package/dist/runtime/app/components/ComponentShell.d.vue.ts +0 -23
- package/dist/runtime/app/components/ComponentShell.vue +0 -97
- package/dist/runtime/app/components/ComponentShell.vue.d.ts +0 -23
- package/dist/runtime/app/components/ConfirmDialog.d.vue.ts +0 -33
- package/dist/runtime/app/components/ConfirmDialog.vue +0 -120
- package/dist/runtime/app/components/ConfirmDialog.vue.d.ts +0 -33
- package/dist/runtime/app/composables/useComponentRouter.d.ts +0 -46
- package/dist/runtime/app/composables/useComponentRouter.js +0 -248
- package/dist/runtime/app/pages/flows/[name].vue +0 -750
- package/dist/runtime/app/pages/flows/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/flows/index.vue +0 -381
- package/dist/runtime/app/pages/flows/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/index.vue +0 -236
- package/dist/runtime/app/pages/queues/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/job.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/job.vue +0 -261
- package/dist/runtime/app/pages/queues/job.vue.d.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.d.vue.ts +0 -3
- package/dist/runtime/app/pages/queues/jobs.vue +0 -595
- package/dist/runtime/app/pages/queues/jobs.vue.d.ts +0 -3
- package/dist/runtime/app/pages/settings/scheduler.d.vue.ts +0 -3
- package/dist/runtime/app/pages/settings/scheduler.vue +0 -310
- package/dist/runtime/app/pages/settings/scheduler.vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name]/edit.d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name]/edit.vue +0 -429
- package/dist/runtime/app/pages/triggers/[name]/edit.vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name].d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/[name].vue +0 -870
- package/dist/runtime/app/pages/triggers/[name].vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/index.d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/index.vue +0 -525
- package/dist/runtime/app/pages/triggers/index.vue.d.ts +0 -3
- package/dist/runtime/app/pages/triggers/new.d.vue.ts +0 -3
- package/dist/runtime/app/pages/triggers/new.vue +0 -610
- package/dist/runtime/app/pages/triggers/new.vue.d.ts +0 -3
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.d.ts +0 -10
- package/dist/runtime/server/api/_flows/[name]/clear-history.delete.js +0 -49
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/cancel.post.js +0 -21
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/restart.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/runs/[runId]/restart.post.js +0 -21
- package/dist/runtime/server/api/_flows/[name]/runs.get.d.ts +0 -17
- package/dist/runtime/server/api/_flows/[name]/runs.get.js +0 -64
- package/dist/runtime/server/api/_flows/[name]/start.post.d.ts +0 -2
- package/dist/runtime/server/api/_flows/[name]/start.post.js +0 -9
- package/dist/runtime/server/api/_flows/index.get.d.ts +0 -7
- package/dist/runtime/server/api/_flows/index.get.js +0 -5
- package/dist/runtime/server/api/_flows/recent-runs.get.d.ts +0 -15
- package/dist/runtime/server/api/_flows/recent-runs.get.js +0 -67
- package/dist/runtime/server/api/_flows/ws.d.ts +0 -80
- package/dist/runtime/server/api/_flows/ws.js +0 -309
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/[name]/job/[id].get.js +0 -14
- package/dist/runtime/server/api/_queues/[name]/job/index.get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/[name]/job/index.get.js +0 -39
- package/dist/runtime/server/api/_queues/index.get.d.ts +0 -2
- package/dist/runtime/server/api/_queues/index.get.js +0 -106
- package/dist/runtime/server/api/_queues/ws.d.ts +0 -48
- package/dist/runtime/server/api/_queues/ws.js +0 -215
- package/dist/runtime/server/api/_scheduler/jobs.get.d.ts +0 -19
- package/dist/runtime/server/api/_scheduler/jobs.get.js +0 -36
- package/dist/runtime/server/api/_triggers/[name]/events.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/[name]/events.get.js +0 -43
- package/dist/runtime/server/api/_triggers/[name]/index.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/[name]/index.get.js +0 -76
- package/dist/runtime/server/api/_triggers/[name].delete.d.ts +0 -7
- package/dist/runtime/server/api/_triggers/[name].delete.js +0 -37
- package/dist/runtime/server/api/_triggers/[name].patch.d.ts +0 -7
- package/dist/runtime/server/api/_triggers/[name].patch.js +0 -117
- package/dist/runtime/server/api/_triggers/index.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/index.get.js +0 -44
- package/dist/runtime/server/api/_triggers/index.post.d.ts +0 -7
- package/dist/runtime/server/api/_triggers/index.post.js +0 -124
- package/dist/runtime/server/api/_triggers/stats.get.d.ts +0 -6
- package/dist/runtime/server/api/_triggers/stats.get.js +0 -41
- package/dist/runtime/server/api/_triggers/ws.d.ts +0 -74
- package/dist/runtime/server/api/_triggers/ws.js +0 -315
- /package/dist/runtime/app/pages/{flows/[name].d.vue.ts → workers.d.vue.ts} +0 -0
- /package/dist/runtime/app/pages/{flows/[name].vue.d.ts → workers.vue.d.ts} +0 -0
|
@@ -1,248 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
computed,
|
|
3
|
-
inject,
|
|
4
|
-
provide,
|
|
5
|
-
shallowRef,
|
|
6
|
-
useRoute,
|
|
7
|
-
useRouter,
|
|
8
|
-
watch,
|
|
9
|
-
defineAsyncComponent
|
|
10
|
-
} from "#imports";
|
|
11
|
-
import { createHooks } from "hookable";
|
|
12
|
-
export function useComponentRouter(opts) {
|
|
13
|
-
const CTX_KEY = "component-router";
|
|
14
|
-
if (!opts || !("routes" in opts) || !opts.routes) {
|
|
15
|
-
const key = opts?.provideKey ?? CTX_KEY;
|
|
16
|
-
const ctx = inject(key, null);
|
|
17
|
-
if (!ctx) {
|
|
18
|
-
console.warn(
|
|
19
|
-
"[useComponentRouter] No parent router context found. Ensure a parent uses useComponentRouter with routes or wrap children in <component-router>."
|
|
20
|
-
);
|
|
21
|
-
const emptyRoute = shallowRef({ path: "", params: {}, query: {} });
|
|
22
|
-
const warnNav = async (_p) => console.warn(
|
|
23
|
-
"[useComponentRouter] push/replace called without a parent router context."
|
|
24
|
-
);
|
|
25
|
-
const noopMake = (p, _params) => p;
|
|
26
|
-
const noopHref = (p, _params) => p;
|
|
27
|
-
const emptyHooks = createHooks();
|
|
28
|
-
return {
|
|
29
|
-
route: emptyRoute,
|
|
30
|
-
push: warnNav,
|
|
31
|
-
replace: warnNav,
|
|
32
|
-
makePath: noopMake,
|
|
33
|
-
makeHref: noopHref,
|
|
34
|
-
pushTo: async (p, _params) => warnNav(p),
|
|
35
|
-
replaceTo: async (p, _params) => warnNav(p),
|
|
36
|
-
hooks: emptyHooks,
|
|
37
|
-
component: void 0
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
return ctx;
|
|
41
|
-
}
|
|
42
|
-
const props = {
|
|
43
|
-
routes: Array.isArray(opts.routes) ? opts.routes : Object.entries(opts.routes || {}).map(([path, component2]) => ({
|
|
44
|
-
path,
|
|
45
|
-
component: component2
|
|
46
|
-
})),
|
|
47
|
-
base: opts.base ?? "fp",
|
|
48
|
-
mode: opts.mode ?? "query",
|
|
49
|
-
initial: opts.initial,
|
|
50
|
-
provideKey: opts.provideKey ?? CTX_KEY,
|
|
51
|
-
debug: opts.debug === true
|
|
52
|
-
};
|
|
53
|
-
const nuxtRoute = useRoute();
|
|
54
|
-
const nuxtRouter = useRouter();
|
|
55
|
-
const component = shallowRef(null);
|
|
56
|
-
const route = shallowRef({
|
|
57
|
-
path: "",
|
|
58
|
-
params: {},
|
|
59
|
-
query: {}
|
|
60
|
-
});
|
|
61
|
-
const hooks = createHooks();
|
|
62
|
-
const dbg = (...args) => {
|
|
63
|
-
if (props.debug) console.info("[component-router]", ...args);
|
|
64
|
-
};
|
|
65
|
-
function esc(text) {
|
|
66
|
-
return text.replace(/([.+*?=^!${}()[\]|\\])/g, "\\$1");
|
|
67
|
-
}
|
|
68
|
-
function compilePattern(path) {
|
|
69
|
-
const keys = [];
|
|
70
|
-
const dyn = /\/:([^/]+)/g;
|
|
71
|
-
let last = 0;
|
|
72
|
-
let pattern = "";
|
|
73
|
-
let m;
|
|
74
|
-
while (m = dyn.exec(path)) {
|
|
75
|
-
pattern += esc(path.slice(last, m.index));
|
|
76
|
-
keys.push(m[1]);
|
|
77
|
-
pattern += "/([^/]+)";
|
|
78
|
-
last = m.index + m[0].length;
|
|
79
|
-
}
|
|
80
|
-
pattern += esc(path.slice(last));
|
|
81
|
-
const regex = new RegExp("^" + pattern + "$");
|
|
82
|
-
dbg("compiled", { path, pattern, regex, keys });
|
|
83
|
-
return { regex, keys };
|
|
84
|
-
}
|
|
85
|
-
const records = computed(
|
|
86
|
-
() => props.routes.map((r) => {
|
|
87
|
-
const { regex, keys } = compilePattern(r.path);
|
|
88
|
-
return { ...r, regex, keys };
|
|
89
|
-
})
|
|
90
|
-
);
|
|
91
|
-
function matchPath(path) {
|
|
92
|
-
dbg("matchPath", path);
|
|
93
|
-
for (const r of records.value) {
|
|
94
|
-
const m = r.regex.exec(path);
|
|
95
|
-
dbg(" try", r.path, r.regex, !!m);
|
|
96
|
-
if (m) {
|
|
97
|
-
const params = {};
|
|
98
|
-
r.keys.forEach(
|
|
99
|
-
(k, i) => params[k] = decodeURIComponent(m[i + 1] || "")
|
|
100
|
-
);
|
|
101
|
-
return { record: r, params };
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
return null;
|
|
105
|
-
}
|
|
106
|
-
function setCurrent(path) {
|
|
107
|
-
dbg("setCurrent", path);
|
|
108
|
-
const m = matchPath(path) || matchPath(props.routes[0]?.path || "/");
|
|
109
|
-
if (!m) return;
|
|
110
|
-
component.value = m.record.component;
|
|
111
|
-
const [pathOnly, queryString] = path.split("?");
|
|
112
|
-
const queryParams = {};
|
|
113
|
-
if (queryString) {
|
|
114
|
-
const params = new URLSearchParams(queryString);
|
|
115
|
-
params.forEach((value, key) => {
|
|
116
|
-
queryParams[key] = value;
|
|
117
|
-
});
|
|
118
|
-
}
|
|
119
|
-
route.value = {
|
|
120
|
-
path: pathOnly || path,
|
|
121
|
-
params: m.params,
|
|
122
|
-
query: queryParams
|
|
123
|
-
// Only use query params from the current path, not from nuxtRoute
|
|
124
|
-
};
|
|
125
|
-
dbg("current", route.value);
|
|
126
|
-
dbg("calling navigated hook with", { path: pathOnly || path, params: m.params });
|
|
127
|
-
hooks.callHook("navigated", { path: pathOnly || path, params: m.params });
|
|
128
|
-
}
|
|
129
|
-
function readFromHost() {
|
|
130
|
-
if (props.mode === "query") {
|
|
131
|
-
const p = nuxtRoute.query?.[props.base];
|
|
132
|
-
dbg("readFromHost(query)", p);
|
|
133
|
-
return typeof p === "string" ? p : null;
|
|
134
|
-
}
|
|
135
|
-
if (props.mode === "hash") {
|
|
136
|
-
const h = (typeof window !== "undefined" ? window.location.hash : "") || "";
|
|
137
|
-
const key = `#${props.base}=`;
|
|
138
|
-
const idx = h.indexOf(key);
|
|
139
|
-
dbg("readFromHost(hash)", h);
|
|
140
|
-
return idx >= 0 ? h.slice(idx + key.length) : null;
|
|
141
|
-
}
|
|
142
|
-
return null;
|
|
143
|
-
}
|
|
144
|
-
async function writeToHost(path, replace2 = false) {
|
|
145
|
-
dbg("writeToHost", path, { replace: replace2, mode: props.mode });
|
|
146
|
-
const prevPath = route.value.path;
|
|
147
|
-
dbg("current path before write:", prevPath, "new path:", path);
|
|
148
|
-
if (props.mode === "query") {
|
|
149
|
-
const [pathOnly, queryString] = path.split("?");
|
|
150
|
-
const pathQuery = {};
|
|
151
|
-
if (queryString) {
|
|
152
|
-
const params = new URLSearchParams(queryString);
|
|
153
|
-
params.forEach((value, key) => {
|
|
154
|
-
pathQuery[key] = value;
|
|
155
|
-
});
|
|
156
|
-
}
|
|
157
|
-
const nextQuery = { [props.base]: pathOnly, ...pathQuery };
|
|
158
|
-
if (nuxtRoute.query?.[props.base] === pathOnly && !queryString) {
|
|
159
|
-
setCurrent(path);
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
await (replace2 ? nuxtRouter.replace({ query: nextQuery }) : nuxtRouter.push({ query: nextQuery }));
|
|
163
|
-
return;
|
|
164
|
-
}
|
|
165
|
-
if (props.mode === "hash" && typeof window !== "undefined") {
|
|
166
|
-
const key = `#${props.base}=`;
|
|
167
|
-
const nextHash = key + path;
|
|
168
|
-
if (window.location.hash !== nextHash) {
|
|
169
|
-
if (replace2) {
|
|
170
|
-
const url = window.location.href.replace(/#.*/, "") + nextHash;
|
|
171
|
-
window.history.replaceState(null, "", url);
|
|
172
|
-
} else {
|
|
173
|
-
window.location.hash = nextHash;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
setCurrent(path);
|
|
177
|
-
return;
|
|
178
|
-
}
|
|
179
|
-
setCurrent(path);
|
|
180
|
-
}
|
|
181
|
-
async function push(path) {
|
|
182
|
-
await writeToHost(path, false);
|
|
183
|
-
}
|
|
184
|
-
async function replace(path) {
|
|
185
|
-
await writeToHost(path, true);
|
|
186
|
-
}
|
|
187
|
-
function makePath(patternOrPath, params) {
|
|
188
|
-
const hasDyn = /:[^/]+/.test(patternOrPath);
|
|
189
|
-
if (!hasDyn) return patternOrPath;
|
|
190
|
-
const replaced = patternOrPath.replace(/:([^/]+)/g, (_m, key) => {
|
|
191
|
-
const v = params?.[key];
|
|
192
|
-
return encodeURIComponent(v == null ? "" : String(v));
|
|
193
|
-
});
|
|
194
|
-
return replaced.replace(/\/{2,}/g, "/");
|
|
195
|
-
}
|
|
196
|
-
function makeHref(patternOrPath, params) {
|
|
197
|
-
const path = makePath(patternOrPath, params);
|
|
198
|
-
if (props.mode === "query") return `?${props.base}=${path}`;
|
|
199
|
-
if (props.mode === "hash") return `#${props.base}=${path}`;
|
|
200
|
-
return path;
|
|
201
|
-
}
|
|
202
|
-
async function pushTo(patternOrPath, params) {
|
|
203
|
-
const path = makePath(patternOrPath, params);
|
|
204
|
-
await push(path);
|
|
205
|
-
}
|
|
206
|
-
async function replaceTo(patternOrPath, params) {
|
|
207
|
-
const path = makePath(patternOrPath, params);
|
|
208
|
-
await replace(path);
|
|
209
|
-
}
|
|
210
|
-
const exposed = { push, replace, route, makePath, makeHref, pushTo, replaceTo, hooks };
|
|
211
|
-
provide(props.provideKey, exposed);
|
|
212
|
-
const initialPath = readFromHost() || props.initial || props.routes[0]?.path || "/";
|
|
213
|
-
dbg("init", { initialPath });
|
|
214
|
-
writeToHost(initialPath, true);
|
|
215
|
-
watch(
|
|
216
|
-
() => ({
|
|
217
|
-
q: nuxtRoute.query?.[props.base],
|
|
218
|
-
h: typeof window !== "undefined" ? window.location.hash : ""
|
|
219
|
-
}),
|
|
220
|
-
() => {
|
|
221
|
-
const path = readFromHost();
|
|
222
|
-
dbg("watch change detected ->", path);
|
|
223
|
-
if (path) setCurrent(path);
|
|
224
|
-
}
|
|
225
|
-
);
|
|
226
|
-
return { component, route, push, replace, makePath, makeHref, pushTo, replaceTo, hooks };
|
|
227
|
-
}
|
|
228
|
-
export default useComponentRouter;
|
|
229
|
-
export function createComponentRoutes(glob, options) {
|
|
230
|
-
const base = options?.base || "";
|
|
231
|
-
const toPath = (key) => {
|
|
232
|
-
let p = key.replace(/^\.\//, "/").replace(/\.(vue|tsx?|jsx?)$/, "");
|
|
233
|
-
p = p.replace(/\/index$/, "");
|
|
234
|
-
p = p.replace(/\[(.+?)\]/g, ":$1");
|
|
235
|
-
if (!p.startsWith("/")) p = "/" + p;
|
|
236
|
-
if (base) {
|
|
237
|
-
const b = base.startsWith("/") ? base : "/" + base;
|
|
238
|
-
p = (b + (p === "/" ? "" : p)).replace(/\/+/, "/");
|
|
239
|
-
}
|
|
240
|
-
return p || "/";
|
|
241
|
-
};
|
|
242
|
-
return Object.entries(glob).map(([key, loader]) => ({
|
|
243
|
-
path: toPath(key),
|
|
244
|
-
component: defineAsyncComponent(
|
|
245
|
-
() => loader().then((m) => m.default || m)
|
|
246
|
-
)
|
|
247
|
-
}));
|
|
248
|
-
}
|