@gurpreetmahi/easy.ui 0.0.0-stage → 0.2.1
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/README.md +72 -2
- package/dist/easy.ui.css +2 -0
- package/dist/favicon.svg +1 -0
- package/dist/icons.svg +24 -0
- package/dist/index.cjs +1 -0
- package/dist/index.js +1139 -0
- package/package.json +55 -4
package/dist/index.js
ADDED
|
@@ -0,0 +1,1139 @@
|
|
|
1
|
+
import { Fragment as e, jsx as t, jsxs as n } from "react/jsx-runtime";
|
|
2
|
+
import { createContext as r, useCallback as i, useContext as a, useEffect as o, useId as s, useMemo as c, useRef as l, useState as u } from "react";
|
|
3
|
+
import { createPortal as d } from "react-dom";
|
|
4
|
+
// src/ribbon/RibbonButton.tsx
|
|
5
|
+
function f({ label: e, icon: r, size: i = "regular", className: a, ...o }) {
|
|
6
|
+
return /* @__PURE__ */ n("button", {
|
|
7
|
+
type: "button",
|
|
8
|
+
className: [
|
|
9
|
+
"ribbon-button",
|
|
10
|
+
`ribbon-button--${i}`,
|
|
11
|
+
a
|
|
12
|
+
].filter(Boolean).join(" "),
|
|
13
|
+
...o,
|
|
14
|
+
children: [r ? /* @__PURE__ */ t("span", {
|
|
15
|
+
className: "ribbon-button__icon",
|
|
16
|
+
"aria-hidden": "true",
|
|
17
|
+
children: r
|
|
18
|
+
}) : null, /* @__PURE__ */ t("span", {
|
|
19
|
+
className: "ribbon-button__label",
|
|
20
|
+
children: e
|
|
21
|
+
})]
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
// src/ribbon/RibbonCarousel.tsx
|
|
25
|
+
function p({ parents: e, activeParentId: r, defaultParentId: i, visibleItems: a = 3, onParentChange: o, onItemClick: s }) {
|
|
26
|
+
let c = Math.max(1, Math.floor(a)), l = e.filter((e) => !e.disabled), d = e.find((e) => !e.disabled), p = e.some((e) => e.id === i && !e.disabled) ? i : d?.id, [m, h] = u(p), [g, _] = u({
|
|
27
|
+
parentId: p,
|
|
28
|
+
index: 0
|
|
29
|
+
}), v = r ?? m, y = e.find((e) => e.id === v && !e.disabled) ?? d, b = l.findIndex((e) => e.id === y?.id), x = l.length > 1, S = y?.children ?? [], C = Math.max(1, Math.ceil(S.length / c)), w = g.parentId === y?.id ? Math.min(g.index, C - 1) : 0, T = S.slice(w * c, (w + 1) * c);
|
|
30
|
+
function E(e) {
|
|
31
|
+
r === void 0 && h(e.id), _({
|
|
32
|
+
parentId: e.id,
|
|
33
|
+
index: 0
|
|
34
|
+
}), o?.(e.id);
|
|
35
|
+
}
|
|
36
|
+
function D(e) {
|
|
37
|
+
if (!x || b < 0) return;
|
|
38
|
+
let t = Math.min(l.length - 1, Math.max(0, b + e)), n = l[t];
|
|
39
|
+
n && n.id !== y?.id && E(n);
|
|
40
|
+
}
|
|
41
|
+
return e.length === 0 ? /* @__PURE__ */ t("p", {
|
|
42
|
+
className: "ribbon-carousel__empty",
|
|
43
|
+
children: "No carousel parents available."
|
|
44
|
+
}) : /* @__PURE__ */ n("div", {
|
|
45
|
+
className: "ribbon-carousel",
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ n("div", {
|
|
48
|
+
className: "ribbon-carousel__parent-nav",
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ t("button", {
|
|
51
|
+
type: "button",
|
|
52
|
+
className: "ribbon-carousel__parent-arrow",
|
|
53
|
+
disabled: !x || b <= 0,
|
|
54
|
+
"aria-label": "Previous parent group",
|
|
55
|
+
onClick: () => D(-1),
|
|
56
|
+
children: "‹"
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ t("div", {
|
|
59
|
+
className: "ribbon-carousel__parents",
|
|
60
|
+
role: "tablist",
|
|
61
|
+
"aria-label": "Carousel parents",
|
|
62
|
+
children: e.map((e) => /* @__PURE__ */ n("button", {
|
|
63
|
+
type: "button",
|
|
64
|
+
role: "tab",
|
|
65
|
+
className: ["ribbon-carousel__parent", e.id === y?.id ? "is-active" : ""].filter(Boolean).join(" "),
|
|
66
|
+
disabled: e.disabled,
|
|
67
|
+
"aria-selected": e.id === y?.id,
|
|
68
|
+
onClick: () => E(e),
|
|
69
|
+
children: [e.icon ? /* @__PURE__ */ t("span", {
|
|
70
|
+
"aria-hidden": "true",
|
|
71
|
+
children: e.icon
|
|
72
|
+
}) : null, /* @__PURE__ */ t("span", { children: e.label })]
|
|
73
|
+
}, e.id))
|
|
74
|
+
}),
|
|
75
|
+
/* @__PURE__ */ t("button", {
|
|
76
|
+
type: "button",
|
|
77
|
+
className: "ribbon-carousel__parent-arrow",
|
|
78
|
+
disabled: !x || b < 0 || b >= l.length - 1,
|
|
79
|
+
"aria-label": "Next parent group",
|
|
80
|
+
onClick: () => D(1),
|
|
81
|
+
children: "›"
|
|
82
|
+
})
|
|
83
|
+
]
|
|
84
|
+
}),
|
|
85
|
+
/* @__PURE__ */ n("div", {
|
|
86
|
+
className: "ribbon-carousel__items-row",
|
|
87
|
+
children: [
|
|
88
|
+
/* @__PURE__ */ t("button", {
|
|
89
|
+
type: "button",
|
|
90
|
+
className: "ribbon-carousel__arrow",
|
|
91
|
+
disabled: w === 0,
|
|
92
|
+
"aria-label": "Previous carousel items",
|
|
93
|
+
onClick: () => _({
|
|
94
|
+
parentId: y?.id,
|
|
95
|
+
index: Math.max(0, w - 1)
|
|
96
|
+
}),
|
|
97
|
+
children: "‹"
|
|
98
|
+
}),
|
|
99
|
+
/* @__PURE__ */ n("div", {
|
|
100
|
+
className: "ribbon-carousel__items",
|
|
101
|
+
role: "tabpanel",
|
|
102
|
+
"aria-live": "polite",
|
|
103
|
+
children: [T.map((e) => /* @__PURE__ */ t(f, {
|
|
104
|
+
className: "ribbon-carousel__item",
|
|
105
|
+
label: e.label,
|
|
106
|
+
icon: e.icon,
|
|
107
|
+
size: e.size ?? "compact",
|
|
108
|
+
disabled: e.disabled,
|
|
109
|
+
onClick: () => {
|
|
110
|
+
e.onClick?.(e.id), y && s?.(e, y.id);
|
|
111
|
+
}
|
|
112
|
+
}, `${y?.id ?? "parent"}-${e.id}`)), T.length === 0 ? /* @__PURE__ */ t("span", {
|
|
113
|
+
className: "ribbon-carousel__empty",
|
|
114
|
+
children: "No items for this parent."
|
|
115
|
+
}) : null]
|
|
116
|
+
}),
|
|
117
|
+
/* @__PURE__ */ t("button", {
|
|
118
|
+
type: "button",
|
|
119
|
+
className: "ribbon-carousel__arrow",
|
|
120
|
+
disabled: w >= C - 1,
|
|
121
|
+
"aria-label": "Next carousel items",
|
|
122
|
+
onClick: () => _({
|
|
123
|
+
parentId: y?.id,
|
|
124
|
+
index: Math.min(C - 1, w + 1)
|
|
125
|
+
}),
|
|
126
|
+
children: "›"
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ n("div", {
|
|
131
|
+
className: "ribbon-carousel__status",
|
|
132
|
+
"aria-hidden": "true",
|
|
133
|
+
children: [
|
|
134
|
+
w + 1,
|
|
135
|
+
" / ",
|
|
136
|
+
C
|
|
137
|
+
]
|
|
138
|
+
})
|
|
139
|
+
]
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
// src/ribbon/RibbonDropdown.tsx
|
|
143
|
+
function m({ label: e, icon: r, size: i = "regular", disabled: a, options: c, onSelect: f }) {
|
|
144
|
+
let [p, m] = u(!1), h = l(null), g = l(null), _ = l(null), [v, y] = u({
|
|
145
|
+
top: 0,
|
|
146
|
+
left: 0,
|
|
147
|
+
width: 170
|
|
148
|
+
}), b = s();
|
|
149
|
+
function x() {
|
|
150
|
+
if (!g.current) return;
|
|
151
|
+
let e = g.current.getBoundingClientRect(), t = Math.max(e.width, 170), n = Math.max(44, c.length * 38 + 12), r = window.innerHeight - e.bottom < n && e.top > n ? e.top - n - 4 : e.bottom + 4;
|
|
152
|
+
y({
|
|
153
|
+
top: Math.max(8, r),
|
|
154
|
+
left: Math.max(8, Math.min(e.left, window.innerWidth - t - 8)),
|
|
155
|
+
width: t
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
return o(() => {
|
|
159
|
+
function e(e) {
|
|
160
|
+
if (!h.current) return;
|
|
161
|
+
let t = e.target, n = h.current.contains(t), r = _.current?.contains(t);
|
|
162
|
+
!n && !r && m(!1);
|
|
163
|
+
}
|
|
164
|
+
function t(e) {
|
|
165
|
+
e.key === "Escape" && m(!1);
|
|
166
|
+
}
|
|
167
|
+
return document.addEventListener("mousedown", e), document.addEventListener("keydown", t), () => {
|
|
168
|
+
document.removeEventListener("mousedown", e), document.removeEventListener("keydown", t);
|
|
169
|
+
};
|
|
170
|
+
}, []), o(() => {
|
|
171
|
+
if (!p) return;
|
|
172
|
+
x();
|
|
173
|
+
function e() {
|
|
174
|
+
x();
|
|
175
|
+
}
|
|
176
|
+
return window.addEventListener("resize", e), window.addEventListener("scroll", e, !0), () => {
|
|
177
|
+
window.removeEventListener("resize", e), window.removeEventListener("scroll", e, !0);
|
|
178
|
+
};
|
|
179
|
+
}, [p, c.length]), /* @__PURE__ */ n("div", {
|
|
180
|
+
ref: h,
|
|
181
|
+
className: [
|
|
182
|
+
"ribbon-dropdown",
|
|
183
|
+
`ribbon-dropdown--${i}`,
|
|
184
|
+
p ? "is-open" : ""
|
|
185
|
+
].filter(Boolean).join(" "),
|
|
186
|
+
children: [/* @__PURE__ */ n("button", {
|
|
187
|
+
ref: g,
|
|
188
|
+
type: "button",
|
|
189
|
+
className: [
|
|
190
|
+
"ribbon-button",
|
|
191
|
+
`ribbon-button--${i}`,
|
|
192
|
+
"ribbon-dropdown__trigger"
|
|
193
|
+
].filter(Boolean).join(" "),
|
|
194
|
+
disabled: a,
|
|
195
|
+
"aria-haspopup": "menu",
|
|
196
|
+
"aria-expanded": p,
|
|
197
|
+
"aria-controls": b,
|
|
198
|
+
onClick: () => m((e) => !e),
|
|
199
|
+
children: [/* @__PURE__ */ n("span", {
|
|
200
|
+
className: "ribbon-dropdown__head",
|
|
201
|
+
children: [r ? /* @__PURE__ */ t("span", {
|
|
202
|
+
className: "ribbon-button__icon",
|
|
203
|
+
"aria-hidden": "true",
|
|
204
|
+
children: r
|
|
205
|
+
}) : null, /* @__PURE__ */ t("span", {
|
|
206
|
+
className: "ribbon-button__label",
|
|
207
|
+
children: e
|
|
208
|
+
})]
|
|
209
|
+
}), /* @__PURE__ */ t("span", {
|
|
210
|
+
className: "ribbon-dropdown__caret",
|
|
211
|
+
"aria-hidden": "true",
|
|
212
|
+
children: "▾"
|
|
213
|
+
})]
|
|
214
|
+
}), p ? d(/* @__PURE__ */ t("ul", {
|
|
215
|
+
id: b,
|
|
216
|
+
ref: _,
|
|
217
|
+
role: "menu",
|
|
218
|
+
className: "ribbon-dropdown__menu ribbon-dropdown__menu--portal",
|
|
219
|
+
"aria-label": `${e} options`,
|
|
220
|
+
style: {
|
|
221
|
+
top: `${v.top}px`,
|
|
222
|
+
left: `${v.left}px`,
|
|
223
|
+
width: `${v.width}px`
|
|
224
|
+
},
|
|
225
|
+
children: c.map((e) => /* @__PURE__ */ t("li", {
|
|
226
|
+
role: "none",
|
|
227
|
+
className: "ribbon-dropdown__menu-item",
|
|
228
|
+
children: /* @__PURE__ */ n("button", {
|
|
229
|
+
type: "button",
|
|
230
|
+
role: "menuitem",
|
|
231
|
+
className: "ribbon-dropdown__option-button",
|
|
232
|
+
onClick: () => {
|
|
233
|
+
f(e.id), m(!1);
|
|
234
|
+
},
|
|
235
|
+
children: [/* @__PURE__ */ t("span", {
|
|
236
|
+
className: "ribbon-dropdown__option-icon",
|
|
237
|
+
"aria-hidden": "true",
|
|
238
|
+
children: e.icon ?? "•"
|
|
239
|
+
}), /* @__PURE__ */ t("span", {
|
|
240
|
+
className: "ribbon-dropdown__option-label",
|
|
241
|
+
children: e.label
|
|
242
|
+
})]
|
|
243
|
+
})
|
|
244
|
+
}, e.id))
|
|
245
|
+
}), document.body) : null]
|
|
246
|
+
});
|
|
247
|
+
}
|
|
248
|
+
// src/ribbon/Ribbon.tsx
|
|
249
|
+
function h({ tabs: e, groups: r, activeTabId: i, onTabChange: a, onItemClick: o, className: s, ariaLabel: c = "Application ribbon" }) {
|
|
250
|
+
return /* @__PURE__ */ n("section", {
|
|
251
|
+
className: ["ribbon", s].filter(Boolean).join(" "),
|
|
252
|
+
"aria-label": c,
|
|
253
|
+
children: [/* @__PURE__ */ t("nav", {
|
|
254
|
+
className: "ribbon__tabbar",
|
|
255
|
+
"aria-label": "Ribbon tabs",
|
|
256
|
+
children: e.map((e) => /* @__PURE__ */ t("button", {
|
|
257
|
+
type: "button",
|
|
258
|
+
className: e.id === i ? "ribbon__tab is-active" : "ribbon__tab",
|
|
259
|
+
onClick: () => a(e.id),
|
|
260
|
+
"aria-selected": e.id === i,
|
|
261
|
+
role: "tab",
|
|
262
|
+
children: e.label
|
|
263
|
+
}, e.id))
|
|
264
|
+
}), /* @__PURE__ */ t("div", {
|
|
265
|
+
className: "ribbon__surface",
|
|
266
|
+
role: "tabpanel",
|
|
267
|
+
"aria-label": `${i} commands`,
|
|
268
|
+
children: r.map((e) => /* @__PURE__ */ n("section", {
|
|
269
|
+
className: "ribbon__group",
|
|
270
|
+
"aria-label": e.title,
|
|
271
|
+
children: [
|
|
272
|
+
/* @__PURE__ */ t("div", {
|
|
273
|
+
className: "ribbon__group-items",
|
|
274
|
+
children: (e.items ?? []).map((e) => e.options && e.options.length > 0 ? /* @__PURE__ */ t(m, {
|
|
275
|
+
label: e.label,
|
|
276
|
+
icon: e.icon,
|
|
277
|
+
size: e.size,
|
|
278
|
+
disabled: e.disabled,
|
|
279
|
+
options: e.options,
|
|
280
|
+
onSelect: (t) => {
|
|
281
|
+
e.onClick?.(e.id), o?.(e, t);
|
|
282
|
+
}
|
|
283
|
+
}, e.id) : /* @__PURE__ */ t(f, {
|
|
284
|
+
label: e.label,
|
|
285
|
+
icon: e.icon,
|
|
286
|
+
size: e.size,
|
|
287
|
+
disabled: e.disabled,
|
|
288
|
+
onClick: () => {
|
|
289
|
+
e.onClick?.(e.id), o?.(e);
|
|
290
|
+
}
|
|
291
|
+
}, e.id))
|
|
292
|
+
}),
|
|
293
|
+
e.carousel ? /* @__PURE__ */ t(p, {
|
|
294
|
+
...e.carousel,
|
|
295
|
+
onItemClick: (e, t) => o?.(e, void 0, t)
|
|
296
|
+
}) : null,
|
|
297
|
+
/* @__PURE__ */ t("h3", {
|
|
298
|
+
className: "ribbon__group-title",
|
|
299
|
+
children: e.title
|
|
300
|
+
})
|
|
301
|
+
]
|
|
302
|
+
}, e.id))
|
|
303
|
+
})]
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
// src/ribbon/RibbonSplitButton.tsx
|
|
307
|
+
function g({ size: e = "regular", className: r, upperLabel: i, upperIcon: a, upperButtonProps: o, lowerLabel: s, lowerIcon: c, lowerButtonProps: l }) {
|
|
308
|
+
return /* @__PURE__ */ n("div", {
|
|
309
|
+
className: [
|
|
310
|
+
"ribbon-split-button",
|
|
311
|
+
`ribbon-split-button--${e}`,
|
|
312
|
+
r
|
|
313
|
+
].filter(Boolean).join(" "),
|
|
314
|
+
role: "group",
|
|
315
|
+
"aria-label": `${i} and ${s}`,
|
|
316
|
+
children: [/* @__PURE__ */ n("button", {
|
|
317
|
+
type: "button",
|
|
318
|
+
className: "ribbon-split-button__half ribbon-split-button__half--upper",
|
|
319
|
+
...o,
|
|
320
|
+
children: [a ? /* @__PURE__ */ t("span", {
|
|
321
|
+
className: "ribbon-split-button__icon",
|
|
322
|
+
"aria-hidden": "true",
|
|
323
|
+
children: a
|
|
324
|
+
}) : null, /* @__PURE__ */ t("span", {
|
|
325
|
+
className: "ribbon-split-button__label",
|
|
326
|
+
children: i
|
|
327
|
+
})]
|
|
328
|
+
}), /* @__PURE__ */ n("button", {
|
|
329
|
+
type: "button",
|
|
330
|
+
className: "ribbon-split-button__half ribbon-split-button__half--lower",
|
|
331
|
+
...l,
|
|
332
|
+
children: [c ? /* @__PURE__ */ t("span", {
|
|
333
|
+
className: "ribbon-split-button__icon",
|
|
334
|
+
"aria-hidden": "true",
|
|
335
|
+
children: c
|
|
336
|
+
}) : null, /* @__PURE__ */ t("span", {
|
|
337
|
+
className: "ribbon-split-button__label",
|
|
338
|
+
children: s
|
|
339
|
+
})]
|
|
340
|
+
})]
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
// src/easy-connectors/client.ts
|
|
344
|
+
var _ = class {
|
|
345
|
+
baseUrl;
|
|
346
|
+
apiKey;
|
|
347
|
+
constructor(e, t) {
|
|
348
|
+
this.baseUrl = e, this.apiKey = t;
|
|
349
|
+
}
|
|
350
|
+
async listConnectors() {
|
|
351
|
+
return this.request("/api/connectors");
|
|
352
|
+
}
|
|
353
|
+
async getConnector(e) {
|
|
354
|
+
return this.request(`/api/connectors/${encodeURIComponent(e)}`);
|
|
355
|
+
}
|
|
356
|
+
async createConnector(e) {
|
|
357
|
+
return this.request("/api/connectors", {
|
|
358
|
+
method: "POST",
|
|
359
|
+
body: JSON.stringify(e)
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
async updateConnector(e, t) {
|
|
363
|
+
return this.request(`/api/connectors/${encodeURIComponent(e)}`, {
|
|
364
|
+
method: "PUT",
|
|
365
|
+
body: JSON.stringify(t)
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
async deleteConnector(e) {
|
|
369
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}`, { method: "DELETE" });
|
|
370
|
+
}
|
|
371
|
+
async enableConnector(e) {
|
|
372
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}/enable`, { method: "POST" });
|
|
373
|
+
}
|
|
374
|
+
async disableConnector(e) {
|
|
375
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}/disable`, { method: "POST" });
|
|
376
|
+
}
|
|
377
|
+
async runConnector(e) {
|
|
378
|
+
await this.request(`/api/connectors/${encodeURIComponent(e)}/run`, { method: "POST" });
|
|
379
|
+
}
|
|
380
|
+
async getRuns(e, t = 20) {
|
|
381
|
+
return this.request(`/api/connectors/${encodeURIComponent(e)}/runs?take=${Math.min(100, Math.max(1, t))}`);
|
|
382
|
+
}
|
|
383
|
+
async request(e, t) {
|
|
384
|
+
let n = new Headers(t?.headers);
|
|
385
|
+
n.set("Accept", "application/json"), t?.body && n.set("Content-Type", "application/json"), this.apiKey && n.set("X-Api-Key", this.apiKey);
|
|
386
|
+
let r = await fetch(new URL(e, this.baseUrl), {
|
|
387
|
+
...t,
|
|
388
|
+
headers: n
|
|
389
|
+
});
|
|
390
|
+
if (!r.ok) {
|
|
391
|
+
let e = `${r.status} ${r.statusText}`;
|
|
392
|
+
try {
|
|
393
|
+
let t = await r.json();
|
|
394
|
+
t.errors && t.errors.length > 0 && (e = t.errors.join("; "));
|
|
395
|
+
} catch {}
|
|
396
|
+
throw Error(e);
|
|
397
|
+
}
|
|
398
|
+
if (r.status !== 204) return await r.json();
|
|
399
|
+
}
|
|
400
|
+
}, v = r(null);
|
|
401
|
+
function y({ baseUrl: e = "http://localhost:5088", apiKey: n, client: r, children: i }) {
|
|
402
|
+
let a = c(() => ({ client: r ?? new _(e, n) }), [
|
|
403
|
+
n,
|
|
404
|
+
e,
|
|
405
|
+
r
|
|
406
|
+
]);
|
|
407
|
+
return /* @__PURE__ */ t(v.Provider, {
|
|
408
|
+
value: a,
|
|
409
|
+
children: i
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
function b() {
|
|
413
|
+
let e = a(v);
|
|
414
|
+
if (!e) throw Error("useEasyConnectors must be used within EasyConnectorsProvider.");
|
|
415
|
+
return e;
|
|
416
|
+
}
|
|
417
|
+
// src/easy-connectors/ConnectorKindIcon.tsx
|
|
418
|
+
function x(e) {
|
|
419
|
+
return /* @__PURE__ */ t("svg", {
|
|
420
|
+
viewBox: "0 0 24 24",
|
|
421
|
+
fill: "none",
|
|
422
|
+
stroke: "currentColor",
|
|
423
|
+
strokeWidth: "1.8",
|
|
424
|
+
strokeLinecap: "round",
|
|
425
|
+
strokeLinejoin: "round",
|
|
426
|
+
"aria-hidden": "true",
|
|
427
|
+
...e
|
|
428
|
+
});
|
|
429
|
+
}
|
|
430
|
+
function S() {
|
|
431
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("path", { d: "M3.5 8.2h6.1l1.5 1.8h9.4" }), /* @__PURE__ */ t("path", { d: "M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z" })] });
|
|
432
|
+
}
|
|
433
|
+
function C() {
|
|
434
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("rect", {
|
|
435
|
+
x: "4",
|
|
436
|
+
y: "5",
|
|
437
|
+
width: "16",
|
|
438
|
+
height: "14",
|
|
439
|
+
rx: "1.5"
|
|
440
|
+
}), /* @__PURE__ */ t("path", { d: "M4 10h16M9.5 5v14M14.5 5v14" })] });
|
|
441
|
+
}
|
|
442
|
+
function w() {
|
|
443
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("path", { d: "M9 12h6" }), /* @__PURE__ */ t("path", { d: "m13 9 3 3-3 3" })] });
|
|
444
|
+
}
|
|
445
|
+
function T() {
|
|
446
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("rect", {
|
|
447
|
+
x: "8",
|
|
448
|
+
y: "11",
|
|
449
|
+
width: "8",
|
|
450
|
+
height: "7",
|
|
451
|
+
rx: "1.2"
|
|
452
|
+
}), /* @__PURE__ */ t("path", { d: "M10 11V9a2 2 0 1 1 4 0v2" })] });
|
|
453
|
+
}
|
|
454
|
+
function E({ kind: r, className: i, ...a }) {
|
|
455
|
+
return /* @__PURE__ */ n(x, {
|
|
456
|
+
className: ["ec-kind-icon", i].filter(Boolean).join(" "),
|
|
457
|
+
...a,
|
|
458
|
+
children: [
|
|
459
|
+
r === "FolderToFolder" ? /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t(S, {}), /* @__PURE__ */ t(w, {})] }) : null,
|
|
460
|
+
r === "FolderToTable" ? /* @__PURE__ */ n(e, { children: [
|
|
461
|
+
/* @__PURE__ */ t(S, {}),
|
|
462
|
+
/* @__PURE__ */ t(w, {}),
|
|
463
|
+
/* @__PURE__ */ t("path", { d: "M17 6.5h3" }),
|
|
464
|
+
/* @__PURE__ */ t("path", { d: "M18.5 5v3" })
|
|
465
|
+
] }) : null,
|
|
466
|
+
r === "TableToFolder" ? /* @__PURE__ */ n(e, { children: [
|
|
467
|
+
/* @__PURE__ */ t(C, {}),
|
|
468
|
+
/* @__PURE__ */ t("path", { d: "M7 12h10" }),
|
|
469
|
+
/* @__PURE__ */ t("path", { d: "m11 9-3 3 3 3" }),
|
|
470
|
+
/* @__PURE__ */ t(S, {})
|
|
471
|
+
] }) : null,
|
|
472
|
+
r === "FolderToSftp" ? /* @__PURE__ */ n(e, { children: [
|
|
473
|
+
/* @__PURE__ */ t(S, {}),
|
|
474
|
+
/* @__PURE__ */ t(w, {}),
|
|
475
|
+
/* @__PURE__ */ t(T, {})
|
|
476
|
+
] }) : null,
|
|
477
|
+
r === "SftpToFolder" ? /* @__PURE__ */ n(e, { children: [
|
|
478
|
+
/* @__PURE__ */ t(T, {}),
|
|
479
|
+
/* @__PURE__ */ t("path", { d: "M8 12h6" }),
|
|
480
|
+
/* @__PURE__ */ t("path", { d: "m11 9-3 3 3 3" }),
|
|
481
|
+
/* @__PURE__ */ t(S, {})
|
|
482
|
+
] }) : null
|
|
483
|
+
]
|
|
484
|
+
});
|
|
485
|
+
}
|
|
486
|
+
// src/easy-connectors/EndpointKindIcon.tsx
|
|
487
|
+
function D(e) {
|
|
488
|
+
return /* @__PURE__ */ t("svg", {
|
|
489
|
+
viewBox: "0 0 24 24",
|
|
490
|
+
fill: "none",
|
|
491
|
+
stroke: "currentColor",
|
|
492
|
+
strokeWidth: "1.8",
|
|
493
|
+
strokeLinecap: "round",
|
|
494
|
+
strokeLinejoin: "round",
|
|
495
|
+
"aria-hidden": "true",
|
|
496
|
+
...e
|
|
497
|
+
});
|
|
498
|
+
}
|
|
499
|
+
function O() {
|
|
500
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("path", { d: "M3.5 8.2h6.1l1.5 1.8h9.4" }), /* @__PURE__ */ t("path", { d: "M3.5 8.2v8.8a1.5 1.5 0 0 0 1.5 1.5h14a1.5 1.5 0 0 0 1.5-1.5V10a1.8 1.8 0 0 0-1.8-1.8H3.5Z" })] });
|
|
501
|
+
}
|
|
502
|
+
function k() {
|
|
503
|
+
return /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ t("rect", {
|
|
504
|
+
x: "4",
|
|
505
|
+
y: "5",
|
|
506
|
+
width: "16",
|
|
507
|
+
height: "14",
|
|
508
|
+
rx: "1.5"
|
|
509
|
+
}), /* @__PURE__ */ t("path", { d: "M4 10h16M9.5 5v14M14.5 5v14" })] });
|
|
510
|
+
}
|
|
511
|
+
function A() {
|
|
512
|
+
return /* @__PURE__ */ n(e, { children: [
|
|
513
|
+
/* @__PURE__ */ t("rect", {
|
|
514
|
+
x: "8",
|
|
515
|
+
y: "11",
|
|
516
|
+
width: "8",
|
|
517
|
+
height: "7",
|
|
518
|
+
rx: "1.2"
|
|
519
|
+
}),
|
|
520
|
+
/* @__PURE__ */ t("path", { d: "M10 11V9a2 2 0 1 1 4 0v2" }),
|
|
521
|
+
/* @__PURE__ */ t("path", { d: "M3 17h3" }),
|
|
522
|
+
/* @__PURE__ */ t("path", { d: "M18 17h3" })
|
|
523
|
+
] });
|
|
524
|
+
}
|
|
525
|
+
function j({ endpoint: e, className: r, ...i }) {
|
|
526
|
+
return /* @__PURE__ */ n(D, {
|
|
527
|
+
className: ["ec-endpoint-icon", r].filter(Boolean).join(" "),
|
|
528
|
+
...i,
|
|
529
|
+
children: [
|
|
530
|
+
e === "Folder" ? /* @__PURE__ */ t(O, {}) : null,
|
|
531
|
+
e === "Table" ? /* @__PURE__ */ t(k, {}) : null,
|
|
532
|
+
e === "Sftp" ? /* @__PURE__ */ t(A, {}) : null
|
|
533
|
+
]
|
|
534
|
+
});
|
|
535
|
+
}
|
|
536
|
+
// src/easy-connectors/connector-flow.ts
|
|
537
|
+
function M(e) {
|
|
538
|
+
switch (e) {
|
|
539
|
+
case "FolderToFolder": return {
|
|
540
|
+
source: "Folder",
|
|
541
|
+
destination: "Folder"
|
|
542
|
+
};
|
|
543
|
+
case "FolderToTable": return {
|
|
544
|
+
source: "Folder",
|
|
545
|
+
destination: "Table"
|
|
546
|
+
};
|
|
547
|
+
case "TableToFolder": return {
|
|
548
|
+
source: "Table",
|
|
549
|
+
destination: "Folder"
|
|
550
|
+
};
|
|
551
|
+
case "FolderToSftp": return {
|
|
552
|
+
source: "Folder",
|
|
553
|
+
destination: "Sftp"
|
|
554
|
+
};
|
|
555
|
+
case "SftpToFolder": return {
|
|
556
|
+
source: "Sftp",
|
|
557
|
+
destination: "Folder"
|
|
558
|
+
};
|
|
559
|
+
default: return {
|
|
560
|
+
source: "Folder",
|
|
561
|
+
destination: "Folder"
|
|
562
|
+
};
|
|
563
|
+
}
|
|
564
|
+
}
|
|
565
|
+
// src/easy-connectors/ConnectorBoard.tsx
|
|
566
|
+
function N({ selectedConnectorId: e, refreshToken: r, onSelect: a, onCreate: s }) {
|
|
567
|
+
let { client: c } = b(), [l, d] = u([]), [f, p] = u(!1), [m, h] = u(null), g = i(async () => {
|
|
568
|
+
p(!0), h(null);
|
|
569
|
+
try {
|
|
570
|
+
d(await c.listConnectors());
|
|
571
|
+
} catch (e) {
|
|
572
|
+
h(e instanceof Error ? e.message : "Failed to load connectors.");
|
|
573
|
+
} finally {
|
|
574
|
+
p(!1);
|
|
575
|
+
}
|
|
576
|
+
}, [c]);
|
|
577
|
+
o(() => {
|
|
578
|
+
g();
|
|
579
|
+
}, [g, r]);
|
|
580
|
+
async function _(e) {
|
|
581
|
+
h(null);
|
|
582
|
+
try {
|
|
583
|
+
await e(), await g();
|
|
584
|
+
} catch (e) {
|
|
585
|
+
h(e instanceof Error ? e.message : "Action failed.");
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
return /* @__PURE__ */ n("section", {
|
|
589
|
+
className: "ec-board",
|
|
590
|
+
children: [
|
|
591
|
+
/* @__PURE__ */ n("header", {
|
|
592
|
+
className: "ec-board__header",
|
|
593
|
+
children: [/* @__PURE__ */ t("h2", { children: "Connectors" }), /* @__PURE__ */ n("div", {
|
|
594
|
+
className: "ec-board__header-actions",
|
|
595
|
+
children: [/* @__PURE__ */ t("button", {
|
|
596
|
+
type: "button",
|
|
597
|
+
onClick: g,
|
|
598
|
+
children: "Refresh"
|
|
599
|
+
}), /* @__PURE__ */ t("button", {
|
|
600
|
+
type: "button",
|
|
601
|
+
className: "ec-primary",
|
|
602
|
+
onClick: s,
|
|
603
|
+
children: "New"
|
|
604
|
+
})]
|
|
605
|
+
})]
|
|
606
|
+
}),
|
|
607
|
+
m ? /* @__PURE__ */ t("p", {
|
|
608
|
+
className: "ec-error",
|
|
609
|
+
children: m
|
|
610
|
+
}) : null,
|
|
611
|
+
f ? /* @__PURE__ */ t("p", {
|
|
612
|
+
className: "ec-muted",
|
|
613
|
+
children: "Loading..."
|
|
614
|
+
}) : null,
|
|
615
|
+
/* @__PURE__ */ t("ul", {
|
|
616
|
+
className: "ec-board__list",
|
|
617
|
+
children: l.map((r) => (() => {
|
|
618
|
+
let i = M(r.kind);
|
|
619
|
+
return /* @__PURE__ */ n("li", {
|
|
620
|
+
className: ["ec-board__item", e === r.id ? "is-selected" : ""].filter(Boolean).join(" "),
|
|
621
|
+
children: [/* @__PURE__ */ n("button", {
|
|
622
|
+
type: "button",
|
|
623
|
+
className: "ec-board__item-main",
|
|
624
|
+
onClick: () => r.id && a?.(r.id),
|
|
625
|
+
children: [
|
|
626
|
+
/* @__PURE__ */ n("span", {
|
|
627
|
+
className: "ec-board__name-row",
|
|
628
|
+
children: [/* @__PURE__ */ t(E, { kind: r.kind }), /* @__PURE__ */ t("span", {
|
|
629
|
+
className: "ec-board__name",
|
|
630
|
+
children: r.name
|
|
631
|
+
})]
|
|
632
|
+
}),
|
|
633
|
+
/* @__PURE__ */ n("span", {
|
|
634
|
+
className: "ec-flow",
|
|
635
|
+
"aria-label": `Flow ${i.source} to ${i.destination}`,
|
|
636
|
+
children: [
|
|
637
|
+
/* @__PURE__ */ n("span", {
|
|
638
|
+
className: "ec-flow__node",
|
|
639
|
+
children: [/* @__PURE__ */ t(j, { endpoint: i.source }), /* @__PURE__ */ t("span", { children: i.source })]
|
|
640
|
+
}),
|
|
641
|
+
/* @__PURE__ */ t("span", {
|
|
642
|
+
className: "ec-flow__arrow",
|
|
643
|
+
"aria-hidden": "true",
|
|
644
|
+
children: "->"
|
|
645
|
+
}),
|
|
646
|
+
/* @__PURE__ */ n("span", {
|
|
647
|
+
className: "ec-flow__connector",
|
|
648
|
+
children: [/* @__PURE__ */ t(E, {
|
|
649
|
+
kind: r.kind,
|
|
650
|
+
className: "ec-kind-icon--chip"
|
|
651
|
+
}), /* @__PURE__ */ t("span", { children: "Connector" })]
|
|
652
|
+
}),
|
|
653
|
+
/* @__PURE__ */ t("span", {
|
|
654
|
+
className: "ec-flow__arrow",
|
|
655
|
+
"aria-hidden": "true",
|
|
656
|
+
children: "->"
|
|
657
|
+
}),
|
|
658
|
+
/* @__PURE__ */ n("span", {
|
|
659
|
+
className: "ec-flow__node",
|
|
660
|
+
children: [/* @__PURE__ */ t(j, { endpoint: i.destination }), /* @__PURE__ */ t("span", { children: i.destination })]
|
|
661
|
+
})
|
|
662
|
+
]
|
|
663
|
+
}),
|
|
664
|
+
/* @__PURE__ */ t("span", {
|
|
665
|
+
className: `ec-status ec-status--${(r.status ?? "Idle").toLowerCase()}`,
|
|
666
|
+
children: r.status ?? "Idle"
|
|
667
|
+
})
|
|
668
|
+
]
|
|
669
|
+
}), /* @__PURE__ */ n("div", {
|
|
670
|
+
className: "ec-board__item-actions",
|
|
671
|
+
children: [/* @__PURE__ */ t("button", {
|
|
672
|
+
type: "button",
|
|
673
|
+
onClick: () => r.id && _(() => c.runConnector(r.id)),
|
|
674
|
+
children: "Run now"
|
|
675
|
+
}), /* @__PURE__ */ t("button", {
|
|
676
|
+
type: "button",
|
|
677
|
+
onClick: () => r.id && _(() => r.status === "Disabled" ? c.enableConnector(r.id) : c.disableConnector(r.id)),
|
|
678
|
+
children: r.status === "Disabled" ? "Enable" : "Disable"
|
|
679
|
+
})]
|
|
680
|
+
})]
|
|
681
|
+
}, r.id);
|
|
682
|
+
})())
|
|
683
|
+
}),
|
|
684
|
+
l.length === 0 && !f ? /* @__PURE__ */ t("p", {
|
|
685
|
+
className: "ec-muted",
|
|
686
|
+
children: "No connectors yet. Create one to start transferring."
|
|
687
|
+
}) : null
|
|
688
|
+
]
|
|
689
|
+
});
|
|
690
|
+
}
|
|
691
|
+
// src/easy-connectors/ConnectorForm.tsx
|
|
692
|
+
var P = [
|
|
693
|
+
"FolderToFolder",
|
|
694
|
+
"FolderToTable",
|
|
695
|
+
"TableToFolder",
|
|
696
|
+
"FolderToSftp",
|
|
697
|
+
"SftpToFolder"
|
|
698
|
+
], F = ["Copy", "Move"], I = [
|
|
699
|
+
"Manual",
|
|
700
|
+
"Interval",
|
|
701
|
+
"Daily",
|
|
702
|
+
"OnCreated",
|
|
703
|
+
"OnUpdated"
|
|
704
|
+
], L = ["Sqlite", "SqlServer"];
|
|
705
|
+
function R() {
|
|
706
|
+
return {
|
|
707
|
+
name: "New connector",
|
|
708
|
+
kind: "FolderToFolder",
|
|
709
|
+
mode: "Copy",
|
|
710
|
+
triggers: ["Manual"],
|
|
711
|
+
sourcePath: "",
|
|
712
|
+
destinationPath: "",
|
|
713
|
+
recursive: !0,
|
|
714
|
+
overwrite: !0,
|
|
715
|
+
skipEmptyFiles: !0,
|
|
716
|
+
continueOnError: !0,
|
|
717
|
+
intervalMinutes: 15,
|
|
718
|
+
provider: "SqlServer",
|
|
719
|
+
tableName: ""
|
|
720
|
+
};
|
|
721
|
+
}
|
|
722
|
+
function z({ connectorId: r, onSaved: i }) {
|
|
723
|
+
let { client: a } = b(), [s, l] = u(R()), [d, f] = u(""), [p, m] = u(!1), [h, g] = u(!1), [_, v] = u(null), [y, x] = u(null);
|
|
724
|
+
o(() => {
|
|
725
|
+
if (!r) {
|
|
726
|
+
l(R()), f(""), v(null), x(null);
|
|
727
|
+
return;
|
|
728
|
+
}
|
|
729
|
+
let e = !1;
|
|
730
|
+
return m(!0), v(null), a.getConnector(r).then((t) => {
|
|
731
|
+
e || (l(t), f((t.keyColumns ?? []).join(", ")));
|
|
732
|
+
}).catch((t) => {
|
|
733
|
+
e || v(t instanceof Error ? t.message : "Failed to load connector.");
|
|
734
|
+
}).finally(() => {
|
|
735
|
+
e || m(!1);
|
|
736
|
+
}), () => {
|
|
737
|
+
e = !0;
|
|
738
|
+
};
|
|
739
|
+
}, [a, r]);
|
|
740
|
+
let S = c(() => M(s.kind), [s.kind]);
|
|
741
|
+
function C(e, t) {
|
|
742
|
+
l((n) => ({
|
|
743
|
+
...n,
|
|
744
|
+
[e]: t
|
|
745
|
+
}));
|
|
746
|
+
}
|
|
747
|
+
function w(e) {
|
|
748
|
+
l((t) => {
|
|
749
|
+
let n = t.triggers.includes(e) ? t.triggers.filter((t) => t !== e) : [...t.triggers, e];
|
|
750
|
+
return {
|
|
751
|
+
...t,
|
|
752
|
+
triggers: n
|
|
753
|
+
};
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
async function T() {
|
|
757
|
+
g(!0), v(null), x(null);
|
|
758
|
+
let e = {
|
|
759
|
+
...s,
|
|
760
|
+
keyColumns: d.split(",").map((e) => e.trim()).filter(Boolean)
|
|
761
|
+
};
|
|
762
|
+
try {
|
|
763
|
+
let t = r ? await a.updateConnector(r, e) : await a.createConnector(e);
|
|
764
|
+
l(t), f((t.keyColumns ?? []).join(", ")), x("Connector saved."), i?.(t);
|
|
765
|
+
} catch (e) {
|
|
766
|
+
v(e instanceof Error ? e.message : "Save failed.");
|
|
767
|
+
} finally {
|
|
768
|
+
g(!1);
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
function D(r) {
|
|
772
|
+
return r === "source" ? /* @__PURE__ */ n(e, { children: [
|
|
773
|
+
/* @__PURE__ */ n("label", { children: ["Source path", /* @__PURE__ */ t("input", {
|
|
774
|
+
value: s.sourcePath ?? "",
|
|
775
|
+
onChange: (e) => C("sourcePath", e.target.value)
|
|
776
|
+
})] }),
|
|
777
|
+
/* @__PURE__ */ n("label", { children: ["Pattern", /* @__PURE__ */ t("input", {
|
|
778
|
+
value: s.pattern ?? "",
|
|
779
|
+
onChange: (e) => C("pattern", e.target.value)
|
|
780
|
+
})] }),
|
|
781
|
+
/* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("span", { children: "Recursive" }), /* @__PURE__ */ t("input", {
|
|
782
|
+
type: "checkbox",
|
|
783
|
+
checked: s.recursive ?? !1,
|
|
784
|
+
onChange: (e) => C("recursive", e.target.checked)
|
|
785
|
+
})] })
|
|
786
|
+
] }) : /* @__PURE__ */ n(e, { children: [/* @__PURE__ */ n("label", { children: ["Destination path", /* @__PURE__ */ t("input", {
|
|
787
|
+
value: s.destinationPath ?? "",
|
|
788
|
+
onChange: (e) => C("destinationPath", e.target.value)
|
|
789
|
+
})] }), /* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("span", { children: "Overwrite" }), /* @__PURE__ */ t("input", {
|
|
790
|
+
type: "checkbox",
|
|
791
|
+
checked: s.overwrite ?? !1,
|
|
792
|
+
onChange: (e) => C("overwrite", e.target.checked)
|
|
793
|
+
})] })] });
|
|
794
|
+
}
|
|
795
|
+
function O() {
|
|
796
|
+
return /* @__PURE__ */ n(e, { children: [
|
|
797
|
+
/* @__PURE__ */ n("label", { children: ["Provider", /* @__PURE__ */ t("select", {
|
|
798
|
+
value: s.provider ?? "SqlServer",
|
|
799
|
+
onChange: (e) => C("provider", e.target.value),
|
|
800
|
+
children: L.map((e) => /* @__PURE__ */ t("option", {
|
|
801
|
+
value: e,
|
|
802
|
+
children: e
|
|
803
|
+
}, e))
|
|
804
|
+
})] }),
|
|
805
|
+
/* @__PURE__ */ n("label", { children: ["Table name", /* @__PURE__ */ t("input", {
|
|
806
|
+
value: s.tableName ?? "",
|
|
807
|
+
onChange: (e) => C("tableName", e.target.value)
|
|
808
|
+
})] }),
|
|
809
|
+
/* @__PURE__ */ n("label", { children: ["Schema", /* @__PURE__ */ t("input", {
|
|
810
|
+
value: s.schema ?? "",
|
|
811
|
+
onChange: (e) => C("schema", e.target.value)
|
|
812
|
+
})] }),
|
|
813
|
+
/* @__PURE__ */ n("label", { children: ["Key columns (comma separated)", /* @__PURE__ */ t("input", {
|
|
814
|
+
value: d,
|
|
815
|
+
onChange: (e) => f(e.target.value)
|
|
816
|
+
})] }),
|
|
817
|
+
/* @__PURE__ */ n("label", {
|
|
818
|
+
className: "ec-grid__wide",
|
|
819
|
+
children: ["Connection string", /* @__PURE__ */ t("input", {
|
|
820
|
+
value: s.connectionString ?? "",
|
|
821
|
+
onChange: (e) => C("connectionString", e.target.value)
|
|
822
|
+
})]
|
|
823
|
+
}),
|
|
824
|
+
/* @__PURE__ */ n("label", {
|
|
825
|
+
className: "ec-grid__wide",
|
|
826
|
+
children: ["Where clause", /* @__PURE__ */ t("input", {
|
|
827
|
+
value: s.whereClause ?? "",
|
|
828
|
+
onChange: (e) => C("whereClause", e.target.value)
|
|
829
|
+
})]
|
|
830
|
+
})
|
|
831
|
+
] });
|
|
832
|
+
}
|
|
833
|
+
function k(r) {
|
|
834
|
+
return /* @__PURE__ */ n(e, { children: [
|
|
835
|
+
/* @__PURE__ */ n("label", { children: ["SFTP host", /* @__PURE__ */ t("input", {
|
|
836
|
+
value: s.sftpHost ?? "",
|
|
837
|
+
onChange: (e) => C("sftpHost", e.target.value)
|
|
838
|
+
})] }),
|
|
839
|
+
/* @__PURE__ */ n("label", { children: ["Port", /* @__PURE__ */ t("input", {
|
|
840
|
+
type: "number",
|
|
841
|
+
min: 1,
|
|
842
|
+
value: s.sftpPort ?? 22,
|
|
843
|
+
onChange: (e) => C("sftpPort", Number(e.target.value) || 22)
|
|
844
|
+
})] }),
|
|
845
|
+
/* @__PURE__ */ n("label", { children: ["Remote path", /* @__PURE__ */ t("input", {
|
|
846
|
+
value: s.remotePath ?? "",
|
|
847
|
+
onChange: (e) => C("remotePath", e.target.value)
|
|
848
|
+
})] }),
|
|
849
|
+
/* @__PURE__ */ n("label", { children: ["Username", /* @__PURE__ */ t("input", {
|
|
850
|
+
value: s.sftpUsername ?? "",
|
|
851
|
+
onChange: (e) => C("sftpUsername", e.target.value)
|
|
852
|
+
})] }),
|
|
853
|
+
/* @__PURE__ */ n("label", { children: ["Password", /* @__PURE__ */ t("input", {
|
|
854
|
+
type: "password",
|
|
855
|
+
value: s.sftpPassword ?? "",
|
|
856
|
+
onChange: (e) => C("sftpPassword", e.target.value)
|
|
857
|
+
})] }),
|
|
858
|
+
/* @__PURE__ */ n("label", { children: ["Private key path", /* @__PURE__ */ t("input", {
|
|
859
|
+
value: s.privateKeyPath ?? "",
|
|
860
|
+
onChange: (e) => C("privateKeyPath", e.target.value)
|
|
861
|
+
})] }),
|
|
862
|
+
/* @__PURE__ */ n("label", {
|
|
863
|
+
className: "ec-grid__wide",
|
|
864
|
+
children: ["Host key SHA256", /* @__PURE__ */ t("input", {
|
|
865
|
+
value: s.hostKeySha256 ?? "",
|
|
866
|
+
onChange: (e) => C("hostKeySha256", e.target.value)
|
|
867
|
+
})]
|
|
868
|
+
}),
|
|
869
|
+
/* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("span", { children: "Accept any host key" }), /* @__PURE__ */ t("input", {
|
|
870
|
+
type: "checkbox",
|
|
871
|
+
checked: s.acceptAnyHostKey ?? !1,
|
|
872
|
+
onChange: (e) => C("acceptAnyHostKey", e.target.checked)
|
|
873
|
+
})] }),
|
|
874
|
+
r === "destination" ? /* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("span", { children: "Overwrite" }), /* @__PURE__ */ t("input", {
|
|
875
|
+
type: "checkbox",
|
|
876
|
+
checked: s.overwrite ?? !1,
|
|
877
|
+
onChange: (e) => C("overwrite", e.target.checked)
|
|
878
|
+
})] }) : null
|
|
879
|
+
] });
|
|
880
|
+
}
|
|
881
|
+
function A(e, t) {
|
|
882
|
+
return e === "Folder" ? D(t) : e === "Table" ? O() : k(t);
|
|
883
|
+
}
|
|
884
|
+
function N(e) {
|
|
885
|
+
return e === "Sftp" ? "SFTP" : e;
|
|
886
|
+
}
|
|
887
|
+
return /* @__PURE__ */ n("section", {
|
|
888
|
+
className: "ec-form",
|
|
889
|
+
children: [
|
|
890
|
+
/* @__PURE__ */ t("header", {
|
|
891
|
+
className: "ec-form__header",
|
|
892
|
+
children: /* @__PURE__ */ t("h3", { children: r ? "Edit connector" : "Create connector" })
|
|
893
|
+
}),
|
|
894
|
+
p ? /* @__PURE__ */ t("p", {
|
|
895
|
+
className: "ec-muted",
|
|
896
|
+
children: "Loading connector..."
|
|
897
|
+
}) : null,
|
|
898
|
+
_ ? /* @__PURE__ */ t("p", {
|
|
899
|
+
className: "ec-error",
|
|
900
|
+
children: _
|
|
901
|
+
}) : null,
|
|
902
|
+
y ? /* @__PURE__ */ t("p", {
|
|
903
|
+
className: "ec-success",
|
|
904
|
+
children: y
|
|
905
|
+
}) : null,
|
|
906
|
+
/* @__PURE__ */ n("div", {
|
|
907
|
+
className: "ec-grid ec-grid--meta",
|
|
908
|
+
children: [
|
|
909
|
+
/* @__PURE__ */ n("label", { children: ["Name", /* @__PURE__ */ t("input", {
|
|
910
|
+
value: s.name,
|
|
911
|
+
onChange: (e) => C("name", e.target.value)
|
|
912
|
+
})] }),
|
|
913
|
+
/* @__PURE__ */ n("label", { children: [
|
|
914
|
+
"Kind",
|
|
915
|
+
/* @__PURE__ */ t("select", {
|
|
916
|
+
value: s.kind,
|
|
917
|
+
onChange: (e) => C("kind", e.target.value),
|
|
918
|
+
children: P.map((e) => /* @__PURE__ */ t("option", {
|
|
919
|
+
value: e,
|
|
920
|
+
children: e
|
|
921
|
+
}, e))
|
|
922
|
+
}),
|
|
923
|
+
/* @__PURE__ */ n("span", {
|
|
924
|
+
className: "ec-kind-preview",
|
|
925
|
+
children: [/* @__PURE__ */ t(E, { kind: s.kind }), s.kind]
|
|
926
|
+
}),
|
|
927
|
+
/* @__PURE__ */ n("span", {
|
|
928
|
+
className: "ec-flow ec-flow--compact",
|
|
929
|
+
"aria-label": `Flow ${S.source} to ${S.destination}`,
|
|
930
|
+
children: [
|
|
931
|
+
/* @__PURE__ */ n("span", {
|
|
932
|
+
className: "ec-flow__node",
|
|
933
|
+
children: [/* @__PURE__ */ t(j, { endpoint: S.source }), /* @__PURE__ */ t("span", { children: S.source })]
|
|
934
|
+
}),
|
|
935
|
+
/* @__PURE__ */ t("span", {
|
|
936
|
+
className: "ec-flow__arrow",
|
|
937
|
+
"aria-hidden": "true",
|
|
938
|
+
children: "->"
|
|
939
|
+
}),
|
|
940
|
+
/* @__PURE__ */ n("span", {
|
|
941
|
+
className: "ec-flow__connector",
|
|
942
|
+
children: [/* @__PURE__ */ t(E, {
|
|
943
|
+
kind: s.kind,
|
|
944
|
+
className: "ec-kind-icon--chip"
|
|
945
|
+
}), /* @__PURE__ */ t("span", { children: "Connector" })]
|
|
946
|
+
}),
|
|
947
|
+
/* @__PURE__ */ t("span", {
|
|
948
|
+
className: "ec-flow__arrow",
|
|
949
|
+
"aria-hidden": "true",
|
|
950
|
+
children: "->"
|
|
951
|
+
}),
|
|
952
|
+
/* @__PURE__ */ n("span", {
|
|
953
|
+
className: "ec-flow__node",
|
|
954
|
+
children: [/* @__PURE__ */ t(j, { endpoint: S.destination }), /* @__PURE__ */ t("span", { children: S.destination })]
|
|
955
|
+
})
|
|
956
|
+
]
|
|
957
|
+
})
|
|
958
|
+
] }),
|
|
959
|
+
/* @__PURE__ */ n("label", { children: ["Mode", /* @__PURE__ */ t("select", {
|
|
960
|
+
value: s.mode,
|
|
961
|
+
onChange: (e) => C("mode", e.target.value),
|
|
962
|
+
children: F.map((e) => /* @__PURE__ */ t("option", {
|
|
963
|
+
value: e,
|
|
964
|
+
children: e
|
|
965
|
+
}, e))
|
|
966
|
+
})] })
|
|
967
|
+
]
|
|
968
|
+
}),
|
|
969
|
+
/* @__PURE__ */ n("div", {
|
|
970
|
+
className: "ec-endpoint-grid",
|
|
971
|
+
children: [/* @__PURE__ */ n("section", {
|
|
972
|
+
className: "ec-endpoint-panel",
|
|
973
|
+
children: [/* @__PURE__ */ n("header", {
|
|
974
|
+
className: "ec-endpoint-panel__header",
|
|
975
|
+
children: [/* @__PURE__ */ t(j, { endpoint: S.source }), /* @__PURE__ */ n("h4", { children: [
|
|
976
|
+
"Source config (",
|
|
977
|
+
N(S.source),
|
|
978
|
+
")"
|
|
979
|
+
] })]
|
|
980
|
+
}), /* @__PURE__ */ t("div", {
|
|
981
|
+
className: "ec-grid ec-grid--endpoint",
|
|
982
|
+
children: A(S.source, "source")
|
|
983
|
+
})]
|
|
984
|
+
}), /* @__PURE__ */ n("section", {
|
|
985
|
+
className: "ec-endpoint-panel",
|
|
986
|
+
children: [/* @__PURE__ */ n("header", {
|
|
987
|
+
className: "ec-endpoint-panel__header",
|
|
988
|
+
children: [/* @__PURE__ */ t(j, { endpoint: S.destination }), /* @__PURE__ */ n("h4", { children: [
|
|
989
|
+
"Destination config (",
|
|
990
|
+
N(S.destination),
|
|
991
|
+
")"
|
|
992
|
+
] })]
|
|
993
|
+
}), /* @__PURE__ */ t("div", {
|
|
994
|
+
className: "ec-grid ec-grid--endpoint",
|
|
995
|
+
children: A(S.destination, "destination")
|
|
996
|
+
})]
|
|
997
|
+
})]
|
|
998
|
+
}),
|
|
999
|
+
/* @__PURE__ */ n("fieldset", {
|
|
1000
|
+
className: "ec-form__fieldset",
|
|
1001
|
+
children: [/* @__PURE__ */ t("legend", { children: "Triggers" }), /* @__PURE__ */ t("div", {
|
|
1002
|
+
className: "ec-check-row",
|
|
1003
|
+
children: I.map((e) => /* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("input", {
|
|
1004
|
+
type: "checkbox",
|
|
1005
|
+
checked: s.triggers.includes(e),
|
|
1006
|
+
onChange: () => w(e)
|
|
1007
|
+
}), e] }, e))
|
|
1008
|
+
})]
|
|
1009
|
+
}),
|
|
1010
|
+
/* @__PURE__ */ n("fieldset", {
|
|
1011
|
+
className: "ec-form__fieldset",
|
|
1012
|
+
children: [/* @__PURE__ */ t("legend", { children: "Options" }), /* @__PURE__ */ n("div", {
|
|
1013
|
+
className: "ec-check-row",
|
|
1014
|
+
children: [
|
|
1015
|
+
/* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("input", {
|
|
1016
|
+
type: "checkbox",
|
|
1017
|
+
checked: s.skipEmptyFiles ?? !1,
|
|
1018
|
+
onChange: (e) => C("skipEmptyFiles", e.target.checked)
|
|
1019
|
+
}), "Skip empty files"] }),
|
|
1020
|
+
/* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("input", {
|
|
1021
|
+
type: "checkbox",
|
|
1022
|
+
checked: s.continueOnError ?? !1,
|
|
1023
|
+
onChange: (e) => C("continueOnError", e.target.checked)
|
|
1024
|
+
}), "Continue on error"] }),
|
|
1025
|
+
/* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("input", {
|
|
1026
|
+
type: "number",
|
|
1027
|
+
min: 1,
|
|
1028
|
+
value: s.intervalMinutes ?? 15,
|
|
1029
|
+
onChange: (e) => C("intervalMinutes", Number(e.target.value) || 1)
|
|
1030
|
+
}), "Interval minutes"] }),
|
|
1031
|
+
/* @__PURE__ */ n("label", { children: [/* @__PURE__ */ t("input", {
|
|
1032
|
+
type: "time",
|
|
1033
|
+
value: s.dailyTimeLocal ?? "",
|
|
1034
|
+
onChange: (e) => C("dailyTimeLocal", e.target.value)
|
|
1035
|
+
}), "Daily time (local)"] })
|
|
1036
|
+
]
|
|
1037
|
+
})]
|
|
1038
|
+
}),
|
|
1039
|
+
/* @__PURE__ */ t("footer", {
|
|
1040
|
+
className: "ec-form__footer",
|
|
1041
|
+
children: /* @__PURE__ */ t("button", {
|
|
1042
|
+
type: "button",
|
|
1043
|
+
className: "ec-primary",
|
|
1044
|
+
onClick: T,
|
|
1045
|
+
disabled: h,
|
|
1046
|
+
children: h ? "Saving..." : "Save connector"
|
|
1047
|
+
})
|
|
1048
|
+
})
|
|
1049
|
+
]
|
|
1050
|
+
});
|
|
1051
|
+
}
|
|
1052
|
+
// src/easy-connectors/ConnectorRuns.tsx
|
|
1053
|
+
function B({ connectorId: e, take: r = 20 }) {
|
|
1054
|
+
let { client: i } = b(), [a, s] = u([]), [c, l] = u(null), [d, f] = u(!1);
|
|
1055
|
+
return o(() => {
|
|
1056
|
+
if (!e) {
|
|
1057
|
+
s([]);
|
|
1058
|
+
return;
|
|
1059
|
+
}
|
|
1060
|
+
let t = !1;
|
|
1061
|
+
return f(!0), l(null), i.getRuns(e, r).then((e) => {
|
|
1062
|
+
t || s(e);
|
|
1063
|
+
}).catch((e) => {
|
|
1064
|
+
t || l(e instanceof Error ? e.message : "Failed to load runs.");
|
|
1065
|
+
}).finally(() => {
|
|
1066
|
+
t || f(!1);
|
|
1067
|
+
}), () => {
|
|
1068
|
+
t = !0;
|
|
1069
|
+
};
|
|
1070
|
+
}, [
|
|
1071
|
+
i,
|
|
1072
|
+
e,
|
|
1073
|
+
r
|
|
1074
|
+
]), /* @__PURE__ */ n("section", {
|
|
1075
|
+
className: "ec-runs",
|
|
1076
|
+
children: [
|
|
1077
|
+
/* @__PURE__ */ t("header", {
|
|
1078
|
+
className: "ec-runs__header",
|
|
1079
|
+
children: /* @__PURE__ */ t("h3", { children: "Recent runs" })
|
|
1080
|
+
}),
|
|
1081
|
+
e ? null : /* @__PURE__ */ t("p", {
|
|
1082
|
+
className: "ec-muted",
|
|
1083
|
+
children: "Select a connector to view run history."
|
|
1084
|
+
}),
|
|
1085
|
+
d ? /* @__PURE__ */ t("p", {
|
|
1086
|
+
className: "ec-muted",
|
|
1087
|
+
children: "Loading runs..."
|
|
1088
|
+
}) : null,
|
|
1089
|
+
c ? /* @__PURE__ */ t("p", {
|
|
1090
|
+
className: "ec-error",
|
|
1091
|
+
children: c
|
|
1092
|
+
}) : null,
|
|
1093
|
+
e && a.length > 0 ? /* @__PURE__ */ t("div", {
|
|
1094
|
+
className: "ec-table-wrap",
|
|
1095
|
+
children: /* @__PURE__ */ n("table", {
|
|
1096
|
+
className: "ec-table",
|
|
1097
|
+
children: [/* @__PURE__ */ t("thead", { children: /* @__PURE__ */ n("tr", { children: [
|
|
1098
|
+
/* @__PURE__ */ t("th", { children: "Status" }),
|
|
1099
|
+
/* @__PURE__ */ t("th", { children: "Started" }),
|
|
1100
|
+
/* @__PURE__ */ t("th", { children: "Transferred" }),
|
|
1101
|
+
/* @__PURE__ */ t("th", { children: "Skipped" }),
|
|
1102
|
+
/* @__PURE__ */ t("th", { children: "Failed" })
|
|
1103
|
+
] }) }), /* @__PURE__ */ t("tbody", { children: a.map((e) => /* @__PURE__ */ n("tr", { children: [
|
|
1104
|
+
/* @__PURE__ */ t("td", { children: e.status }),
|
|
1105
|
+
/* @__PURE__ */ t("td", { children: new Date(e.startedUtc).toLocaleString() }),
|
|
1106
|
+
/* @__PURE__ */ t("td", { children: e.transferred }),
|
|
1107
|
+
/* @__PURE__ */ t("td", { children: e.skipped }),
|
|
1108
|
+
/* @__PURE__ */ t("td", { children: e.failed })
|
|
1109
|
+
] }, e.id)) })]
|
|
1110
|
+
})
|
|
1111
|
+
}) : null
|
|
1112
|
+
]
|
|
1113
|
+
});
|
|
1114
|
+
}
|
|
1115
|
+
// src/easy-connectors/EasyConnectorsApp.tsx
|
|
1116
|
+
function V({ className: e }) {
|
|
1117
|
+
let [r, i] = u(void 0), [a, o] = u(0);
|
|
1118
|
+
return /* @__PURE__ */ n("section", {
|
|
1119
|
+
className: ["ec-app", e].filter(Boolean).join(" "),
|
|
1120
|
+
children: [/* @__PURE__ */ t("div", {
|
|
1121
|
+
className: "ec-app__left",
|
|
1122
|
+
children: /* @__PURE__ */ t(N, {
|
|
1123
|
+
selectedConnectorId: r,
|
|
1124
|
+
onSelect: i,
|
|
1125
|
+
onCreate: () => i(void 0),
|
|
1126
|
+
refreshToken: a
|
|
1127
|
+
})
|
|
1128
|
+
}), /* @__PURE__ */ n("div", {
|
|
1129
|
+
className: "ec-app__right",
|
|
1130
|
+
children: [/* @__PURE__ */ t(z, {
|
|
1131
|
+
connectorId: r,
|
|
1132
|
+
onSaved: (e) => {
|
|
1133
|
+
i(e.id), o((e) => e + 1);
|
|
1134
|
+
}
|
|
1135
|
+
}), /* @__PURE__ */ t(B, { connectorId: r })]
|
|
1136
|
+
})]
|
|
1137
|
+
});
|
|
1138
|
+
}
|
|
1139
|
+
export { N as ConnectorBoard, z as ConnectorForm, E as ConnectorKindIcon, B as ConnectorRuns, V as EasyConnectorsApp, _ as EasyConnectorsClient, y as EasyConnectorsProvider, j as EndpointKindIcon, h as Ribbon, f as RibbonButton, p as RibbonCarousel, m as RibbonDropdown, g as RibbonSplitButton, M as getConnectorFlow, b as useEasyConnectors };
|