@elixir-cloud/trs-filer 2.0.0-alpha.2 → 2.0.0-alpha.29
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.II7PIADM.js → chunk.5M5UHQTG.js} +5 -5
- package/dist/chunks/{chunk.Q5GOJN3Z.js → chunk.D4A7TFU2.js} +95 -30
- package/dist/chunks/{chunk.FZDL764O.js → chunk.PNFA44FN.js} +300 -432
- package/dist/chunks/chunk.S3NI7NKU.js +30 -0
- package/dist/chunks/chunk.TEZHVCRK.js +1 -0
- package/dist/chunks/{chunk.ZZTQWNKT.js → chunk.V6CU7C3N.js} +1 -1
- 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
|
})
|
|
@@ -492,6 +252,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
492
252
|
updatedVersions[versionIndex].files.push({
|
|
493
253
|
path: "",
|
|
494
254
|
fileType: "PRIMARY_DESCRIPTOR",
|
|
255
|
+
uiFileType: "PRIMARY_DESCRIPTOR",
|
|
495
256
|
content: "",
|
|
496
257
|
checksumType: "sha256",
|
|
497
258
|
checksumValue: "",
|
|
@@ -524,14 +285,16 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
524
285
|
}
|
|
525
286
|
handleBulkFileUpload(versionIndex, event) {
|
|
526
287
|
const input = event.target;
|
|
527
|
-
const files = input
|
|
288
|
+
const { files } = input;
|
|
528
289
|
if (files && files.length > 0) {
|
|
529
290
|
const version = this.versions[versionIndex];
|
|
530
291
|
const activeDescriptorType = this.activeDescriptorType[versionIndex] || (version.descriptorTypes.length > 0 ? version.descriptorTypes[0] : null);
|
|
531
292
|
if (!activeDescriptorType) {
|
|
532
293
|
this.dispatchEvent(
|
|
533
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
534
|
-
detail: {
|
|
294
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
295
|
+
detail: {
|
|
296
|
+
error: "Please select a descriptor type before uploading files."
|
|
297
|
+
},
|
|
535
298
|
bubbles: true,
|
|
536
299
|
composed: true
|
|
537
300
|
})
|
|
@@ -541,15 +304,25 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
541
304
|
}
|
|
542
305
|
const updatedVersions = [...this.versions];
|
|
543
306
|
const descriptorType = activeDescriptorType;
|
|
544
|
-
Array.from(files).forEach((file
|
|
307
|
+
Array.from(files).forEach((file) => {
|
|
308
|
+
const defaultFileType = _ECCClientElixirTrsToolCreate.getDefaultFileType(
|
|
309
|
+
file.name
|
|
310
|
+
);
|
|
311
|
+
const uiFileType = _ECCClientElixirTrsToolCreate.getUIFileType(
|
|
312
|
+
file.name,
|
|
313
|
+
defaultFileType
|
|
314
|
+
);
|
|
315
|
+
const containerImageType = defaultFileType === "CONTAINERFILE" ? _ECCClientElixirTrsToolCreate.getContainerImageType(file.name) : void 0;
|
|
545
316
|
const fileData = {
|
|
546
317
|
path: file.name,
|
|
547
|
-
fileType:
|
|
318
|
+
fileType: defaultFileType,
|
|
319
|
+
uiFileType,
|
|
548
320
|
content: "",
|
|
549
321
|
file,
|
|
550
322
|
checksumType: "sha256",
|
|
551
323
|
checksumValue: "",
|
|
552
|
-
descriptorType
|
|
324
|
+
descriptorType,
|
|
325
|
+
containerImageType
|
|
553
326
|
};
|
|
554
327
|
updatedVersions[versionIndex].files.push(fileData);
|
|
555
328
|
const reader = new FileReader();
|
|
@@ -576,7 +349,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
576
349
|
const file = (_a = input.files) == null ? void 0 : _a[0];
|
|
577
350
|
if (!file || !file.name.toLowerCase().endsWith(".zip")) {
|
|
578
351
|
this.dispatchEvent(
|
|
579
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
352
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
580
353
|
detail: { error: "Please select a valid ZIP file" },
|
|
581
354
|
bubbles: true,
|
|
582
355
|
composed: true
|
|
@@ -588,8 +361,10 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
588
361
|
const activeDescriptorType = this.activeDescriptorType[versionIndex] || (version.descriptorTypes.length > 0 ? version.descriptorTypes[0] : null);
|
|
589
362
|
if (!activeDescriptorType) {
|
|
590
363
|
this.dispatchEvent(
|
|
591
|
-
new CustomEvent("ecc-tool-create-validation-
|
|
592
|
-
detail: {
|
|
364
|
+
new CustomEvent("ecc-tool-create-validation-failed", {
|
|
365
|
+
detail: {
|
|
366
|
+
error: "Please select a descriptor type before uploading ZIP files."
|
|
367
|
+
},
|
|
593
368
|
bubbles: true,
|
|
594
369
|
composed: true
|
|
595
370
|
})
|
|
@@ -603,17 +378,16 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
603
378
|
const zipContent = await zip.loadAsync(file);
|
|
604
379
|
const updatedVersions = [...this.versions];
|
|
605
380
|
const filePromises = [];
|
|
606
|
-
let extractedCount = 0;
|
|
607
381
|
const descriptorType = activeDescriptorType;
|
|
608
382
|
zipContent.forEach((relativePath, zipEntry) => {
|
|
609
|
-
if (zipEntry.dir)
|
|
610
|
-
|
|
611
|
-
|
|
383
|
+
if (zipEntry.dir) return;
|
|
384
|
+
const promise = _ECCClientElixirTrsToolCreate.extractFileFromZip(
|
|
385
|
+
zipEntry,
|
|
386
|
+
relativePath
|
|
387
|
+
).then((fileData) => {
|
|
612
388
|
if (fileData) {
|
|
613
|
-
|
|
614
|
-
updatedVersions[versionIndex].files.push(
|
|
615
|
-
extractedCount++;
|
|
616
|
-
} else {
|
|
389
|
+
const fileDataWithDescriptor = __spreadProps(__spreadValues({}, fileData), { descriptorType });
|
|
390
|
+
updatedVersions[versionIndex].files.push(fileDataWithDescriptor);
|
|
617
391
|
}
|
|
618
392
|
}).catch((error) => {
|
|
619
393
|
console.error(`Failed to extract file ${relativePath}:`, error);
|
|
@@ -635,7 +409,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
635
409
|
error instanceof Error ? error.stack : "No stack trace"
|
|
636
410
|
);
|
|
637
411
|
this.dispatchEvent(
|
|
638
|
-
new CustomEvent("ecc-tool-create-
|
|
412
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
639
413
|
detail: {
|
|
640
414
|
error: `Failed to extract ZIP file: ${error instanceof Error ? error.message : "Unknown error"}. Please ensure it's a valid ZIP archive.`
|
|
641
415
|
},
|
|
@@ -647,9 +421,9 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
647
421
|
this.loading = false;
|
|
648
422
|
}
|
|
649
423
|
}
|
|
650
|
-
async extractFileFromZip(zipEntry, relativePath) {
|
|
424
|
+
static async extractFileFromZip(zipEntry, relativePath) {
|
|
651
425
|
try {
|
|
652
|
-
const isTextFile =
|
|
426
|
+
const isTextFile = _ECCClientElixirTrsToolCreate.isTextFile(relativePath);
|
|
653
427
|
let content;
|
|
654
428
|
if (isTextFile) {
|
|
655
429
|
content = await zipEntry.async("text");
|
|
@@ -658,16 +432,24 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
658
432
|
const uint8Array = new Uint8Array(arrayBuffer);
|
|
659
433
|
content = btoa(String.fromCharCode(...uint8Array));
|
|
660
434
|
}
|
|
435
|
+
const defaultFileType = _ECCClientElixirTrsToolCreate.getDefaultFileType(relativePath);
|
|
436
|
+
const uiFileType = _ECCClientElixirTrsToolCreate.getUIFileType(
|
|
437
|
+
relativePath,
|
|
438
|
+
defaultFileType
|
|
439
|
+
);
|
|
440
|
+
const containerImageType = defaultFileType === "CONTAINERFILE" ? _ECCClientElixirTrsToolCreate.getContainerImageType(relativePath) : void 0;
|
|
661
441
|
const fileData = {
|
|
662
442
|
path: relativePath,
|
|
663
|
-
fileType:
|
|
443
|
+
fileType: defaultFileType,
|
|
444
|
+
uiFileType,
|
|
664
445
|
content,
|
|
665
446
|
file: void 0,
|
|
666
447
|
// No actual File object for extracted files
|
|
667
448
|
checksumType: "sha256",
|
|
668
449
|
checksumValue: "",
|
|
669
|
-
descriptorType: void 0
|
|
450
|
+
descriptorType: void 0,
|
|
670
451
|
// Will be set by the calling method
|
|
452
|
+
containerImageType
|
|
671
453
|
};
|
|
672
454
|
return fileData;
|
|
673
455
|
} catch (error) {
|
|
@@ -679,7 +461,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
679
461
|
return null;
|
|
680
462
|
}
|
|
681
463
|
}
|
|
682
|
-
isTextFile(filename) {
|
|
464
|
+
static isTextFile(filename) {
|
|
683
465
|
var _a;
|
|
684
466
|
const textExtensions = [
|
|
685
467
|
"txt",
|
|
@@ -715,7 +497,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
715
497
|
const extension = (_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
716
498
|
return textExtensions.includes(extension || "") || filename.toLowerCase().includes("readme") || filename.toLowerCase().includes("license") || filename.toLowerCase().includes("changelog");
|
|
717
499
|
}
|
|
718
|
-
getDefaultFileType(filename) {
|
|
500
|
+
static getDefaultFileType(filename) {
|
|
719
501
|
var _a;
|
|
720
502
|
const extension = (_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
721
503
|
const basename = filename.toLowerCase();
|
|
@@ -728,15 +510,12 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
728
510
|
if (basename === "dockerfile" || basename.includes("container") || extension === "def") {
|
|
729
511
|
return "CONTAINERFILE";
|
|
730
512
|
}
|
|
731
|
-
if (extension === "yml" || extension === "yaml" || extension === "json") {
|
|
513
|
+
if (basename.includes("workflow") || basename.includes("main") || extension === "cwl" || extension === "wdl" || extension === "nf" || extension === "yml" || extension === "yaml" || extension === "json") {
|
|
732
514
|
return "SECONDARY_DESCRIPTOR";
|
|
733
515
|
}
|
|
734
516
|
return "OTHER";
|
|
735
517
|
}
|
|
736
|
-
|
|
737
|
-
return void 0;
|
|
738
|
-
}
|
|
739
|
-
getContainerImageType(filename) {
|
|
518
|
+
static getContainerImageType(filename) {
|
|
740
519
|
var _a;
|
|
741
520
|
const basename = filename.toLowerCase();
|
|
742
521
|
const extension = (_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase();
|
|
@@ -748,7 +527,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
748
527
|
}
|
|
749
528
|
return "Docker";
|
|
750
529
|
}
|
|
751
|
-
getFileExtension(filename) {
|
|
530
|
+
static getFileExtension(filename) {
|
|
752
531
|
var _a;
|
|
753
532
|
return ((_a = filename.split(".").pop()) == null ? void 0 : _a.toLowerCase()) || "txt";
|
|
754
533
|
}
|
|
@@ -775,11 +554,12 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
775
554
|
this.versions = updatedVersions;
|
|
776
555
|
}
|
|
777
556
|
async handleSubmit() {
|
|
778
|
-
console.log("handleSubmit");
|
|
779
557
|
if (!this._provider || !this._provider.createTool) {
|
|
780
558
|
this.dispatchEvent(
|
|
781
|
-
new CustomEvent("ecc-tool-create-
|
|
782
|
-
detail: {
|
|
559
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
560
|
+
detail: {
|
|
561
|
+
error: "Tool creation is not supported by the current provider"
|
|
562
|
+
},
|
|
783
563
|
bubbles: true,
|
|
784
564
|
composed: true
|
|
785
565
|
})
|
|
@@ -829,7 +609,9 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
829
609
|
}
|
|
830
610
|
] : void 0
|
|
831
611
|
},
|
|
832
|
-
type: file.fileType === "CONTAINERFILE" ?
|
|
612
|
+
type: file.fileType === "CONTAINERFILE" ? file.containerImageType || _ECCClientElixirTrsToolCreate.getContainerImageType(
|
|
613
|
+
file.path
|
|
614
|
+
) : file.descriptorType || version.descriptorTypes[0] || "CWL"
|
|
833
615
|
// Use file's descriptor type or first version descriptor type as default
|
|
834
616
|
})) : void 0,
|
|
835
617
|
images: version.images.length > 0 ? version.images : void 0
|
|
@@ -846,7 +628,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
846
628
|
}
|
|
847
629
|
const successMessage = `Tool created successfully with ID: ${toolId}`;
|
|
848
630
|
this.dispatchEvent(
|
|
849
|
-
new CustomEvent("ecc-tool-
|
|
631
|
+
new CustomEvent("ecc-tool-created", {
|
|
850
632
|
detail: { toolId, toolData, message: successMessage },
|
|
851
633
|
bubbles: true,
|
|
852
634
|
composed: true
|
|
@@ -856,7 +638,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
856
638
|
} catch (err) {
|
|
857
639
|
const errorMessage = err instanceof Error ? err.message : "Failed to create tool";
|
|
858
640
|
this.dispatchEvent(
|
|
859
|
-
new CustomEvent("ecc-tool-create-
|
|
641
|
+
new CustomEvent("ecc-tool-create-failed", {
|
|
860
642
|
detail: { error: errorMessage },
|
|
861
643
|
bubbles: true,
|
|
862
644
|
composed: true
|
|
@@ -897,100 +679,94 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
897
679
|
}
|
|
898
680
|
renderBasicFields() {
|
|
899
681
|
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>
|
|
682
|
+
<div class="grid gap-4">
|
|
683
|
+
<!-- Tool Name, Organization, Tool Class in same row on desktop -->
|
|
684
|
+
<div class="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
685
|
+
<div class="grid gap-2">
|
|
686
|
+
<ecc-utils-design-label for="tool-name" class="text-sm font-medium">
|
|
687
|
+
Tool Name
|
|
688
|
+
</ecc-utils-design-label>
|
|
689
|
+
<ecc-utils-design-input
|
|
690
|
+
id="tool-name"
|
|
691
|
+
.value=${this.formData.name}
|
|
692
|
+
@ecc-input-changed=${(e) => this.handleInputChange("name", e.detail.value)}
|
|
693
|
+
placeholder="Enter a descriptive name for your tool"
|
|
694
|
+
class="h-10"
|
|
695
|
+
></ecc-utils-design-input>
|
|
696
|
+
</div>
|
|
918
697
|
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
698
|
+
<div class="grid gap-2">
|
|
699
|
+
<ecc-utils-design-label
|
|
700
|
+
for="organization"
|
|
701
|
+
class="text-sm font-medium"
|
|
702
|
+
>
|
|
703
|
+
Organization <span class="text-destructive">*</span>
|
|
704
|
+
</ecc-utils-design-label>
|
|
705
|
+
<ecc-utils-design-input
|
|
706
|
+
id="organization"
|
|
707
|
+
.value=${this.formData.organization}
|
|
708
|
+
@ecc-input-changed=${(e) => this.handleInputChange("organization", e.detail.value)}
|
|
709
|
+
placeholder="Enter your organization name"
|
|
710
|
+
required
|
|
711
|
+
class="h-10"
|
|
712
|
+
></ecc-utils-design-input>
|
|
713
|
+
</div>
|
|
935
714
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
715
|
+
<div class="grid gap-1">
|
|
716
|
+
<ecc-utils-design-label
|
|
717
|
+
for="tool-class"
|
|
718
|
+
class="text-sm font-medium"
|
|
719
|
+
>
|
|
720
|
+
Tool Class <span class="text-destructive">*</span>
|
|
721
|
+
</ecc-utils-design-label>
|
|
722
|
+
<ecc-utils-design-select
|
|
723
|
+
id="tool-class-select"
|
|
724
|
+
.value=${this.formData.toolClassId}
|
|
725
|
+
@ecc-input-changed=${(e) => {
|
|
947
726
|
this.handleInputChange("toolClassId", e.detail.value);
|
|
948
727
|
}}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
728
|
+
required
|
|
729
|
+
>
|
|
730
|
+
<ecc-utils-design-select-trigger class="h-10">
|
|
731
|
+
<ecc-utils-design-select-value
|
|
732
|
+
placeholder="Select a tool class"
|
|
733
|
+
></ecc-utils-design-select-value>
|
|
734
|
+
</ecc-utils-design-select-trigger>
|
|
956
735
|
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
736
|
+
<ecc-utils-design-select-content>
|
|
737
|
+
<ecc-utils-design-select-item value="">
|
|
738
|
+
Select a tool class
|
|
739
|
+
</ecc-utils-design-select-item>
|
|
740
|
+
${this.toolClasses.map(
|
|
962
741
|
(tc) => html`
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
742
|
+
<ecc-utils-design-select-item value=${tc.id}>
|
|
743
|
+
<div class="flex flex-col">
|
|
744
|
+
<span class="font-medium">${tc.name}</span>
|
|
745
|
+
</div>
|
|
746
|
+
</ecc-utils-design-select-item>
|
|
747
|
+
`
|
|
969
748
|
)}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
</div>
|
|
749
|
+
</ecc-utils-design-select-content>
|
|
750
|
+
</ecc-utils-design-select>
|
|
973
751
|
</div>
|
|
752
|
+
</div>
|
|
974
753
|
|
|
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()}
|
|
754
|
+
<!-- Description spans full width -->
|
|
755
|
+
<div class="grid gap-2">
|
|
756
|
+
<ecc-utils-design-label for="description" class="text-sm font-medium">
|
|
757
|
+
Description
|
|
758
|
+
</ecc-utils-design-label>
|
|
759
|
+
<ecc-utils-design-textarea
|
|
760
|
+
id="description"
|
|
761
|
+
.value=${this.formData.description}
|
|
762
|
+
@ecc-input-changed=${(e) => this.handleInputChange("description", e.detail.value)}
|
|
763
|
+
placeholder="Provide a detailed description of what your tool does"
|
|
764
|
+
rows="4"
|
|
765
|
+
class="resize-none"
|
|
766
|
+
></ecc-utils-design-textarea>
|
|
993
767
|
</div>
|
|
768
|
+
${this.renderAdvancedFields()}
|
|
769
|
+
</div>
|
|
994
770
|
`;
|
|
995
771
|
}
|
|
996
772
|
renderAdvancedFields() {
|
|
@@ -1037,7 +813,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1037
813
|
<ecc-utils-design-input
|
|
1038
814
|
id="custom-tool-id"
|
|
1039
815
|
.value=${this.formData.customToolId}
|
|
1040
|
-
@ecc-
|
|
816
|
+
@ecc-input-changed=${(e) => {
|
|
1041
817
|
this.handleInputChange("customToolId", e.detail.value);
|
|
1042
818
|
this.handleInputChange(
|
|
1043
819
|
"useCustomId",
|
|
@@ -1060,7 +836,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1060
836
|
<ecc-utils-design-input
|
|
1061
837
|
id="aliases"
|
|
1062
838
|
.value=${this.formData.aliases.join(", ")}
|
|
1063
|
-
@ecc-
|
|
839
|
+
@ecc-input-changed=${(e) => this.handleArrayInputChange("aliases", e.detail.value)}
|
|
1064
840
|
placeholder="alias1, alias2, alias3"
|
|
1065
841
|
class="h-10"
|
|
1066
842
|
></ecc-utils-design-input>
|
|
@@ -1077,7 +853,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1077
853
|
<ecc-utils-design-input
|
|
1078
854
|
id="checker-url"
|
|
1079
855
|
.value=${this.formData.checkerUrl}
|
|
1080
|
-
@ecc-
|
|
856
|
+
@ecc-input-changed=${(e) => {
|
|
1081
857
|
this.handleInputChange("checkerUrl", e.detail.value);
|
|
1082
858
|
this.handleInputChange(
|
|
1083
859
|
"hasChecker",
|
|
@@ -1190,7 +966,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1190
966
|
>
|
|
1191
967
|
<ecc-utils-design-input
|
|
1192
968
|
.value=${version.name}
|
|
1193
|
-
@ecc-
|
|
969
|
+
@ecc-input-changed=${(e) => this.handleVersionChange(index, "name", e.detail.value)}
|
|
1194
970
|
placeholder="e.g., v1.0.0"
|
|
1195
971
|
class="h-10"
|
|
1196
972
|
></ecc-utils-design-input>
|
|
@@ -1202,7 +978,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1202
978
|
</ecc-utils-design-label>
|
|
1203
979
|
<ecc-utils-design-input
|
|
1204
980
|
.value=${version.author.join(", ")}
|
|
1205
|
-
@ecc-
|
|
981
|
+
@ecc-input-changed=${(e) => {
|
|
1206
982
|
const authors = e.detail.value.split(",").map((a) => a.trim()).filter((a) => a);
|
|
1207
983
|
this.handleVersionChange(index, "author", authors);
|
|
1208
984
|
}}
|
|
@@ -1219,9 +995,30 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1219
995
|
<ecc-utils-design-multi-select
|
|
1220
996
|
.value=${version.descriptorTypes}
|
|
1221
997
|
placeholder="Select supported languages..."
|
|
1222
|
-
@ecc-
|
|
998
|
+
@ecc-input-changed=${(e) => {
|
|
1223
999
|
const updatedVersions = [...this.versions];
|
|
1224
|
-
updatedVersions[index].descriptorTypes
|
|
1000
|
+
const oldDescriptorTypes = updatedVersions[index].descriptorTypes;
|
|
1001
|
+
const newDescriptorTypes = e.detail.value;
|
|
1002
|
+
updatedVersions[index].descriptorTypes = newDescriptorTypes;
|
|
1003
|
+
const removedDescriptorTypes = oldDescriptorTypes.filter(
|
|
1004
|
+
(type) => !newDescriptorTypes.includes(type)
|
|
1005
|
+
);
|
|
1006
|
+
if (removedDescriptorTypes.length > 0) {
|
|
1007
|
+
updatedVersions[index].files = updatedVersions[index].files.filter(
|
|
1008
|
+
(file) => !removedDescriptorTypes.includes(file.descriptorType)
|
|
1009
|
+
);
|
|
1010
|
+
}
|
|
1011
|
+
const currentActiveDescriptor = this.activeDescriptorType[index];
|
|
1012
|
+
if (currentActiveDescriptor && removedDescriptorTypes.includes(
|
|
1013
|
+
currentActiveDescriptor
|
|
1014
|
+
)) {
|
|
1015
|
+
this.activeDescriptorType = __spreadProps(__spreadValues({}, this.activeDescriptorType), {
|
|
1016
|
+
[index]: newDescriptorTypes.length > 0 ? newDescriptorTypes[0] : void 0
|
|
1017
|
+
});
|
|
1018
|
+
this.activeFileIndex = __spreadProps(__spreadValues({}, this.activeFileIndex), {
|
|
1019
|
+
[index]: -1
|
|
1020
|
+
});
|
|
1021
|
+
}
|
|
1225
1022
|
this.versions = updatedVersions;
|
|
1226
1023
|
}}
|
|
1227
1024
|
class="mt-2"
|
|
@@ -1285,9 +1082,11 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1285
1082
|
Tags
|
|
1286
1083
|
</ecc-utils-design-label>
|
|
1287
1084
|
<ecc-utils-design-multi-select
|
|
1288
|
-
.value=${
|
|
1085
|
+
.value=${_ECCClientElixirTrsToolCreate.getVersionTags(
|
|
1086
|
+
version
|
|
1087
|
+
)}
|
|
1289
1088
|
placeholder="Select tags..."
|
|
1290
|
-
@ecc-
|
|
1089
|
+
@ecc-input-changed=${(e) => {
|
|
1291
1090
|
this.handleVersionTagsChange(index, e.detail.value);
|
|
1292
1091
|
}}
|
|
1293
1092
|
>
|
|
@@ -1314,7 +1113,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1314
1113
|
</ecc-utils-design-label>
|
|
1315
1114
|
<ecc-utils-design-input
|
|
1316
1115
|
.value=${version.customVersionId}
|
|
1317
|
-
@ecc-
|
|
1116
|
+
@ecc-input-changed=${(e) => this.handleVersionChange(
|
|
1318
1117
|
index,
|
|
1319
1118
|
"customVersionId",
|
|
1320
1119
|
e.detail.value
|
|
@@ -1391,7 +1190,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1391
1190
|
>
|
|
1392
1191
|
<ecc-utils-design-select
|
|
1393
1192
|
.value=${this.activeDescriptorType[index] || version.descriptorTypes[0]}
|
|
1394
|
-
@ecc-
|
|
1193
|
+
@ecc-input-changed=${(e) => {
|
|
1395
1194
|
this.activeDescriptorType = __spreadProps(__spreadValues({}, this.activeDescriptorType), {
|
|
1396
1195
|
[index]: e.detail.value
|
|
1397
1196
|
});
|
|
@@ -1475,7 +1274,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1475
1274
|
<!-- Files List Section - 1/5 of screen -->
|
|
1476
1275
|
<div class="col-span-5 md:col-span-1">
|
|
1477
1276
|
<div class="space-y-1 max-h-[400px] overflow-y-auto">
|
|
1478
|
-
${filteredFiles.map((file
|
|
1277
|
+
${filteredFiles.map((file) => {
|
|
1479
1278
|
const originalIndex = files.indexOf(file);
|
|
1480
1279
|
return html`
|
|
1481
1280
|
<ecc-utils-design-button
|
|
@@ -1491,8 +1290,8 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1491
1290
|
>
|
|
1492
1291
|
<span class="truncate">
|
|
1493
1292
|
${file.path || `File ${originalIndex + 1}`}
|
|
1494
|
-
${file.
|
|
1495
|
-
>(${file.
|
|
1293
|
+
${file.uiFileType ? html`<span class="text-xs text-muted-foreground ml-1"
|
|
1294
|
+
>(${file.uiFileType})</span
|
|
1496
1295
|
>` : ""}
|
|
1497
1296
|
</span>
|
|
1498
1297
|
<ecc-utils-design-button
|
|
@@ -1541,24 +1340,19 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1541
1340
|
</div>
|
|
1542
1341
|
`;
|
|
1543
1342
|
}
|
|
1544
|
-
const
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
{ value: "TEST_FILE", label: "Test File" },
|
|
1548
|
-
{ value: "CONTAINERFILE", label: "Container File" },
|
|
1549
|
-
{ value: "OTHER", label: "Other" }
|
|
1550
|
-
];
|
|
1343
|
+
const otherFileHasPrimaryDescriptor = files.some(
|
|
1344
|
+
(file, index) => index !== activeIndex && file.uiFileType === "PRIMARY_DESCRIPTOR" && file.descriptorType === activeFile.descriptorType
|
|
1345
|
+
);
|
|
1551
1346
|
const checksumTypes = ["sha256", "sha1", "md5"];
|
|
1552
1347
|
return html`
|
|
1553
1348
|
<div class="space-y-4">
|
|
1554
|
-
|
|
1555
1349
|
<!-- File Configuration -->
|
|
1556
1350
|
<div class="grid grid-cols-1 md:grid-cols-4 gap-4">
|
|
1557
1351
|
<div>
|
|
1558
1352
|
<ecc-utils-design-label>File Path</ecc-utils-design-label>
|
|
1559
1353
|
<ecc-utils-design-input
|
|
1560
1354
|
.value=${activeFile.path}
|
|
1561
|
-
@ecc-
|
|
1355
|
+
@ecc-input-changed=${(e) => {
|
|
1562
1356
|
this.handleFileFieldChange(
|
|
1563
1357
|
versionIndex,
|
|
1564
1358
|
activeIndex,
|
|
@@ -1573,27 +1367,87 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1573
1367
|
<div>
|
|
1574
1368
|
<ecc-utils-design-label>File Type</ecc-utils-design-label>
|
|
1575
1369
|
<ecc-utils-design-select
|
|
1576
|
-
.value=${activeFile.
|
|
1577
|
-
@ecc-
|
|
1370
|
+
.value=${activeFile.uiFileType}
|
|
1371
|
+
@ecc-input-changed=${(e) => {
|
|
1372
|
+
const newUIFileType = e.detail.value;
|
|
1373
|
+
const newFileType = _ECCClientElixirTrsToolCreate.convertUIFileTypeToFileType(
|
|
1374
|
+
newUIFileType
|
|
1375
|
+
);
|
|
1376
|
+
const newContainerImageType = _ECCClientElixirTrsToolCreate.convertUIFileTypeToImageType(
|
|
1377
|
+
newUIFileType
|
|
1378
|
+
);
|
|
1379
|
+
this.handleFileFieldChange(
|
|
1380
|
+
versionIndex,
|
|
1381
|
+
activeIndex,
|
|
1382
|
+
"uiFileType",
|
|
1383
|
+
newUIFileType
|
|
1384
|
+
);
|
|
1578
1385
|
this.handleFileFieldChange(
|
|
1579
1386
|
versionIndex,
|
|
1580
1387
|
activeIndex,
|
|
1581
1388
|
"fileType",
|
|
1582
|
-
|
|
1389
|
+
newFileType
|
|
1583
1390
|
);
|
|
1391
|
+
if (newContainerImageType) {
|
|
1392
|
+
this.handleFileFieldChange(
|
|
1393
|
+
versionIndex,
|
|
1394
|
+
activeIndex,
|
|
1395
|
+
"containerImageType",
|
|
1396
|
+
newContainerImageType
|
|
1397
|
+
);
|
|
1398
|
+
} else {
|
|
1399
|
+
this.handleFileFieldChange(
|
|
1400
|
+
versionIndex,
|
|
1401
|
+
activeIndex,
|
|
1402
|
+
"containerImageType",
|
|
1403
|
+
void 0
|
|
1404
|
+
);
|
|
1405
|
+
}
|
|
1584
1406
|
}}
|
|
1585
1407
|
>
|
|
1586
1408
|
<ecc-utils-design-select-trigger>
|
|
1587
1409
|
<ecc-utils-design-select-value></ecc-utils-design-select-value>
|
|
1588
1410
|
</ecc-utils-design-select-trigger>
|
|
1589
1411
|
<ecc-utils-design-select-content>
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1412
|
+
<!-- Source Files Group -->
|
|
1413
|
+
<ecc-utils-design-select-group>
|
|
1414
|
+
<ecc-utils-design-select-label
|
|
1415
|
+
>Source file</ecc-utils-design-select-label
|
|
1416
|
+
>
|
|
1417
|
+
<ecc-utils-design-select-item
|
|
1418
|
+
value="PRIMARY_DESCRIPTOR"
|
|
1419
|
+
.disabled=${otherFileHasPrimaryDescriptor && activeFile.uiFileType !== "PRIMARY_DESCRIPTOR"}
|
|
1420
|
+
>
|
|
1421
|
+
Primary Descriptor
|
|
1422
|
+
</ecc-utils-design-select-item>
|
|
1423
|
+
<ecc-utils-design-select-item value="SECONDARY_DESCRIPTOR">
|
|
1424
|
+
Secondary Descriptor
|
|
1425
|
+
</ecc-utils-design-select-item>
|
|
1426
|
+
<ecc-utils-design-select-item value="TEST_FILE">
|
|
1427
|
+
Test File
|
|
1428
|
+
</ecc-utils-design-select-item>
|
|
1429
|
+
<ecc-utils-design-select-item value="OTHER">
|
|
1430
|
+
Other
|
|
1431
|
+
</ecc-utils-design-select-item>
|
|
1432
|
+
</ecc-utils-design-select-group>
|
|
1433
|
+
|
|
1434
|
+
<ecc-utils-design-select-separator></ecc-utils-design-select-separator>
|
|
1435
|
+
|
|
1436
|
+
<!-- Image Files Group -->
|
|
1437
|
+
<ecc-utils-design-select-group>
|
|
1438
|
+
<ecc-utils-design-select-label
|
|
1439
|
+
>Image file</ecc-utils-design-select-label
|
|
1440
|
+
>
|
|
1441
|
+
<ecc-utils-design-select-item value="Docker">
|
|
1442
|
+
Docker
|
|
1443
|
+
</ecc-utils-design-select-item>
|
|
1444
|
+
<ecc-utils-design-select-item value="Singularity">
|
|
1445
|
+
Singularity
|
|
1446
|
+
</ecc-utils-design-select-item>
|
|
1447
|
+
<ecc-utils-design-select-item value="Conda">
|
|
1448
|
+
Conda
|
|
1449
|
+
</ecc-utils-design-select-item>
|
|
1450
|
+
</ecc-utils-design-select-group>
|
|
1597
1451
|
</ecc-utils-design-select-content>
|
|
1598
1452
|
</ecc-utils-design-select>
|
|
1599
1453
|
</div>
|
|
@@ -1602,7 +1456,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1602
1456
|
<ecc-utils-design-label>Checksum Type</ecc-utils-design-label>
|
|
1603
1457
|
<ecc-utils-design-select
|
|
1604
1458
|
.value=${activeFile.checksumType}
|
|
1605
|
-
@ecc-
|
|
1459
|
+
@ecc-input-changed=${(e) => {
|
|
1606
1460
|
this.handleFileFieldChange(
|
|
1607
1461
|
versionIndex,
|
|
1608
1462
|
activeIndex,
|
|
@@ -1632,7 +1486,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1632
1486
|
>
|
|
1633
1487
|
<ecc-utils-design-input
|
|
1634
1488
|
.value=${activeFile.checksumValue}
|
|
1635
|
-
@ecc-
|
|
1489
|
+
@ecc-input-changed=${(e) => {
|
|
1636
1490
|
this.handleFileFieldChange(
|
|
1637
1491
|
versionIndex,
|
|
1638
1492
|
activeIndex,
|
|
@@ -1652,8 +1506,10 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1652
1506
|
${activeFile.content !== void 0 ? html`
|
|
1653
1507
|
<ecc-utils-design-code
|
|
1654
1508
|
value=${activeFile.content}
|
|
1655
|
-
extension=${
|
|
1656
|
-
|
|
1509
|
+
extension=${_ECCClientElixirTrsToolCreate.getFileExtension(
|
|
1510
|
+
activeFile.path
|
|
1511
|
+
)}
|
|
1512
|
+
@ecc-input-changed=${(e) => {
|
|
1657
1513
|
this.handleFileFieldChange(
|
|
1658
1514
|
versionIndex,
|
|
1659
1515
|
activeIndex,
|
|
@@ -1675,17 +1531,11 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1675
1531
|
</div>
|
|
1676
1532
|
`;
|
|
1677
1533
|
}
|
|
1678
|
-
|
|
1679
|
-
return html``;
|
|
1680
|
-
}
|
|
1681
|
-
getVersionTags(version) {
|
|
1534
|
+
static getVersionTags(version) {
|
|
1682
1535
|
const tags = [];
|
|
1683
|
-
if (version.isProduction)
|
|
1684
|
-
|
|
1685
|
-
if (version.
|
|
1686
|
-
tags.push("verified");
|
|
1687
|
-
if (version.signed)
|
|
1688
|
-
tags.push("signed");
|
|
1536
|
+
if (version.isProduction) tags.push("prod");
|
|
1537
|
+
if (version.verified) tags.push("verified");
|
|
1538
|
+
if (version.signed) tags.push("signed");
|
|
1689
1539
|
return tags;
|
|
1690
1540
|
}
|
|
1691
1541
|
handleVersionTagsChange(index, tags) {
|
|
@@ -1697,6 +1547,24 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1697
1547
|
});
|
|
1698
1548
|
this.versions = updatedVersions;
|
|
1699
1549
|
}
|
|
1550
|
+
static getUIFileType(filename, fileType) {
|
|
1551
|
+
if (fileType === "CONTAINERFILE") {
|
|
1552
|
+
return _ECCClientElixirTrsToolCreate.getContainerImageType(filename);
|
|
1553
|
+
}
|
|
1554
|
+
return fileType;
|
|
1555
|
+
}
|
|
1556
|
+
static convertUIFileTypeToFileType(uiFileType) {
|
|
1557
|
+
if (uiFileType === "Docker" || uiFileType === "Singularity" || uiFileType === "Conda") {
|
|
1558
|
+
return "CONTAINERFILE";
|
|
1559
|
+
}
|
|
1560
|
+
return uiFileType;
|
|
1561
|
+
}
|
|
1562
|
+
static convertUIFileTypeToImageType(uiFileType) {
|
|
1563
|
+
if (uiFileType === "Docker" || uiFileType === "Singularity" || uiFileType === "Conda") {
|
|
1564
|
+
return uiFileType;
|
|
1565
|
+
}
|
|
1566
|
+
return void 0;
|
|
1567
|
+
}
|
|
1700
1568
|
render() {
|
|
1701
1569
|
return html`
|
|
1702
1570
|
<div class="">
|
|
@@ -1707,8 +1575,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1707
1575
|
}}
|
|
1708
1576
|
>
|
|
1709
1577
|
<div class="space-y-4">
|
|
1710
|
-
${this.renderBasicFields()}
|
|
1711
|
-
${this.renderVersions()}
|
|
1578
|
+
${this.renderBasicFields()} ${this.renderVersions()}
|
|
1712
1579
|
</div>
|
|
1713
1580
|
|
|
1714
1581
|
<div class="flex justify-between items-center mt-4">
|
|
@@ -1735,7 +1602,7 @@ var ECCClientElixirTrsToolCreate = class extends LitElement {
|
|
|
1735
1602
|
`;
|
|
1736
1603
|
}
|
|
1737
1604
|
};
|
|
1738
|
-
|
|
1605
|
+
_ECCClientElixirTrsToolCreate.styles = [
|
|
1739
1606
|
ComponentStyles,
|
|
1740
1607
|
GlobalStyles,
|
|
1741
1608
|
css`
|
|
@@ -1756,34 +1623,35 @@ ECCClientElixirTrsToolCreate.styles = [
|
|
|
1756
1623
|
];
|
|
1757
1624
|
__decorateClass([
|
|
1758
1625
|
property({ type: String, reflect: true })
|
|
1759
|
-
],
|
|
1626
|
+
], _ECCClientElixirTrsToolCreate.prototype, "baseUrl", 2);
|
|
1760
1627
|
__decorateClass([
|
|
1761
1628
|
property({ attribute: false, reflect: true })
|
|
1762
|
-
],
|
|
1629
|
+
], _ECCClientElixirTrsToolCreate.prototype, "provider", 2);
|
|
1763
1630
|
__decorateClass([
|
|
1764
1631
|
state()
|
|
1765
|
-
],
|
|
1632
|
+
], _ECCClientElixirTrsToolCreate.prototype, "toolClasses", 2);
|
|
1766
1633
|
__decorateClass([
|
|
1767
1634
|
state()
|
|
1768
|
-
],
|
|
1635
|
+
], _ECCClientElixirTrsToolCreate.prototype, "loading", 2);
|
|
1769
1636
|
__decorateClass([
|
|
1770
1637
|
state()
|
|
1771
|
-
],
|
|
1638
|
+
], _ECCClientElixirTrsToolCreate.prototype, "error", 2);
|
|
1772
1639
|
__decorateClass([
|
|
1773
1640
|
state()
|
|
1774
|
-
],
|
|
1641
|
+
], _ECCClientElixirTrsToolCreate.prototype, "success", 2);
|
|
1775
1642
|
__decorateClass([
|
|
1776
1643
|
state()
|
|
1777
|
-
],
|
|
1644
|
+
], _ECCClientElixirTrsToolCreate.prototype, "formData", 2);
|
|
1778
1645
|
__decorateClass([
|
|
1779
1646
|
state()
|
|
1780
|
-
],
|
|
1647
|
+
], _ECCClientElixirTrsToolCreate.prototype, "versions", 2);
|
|
1781
1648
|
__decorateClass([
|
|
1782
1649
|
state()
|
|
1783
|
-
],
|
|
1650
|
+
], _ECCClientElixirTrsToolCreate.prototype, "activeFileIndex", 2);
|
|
1784
1651
|
__decorateClass([
|
|
1785
1652
|
state()
|
|
1786
|
-
],
|
|
1653
|
+
], _ECCClientElixirTrsToolCreate.prototype, "activeDescriptorType", 2);
|
|
1654
|
+
var ECCClientElixirTrsToolCreate = _ECCClientElixirTrsToolCreate;
|
|
1787
1655
|
var tool_create_default = ECCClientElixirTrsToolCreate;
|
|
1788
1656
|
|
|
1789
1657
|
export { ECCClientElixirTrsToolCreate, tool_create_default };
|