@elixir-cloud/drs-filer 2.0.0-alpha.34

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.
Files changed (42) hide show
  1. package/LICENSE +133 -0
  2. package/README.md +48 -0
  3. package/dist/chunks/chunk.3WU6NPWM.js +1 -0
  4. package/dist/chunks/chunk.566Z3G7U.js +141 -0
  5. package/dist/chunks/chunk.I3IINMCX.js +1 -0
  6. package/dist/chunks/chunk.I4IZIBWK.js +832 -0
  7. package/dist/chunks/chunk.LZXOE4LL.js +26 -0
  8. package/dist/chunks/chunk.S3NI7NKU.js +30 -0
  9. package/dist/chunks/chunk.WP2KCEZO.js +10 -0
  10. package/dist/chunks/chunk.XGZHBPCB.js +518 -0
  11. package/dist/components/index.d.ts +1 -0
  12. package/dist/components/index.js +6 -0
  13. package/dist/components/object-create/index.d.ts +8 -0
  14. package/dist/components/object-create/index.js +5 -0
  15. package/dist/components/object-create/object-create.d.ts +59 -0
  16. package/dist/components/object-create/object-create.js +4 -0
  17. package/dist/components/object-create/tw-styles.d.ts +1 -0
  18. package/dist/components/object-create/tw-styles.js +2 -0
  19. package/dist/custom-elements.json +540 -0
  20. package/dist/events/ecc-drs-object-create-failed.d.ts +6 -0
  21. package/dist/events/ecc-drs-object-create-input-changed.d.ts +6 -0
  22. package/dist/events/ecc-drs-object-create-validation-failed.d.ts +6 -0
  23. package/dist/events/ecc-drs-object-created.d.ts +10 -0
  24. package/dist/events/ecc-drs-object-selected.d.ts +6 -0
  25. package/dist/events/ecc-drs-objects-changed.d.ts +6 -0
  26. package/dist/events/index.d.ts +6 -0
  27. package/dist/global.d.ts +1 -0
  28. package/dist/index.d.ts +1 -0
  29. package/dist/index.js +6 -0
  30. package/dist/providers/drs-filer-provider.d.ts +73 -0
  31. package/dist/providers/drs-filer-provider.js +1 -0
  32. package/dist/providers/index.d.ts +4 -0
  33. package/dist/providers/index.js +3 -0
  34. package/dist/providers/rest-drs-filer-provider.d.ts +26 -0
  35. package/dist/providers/rest-drs-filer-provider.js +2 -0
  36. package/dist/react/index.d.ts +1 -0
  37. package/dist/react/index.js +5 -0
  38. package/dist/react/object-create/index.d.ts +29 -0
  39. package/dist/react/object-create/index.js +5 -0
  40. package/dist/vscode.html-custom-data.json +17 -0
  41. package/dist/web-types.json +68 -0
  42. package/package.json +79 -0
@@ -0,0 +1,832 @@
1
+ import { ComponentStyles } from './chunk.XGZHBPCB.js';
2
+ import { RestDrsFilerProvider } from './chunk.566Z3G7U.js';
3
+ import { __decorateClass, __spreadProps, __spreadValues } from './chunk.S3NI7NKU.js';
4
+ import { css, LitElement, html } from 'lit';
5
+ import { property, state } from 'lit/decorators.js';
6
+ import '@elixir-cloud/design/components/button/index.js';
7
+ import '@elixir-cloud/design/components/input/index.js';
8
+ import '@elixir-cloud/design/components/select/index.js';
9
+ import '@elixir-cloud/design/components/label/index.js';
10
+ import '@elixir-cloud/design/components/textarea/index.js';
11
+ import '@elixir-cloud/design/components/badge/index.js';
12
+ import '@elixir-cloud/design/components/tabs/index.js';
13
+ import '@elixir-cloud/design/components/separator/index.js';
14
+ import '@elixir-cloud/design/components/checkbox/index.js';
15
+
16
+ var GlobalStyles = css`
17
+ :host {
18
+ --background: var(--ecc-background, oklch(1 0 0));
19
+ --foreground: var(--ecc-foreground, oklch(0.145 0 0));
20
+ --card: var(--ecc-card, oklch(1 0 0));
21
+ --card-foreground: var(--ecc-card-foreground, oklch(0.145 0 0));
22
+ --popover: var(--ecc-popover, oklch(1 0 0));
23
+ --popover-foreground: var(--ecc-popover-foreground, oklch(0.145 0 0));
24
+ --primary: var(--ecc-primary, oklch(0.205 0 0));
25
+ --primary-foreground: var(--ecc-primary-foreground, oklch(0.985 0 0));
26
+ --secondary: var(--ecc-secondary, oklch(0.97 0 0));
27
+ --secondary-foreground: var(--ecc-secondary-foreground, oklch(0.205 0 0));
28
+ --muted: var(--ecc-muted, oklch(0.97 0 0));
29
+ --muted-foreground: var(--ecc-muted-foreground, oklch(0.556 0 0));
30
+ --accent: var(--ecc-accent, oklch(0.97 0 0));
31
+ --accent-foreground: var(--ecc-accent-foreground, oklch(0.205 0 0));
32
+ --destructive: var(--ecc-destructive, oklch(0.577 0.245 27.325));
33
+ --destructive-foreground: var(
34
+ --ecc-destructive-foreground,
35
+ oklch(0.985 0 0)
36
+ );
37
+ --border: var(--ecc-border, oklch(0.922 0 0));
38
+ --input: var(--ecc-input, oklch(0.922 0 0));
39
+ --ring: var(--ecc-ring, oklch(0.708 0 0));
40
+ --chart-1: var(--ecc-chart-1, oklch(0.646 0.222 41.116));
41
+ --chart-2: var(--ecc-chart-2, oklch(0.6 0.118 184.704));
42
+ --chart-3: var(--ecc-chart-3, oklch(0.398 0.07 227.392));
43
+ --chart-4: var(--ecc-chart-4, oklch(0.828 0.189 84.429));
44
+ --chart-5: var(--ecc-chart-5, oklch(0.769 0.188 70.08));
45
+ --radius: var(--ecc-radius, 0.625rem);
46
+ --sidebar: var(--ecc-sidebar, oklch(0.985 0 0));
47
+ --sidebar-foreground: var(--ecc-sidebar-foreground, oklch(0.145 0 0));
48
+ --sidebar-primary: var(--ecc-sidebar-primary, oklch(0.205 0 0));
49
+ --sidebar-primary-foreground: var(
50
+ --ecc-sidebar-primary-foreground,
51
+ oklch(0.985 0 0)
52
+ );
53
+ --sidebar-accent: var(--ecc-sidebar-accent, oklch(0.97 0 0));
54
+ --sidebar-accent-foreground: var(
55
+ --ecc-sidebar-accent-foreground,
56
+ oklch(0.205 0 0)
57
+ );
58
+ --sidebar-border: var(--ecc-sidebar-border, oklch(0.922 0 0));
59
+ --sidebar-ring: var(--ecc-sidebar-ring, oklch(0.708 0 0));
60
+ }
61
+
62
+ :host([dark]),
63
+ :host-context([dark]),
64
+ :host-context(.dark) {
65
+ --background: var(--ecc-background, oklch(0.145 0 0));
66
+ --foreground: var(--ecc-foreground, oklch(0.985 0 0));
67
+ --card: var(--ecc-card, oklch(0.145 0 0));
68
+ --card-foreground: var(--ecc-card-foreground, oklch(0.985 0 0));
69
+ --popover: var(--ecc-popover, oklch(0.145 0 0));
70
+ --popover-foreground: var(--ecc-popover-foreground, oklch(0.985 0 0));
71
+ --primary: var(--ecc-primary, oklch(0.985 0 0));
72
+ --primary-foreground: var(--ecc-primary-foreground, oklch(0.205 0 0));
73
+ --secondary: var(--ecc-secondary, oklch(0.269 0 0));
74
+ --secondary-foreground: var(--ecc-secondary-foreground, oklch(0.985 0 0));
75
+ --muted: var(--ecc-muted, oklch(0.269 0 0));
76
+ --muted-foreground: var(--ecc-muted-foreground, oklch(0.708 0 0));
77
+ --accent: var(--ecc-accent, oklch(0.269 0 0));
78
+ --accent-foreground: var(--ecc-accent-foreground, oklch(0.985 0 0));
79
+ --destructive: var(--ecc-destructive, oklch(0.396 0.141 25.723));
80
+ --destructive-foreground: var(
81
+ --ecc-destructive-foreground,
82
+ oklch(0.637 0.237 25.331)
83
+ );
84
+ --border: var(--ecc-border, oklch(0.269 0 0));
85
+ --input: var(--ecc-input, oklch(0.269 0 0));
86
+ --ring: var(--ecc-ring, oklch(0.439 0 0));
87
+ --chart-1: var(--ecc-chart-1, oklch(0.488 0.243 264.376));
88
+ --chart-2: var(--ecc-chart-2, oklch(0.696 0.17 162.48));
89
+ --chart-3: var(--ecc-chart-3, oklch(0.769 0.188 70.08));
90
+ --chart-4: var(--ecc-chart-4, oklch(0.627 0.265 303.9));
91
+ --chart-5: var(--ecc-chart-5, oklch(0.645 0.246 16.439));
92
+ --sidebar: var(--ecc-sidebar, oklch(0.205 0 0));
93
+ --sidebar-foreground: var(--ecc-sidebar-foreground, oklch(0.985 0 0));
94
+ --sidebar-primary: var(--ecc-sidebar-primary, oklch(0.488 0.243 264.376));
95
+ --sidebar-primary-foreground: var(
96
+ --ecc-sidebar-primary-foreground,
97
+ oklch(0.985 0 0)
98
+ );
99
+ --sidebar-accent: var(--ecc-sidebar-accent, oklch(0.269 0 0));
100
+ --sidebar-accent-foreground: var(
101
+ --ecc-sidebar-accent-foreground,
102
+ oklch(0.985 0 0)
103
+ );
104
+ --sidebar-border: var(--ecc-sidebar-border, oklch(0.269 0 0));
105
+ --sidebar-ring: var(--ecc-sidebar-ring, oklch(0.439 0 0));
106
+ }
107
+ `;
108
+ var ECCClientElixirDrsFilerObjectCreate = class extends LitElement {
109
+ constructor() {
110
+ super(...arguments);
111
+ this.baseUrl = "";
112
+ this.loading = false;
113
+ this.error = null;
114
+ this.success = null;
115
+ this.formData = {
116
+ name: "",
117
+ description: "",
118
+ mimeType: "",
119
+ version: "",
120
+ aliases: [],
121
+ size: 0,
122
+ checksums: [],
123
+ accessMethods: [],
124
+ contents: []
125
+ };
126
+ this.objectType = "blob";
127
+ this._provider = null;
128
+ }
129
+ async firstUpdated() {
130
+ if (!this.baseUrl && !this.provider) {
131
+ this.error = "Please provide either a base URL for the DRS API or a custom provider.";
132
+ return;
133
+ }
134
+ if (this.provider) {
135
+ this._provider = this.provider;
136
+ } else if (this.baseUrl) {
137
+ this._provider = new RestDrsFilerProvider(this.baseUrl);
138
+ } else {
139
+ this._provider = null;
140
+ }
141
+ }
142
+ updated(changedProperties) {
143
+ if (changedProperties.has("provider")) {
144
+ if (!this.provider && !this.baseUrl) {
145
+ this.error = "Please provide either a base URL for the DRS API or a custom provider.";
146
+ return;
147
+ }
148
+ if (this.provider !== this._provider) {
149
+ this._provider = this.provider || null;
150
+ }
151
+ return;
152
+ }
153
+ if (changedProperties.has("baseUrl") && !this.provider) {
154
+ if (!this.baseUrl) {
155
+ this.error = "Please provide either a base URL for the DRS API or a custom provider.";
156
+ return;
157
+ }
158
+ this._provider = new RestDrsFilerProvider(this.baseUrl);
159
+ }
160
+ }
161
+ handleInputChange(field, value) {
162
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { [field]: value });
163
+ const event = new CustomEvent("ecc-drs-object-create-input-changed", {
164
+ detail: { field, value, formData: this.formData },
165
+ bubbles: true,
166
+ composed: true
167
+ });
168
+ this.dispatchEvent(event);
169
+ }
170
+ handleArrayInputChange(field, value) {
171
+ const arrayValue = value.split(",").map((item) => item.trim()).filter((item) => item.length > 0);
172
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { [field]: arrayValue });
173
+ const event = new CustomEvent("ecc-drs-object-create-input-changed", {
174
+ detail: { field, value: arrayValue, formData: this.formData },
175
+ bubbles: true,
176
+ composed: true
177
+ });
178
+ this.dispatchEvent(event);
179
+ }
180
+ addChecksum() {
181
+ this.formData = __spreadProps(__spreadValues({}, this.formData), {
182
+ checksums: [...this.formData.checksums, { type: "md5", checksum: "" }]
183
+ });
184
+ }
185
+ removeChecksum(index) {
186
+ this.formData = __spreadProps(__spreadValues({}, this.formData), {
187
+ checksums: this.formData.checksums.filter((_, i) => i !== index)
188
+ });
189
+ }
190
+ updateChecksum(index, field, value) {
191
+ const updatedChecksums = [...this.formData.checksums];
192
+ updatedChecksums[index] = __spreadProps(__spreadValues({}, updatedChecksums[index]), { [field]: value });
193
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { checksums: updatedChecksums });
194
+ }
195
+ addAccessMethod() {
196
+ this.formData = __spreadProps(__spreadValues({}, this.formData), {
197
+ accessMethods: [
198
+ ...this.formData.accessMethods,
199
+ { type: "https", access_url: { url: "" } }
200
+ ]
201
+ });
202
+ }
203
+ removeAccessMethod(index) {
204
+ this.formData = __spreadProps(__spreadValues({}, this.formData), {
205
+ accessMethods: this.formData.accessMethods.filter((_, i) => i !== index)
206
+ });
207
+ }
208
+ updateAccessMethod(index, field, value) {
209
+ const updatedMethods = [...this.formData.accessMethods];
210
+ if (field === "url") {
211
+ updatedMethods[index] = __spreadProps(__spreadValues({}, updatedMethods[index]), {
212
+ access_url: { url: value }
213
+ });
214
+ } else {
215
+ updatedMethods[index] = __spreadProps(__spreadValues({}, updatedMethods[index]), { [field]: value });
216
+ }
217
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { accessMethods: updatedMethods });
218
+ }
219
+ async handleSubmit() {
220
+ if (!this._provider) {
221
+ this.error = "No provider available";
222
+ return;
223
+ }
224
+ if (!this.formData.name) {
225
+ this.error = "Object name is required";
226
+ const event = new CustomEvent("ecc-drs-object-create-validation-failed", {
227
+ detail: { errors: ["Object name is required"] },
228
+ bubbles: true,
229
+ composed: true
230
+ });
231
+ this.dispatchEvent(event);
232
+ return;
233
+ }
234
+ this.loading = true;
235
+ this.error = null;
236
+ this.success = null;
237
+ try {
238
+ const drsObject = {
239
+ name: this.formData.name,
240
+ description: this.formData.description || void 0,
241
+ created_time: (/* @__PURE__ */ new Date()).toISOString(),
242
+ mime_type: this.formData.mimeType || void 0,
243
+ version: this.formData.version || void 0,
244
+ aliases: this.formData.aliases.length > 0 ? this.formData.aliases : void 0,
245
+ size: this.formData.size,
246
+ checksums: this.formData.checksums,
247
+ access_methods: this.formData.accessMethods,
248
+ contents: this.objectType === "bundle" && this.formData.contents.length > 0 ? this.formData.contents.filter((content) => content.id.trim()).map((content) => ({ name: content.id, id: content.id })) : void 0
249
+ };
250
+ const objectId = await this._provider.createObject(drsObject);
251
+ this.success = `DRS object created successfully with ID: ${objectId}`;
252
+ const event = new CustomEvent("ecc-drs-object-created", {
253
+ detail: {
254
+ objectId,
255
+ objectData: drsObject,
256
+ message: this.success
257
+ },
258
+ bubbles: true,
259
+ composed: true
260
+ });
261
+ this.dispatchEvent(event);
262
+ this.resetForm();
263
+ } catch (err) {
264
+ this.error = err instanceof Error ? err.message : "Failed to create DRS object";
265
+ const event = new CustomEvent("ecc-drs-object-create-failed", {
266
+ detail: { error: this.error, formData: this.formData },
267
+ bubbles: true,
268
+ composed: true
269
+ });
270
+ this.dispatchEvent(event);
271
+ } finally {
272
+ this.loading = false;
273
+ }
274
+ }
275
+ resetForm() {
276
+ this.formData = {
277
+ name: "",
278
+ description: "",
279
+ mimeType: "",
280
+ version: "",
281
+ aliases: [],
282
+ size: 0,
283
+ checksums: [],
284
+ accessMethods: [],
285
+ contents: []
286
+ };
287
+ this.objectType = "blob";
288
+ this.error = null;
289
+ this.success = null;
290
+ }
291
+ renderBasicFields() {
292
+ return html`
293
+ <div class="space-y-4">
294
+ <h3 class="text-lg font-medium">Basic Information</h3>
295
+
296
+ ${this.error ? html`
297
+ <div
298
+ class="p-4 border border-destructive rounded-md text-destructive-foreground bg-destructive/10"
299
+ >
300
+ ${this.error}
301
+ </div>
302
+ ` : ""}
303
+ ${this.success ? html`
304
+ <div
305
+ class="p-4 border border-primary rounded-md text-primary-foreground bg-primary/10"
306
+ >
307
+ ${this.success}
308
+ </div>
309
+ ` : ""}
310
+
311
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
312
+ <div>
313
+ <ecc-utils-design-label for="object-name"
314
+ >Object Name *</ecc-utils-design-label
315
+ >
316
+ <ecc-utils-design-input
317
+ id="object-name"
318
+ placeholder="Enter object name"
319
+ .value=${this.formData.name}
320
+ @ecc-input-changed=${(e) => this.handleInputChange("name", e.detail.value)}
321
+ ></ecc-utils-design-input>
322
+ </div>
323
+
324
+ <div>
325
+ <ecc-utils-design-label for="object-type"
326
+ >Object Type</ecc-utils-design-label
327
+ >
328
+ <ecc-utils-design-select
329
+ id="object-type"
330
+ .value=${this.objectType}
331
+ @ecc-input-changed=${(e) => {
332
+ this.objectType = e.detail.value;
333
+ }}
334
+ >
335
+ <ecc-utils-design-select-trigger>
336
+ <ecc-utils-design-select-value
337
+ placeholder="Select object type"
338
+ ></ecc-utils-design-select-value>
339
+ </ecc-utils-design-select-trigger>
340
+ <ecc-utils-design-select-content>
341
+ <ecc-utils-design-select-item value="blob"
342
+ >Blob (Single file)</ecc-utils-design-select-item
343
+ >
344
+ <ecc-utils-design-select-item value="bundle"
345
+ >Bundle (Collection)</ecc-utils-design-select-item
346
+ >
347
+ </ecc-utils-design-select-content>
348
+ </ecc-utils-design-select>
349
+ </div>
350
+ </div>
351
+
352
+ <div>
353
+ <ecc-utils-design-label for="description"
354
+ >Description</ecc-utils-design-label
355
+ >
356
+ <ecc-utils-design-textarea
357
+ id="description"
358
+ placeholder="Enter object description"
359
+ .value=${this.formData.description}
360
+ @ecc-textarea-changed=${(e) => this.handleInputChange("description", e.detail.value)}
361
+ ></ecc-utils-design-textarea>
362
+ </div>
363
+
364
+ <div class="grid grid-cols-1 md:grid-cols-3 gap-4">
365
+ <div>
366
+ <ecc-utils-design-label for="mime-type"
367
+ >MIME Type</ecc-utils-design-label
368
+ >
369
+ <ecc-utils-design-input
370
+ id="mime-type"
371
+ placeholder="e.g., application/json"
372
+ .value=${this.formData.mimeType}
373
+ @ecc-input-changed=${(e) => this.handleInputChange("mimeType", e.detail.value)}
374
+ ></ecc-utils-design-input>
375
+ </div>
376
+
377
+ <div>
378
+ <ecc-utils-design-label for="version"
379
+ >Version</ecc-utils-design-label
380
+ >
381
+ <ecc-utils-design-input
382
+ id="version"
383
+ placeholder="e.g., 1.0.0"
384
+ .value=${this.formData.version}
385
+ @ecc-input-changed=${(e) => this.handleInputChange("version", e.detail.value)}
386
+ ></ecc-utils-design-input>
387
+ </div>
388
+
389
+ <div>
390
+ <ecc-utils-design-label for="size"
391
+ >Size (bytes)</ecc-utils-design-label
392
+ >
393
+ <ecc-utils-design-input
394
+ id="size"
395
+ type="number"
396
+ placeholder="0"
397
+ .value=${this.formData.size.toString()}
398
+ @ecc-input-changed=${(e) => this.handleInputChange(
399
+ "size",
400
+ parseInt(e.detail.value, 10) || 0
401
+ )}
402
+ ></ecc-utils-design-input>
403
+ </div>
404
+ </div>
405
+
406
+ <div>
407
+ <ecc-utils-design-label for="aliases"
408
+ >Aliases (comma-separated)</ecc-utils-design-label
409
+ >
410
+ <ecc-utils-design-input
411
+ id="aliases"
412
+ placeholder="alias1, alias2, alias3"
413
+ .value=${this.formData.aliases.join(", ")}
414
+ @ecc-input-changed=${(e) => this.handleArrayInputChange("aliases", e.detail.value)}
415
+ ></ecc-utils-design-input>
416
+ </div>
417
+ </div>
418
+ `;
419
+ }
420
+ renderChecksums() {
421
+ return html`
422
+ <div class="space-y-4 mt-4">
423
+ <div class="flex justify-between items-center">
424
+ <h3 class="text-lg font-medium">Checksums</h3>
425
+ <ecc-utils-design-button
426
+ type="button"
427
+ variant="outline"
428
+ size="sm"
429
+ @click=${this.addChecksum}
430
+ >
431
+ Add Checksum
432
+ </ecc-utils-design-button>
433
+ </div>
434
+
435
+ ${this.formData.checksums.length === 0 ? html`
436
+ <p class="text-muted-foreground text-sm">
437
+ No checksums added yet.
438
+ </p>
439
+ ` : ""}
440
+ ${this.formData.checksums.map(
441
+ (checksum, index) => html`
442
+ <div
443
+ class="grid grid-cols-1 md:grid-cols-3 gap-4 p-4 border rounded-lg"
444
+ >
445
+ <div>
446
+ <ecc-utils-design-label>Type</ecc-utils-design-label>
447
+ <ecc-utils-design-select
448
+ .value=${checksum.type}
449
+ @ecc-input-changed=${(e) => this.updateChecksum(index, "type", e.detail.value)}
450
+ >
451
+ <ecc-utils-design-select-trigger>
452
+ <ecc-utils-design-select-value
453
+ placeholder="Select type"
454
+ ></ecc-utils-design-select-value>
455
+ </ecc-utils-design-select-trigger>
456
+ <ecc-utils-design-select-content>
457
+ <ecc-utils-design-select-item value="md5"
458
+ >MD5</ecc-utils-design-select-item
459
+ >
460
+ <ecc-utils-design-select-item value="sha1"
461
+ >SHA1</ecc-utils-design-select-item
462
+ >
463
+ <ecc-utils-design-select-item value="sha256"
464
+ >SHA256</ecc-utils-design-select-item
465
+ >
466
+ <ecc-utils-design-select-item value="sha512"
467
+ >SHA512</ecc-utils-design-select-item
468
+ >
469
+ </ecc-utils-design-select-content>
470
+ </ecc-utils-design-select>
471
+ </div>
472
+ <div>
473
+ <ecc-utils-design-label>Checksum Value</ecc-utils-design-label>
474
+ <ecc-utils-design-input
475
+ placeholder="Enter checksum value"
476
+ .value=${checksum.checksum}
477
+ @ecc-input-changed=${(e) => this.updateChecksum(index, "checksum", e.detail.value)}
478
+ ></ecc-utils-design-input>
479
+ </div>
480
+ <div class="flex items-end">
481
+ <ecc-utils-design-button
482
+ type="button"
483
+ variant="outline"
484
+ size="sm"
485
+ @click=${() => this.removeChecksum(index)}
486
+ >
487
+ Remove
488
+ </ecc-utils-design-button>
489
+ </div>
490
+ </div>
491
+ `
492
+ )}
493
+ </div>
494
+ `;
495
+ }
496
+ renderAccessMethods() {
497
+ return html`
498
+ <div class="space-y-4 mt-4">
499
+ <div class="flex justify-between items-center">
500
+ <h3 class="text-lg font-medium">Access Methods</h3>
501
+ <ecc-utils-design-button
502
+ type="button"
503
+ variant="outline"
504
+ size="sm"
505
+ @click=${this.addAccessMethod}
506
+ >
507
+ Add Access Method
508
+ </ecc-utils-design-button>
509
+ </div>
510
+
511
+ ${this.formData.accessMethods.length === 0 ? html`
512
+ <p class="text-muted-foreground text-sm">
513
+ No access methods added yet.
514
+ </p>
515
+ ` : ""}
516
+ ${this.formData.accessMethods.map(
517
+ (method, index) => {
518
+ var _a;
519
+ return html`
520
+ <div
521
+ class="grid grid-cols-1 md:grid-cols-3 gap-4 p-4 border rounded-lg"
522
+ >
523
+ <div>
524
+ <ecc-utils-design-label>Type</ecc-utils-design-label>
525
+ <ecc-utils-design-select
526
+ .value=${method.type}
527
+ @ecc-input-changed=${(e) => this.updateAccessMethod(index, "type", e.detail.value)}
528
+ >
529
+ <ecc-utils-design-select-trigger>
530
+ <ecc-utils-design-select-value
531
+ placeholder="Select type"
532
+ ></ecc-utils-design-select-value>
533
+ </ecc-utils-design-select-trigger>
534
+ <ecc-utils-design-select-content>
535
+ <ecc-utils-design-select-item value="https"
536
+ >HTTPS</ecc-utils-design-select-item
537
+ >
538
+ <ecc-utils-design-select-item value="http"
539
+ >HTTP</ecc-utils-design-select-item
540
+ >
541
+ <ecc-utils-design-select-item value="ftp"
542
+ >FTP</ecc-utils-design-select-item
543
+ >
544
+ <ecc-utils-design-select-item value="sftp"
545
+ >SFTP</ecc-utils-design-select-item
546
+ >
547
+ <ecc-utils-design-select-item value="s3"
548
+ >S3</ecc-utils-design-select-item
549
+ >
550
+ <ecc-utils-design-select-item value="gs"
551
+ >Google Storage</ecc-utils-design-select-item
552
+ >
553
+ </ecc-utils-design-select-content>
554
+ </ecc-utils-design-select>
555
+ </div>
556
+ <div>
557
+ <ecc-utils-design-label>Access URL</ecc-utils-design-label>
558
+ <ecc-utils-design-input
559
+ placeholder="Enter access URL"
560
+ .value=${((_a = method.access_url) == null ? void 0 : _a.url) || ""}
561
+ @ecc-input-changed=${(e) => this.updateAccessMethod(index, "url", e.detail.value)}
562
+ ></ecc-utils-design-input>
563
+ </div>
564
+ <div class="flex items-end">
565
+ <ecc-utils-design-button
566
+ type="button"
567
+ variant="outline"
568
+ size="sm"
569
+ @click=${() => this.removeAccessMethod(index)}
570
+ >
571
+ Remove
572
+ </ecc-utils-design-button>
573
+ </div>
574
+ </div>
575
+ `;
576
+ }
577
+ )}
578
+ </div>
579
+ `;
580
+ }
581
+ renderBundleContents() {
582
+ if (this.objectType !== "bundle") return html``;
583
+ return html`
584
+ <div class="space-y-4 mt-4">
585
+ <div class="flex justify-between items-center">
586
+ <h3 class="text-lg font-medium">Bundle Contents</h3>
587
+ <ecc-utils-design-button
588
+ type="button"
589
+ variant="outline"
590
+ size="sm"
591
+ @click=${this.addBundleContent}
592
+ >
593
+ Add Content Object
594
+ </ecc-utils-design-button>
595
+ </div>
596
+
597
+ ${this.formData.contents.length === 0 ? html`
598
+ <p class="text-muted-foreground text-sm">
599
+ No content objects added yet.
600
+ </p>
601
+ ` : ""}
602
+
603
+ <div class="space-y-3">
604
+ ${this.formData.contents.map(
605
+ (content, index) => this.renderBundleContentItem(content, index)
606
+ )}
607
+ </div>
608
+
609
+ <div class="p-4 bg-blue-50 border border-blue-200 rounded">
610
+ <p class="text-sm text-blue-700">
611
+ <strong>Tip:</strong> You can create nested bundle structures by
612
+ referencing other bundle object IDs. Each content object can have
613
+ its own nested contents for complex hierarchical data organization.
614
+ </p>
615
+ </div>
616
+ </div>
617
+ `;
618
+ }
619
+ renderBundleContentItem(content, index) {
620
+ const indent = content.depth * 24;
621
+ const depthIndicator = " ".repeat(content.depth) + (content.depth > 0 ? "\u2514\u2500 " : "");
622
+ return html`
623
+ <div
624
+ class="border rounded-lg p-4 relative"
625
+ style="margin-left: ${indent}px;"
626
+ >
627
+ ${content.depth > 0 ? html`
628
+ <div class="absolute -left-4 top-0 bottom-0 w-px bg-border"></div>
629
+ <div class="absolute -left-4 top-6 w-4 h-px bg-border"></div>
630
+ ` : ""}
631
+
632
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
633
+ <div>
634
+ <ecc-utils-design-label class="flex items-center gap-2">
635
+ ${content.depth > 0 ? html`
636
+ <span class="text-muted-foreground font-mono text-xs">
637
+ ${depthIndicator}
638
+ </span>
639
+ ` : ""}
640
+ Object ID *
641
+ </ecc-utils-design-label>
642
+ <ecc-utils-design-input
643
+ placeholder="Enter DRS object ID"
644
+ .value=${content.id}
645
+ @ecc-input-changed=${(e) => this.updateBundleContent(index, e.detail.value)}
646
+ ></ecc-utils-design-input>
647
+ </div>
648
+
649
+ <div class="flex items-end gap-2">
650
+ <ecc-utils-design-button
651
+ type="button"
652
+ variant="outline"
653
+ size="sm"
654
+ @click=${() => this.addNestedContent(index)}
655
+ >
656
+ Add Child
657
+ </ecc-utils-design-button>
658
+ ${content.depth < 3 ? html`
659
+ <ecc-utils-design-button
660
+ type="button"
661
+ variant="outline"
662
+ size="sm"
663
+ @click=${() => this.indentContent(index)}
664
+ >
665
+ Indent →
666
+ </ecc-utils-design-button>
667
+ ` : ""}
668
+ ${content.depth > 0 ? html`
669
+ <ecc-utils-design-button
670
+ type="button"
671
+ variant="outline"
672
+ size="sm"
673
+ @click=${() => this.outdentContent(index)}
674
+ >
675
+ ← Outdent
676
+ </ecc-utils-design-button>
677
+ ` : ""}
678
+ <ecc-utils-design-button
679
+ type="button"
680
+ variant="outline"
681
+ size="sm"
682
+ @click=${() => this.removeBundleContent(index)}
683
+ >
684
+ Remove
685
+ </ecc-utils-design-button>
686
+ </div>
687
+ </div>
688
+
689
+ <!-- Show depth level indicator -->
690
+ ${content.depth > 0 ? html`
691
+ <div
692
+ class="mt-2 text-xs text-muted-foreground flex items-center gap-1"
693
+ >
694
+ <span
695
+ class="inline-flex items-center gap-1 px-2 py-1 bg-muted rounded"
696
+ >
697
+ <span>Level ${content.depth + 1}</span>
698
+ <span class="text-xs opacity-60">(nested)</span>
699
+ </span>
700
+ </div>
701
+ ` : ""}
702
+ </div>
703
+ `;
704
+ }
705
+ addBundleContent() {
706
+ this.formData = __spreadProps(__spreadValues({}, this.formData), {
707
+ contents: [...this.formData.contents, { id: "", depth: 0 }]
708
+ });
709
+ }
710
+ removeBundleContent(index) {
711
+ this.formData = __spreadProps(__spreadValues({}, this.formData), {
712
+ contents: this.formData.contents.filter((_, i) => i !== index)
713
+ });
714
+ }
715
+ updateBundleContent(index, value) {
716
+ const updatedContents = [...this.formData.contents];
717
+ updatedContents[index] = __spreadProps(__spreadValues({}, updatedContents[index]), { id: value });
718
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { contents: updatedContents });
719
+ }
720
+ addNestedContent(parentIndex) {
721
+ const updatedContents = [...this.formData.contents];
722
+ const parentDepth = updatedContents[parentIndex].depth;
723
+ updatedContents.splice(parentIndex + 1, 0, {
724
+ id: "",
725
+ depth: parentDepth + 1
726
+ });
727
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { contents: updatedContents });
728
+ }
729
+ indentContent(index) {
730
+ const updatedContents = [...this.formData.contents];
731
+ if (updatedContents[index].depth < 3) {
732
+ updatedContents[index] = __spreadProps(__spreadValues({}, updatedContents[index]), {
733
+ depth: updatedContents[index].depth + 1
734
+ });
735
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { contents: updatedContents });
736
+ }
737
+ }
738
+ outdentContent(index) {
739
+ const updatedContents = [...this.formData.contents];
740
+ if (updatedContents[index].depth > 0) {
741
+ updatedContents[index] = __spreadProps(__spreadValues({}, updatedContents[index]), {
742
+ depth: updatedContents[index].depth - 1
743
+ });
744
+ this.formData = __spreadProps(__spreadValues({}, this.formData), { contents: updatedContents });
745
+ }
746
+ }
747
+ render() {
748
+ if (!this.baseUrl && !this.provider) {
749
+ return html`
750
+ <div
751
+ class="p-4 border border-destructive rounded-md text-destructive-foreground bg-destructive/10"
752
+ >
753
+ Please provide either a base URL for the DRS API or a custom provider.
754
+ </div>
755
+ `;
756
+ }
757
+ return html`
758
+ <div class="space-y-6">
759
+ <form
760
+ @submit=${(e) => {
761
+ e.preventDefault();
762
+ this.handleSubmit();
763
+ }}
764
+ >
765
+ <div class="space-y-6">
766
+ ${this.renderBasicFields()}
767
+ <ecc-utils-design-separator></ecc-utils-design-separator>
768
+ ${this.renderChecksums()}
769
+ <ecc-utils-design-separator></ecc-utils-design-separator>
770
+ ${this.renderAccessMethods()}
771
+ <ecc-utils-design-separator></ecc-utils-design-separator>
772
+ ${this.renderBundleContents()}
773
+ </div>
774
+
775
+ <div class="flex justify-between items-center mt-6">
776
+ <div></div>
777
+ <div class="space-x-2">
778
+ <ecc-utils-design-button
779
+ type="button"
780
+ variant="outline"
781
+ @click=${this.resetForm}
782
+ >
783
+ Reset
784
+ </ecc-utils-design-button>
785
+ <ecc-utils-design-button
786
+ type="submit"
787
+ @click=${this.handleSubmit}
788
+ .disabled=${this.loading || !this.formData.name}
789
+ >
790
+ ${this.loading ? "Creating..." : "Create Object"}
791
+ </ecc-utils-design-button>
792
+ </div>
793
+ </div>
794
+ </form>
795
+ </div>
796
+ `;
797
+ }
798
+ };
799
+ ECCClientElixirDrsFilerObjectCreate.styles = [
800
+ ComponentStyles,
801
+ GlobalStyles,
802
+ css`
803
+ :host {
804
+ display: block;
805
+ width: 100%;
806
+ }
807
+ `
808
+ ];
809
+ __decorateClass([
810
+ property({ type: String, reflect: true })
811
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "baseUrl", 2);
812
+ __decorateClass([
813
+ property({ attribute: false, reflect: true })
814
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "provider", 2);
815
+ __decorateClass([
816
+ state()
817
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "loading", 2);
818
+ __decorateClass([
819
+ state()
820
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "error", 2);
821
+ __decorateClass([
822
+ state()
823
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "success", 2);
824
+ __decorateClass([
825
+ state()
826
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "formData", 2);
827
+ __decorateClass([
828
+ state()
829
+ ], ECCClientElixirDrsFilerObjectCreate.prototype, "objectType", 2);
830
+ var object_create_default = ECCClientElixirDrsFilerObjectCreate;
831
+
832
+ export { ECCClientElixirDrsFilerObjectCreate, object_create_default };