@elixir-cloud/trs-filer 2.0.0-alpha.3 → 2.0.0-alpha.30
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/chunks/chunk.3S22ENXV.js +252 -0
- package/dist/chunks/{chunk.Q5GOJN3Z.js → chunk.D4A7TFU2.js} +95 -30
- package/dist/chunks/{chunk.II7PIADM.js → chunk.ECGVPJ4T.js} +5 -5
- package/dist/chunks/{chunk.ZZTQWNKT.js → chunk.HHC6HRU2.js} +1 -1
- package/dist/chunks/{chunk.FZDL764O.js → chunk.KYMGLPMB.js} +307 -433
- package/dist/chunks/chunk.S3NI7NKU.js +30 -0
- package/dist/chunks/chunk.TEZHVCRK.js +1 -0
- package/dist/components/index.js +5 -3
- package/dist/components/tool-create/index.js +5 -3
- package/dist/components/tool-create/tool-create.d.ts +15 -12
- package/dist/components/tool-create/tool-create.js +4 -2
- package/dist/components/tool-create/tw-styles.js +2 -1
- package/dist/custom-elements.json +74 -57
- package/dist/events/ecc-tool-create-failed.d.ts +6 -0
- package/dist/events/ecc-tool-create-validation-failed.d.ts +6 -0
- package/dist/events/{ecc-tool-create-success.d.ts → ecc-tool-created.d.ts} +2 -2
- package/dist/events/ecc-tools-changed.d.ts +6 -0
- package/dist/events/ecc-tools-selected.d.ts +6 -0
- package/dist/events/index.d.ts +5 -5
- package/dist/index.js +5 -3
- package/dist/providers/index.js +3 -0
- package/dist/providers/rest-trs-filer-provider.js +2 -0
- package/dist/providers/trs-filer-provider.d.ts +3 -3
- package/dist/providers/trs-filer-provider.js +1 -0
- package/dist/react/ecc-client-elixir-trs-tool-create/index.d.ts +12 -12
- package/dist/react/ecc-client-elixir-trs-tool-create/index.js +5 -3
- package/dist/react/index.js +5 -3
- package/dist/vscode.html-custom-data.json +1 -1
- package/dist/web-types.json +17 -72
- package/package.json +4 -4
- package/dist/events/ecc-tool-create-error.d.ts +0 -6
- package/dist/events/ecc-tool-create-validation-error.d.ts +0 -6
- package/dist/events/ecc-tools-change.d.ts +0 -6
- package/dist/events/ecc-tools-click.d.ts +0 -6
|
@@ -1,6 +1,9 @@
|
|
|
1
|
-
import { ComponentStyles
|
|
1
|
+
import { ComponentStyles } from './chunk.D4A7TFU2.js';
|
|
2
|
+
import { RestTrsFilerProvider } from './chunk.3S22ENXV.js';
|
|
3
|
+
import { __decorateClass, __spreadProps, __spreadValues } from './chunk.S3NI7NKU.js';
|
|
2
4
|
import { css, LitElement, html } from 'lit';
|
|
3
5
|
import { property, state } from 'lit/decorators.js';
|
|
6
|
+
import JSZip from '@progress/jszip-esm';
|
|
4
7
|
import '@elixir-cloud/design/components/button/index.js';
|
|
5
8
|
import '@elixir-cloud/design/components/input/index.js';
|
|
6
9
|
import '@elixir-cloud/design/components/select/index.js';
|
|
@@ -13,7 +16,6 @@ import '@elixir-cloud/design/components/tabs/index.js';
|
|
|
13
16
|
import '@elixir-cloud/design/components/separator/index.js';
|
|
14
17
|
import '@elixir-cloud/design/components/checkbox/index.js';
|
|
15
18
|
import '@elixir-cloud/design/components/collapsible/index.js';
|
|
16
|
-
import JSZip from '@progress/jszip-esm';
|
|
17
19
|
|
|
18
20
|
var GlobalStyles = css`
|
|
19
21
|
:host {
|
|
@@ -107,250 +109,7 @@ var GlobalStyles = css`
|
|
|
107
109
|
--sidebar-ring: var(--ecc-sidebar-ring, oklch(0.439 0 0));
|
|
108
110
|
}
|
|
109
111
|
`;
|
|
110
|
-
|
|
111
|
-
// src/providers/rest-trs-filer-provider.ts
|
|
112
|
-
var RestTrsFilerProvider = class {
|
|
113
|
-
constructor(baseUrl) {
|
|
114
|
-
this.baseUrl = baseUrl;
|
|
115
|
-
}
|
|
116
|
-
async getToolClasses() {
|
|
117
|
-
const url = `${this.baseUrl}/toolClasses`;
|
|
118
|
-
const response = await fetch(url);
|
|
119
|
-
if (!response.ok) {
|
|
120
|
-
throw new Error(`Failed to fetch tool classes: ${response.statusText}`);
|
|
121
|
-
}
|
|
122
|
-
return response.json();
|
|
123
|
-
}
|
|
124
|
-
async getToolsList(limit, offset, filters, query) {
|
|
125
|
-
let url = `${this.baseUrl}/tools?${limit ? `limit=${limit}&` : ""}${offset ? `offset=${offset}&` : ""}`;
|
|
126
|
-
if (query && query.length > 0) {
|
|
127
|
-
url += `&name=${encodeURIComponent(query)}`;
|
|
128
|
-
}
|
|
129
|
-
Object.entries(filters).forEach(([key, value]) => {
|
|
130
|
-
if (value !== "" && value !== void 0 && key !== "offset") {
|
|
131
|
-
url += `&${key}=${encodeURIComponent(String(value))}`;
|
|
132
|
-
}
|
|
133
|
-
});
|
|
134
|
-
const response = await fetch(url);
|
|
135
|
-
if (!response.ok) {
|
|
136
|
-
throw new Error(`Failed to fetch tools: ${response.statusText}`);
|
|
137
|
-
}
|
|
138
|
-
return response.json();
|
|
139
|
-
}
|
|
140
|
-
async getTool(url, id) {
|
|
141
|
-
const encodedToolId = encodeURIComponent(id);
|
|
142
|
-
const response = await fetch(`${this.baseUrl}/tools/${encodedToolId}`);
|
|
143
|
-
if (!response.ok) {
|
|
144
|
-
throw new Error(`Failed to fetch tool: ${response.statusText}`);
|
|
145
|
-
}
|
|
146
|
-
return response.json();
|
|
147
|
-
}
|
|
148
|
-
async getToolVersions(url, id) {
|
|
149
|
-
const encodedToolId = encodeURIComponent(id);
|
|
150
|
-
const response = await fetch(
|
|
151
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions`
|
|
152
|
-
);
|
|
153
|
-
if (!response.ok) {
|
|
154
|
-
throw new Error(`Failed to fetch tool versions: ${response.statusText}`);
|
|
155
|
-
}
|
|
156
|
-
return response.json();
|
|
157
|
-
}
|
|
158
|
-
async getToolVersion(url, id, versionId) {
|
|
159
|
-
const encodedToolId = encodeURIComponent(id);
|
|
160
|
-
const version = versionId.split(":")[1] ? versionId.split(":")[1] : versionId;
|
|
161
|
-
const encodedVersionId = encodeURIComponent(version);
|
|
162
|
-
const response = await fetch(
|
|
163
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}`
|
|
164
|
-
);
|
|
165
|
-
if (!response.ok) {
|
|
166
|
-
throw new Error(`Failed to fetch tool version: ${response.statusText}`);
|
|
167
|
-
}
|
|
168
|
-
return response.json();
|
|
169
|
-
}
|
|
170
|
-
async getToolFiles(url, id, version, descriptorType, format) {
|
|
171
|
-
const encodedToolId = encodeURIComponent(id);
|
|
172
|
-
const versionPart = version.split(":")[1] ? version.split(":")[1] : version;
|
|
173
|
-
const encodedVersionId = encodeURIComponent(versionPart);
|
|
174
|
-
const encodedType = encodeURIComponent(descriptorType);
|
|
175
|
-
let requestUrl = `${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/${encodedType}/files`;
|
|
176
|
-
if (format) {
|
|
177
|
-
requestUrl += `?format=${format}`;
|
|
178
|
-
}
|
|
179
|
-
const response = await fetch(requestUrl);
|
|
180
|
-
if (!response.ok) {
|
|
181
|
-
throw new Error(`Failed to fetch tool files: ${response.statusText}`);
|
|
182
|
-
}
|
|
183
|
-
return response.json();
|
|
184
|
-
}
|
|
185
|
-
async getToolDescriptor(url, id, version, descriptorType) {
|
|
186
|
-
const encodedToolId = encodeURIComponent(id);
|
|
187
|
-
const versionPart = version.split(":")[1] ? version.split(":")[1] : version;
|
|
188
|
-
const encodedVersionId = encodeURIComponent(versionPart);
|
|
189
|
-
const encodedType = encodeURIComponent(descriptorType);
|
|
190
|
-
const response = await fetch(
|
|
191
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/${encodedType}/descriptor`
|
|
192
|
-
);
|
|
193
|
-
if (!response.ok) {
|
|
194
|
-
throw new Error(
|
|
195
|
-
`Failed to fetch tool descriptor: ${response.statusText}`
|
|
196
|
-
);
|
|
197
|
-
}
|
|
198
|
-
return response.json();
|
|
199
|
-
}
|
|
200
|
-
async getToolDescriptorByPath(url, id, version, descriptorType, path) {
|
|
201
|
-
const encodedToolId = encodeURIComponent(id);
|
|
202
|
-
const versionPart = version.split(":")[1] ? version.split(":")[1] : version;
|
|
203
|
-
const encodedVersionId = encodeURIComponent(versionPart);
|
|
204
|
-
const encodedType = encodeURIComponent(descriptorType);
|
|
205
|
-
try {
|
|
206
|
-
const response = await fetch(
|
|
207
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/${encodedType}/descriptor/${path}`
|
|
208
|
-
);
|
|
209
|
-
if (response.ok) {
|
|
210
|
-
return response.json();
|
|
211
|
-
}
|
|
212
|
-
const encodedPath = encodeURIComponent(path);
|
|
213
|
-
const encodedResponse = await fetch(
|
|
214
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/${encodedType}/descriptor/${encodedPath}`
|
|
215
|
-
);
|
|
216
|
-
if (encodedResponse.ok) {
|
|
217
|
-
return encodedResponse.json();
|
|
218
|
-
}
|
|
219
|
-
throw new Error(
|
|
220
|
-
`Failed to fetch tool descriptor by path: ${encodedResponse.statusText}`
|
|
221
|
-
);
|
|
222
|
-
} catch (error) {
|
|
223
|
-
const encodedPath = encodeURIComponent(path);
|
|
224
|
-
try {
|
|
225
|
-
const encodedResponse = await fetch(
|
|
226
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/${encodedType}/descriptor/${encodedPath}`
|
|
227
|
-
);
|
|
228
|
-
if (encodedResponse.ok) {
|
|
229
|
-
return encodedResponse.json();
|
|
230
|
-
}
|
|
231
|
-
throw new Error(
|
|
232
|
-
`Failed to fetch tool descriptor by path: ${encodedResponse.statusText}`
|
|
233
|
-
);
|
|
234
|
-
} catch (encodedError) {
|
|
235
|
-
throw error;
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
async getContainerfile(url, id, version) {
|
|
240
|
-
const encodedToolId = encodeURIComponent(id);
|
|
241
|
-
const versionPart = version.split(":")[1] ? version.split(":")[1] : version;
|
|
242
|
-
const encodedVersionId = encodeURIComponent(versionPart);
|
|
243
|
-
const response = await fetch(
|
|
244
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/containerfile`
|
|
245
|
-
);
|
|
246
|
-
if (!response.ok) {
|
|
247
|
-
throw new Error(`Failed to fetch containerfile: ${response.statusText}`);
|
|
248
|
-
}
|
|
249
|
-
return response.json();
|
|
250
|
-
}
|
|
251
|
-
async getToolTests(url, id, version, descriptorType) {
|
|
252
|
-
const encodedToolId = encodeURIComponent(id);
|
|
253
|
-
const versionPart = version.split(":")[1] ? version.split(":")[1] : version;
|
|
254
|
-
const encodedVersionId = encodeURIComponent(versionPart);
|
|
255
|
-
const encodedType = encodeURIComponent(descriptorType);
|
|
256
|
-
const response = await fetch(
|
|
257
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}/${encodedType}/tests`
|
|
258
|
-
);
|
|
259
|
-
if (!response.ok) {
|
|
260
|
-
throw new Error(`Failed to fetch tool tests: ${response.statusText}`);
|
|
261
|
-
}
|
|
262
|
-
return response.json();
|
|
263
|
-
}
|
|
264
|
-
// Creation methods (TRS-Filer specific functionality)
|
|
265
|
-
async createTool(tool) {
|
|
266
|
-
console.log("Creating tool:", tool);
|
|
267
|
-
const response = await fetch(`${this.baseUrl}/tools`, {
|
|
268
|
-
method: "POST",
|
|
269
|
-
headers: {
|
|
270
|
-
"Content-Type": "application/json"
|
|
271
|
-
},
|
|
272
|
-
body: JSON.stringify(tool)
|
|
273
|
-
});
|
|
274
|
-
if (!response.ok) {
|
|
275
|
-
throw new Error(`Failed to create tool: ${response.statusText}`);
|
|
276
|
-
}
|
|
277
|
-
return response.text();
|
|
278
|
-
}
|
|
279
|
-
async createToolWithId(id, tool) {
|
|
280
|
-
const encodedToolId = encodeURIComponent(id);
|
|
281
|
-
const response = await fetch(`${this.baseUrl}/tools/${encodedToolId}`, {
|
|
282
|
-
method: "PUT",
|
|
283
|
-
headers: {
|
|
284
|
-
"Content-Type": "application/json"
|
|
285
|
-
},
|
|
286
|
-
body: JSON.stringify(tool)
|
|
287
|
-
});
|
|
288
|
-
if (!response.ok) {
|
|
289
|
-
throw new Error(`Failed to create/update tool: ${response.statusText}`);
|
|
290
|
-
}
|
|
291
|
-
return response.text();
|
|
292
|
-
}
|
|
293
|
-
async createToolVersion(toolId, version) {
|
|
294
|
-
const encodedToolId = encodeURIComponent(toolId);
|
|
295
|
-
const response = await fetch(`${this.baseUrl}/tools/${encodedToolId}/versions`, {
|
|
296
|
-
method: "POST",
|
|
297
|
-
headers: {
|
|
298
|
-
"Content-Type": "application/json"
|
|
299
|
-
},
|
|
300
|
-
body: JSON.stringify(version)
|
|
301
|
-
});
|
|
302
|
-
if (!response.ok) {
|
|
303
|
-
throw new Error(`Failed to create tool version: ${response.statusText}`);
|
|
304
|
-
}
|
|
305
|
-
return response.text();
|
|
306
|
-
}
|
|
307
|
-
async createToolVersionWithId(toolId, versionId, version) {
|
|
308
|
-
const encodedToolId = encodeURIComponent(toolId);
|
|
309
|
-
const encodedVersionId = encodeURIComponent(versionId);
|
|
310
|
-
const response = await fetch(
|
|
311
|
-
`${this.baseUrl}/tools/${encodedToolId}/versions/${encodedVersionId}`,
|
|
312
|
-
{
|
|
313
|
-
method: "PUT",
|
|
314
|
-
headers: {
|
|
315
|
-
"Content-Type": "application/json"
|
|
316
|
-
},
|
|
317
|
-
body: JSON.stringify(version)
|
|
318
|
-
}
|
|
319
|
-
);
|
|
320
|
-
if (!response.ok) {
|
|
321
|
-
throw new Error(`Failed to create/update tool version: ${response.statusText}`);
|
|
322
|
-
}
|
|
323
|
-
return response.text();
|
|
324
|
-
}
|
|
325
|
-
async createToolClass(toolClass) {
|
|
326
|
-
const response = await fetch(`${this.baseUrl}/toolClasses`, {
|
|
327
|
-
method: "POST",
|
|
328
|
-
headers: {
|
|
329
|
-
"Content-Type": "application/json"
|
|
330
|
-
},
|
|
331
|
-
body: JSON.stringify(toolClass)
|
|
332
|
-
});
|
|
333
|
-
if (!response.ok) {
|
|
334
|
-
throw new Error(`Failed to create tool class: ${response.statusText}`);
|
|
335
|
-
}
|
|
336
|
-
return response.text();
|
|
337
|
-
}
|
|
338
|
-
async createToolClassWithId(id, toolClass) {
|
|
339
|
-
const encodedId = encodeURIComponent(id);
|
|
340
|
-
const response = await fetch(`${this.baseUrl}/toolClasses/${encodedId}`, {
|
|
341
|
-
method: "PUT",
|
|
342
|
-
headers: {
|
|
343
|
-
"Content-Type": "application/json"
|
|
344
|
-
},
|
|
345
|
-
body: JSON.stringify(toolClass)
|
|
346
|
-
});
|
|
347
|
-
if (!response.ok) {
|
|
348
|
-
throw new Error(`Failed to create/update tool class: ${response.statusText}`);
|
|
349
|
-
}
|
|
350
|
-
return response.text();
|
|
351
|
-
}
|
|
352
|
-
};
|
|
353
|
-
var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
112
|
+
var _ECCClientElixirTrsToolCreate = class _ECCClientElixirTrsToolCreate extends LitElement {
|
|
354
113
|
constructor() {
|
|
355
114
|
super(...arguments);
|
|
356
115
|
this.baseUrl = "";
|
|
@@ -392,7 +151,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
392
151
|
async firstUpdated() {
|
|
393
152
|
if (!this.baseUrl && !this.provider) {
|
|
394
153
|
this.dispatchEvent(
|
|
395
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
154
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
396
155
|
detail: {
|
|
397
156
|
error: "Please provide either a base URL for the TRS API or a custom provider."
|
|
398
157
|
},
|
|
@@ -420,14 +179,13 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
420
179
|
}
|
|
421
180
|
}
|
|
422
181
|
async loadToolClasses() {
|
|
423
|
-
if (!this._provider)
|
|
424
|
-
return;
|
|
182
|
+
if (!this._provider) return;
|
|
425
183
|
try {
|
|
426
184
|
this.toolClasses = await this._provider.getToolClasses();
|
|
427
185
|
} catch (error) {
|
|
428
186
|
console.error("Failed to load tool classes:", error);
|
|
429
187
|
this.dispatchEvent(
|
|
430
|
-
new CustomEvent("ecc-tool-create-
|
|
188
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
431
189
|
detail: { error: "Failed to load tool classes" },
|
|
432
190
|
bubbles: true,
|
|
433
191
|
composed: true
|
|
@@ -479,8 +237,10 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
479
237
|
const activeDescriptorType = this.activeDescriptorType[versionIndex] || (version.descriptorTypes.length > 0 ? version.descriptorTypes[0] : null);
|
|
480
238
|
if (!activeDescriptorType) {
|
|
481
239
|
this.dispatchEvent(
|
|
482
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
483
|
-
detail: {
|
|
240
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
241
|
+
detail: {
|
|
242
|
+
error: "Please select a descriptor type before adding files."
|
|
243
|
+
},
|
|
484
244
|
bubbles: true,
|
|
485
245
|
composed: true
|
|
486
246
|
})
|
|
@@ -489,9 +249,16 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
489
249
|
}
|
|
490
250
|
const updatedVersions = [...this.versions];
|
|
491
251
|
const descriptorType = activeDescriptorType;
|
|
252
|
+
let fileType = "PRIMARY_DESCRIPTOR";
|
|
253
|
+
if (updatedVersions[versionIndex].files.find(
|
|
254
|
+
(file) => file.fileType === "PRIMARY_DESCRIPTOR"
|
|
255
|
+
)) {
|
|
256
|
+
fileType = "SECONDARY_DESCRIPTOR";
|
|
257
|
+
}
|
|
492
258
|
updatedVersions[versionIndex].files.push({
|
|
493
259
|
path: "",
|
|
494
|
-
fileType
|
|
260
|
+
fileType,
|
|
261
|
+
uiFileType: fileType,
|
|
495
262
|
content: "",
|
|
496
263
|
checksumType: "sha256",
|
|
497
264
|
checksumValue: "",
|
|
@@ -524,14 +291,16 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
524
291
|
}
|
|
525
292
|
handleBulkFileUpload(versionIndex, event) {
|
|
526
293
|
const input = event.target;
|
|
527
|
-
const files = input
|
|
294
|
+
const { files } = input;
|
|
528
295
|
if (files && files.length > 0) {
|
|
529
296
|
const version = this.versions[versionIndex];
|
|
530
297
|
const activeDescriptorType = this.activeDescriptorType[versionIndex] || (version.descriptorTypes.length > 0 ? version.descriptorTypes[0] : null);
|
|
531
298
|
if (!activeDescriptorType) {
|
|
532
299
|
this.dispatchEvent(
|
|
533
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
534
|
-
detail: {
|
|
300
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
301
|
+
detail: {
|
|
302
|
+
error: "Please select a descriptor type before uploading files."
|
|
303
|
+
},
|
|
535
304
|
bubbles: true,
|
|
536
305
|
composed: true
|
|
537
306
|
})
|
|
@@ -541,15 +310,25 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
541
310
|
}
|
|
542
311
|
const updatedVersions = [...this.versions];
|
|
543
312
|
const descriptorType = activeDescriptorType;
|
|
544
|
-
Array.from(files).forEach((file
|
|
313
|
+
Array.from(files).forEach((file) => {
|
|
314
|
+
const defaultFileType = _ECCClientElixirTrsToolCreate.getDefaultFileType(
|
|
315
|
+
file.name
|
|
316
|
+
);
|
|
317
|
+
const uiFileType = _ECCClientElixirTrsToolCreate.getUIFileType(
|
|
318
|
+
file.name,
|
|
319
|
+
defaultFileType
|
|
320
|
+
);
|
|
321
|
+
const containerImageType = defaultFileType === "CONTAINERFILE" ? _ECCClientElixirTrsToolCreate.getContainerImageType(file.name) : void 0;
|
|
545
322
|
const fileData = {
|
|
546
323
|
path: file.name,
|
|
547
|
-
fileType:
|
|
324
|
+
fileType: defaultFileType,
|
|
325
|
+
uiFileType,
|
|
548
326
|
content: "",
|
|
549
327
|
file,
|
|
550
328
|
checksumType: "sha256",
|
|
551
329
|
checksumValue: "",
|
|
552
|
-
descriptorType
|
|
330
|
+
descriptorType,
|
|
331
|
+
containerImageType
|
|
553
332
|
};
|
|
554
333
|
updatedVersions[versionIndex].files.push(fileData);
|
|
555
334
|
const reader = new FileReader();
|
|
@@ -576,7 +355,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
576
355
|
const file = (_a = input.files) == null ? void 0 : _a[0];
|
|
577
356
|
if (!file || !file.name.toLowerCase().endsWith(".zip")) {
|
|
578
357
|
this.dispatchEvent(
|
|
579
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
358
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
580
359
|
detail: { error: "Please select a valid ZIP file" },
|
|
581
360
|
bubbles: true,
|
|
582
361
|
composed: true
|
|
@@ -588,8 +367,10 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
588
367
|
const activeDescriptorType = this.activeDescriptorType[versionIndex] || (version.descriptorTypes.length > 0 ? version.descriptorTypes[0] : null);
|
|
589
368
|
if (!activeDescriptorType) {
|
|
590
369
|
this.dispatchEvent(
|
|
591
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
592
|
-
detail: {
|
|
370
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
371
|
+
detail: {
|
|
372
|
+
error: "Please select a descriptor type before uploading ZIP files."
|
|
373
|
+
},
|
|
593
374
|
bubbles: true,
|
|
594
375
|
composed: true
|
|
595
376
|
})
|
|
@@ -603,17 +384,16 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
603
384
|
const zipContent = await zip.loadAsync(file);
|
|
604
385
|
const updatedVersions = [...this.versions];
|
|
605
386
|
const filePromises = [];
|
|
606
|
-
let extractedCount = 0;
|
|
607
387
|
const descriptorType = activeDescriptorType;
|
|
608
388
|
zipContent.forEach((relativePath, zipEntry) => {
|
|
609
|
-
if (zipEntry.dir)
|
|
610
|
-
|
|
611
|
-
|
|
389
|
+
if (zipEntry.dir) return;
|
|
390
|
+
const promise = _ECCClientElixirTrsToolCreate.extractFileFromZip(
|
|
391
|
+
zipEntry,
|
|
392
|
+
relativePath
|
|
393
|
+
).then((fileData) => {
|
|
612
394
|
if (fileData) {
|
|
613
|
-
|
|
614
|
-
updatedVersions[versionIndex].files.push(
|
|
615
|
-
extractedCount++;
|
|
616
|
-
} else {
|
|
395
|
+
const fileDataWithDescriptor = __spreadProps(__spreadValues({}, fileData), { descriptorType });
|
|
396
|
+
updatedVersions[versionIndex].files.push(fileDataWithDescriptor);
|
|
617
397
|
}
|
|
618
398
|
}).catch((error) => {
|
|
619
399
|
console.error(`Failed to extract file ${relativePath}:`, error);
|
|
@@ -635,7 +415,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
635
415
|
error instanceof Error ? error.stack : "No stack trace"
|
|
636
416
|
);
|
|
637
417
|
this.dispatchEvent(
|
|
638
|
-
new CustomEvent("ecc-tool-create-
|
|
418
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
639
419
|
detail: {
|
|
640
420
|
error: `Failed to extract ZIP file: ${error instanceof Error ? error.message : "Unknown error"}. Please ensure it's a valid ZIP archive.`
|
|
641
421
|
},
|
|
@@ -647,9 +427,9 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
647
427
|
this.loading = false;
|
|
648
428
|
}
|
|
649
429
|
}
|
|
650
|
-
async extractFileFromZip(zipEntry, relativePath) {
|
|
430
|
+
static async extractFileFromZip(zipEntry, relativePath) {
|
|
651
431
|
try {
|
|
652
|
-
const isTextFile =
|
|
432
|
+
const isTextFile = _ECCClientElixirTrsToolCreate.isTextFile(relativePath);
|
|
653
433
|
let content;
|
|
654
434
|
if (isTextFile) {
|
|
655
435
|
content = await zipEntry.async("text");
|
|
@@ -658,16 +438,24 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
658
438
|
const uint8Array = new Uint8Array(arrayBuffer);
|
|
659
439
|
content = btoa(String.fromCharCode(...uint8Array));
|
|
660
440
|
}
|
|
441
|
+
const defaultFileType = _ECCClientElixirTrsToolCreate.getDefaultFileType(relativePath);
|
|
442
|
+
const uiFileType = _ECCClientElixirTrsToolCreate.getUIFileType(
|
|
443
|
+
relativePath,
|
|
444
|
+
defaultFileType
|
|
445
|
+
);
|
|
446
|
+
const containerImageType = defaultFileType === "CONTAINERFILE" ? _ECCClientElixirTrsToolCreate.getContainerImageType(relativePath) : void 0;
|
|
661
447
|
const fileData = {
|
|
662
448
|
path: relativePath,
|
|
663
|
-
fileType:
|
|
449
|
+
fileType: defaultFileType,
|
|
450
|
+
uiFileType,
|
|
664
451
|
content,
|
|
665
452
|
file: void 0,
|
|
666
453
|
// No actual File object for extracted files
|
|
667
454
|
checksumType: "sha256",
|
|
668
455
|
checksumValue: "",
|
|
669
|
-
descriptorType: void 0
|
|
456
|
+
descriptorType: void 0,
|
|
670
457
|
// Will be set by the calling method
|
|
458
|
+
containerImageType
|
|
671
459
|
};
|
|
672
460
|
return fileData;
|
|
673
461
|
} catch (error) {
|
|
@@ -679,7 +467,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
679
467
|
return null;
|
|
680
468
|
}
|
|
681
469
|
}
|
|
682
|
-
isTextFile(filename) {
|
|
470
|
+
static isTextFile(filename) {
|
|
683
471
|
var _a;
|
|
684
472
|
const textExtensions = [
|
|
685
473
|
"txt",
|
|
@@ -715,7 +503,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
715
503
|
const extension = (_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
716
504
|
return textExtensions.includes(extension || "") || filename.toLowerCase().includes("readme") || filename.toLowerCase().includes("license") || filename.toLowerCase().includes("changelog");
|
|
717
505
|
}
|
|
718
|
-
getDefaultFileType(filename) {
|
|
506
|
+
static getDefaultFileType(filename) {
|
|
719
507
|
var _a;
|
|
720
508
|
const extension = (_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
721
509
|
const basename = filename.toLowerCase();
|
|
@@ -728,15 +516,12 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
728
516
|
if (basename === "dockerfile" || basename.includes("container") || extension === "def") {
|
|
729
517
|
return "CONTAINERFILE";
|
|
730
518
|
}
|
|
731
|
-
if (extension === "yml" || extension === "yaml" || extension === "json") {
|
|
519
|
+
if (basename.includes("workflow") || basename.includes("main") || extension === "cwl" || extension === "wdl" || extension === "nf" || extension === "yml" || extension === "yaml" || extension === "json") {
|
|
732
520
|
return "SECONDARY_DESCRIPTOR";
|
|
733
521
|
}
|
|
734
522
|
return "OTHER";
|
|
735
523
|
}
|
|
736
|
-
|
|
737
|
-
return void 0;
|
|
738
|
-
}
|
|
739
|
-
getContainerImageType(filename) {
|
|
524
|
+
static getContainerImageType(filename) {
|
|
740
525
|
var _a;
|
|
741
526
|
const basename = filename.toLowerCase();
|
|
742
527
|
const extension = (_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
@@ -748,7 +533,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
748
533
|
}
|
|
749
534
|
return "Docker";
|
|
750
535
|
}
|
|
751
|
-
getFileExtension(filename) {
|
|
536
|
+
static getFileExtension(filename) {
|
|
752
537
|
var _a;
|
|
753
538
|
return ((_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "txt";
|
|
754
539
|
}
|
|
@@ -775,11 +560,12 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
775
560
|
this.versions = updatedVersions;
|
|
776
561
|
}
|
|
777
562
|
async handleSubmit() {
|
|
778
|
-
console.log("handleSubmit");
|
|
779
563
|
if (!this._provider || !this._provider.createTool) {
|
|
780
564
|
this.dispatchEvent(
|
|
781
|
-
new CustomEvent("ecc-tool-create-
|
|
782
|
-
detail: {
|
|
565
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
566
|
+
detail: {
|
|
567
|
+
error: "Tool creation is not supported by the current provider"
|
|
568
|
+
},
|
|
783
569
|
bubbles: true,
|
|
784
570
|
composed: true
|
|
785
571
|
})
|
|
@@ -829,7 +615,9 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
829
615
|
}
|
|
830
616
|
] : void 0
|
|
831
617
|
},
|
|
832
|
-
type: file.fileType === "CONTAINERFILE" ?
|
|
618
|
+
type: file.fileType === "CONTAINERFILE" ? file.containerImageType || _ECCClientElixirTrsToolCreate.getContainerImageType(
|
|
619
|
+
file.path
|
|
620
|
+
) : file.descriptorType || version.descriptorTypes[0] || "CWL"
|
|
833
621
|
// Use file's descriptor type or first version descriptor type as default
|
|
834
622
|
})) : void 0,
|
|
835
623
|
images: version.images.length > 0 ? version.images : void 0
|
|
@@ -846,7 +634,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
846
634
|
}
|
|
847
635
|
const successMessage = `Tool created successfully with ID: ${toolId}`;
|
|
848
636
|
this.dispatchEvent(
|
|
849
|
-
new CustomEvent("ecc-tool-
|
|
637
|
+
new CustomEvent("ecc-tool-created", {
|
|
850
638
|
detail: { toolId, toolData, message: successMessage },
|
|
851
639
|
bubbles: true,
|
|
852
640
|
composed: true
|
|
@@ -856,7 +644,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
856
644
|
} catch (err) {
|
|
857
645
|
const errorMessage = err instanceof Error ? err.message : "Failed to create tool";
|
|
858
646
|
this.dispatchEvent(
|
|
859
|
-
new CustomEvent("ecc-tool-create-
|
|
647
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
860
648
|
detail: { error: errorMessage },
|
|
861
649
|
bubbles: true,
|
|
862
650
|
composed: true
|
|
@@ -897,100 +685,94 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
897
685
|
}
|
|
898
686
|
renderBasicFields() {
|
|
899
687
|
return html`
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
class="h-10"
|
|
916
|
-
></ecc-utils-design-input>
|
|
917
|
-
</div>
|
|
688
|
+
<div class="grid gap-4">
|
|
689
|
+
<!-- Tool Name, Organization, Tool Class in same row on desktop -->
|
|
690
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
691
|
+
<div class="grid gap-2">
|
|
692
|
+
<ecc-utils-design-label for="tool-name" class="text-sm font-medium">
|
|
693
|
+
Tool Name
|
|
694
|
+
</ecc-utils-design-label>
|
|
695
|
+
<ecc-utils-design-input
|
|
696
|
+
id="tool-name"
|
|
697
|
+
.value=${this.formData.name}
|
|
698
|
+
@ecc-input-changed=${(e) => this.handleInputChange("name", e.detail.value)}
|
|
699
|
+
placeholder="Enter a descriptive name for your tool"
|
|
700
|
+
class="h-10"
|
|
701
|
+
></ecc-utils-design-input>
|
|
702
|
+
</div>
|
|
918
703
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
704
|
+
<div class="grid gap-2">
|
|
705
|
+
<ecc-utils-design-label
|
|
706
|
+
for="organization"
|
|
707
|
+
class="text-sm font-medium"
|
|
708
|
+
>
|
|
709
|
+
Organization <span class="text-destructive">*</span>
|
|
710
|
+
</ecc-utils-design-label>
|
|
711
|
+
<ecc-utils-design-input
|
|
712
|
+
id="organization"
|
|
713
|
+
.value=${this.formData.organization}
|
|
714
|
+
@ecc-input-changed=${(e) => this.handleInputChange("organization", e.detail.value)}
|
|
715
|
+
placeholder="Enter your organization name"
|
|
716
|
+
required
|
|
717
|
+
class="h-10"
|
|
718
|
+
></ecc-utils-design-input>
|
|
719
|
+
</div>
|
|
935
720
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
721
|
+
<div class="grid gap-1">
|
|
722
|
+
<ecc-utils-design-label
|
|
723
|
+
for="tool-class"
|
|
724
|
+
class="text-sm font-medium"
|
|
725
|
+
>
|
|
726
|
+
Tool Class <span class="text-destructive">*</span>
|
|
727
|
+
</ecc-utils-design-label>
|
|
728
|
+
<ecc-utils-design-select
|
|
729
|
+
id="tool-class-select"
|
|
730
|
+
.value=${this.formData.toolClassId}
|
|
731
|
+
@ecc-input-changed=${(e) => {
|
|
947
732
|
this.handleInputChange("toolClassId", e.detail.value);
|
|
948
733
|
}}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
734
|
+
required
|
|
735
|
+
>
|
|
736
|
+
<ecc-utils-design-select-trigger class="h-10">
|
|
737
|
+
<ecc-utils-design-select-value
|
|
738
|
+
placeholder="Select a tool class"
|
|
739
|
+
></ecc-utils-design-select-value>
|
|
740
|
+
</ecc-utils-design-select-trigger>
|
|
956
741
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
742
|
+
<ecc-utils-design-select-content>
|
|
743
|
+
<ecc-utils-design-select-item value="">
|
|
744
|
+
Select a tool class
|
|
745
|
+
</ecc-utils-design-select-item>
|
|
746
|
+
${this.toolClasses.map(
|
|
962
747
|
(tc) => html`
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
748
|
+
<ecc-utils-design-select-item value=${tc.id}>
|
|
749
|
+
<div class="flex flex-col">
|
|
750
|
+
<span class="font-medium">${tc.name}</span>
|
|
751
|
+
</div>
|
|
752
|
+
</ecc-utils-design-select-item>
|
|
753
|
+
`
|
|
969
754
|
)}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
</div>
|
|
755
|
+
</ecc-utils-design-select-content>
|
|
756
|
+
</ecc-utils-design-select>
|
|
973
757
|
</div>
|
|
758
|
+
</div>
|
|
974
759
|
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
rows="4"
|
|
989
|
-
class="resize-none"
|
|
990
|
-
></ecc-utils-design-textarea>
|
|
991
|
-
</div>
|
|
992
|
-
${this.renderAdvancedFields()}
|
|
760
|
+
<!-- Description spans full width -->
|
|
761
|
+
<div class="grid gap-2">
|
|
762
|
+
<ecc-utils-design-label for="description" class="text-sm font-medium">
|
|
763
|
+
Description
|
|
764
|
+
</ecc-utils-design-label>
|
|
765
|
+
<ecc-utils-design-textarea
|
|
766
|
+
id="description"
|
|
767
|
+
.value=${this.formData.description}
|
|
768
|
+
@ecc-input-changed=${(e) => this.handleInputChange("description", e.detail.value)}
|
|
769
|
+
placeholder="Provide a detailed description of what your tool does"
|
|
770
|
+
rows="4"
|
|
771
|
+
class="resize-none"
|
|
772
|
+
></ecc-utils-design-textarea>
|
|
993
773
|
</div>
|
|
774
|
+
${this.renderAdvancedFields()}
|
|
775
|
+
</div>
|
|
994
776
|
`;
|
|
995
777
|
}
|
|
996
778
|
renderAdvancedFields() {
|
|
@@ -1037,7 +819,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1037
819
|
<ecc-utils-design-input
|
|
1038
820
|
id="custom-tool-id"
|
|
1039
821
|
.value=${this.formData.customToolId}
|
|
1040
|
-
@ecc-
|
|
822
|
+
@ecc-input-changed=${(e) => {
|
|
1041
823
|
this.handleInputChange("customToolId", e.detail.value);
|
|
1042
824
|
this.handleInputChange(
|
|
1043
825
|
"useCustomId",
|
|
@@ -1060,7 +842,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1060
842
|
<ecc-utils-design-input
|
|
1061
843
|
id="aliases"
|
|
1062
844
|
.value=${this.formData.aliases.join(", ")}
|
|
1063
|
-
@ecc-
|
|
845
|
+
@ecc-input-changed=${(e) => this.handleArrayInputChange("aliases", e.detail.value)}
|
|
1064
846
|
placeholder="alias1, alias2, alias3"
|
|
1065
847
|
class="h-10"
|
|
1066
848
|
></ecc-utils-design-input>
|
|
@@ -1077,7 +859,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1077
859
|
<ecc-utils-design-input
|
|
1078
860
|
id="checker-url"
|
|
1079
861
|
.value=${this.formData.checkerUrl}
|
|
1080
|
-
@ecc-
|
|
862
|
+
@ecc-input-changed=${(e) => {
|
|
1081
863
|
this.handleInputChange("checkerUrl", e.detail.value);
|
|
1082
864
|
this.handleInputChange(
|
|
1083
865
|
"hasChecker",
|
|
@@ -1190,7 +972,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1190
972
|
>
|
|
1191
973
|
<ecc-utils-design-input
|
|
1192
974
|
.value=${version.name}
|
|
1193
|
-
@ecc-
|
|
975
|
+
@ecc-input-changed=${(e) => this.handleVersionChange(index, "name", e.detail.value)}
|
|
1194
976
|
placeholder="e.g., v1.0.0"
|
|
1195
977
|
class="h-10"
|
|
1196
978
|
></ecc-utils-design-input>
|
|
@@ -1202,7 +984,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1202
984
|
</ecc-utils-design-label>
|
|
1203
985
|
<ecc-utils-design-input
|
|
1204
986
|
.value=${version.author.join(", ")}
|
|
1205
|
-
@ecc-
|
|
987
|
+
@ecc-input-changed=${(e) => {
|
|
1206
988
|
const authors = e.detail.value.split(",").map((a) => a.trim()).filter((a) => a);
|
|
1207
989
|
this.handleVersionChange(index, "author", authors);
|
|
1208
990
|
}}
|
|
@@ -1219,9 +1001,30 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1219
1001
|
<ecc-utils-design-multi-select
|
|
1220
1002
|
.value=${version.descriptorTypes}
|
|
1221
1003
|
placeholder="Select supported languages..."
|
|
1222
|
-
@ecc-
|
|
1004
|
+
@ecc-input-changed=${(e) => {
|
|
1223
1005
|
const updatedVersions = [...this.versions];
|
|
1224
|
-
updatedVersions[index].descriptorTypes
|
|
1006
|
+
const oldDescriptorTypes = updatedVersions[index].descriptorTypes;
|
|
1007
|
+
const newDescriptorTypes = e.detail.value;
|
|
1008
|
+
updatedVersions[index].descriptorTypes = newDescriptorTypes;
|
|
1009
|
+
const removedDescriptorTypes = oldDescriptorTypes.filter(
|
|
1010
|
+
(type) => !newDescriptorTypes.includes(type)
|
|
1011
|
+
);
|
|
1012
|
+
if (removedDescriptorTypes.length > 0) {
|
|
1013
|
+
updatedVersions[index].files = updatedVersions[index].files.filter(
|
|
1014
|
+
(file) => !removedDescriptorTypes.includes(file.descriptorType)
|
|
1015
|
+
);
|
|
1016
|
+
}
|
|
1017
|
+
const currentActiveDescriptor = this.activeDescriptorType[index];
|
|
1018
|
+
if (currentActiveDescriptor && removedDescriptorTypes.includes(
|
|
1019
|
+
currentActiveDescriptor
|
|
1020
|
+
)) {
|
|
1021
|
+
this.activeDescriptorType = __spreadProps(__spreadValues({}, this.activeDescriptorType), {
|
|
1022
|
+
[index]: newDescriptorTypes.length > 0 ? newDescriptorTypes[0] : void 0
|
|
1023
|
+
});
|
|
1024
|
+
this.activeFileIndex = __spreadProps(__spreadValues({}, this.activeFileIndex), {
|
|
1025
|
+
[index]: -1
|
|
1026
|
+
});
|
|
1027
|
+
}
|
|
1225
1028
|
this.versions = updatedVersions;
|
|
1226
1029
|
}}
|
|
1227
1030
|
class="mt-2"
|
|
@@ -1285,9 +1088,11 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1285
1088
|
Tags
|
|
1286
1089
|
</ecc-utils-design-label>
|
|
1287
1090
|
<ecc-utils-design-multi-select
|
|
1288
|
-
.value=${
|
|
1091
|
+
.value=${_ECCClientElixirTrsToolCreate.getVersionTags(
|
|
1092
|
+
version
|
|
1093
|
+
)}
|
|
1289
1094
|
placeholder="Select tags..."
|
|
1290
|
-
@ecc-
|
|
1095
|
+
@ecc-input-changed=${(e) => {
|
|
1291
1096
|
this.handleVersionTagsChange(index, e.detail.value);
|
|
1292
1097
|
}}
|
|
1293
1098
|
>
|
|
@@ -1314,7 +1119,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1314
1119
|
</ecc-utils-design-label>
|
|
1315
1120
|
<ecc-utils-design-input
|
|
1316
1121
|
.value=${version.customVersionId}
|
|
1317
|
-
@ecc-
|
|
1122
|
+
@ecc-input-changed=${(e) => this.handleVersionChange(
|
|
1318
1123
|
index,
|
|
1319
1124
|
"customVersionId",
|
|
1320
1125
|
e.detail.value
|
|
@@ -1391,7 +1196,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1391
1196
|
>
|
|
1392
1197
|
<ecc-utils-design-select
|
|
1393
1198
|
.value=${this.activeDescriptorType[index] || version.descriptorTypes[0]}
|
|
1394
|
-
@ecc-
|
|
1199
|
+
@ecc-input-changed=${(e) => {
|
|
1395
1200
|
this.activeDescriptorType = __spreadProps(__spreadValues({}, this.activeDescriptorType), {
|
|
1396
1201
|
[index]: e.detail.value
|
|
1397
1202
|
});
|
|
@@ -1475,7 +1280,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1475
1280
|
<!-- Files List Section - 1/5 of screen -->
|
|
1476
1281
|
<div class="col-span-5 md:col-span-1">
|
|
1477
1282
|
<div class="space-y-1 max-h-[400px] overflow-y-auto">
|
|
1478
|
-
${filteredFiles.map((file
|
|
1283
|
+
${filteredFiles.map((file) => {
|
|
1479
1284
|
const originalIndex = files.indexOf(file);
|
|
1480
1285
|
return html`
|
|
1481
1286
|
<ecc-utils-design-button
|
|
@@ -1491,8 +1296,8 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1491
1296
|
>
|
|
1492
1297
|
<span class="truncate">
|
|
1493
1298
|
${file.path || `File ${originalIndex + 1}`}
|
|
1494
|
-
${file.
|
|
1495
|
-
>(${file.
|
|
1299
|
+
${file.uiFileType ? html`<span class="text-xs text-muted-foreground ml-1"
|
|
1300
|
+
>(${file.uiFileType})</span
|
|
1496
1301
|
>` : ""}
|
|
1497
1302
|
</span>
|
|
1498
1303
|
<ecc-utils-design-button
|
|
@@ -1541,24 +1346,19 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1541
1346
|
</div>
|
|
1542
1347
|
`;
|
|
1543
1348
|
}
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
{ value: "TEST_FILE", label: "Test File" },
|
|
1548
|
-
{ value: "CONTAINERFILE", label: "Container File" },
|
|
1549
|
-
{ value: "OTHER", label: "Other" }
|
|
1550
|
-
];
|
|
1349
|
+
const otherFileHasPrimaryDescriptor = files.some(
|
|
1350
|
+
(file, index) => index !== activeIndex && file.uiFileType === "PRIMARY_DESCRIPTOR" && file.descriptorType === activeFile.descriptorType
|
|
1351
|
+
);
|
|
1551
1352
|
const checksumTypes = ["sha256", "sha1", "md5"];
|
|
1552
1353
|
return html`
|
|
1553
1354
|
<div class="space-y-4">
|
|
1554
|
-
|
|
1555
1355
|
<!-- File Configuration -->
|
|
1556
1356
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
1557
1357
|
<div>
|
|
1558
1358
|
<ecc-utils-design-label>File Path</ecc-utils-design-label>
|
|
1559
1359
|
<ecc-utils-design-input
|
|
1560
1360
|
.value=${activeFile.path}
|
|
1561
|
-
@ecc-
|
|
1361
|
+
@ecc-input-changed=${(e) => {
|
|
1562
1362
|
this.handleFileFieldChange(
|
|
1563
1363
|
versionIndex,
|
|
1564
1364
|
activeIndex,
|
|
@@ -1573,27 +1373,87 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1573
1373
|
<div>
|
|
1574
1374
|
<ecc-utils-design-label>File Type</ecc-utils-design-label>
|
|
1575
1375
|
<ecc-utils-design-select
|
|
1576
|
-
.value=${activeFile.
|
|
1577
|
-
@ecc-
|
|
1376
|
+
.value=${activeFile.uiFileType}
|
|
1377
|
+
@ecc-input-changed=${(e) => {
|
|
1378
|
+
const newUIFileType = e.detail.value;
|
|
1379
|
+
const newFileType = _ECCClientElixirTrsToolCreate.convertUIFileTypeToFileType(
|
|
1380
|
+
newUIFileType
|
|
1381
|
+
);
|
|
1382
|
+
const newContainerImageType = _ECCClientElixirTrsToolCreate.convertUIFileTypeToImageType(
|
|
1383
|
+
newUIFileType
|
|
1384
|
+
);
|
|
1385
|
+
this.handleFileFieldChange(
|
|
1386
|
+
versionIndex,
|
|
1387
|
+
activeIndex,
|
|
1388
|
+
"uiFileType",
|
|
1389
|
+
newUIFileType
|
|
1390
|
+
);
|
|
1578
1391
|
this.handleFileFieldChange(
|
|
1579
1392
|
versionIndex,
|
|
1580
1393
|
activeIndex,
|
|
1581
1394
|
"fileType",
|
|
1582
|
-
|
|
1395
|
+
newFileType
|
|
1583
1396
|
);
|
|
1397
|
+
if (newContainerImageType) {
|
|
1398
|
+
this.handleFileFieldChange(
|
|
1399
|
+
versionIndex,
|
|
1400
|
+
activeIndex,
|
|
1401
|
+
"containerImageType",
|
|
1402
|
+
newContainerImageType
|
|
1403
|
+
);
|
|
1404
|
+
} else {
|
|
1405
|
+
this.handleFileFieldChange(
|
|
1406
|
+
versionIndex,
|
|
1407
|
+
activeIndex,
|
|
1408
|
+
"containerImageType",
|
|
1409
|
+
void 0
|
|
1410
|
+
);
|
|
1411
|
+
}
|
|
1584
1412
|
}}
|
|
1585
1413
|
>
|
|
1586
1414
|
<ecc-utils-design-select-trigger>
|
|
1587
1415
|
<ecc-utils-design-select-value></ecc-utils-design-select-value>
|
|
1588
1416
|
</ecc-utils-design-select-trigger>
|
|
1589
1417
|
<ecc-utils-design-select-content>
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1418
|
+
<!-- Source Files Group -->
|
|
1419
|
+
<ecc-utils-design-select-group>
|
|
1420
|
+
<ecc-utils-design-select-label
|
|
1421
|
+
>Source file</ecc-utils-design-select-label
|
|
1422
|
+
>
|
|
1423
|
+
<ecc-utils-design-select-item
|
|
1424
|
+
value="PRIMARY_DESCRIPTOR"
|
|
1425
|
+
.disabled=${otherFileHasPrimaryDescriptor && activeFile.uiFileType !== "PRIMARY_DESCRIPTOR"}
|
|
1426
|
+
>
|
|
1427
|
+
Primary Descriptor
|
|
1428
|
+
</ecc-utils-design-select-item>
|
|
1429
|
+
<ecc-utils-design-select-item value="SECONDARY_DESCRIPTOR">
|
|
1430
|
+
Secondary Descriptor
|
|
1431
|
+
</ecc-utils-design-select-item>
|
|
1432
|
+
<ecc-utils-design-select-item value="TEST_FILE">
|
|
1433
|
+
Test File
|
|
1434
|
+
</ecc-utils-design-select-item>
|
|
1435
|
+
<ecc-utils-design-select-item value="OTHER">
|
|
1436
|
+
Other
|
|
1437
|
+
</ecc-utils-design-select-item>
|
|
1438
|
+
</ecc-utils-design-select-group>
|
|
1439
|
+
|
|
1440
|
+
<ecc-utils-design-select-separator></ecc-utils-design-select-separator>
|
|
1441
|
+
|
|
1442
|
+
<!-- Image Files Group -->
|
|
1443
|
+
<ecc-utils-design-select-group>
|
|
1444
|
+
<ecc-utils-design-select-label
|
|
1445
|
+
>Image file</ecc-utils-design-select-label
|
|
1446
|
+
>
|
|
1447
|
+
<ecc-utils-design-select-item value="Docker">
|
|
1448
|
+
Docker
|
|
1449
|
+
</ecc-utils-design-select-item>
|
|
1450
|
+
<ecc-utils-design-select-item value="Singularity">
|
|
1451
|
+
Singularity
|
|
1452
|
+
</ecc-utils-design-select-item>
|
|
1453
|
+
<ecc-utils-design-select-item value="Conda">
|
|
1454
|
+
Conda
|
|
1455
|
+
</ecc-utils-design-select-item>
|
|
1456
|
+
</ecc-utils-design-select-group>
|
|
1597
1457
|
</ecc-utils-design-select-content>
|
|
1598
1458
|
</ecc-utils-design-select>
|
|
1599
1459
|
</div>
|
|
@@ -1602,7 +1462,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1602
1462
|
<ecc-utils-design-label>Checksum Type</ecc-utils-design-label>
|
|
1603
1463
|
<ecc-utils-design-select
|
|
1604
1464
|
.value=${activeFile.checksumType}
|
|
1605
|
-
@ecc-
|
|
1465
|
+
@ecc-input-changed=${(e) => {
|
|
1606
1466
|
this.handleFileFieldChange(
|
|
1607
1467
|
versionIndex,
|
|
1608
1468
|
activeIndex,
|
|
@@ -1632,7 +1492,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1632
1492
|
>
|
|
1633
1493
|
<ecc-utils-design-input
|
|
1634
1494
|
.value=${activeFile.checksumValue}
|
|
1635
|
-
@ecc-
|
|
1495
|
+
@ecc-input-changed=${(e) => {
|
|
1636
1496
|
this.handleFileFieldChange(
|
|
1637
1497
|
versionIndex,
|
|
1638
1498
|
activeIndex,
|
|
@@ -1652,8 +1512,10 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1652
1512
|
${activeFile.content !== void 0 ? html`
|
|
1653
1513
|
<ecc-utils-design-code
|
|
1654
1514
|
value=${activeFile.content}
|
|
1655
|
-
extension=${
|
|
1656
|
-
|
|
1515
|
+
extension=${_ECCClientElixirTrsToolCreate.getFileExtension(
|
|
1516
|
+
activeFile.path
|
|
1517
|
+
)}
|
|
1518
|
+
@ecc-input-changed=${(e) => {
|
|
1657
1519
|
this.handleFileFieldChange(
|
|
1658
1520
|
versionIndex,
|
|
1659
1521
|
activeIndex,
|
|
@@ -1675,17 +1537,11 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1675
1537
|
</div>
|
|
1676
1538
|
`;
|
|
1677
1539
|
}
|
|
1678
|
-
|
|
1679
|
-
return html``;
|
|
1680
|
-
}
|
|
1681
|
-
getVersionTags(version) {
|
|
1540
|
+
static getVersionTags(version) {
|
|
1682
1541
|
const tags = [];
|
|
1683
|
-
if (version.isProduction)
|
|
1684
|
-
|
|
1685
|
-
if (version.
|
|
1686
|
-
tags.push("verified");
|
|
1687
|
-
if (version.signed)
|
|
1688
|
-
tags.push("signed");
|
|
1542
|
+
if (version.isProduction) tags.push("prod");
|
|
1543
|
+
if (version.verified) tags.push("verified");
|
|
1544
|
+
if (version.signed) tags.push("signed");
|
|
1689
1545
|
return tags;
|
|
1690
1546
|
}
|
|
1691
1547
|
handleVersionTagsChange(index, tags) {
|
|
@@ -1697,6 +1553,24 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1697
1553
|
});
|
|
1698
1554
|
this.versions = updatedVersions;
|
|
1699
1555
|
}
|
|
1556
|
+
static getUIFileType(filename, fileType) {
|
|
1557
|
+
if (fileType === "CONTAINERFILE") {
|
|
1558
|
+
return _ECCClientElixirTrsToolCreate.getContainerImageType(filename);
|
|
1559
|
+
}
|
|
1560
|
+
return fileType;
|
|
1561
|
+
}
|
|
1562
|
+
static convertUIFileTypeToFileType(uiFileType) {
|
|
1563
|
+
if (uiFileType === "Docker" || uiFileType === "Singularity" || uiFileType === "Conda") {
|
|
1564
|
+
return "CONTAINERFILE";
|
|
1565
|
+
}
|
|
1566
|
+
return uiFileType;
|
|
1567
|
+
}
|
|
1568
|
+
static convertUIFileTypeToImageType(uiFileType) {
|
|
1569
|
+
if (uiFileType === "Docker" || uiFileType === "Singularity" || uiFileType === "Conda") {
|
|
1570
|
+
return uiFileType;
|
|
1571
|
+
}
|
|
1572
|
+
return void 0;
|
|
1573
|
+
}
|
|
1700
1574
|
render() {
|
|
1701
1575
|
return html`
|
|
1702
1576
|
<div class="">
|
|
@@ -1707,8 +1581,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1707
1581
|
}}
|
|
1708
1582
|
>
|
|
1709
1583
|
<div class="space-y-4">
|
|
1710
|
-
${this.renderBasicFields()}
|
|
1711
|
-
${this.renderVersions()}
|
|
1584
|
+
${this.renderBasicFields()} ${this.renderVersions()}
|
|
1712
1585
|
</div>
|
|
1713
1586
|
|
|
1714
1587
|
<div class="flex justify-between items-center mt-4">
|
|
@@ -1735,7 +1608,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1735
1608
|
`;
|
|
1736
1609
|
}
|
|
1737
1610
|
};
|
|
1738
|
-
|
|
1611
|
+
_ECCClientElixirTrsToolCreate.styles = [
|
|
1739
1612
|
ComponentStyles,
|
|
1740
1613
|
GlobalStyles,
|
|
1741
1614
|
css`
|
|
@@ -1756,34 +1629,35 @@ ECCClientElixirTrsToolCreate.styles = [
|
|
|
1756
1629
|
];
|
|
1757
1630
|
__decorateClass([
|
|
1758
1631
|
property({ type: String, reflect: true })
|
|
1759
|
-
],
|
|
1632
|
+
], _ECCClientElixirTrsToolCreate.prototype, "baseUrl", 2);
|
|
1760
1633
|
__decorateClass([
|
|
1761
1634
|
property({ attribute: false, reflect: true })
|
|
1762
|
-
],
|
|
1635
|
+
], _ECCClientElixirTrsToolCreate.prototype, "provider", 2);
|
|
1763
1636
|
__decorateClass([
|
|
1764
1637
|
state()
|
|
1765
|
-
],
|
|
1638
|
+
], _ECCClientElixirTrsToolCreate.prototype, "toolClasses", 2);
|
|
1766
1639
|
__decorateClass([
|
|
1767
1640
|
state()
|
|
1768
|
-
],
|
|
1641
|
+
], _ECCClientElixirTrsToolCreate.prototype, "loading", 2);
|
|
1769
1642
|
__decorateClass([
|
|
1770
1643
|
state()
|
|
1771
|
-
],
|
|
1644
|
+
], _ECCClientElixirTrsToolCreate.prototype, "error", 2);
|
|
1772
1645
|
__decorateClass([
|
|
1773
1646
|
state()
|
|
1774
|
-
],
|
|
1647
|
+
], _ECCClientElixirTrsToolCreate.prototype, "success", 2);
|
|
1775
1648
|
__decorateClass([
|
|
1776
1649
|
state()
|
|
1777
|
-
],
|
|
1650
|
+
], _ECCClientElixirTrsToolCreate.prototype, "formData", 2);
|
|
1778
1651
|
__decorateClass([
|
|
1779
1652
|
state()
|
|
1780
|
-
],
|
|
1653
|
+
], _ECCClientElixirTrsToolCreate.prototype, "versions", 2);
|
|
1781
1654
|
__decorateClass([
|
|
1782
1655
|
state()
|
|
1783
|
-
],
|
|
1656
|
+
], _ECCClientElixirTrsToolCreate.prototype, "activeFileIndex", 2);
|
|
1784
1657
|
__decorateClass([
|
|
1785
1658
|
state()
|
|
1786
|
-
],
|
|
1659
|
+
], _ECCClientElixirTrsToolCreate.prototype, "activeDescriptorType", 2);
|
|
1660
|
+
var ECCClientElixirTrsToolCreate = _ECCClientElixirTrsToolCreate;
|
|
1787
1661
|
var tool_create_default = ECCClientElixirTrsToolCreate;
|
|
1788
1662
|
|
|
1789
1663
|
export { ECCClientElixirTrsToolCreate, tool_create_default };
|