@flusys/ng-storage 1.1.0 → 1.2.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (29) hide show
  1. package/README.md +36 -762
  2. package/fesm2022/flusys-ng-storage-file-manager-form.component-DhqZmpuX.mjs +671 -0
  3. package/fesm2022/flusys-ng-storage-file-manager-form.component-DhqZmpuX.mjs.map +1 -0
  4. package/fesm2022/flusys-ng-storage-file-manager-list.component-nZDj1UfS.mjs +464 -0
  5. package/fesm2022/flusys-ng-storage-file-manager-list.component-nZDj1UfS.mjs.map +1 -0
  6. package/fesm2022/flusys-ng-storage-folder-form.component-Bru9NQyr.mjs +218 -0
  7. package/fesm2022/flusys-ng-storage-folder-form.component-Bru9NQyr.mjs.map +1 -0
  8. package/fesm2022/flusys-ng-storage-folder-list.component-fuJMWYWZ.mjs +263 -0
  9. package/fesm2022/flusys-ng-storage-folder-list.component-fuJMWYWZ.mjs.map +1 -0
  10. package/fesm2022/flusys-ng-storage-storage-config-form.component-Da-pWR7d.mjs +891 -0
  11. package/fesm2022/flusys-ng-storage-storage-config-form.component-Da-pWR7d.mjs.map +1 -0
  12. package/fesm2022/flusys-ng-storage-storage-config-list.component-D59X4sae.mjs +288 -0
  13. package/fesm2022/flusys-ng-storage-storage-config-list.component-D59X4sae.mjs.map +1 -0
  14. package/fesm2022/flusys-ng-storage.mjs +533 -216
  15. package/fesm2022/flusys-ng-storage.mjs.map +1 -1
  16. package/package.json +11 -10
  17. package/types/flusys-ng-storage.d.ts +99 -48
  18. package/fesm2022/flusys-ng-storage-file-manager-form.component-CXVB9G-f.mjs +0 -484
  19. package/fesm2022/flusys-ng-storage-file-manager-form.component-CXVB9G-f.mjs.map +0 -1
  20. package/fesm2022/flusys-ng-storage-file-manager-list.component-0O_b4EjN.mjs +0 -304
  21. package/fesm2022/flusys-ng-storage-file-manager-list.component-0O_b4EjN.mjs.map +0 -1
  22. package/fesm2022/flusys-ng-storage-folder-form.component-BTQGEqNu.mjs +0 -155
  23. package/fesm2022/flusys-ng-storage-folder-form.component-BTQGEqNu.mjs.map +0 -1
  24. package/fesm2022/flusys-ng-storage-folder-list.component-B8GoIh6Z.mjs +0 -194
  25. package/fesm2022/flusys-ng-storage-folder-list.component-B8GoIh6Z.mjs.map +0 -1
  26. package/fesm2022/flusys-ng-storage-storage-config-form.component-CorNWrmF.mjs +0 -463
  27. package/fesm2022/flusys-ng-storage-storage-config-form.component-CorNWrmF.mjs.map +0 -1
  28. package/fesm2022/flusys-ng-storage-storage-config-list.component-YXzz3Tvo.mjs +0 -187
  29. package/fesm2022/flusys-ng-storage-storage-config-list.component-YXzz3Tvo.mjs.map +0 -1
@@ -0,0 +1,891 @@
1
+ import * as i0 from '@angular/core';
2
+ import { inject, signal, computed, effect, Component } from '@angular/core';
3
+ import { toSignal } from '@angular/core/rxjs-interop';
4
+ import { form, required, FormField } from '@angular/forms/signals';
5
+ import { ActivatedRoute } from '@angular/router';
6
+ import { TranslateService, AngularModule, TranslatePipe } from '@flusys/ng-shared';
7
+ import { FileLocationEnum, BaseStoragePage, StorageConfigApiService, STORAGE_PROVIDER_OPTIONS } from './flusys-ng-storage.mjs';
8
+ import * as i1$1 from '@flusys/ng-ui';
9
+ import { UiModule } from '@flusys/ng-ui';
10
+ import * as i1 from '@angular/forms';
11
+
12
+ const DEFAULT_FORM_MODEL = {
13
+ id: '',
14
+ name: '',
15
+ storage: FileLocationEnum.AWS,
16
+ isActive: true,
17
+ isDefault: false,
18
+ awsRegion: '',
19
+ awsBucket: '',
20
+ awsAccessKeyId: '',
21
+ awsSecretAccessKey: '',
22
+ awsEndpoint: '',
23
+ azureAccountName: '',
24
+ azureAccountKey: '',
25
+ azureContainerName: '',
26
+ sftpHost: '',
27
+ sftpPort: '22',
28
+ sftpUsername: '',
29
+ sftpPassword: '',
30
+ sftpBasePath: '',
31
+ localBasePath: '',
32
+ };
33
+ class StorageConfigFormComponent extends BaseStoragePage {
34
+ route = inject(ActivatedRoute);
35
+ configService = inject(StorageConfigApiService);
36
+ translateService = inject(TranslateService);
37
+ routeParams = toSignal(this.route.paramMap);
38
+ initialized = false;
39
+ fileLocationEnum = FileLocationEnum;
40
+ storageProviderOptions = STORAGE_PROVIDER_OPTIONS;
41
+ existingConfig = signal(null, /* @ts-ignore */
42
+ ...(ngDevMode ? [{ debugName: "existingConfig" }] : /* istanbul ignore next */ []));
43
+ isEditMode = computed(() => !!this.existingConfig(), /* @ts-ignore */
44
+ ...(ngDevMode ? [{ debugName: "isEditMode" }] : /* istanbul ignore next */ []));
45
+ formModel = signal({
46
+ ...DEFAULT_FORM_MODEL,
47
+ }, /* @ts-ignore */
48
+ ...(ngDevMode ? [{ debugName: "formModel" }] : /* istanbul ignore next */ []));
49
+ configForm = form(this.formModel, (f) => {
50
+ required(f.name, {
51
+ message: this.translateService.translate('storage.validation.config.name.required'),
52
+ });
53
+ });
54
+ selectedProvider = computed(() => this.formModel().storage, /* @ts-ignore */
55
+ ...(ngDevMode ? [{ debugName: "selectedProvider" }] : /* istanbul ignore next */ []));
56
+ isFormValid = computed(() => this.formModel().name.trim().length > 0, /* @ts-ignore */
57
+ ...(ngDevMode ? [{ debugName: "isFormValid" }] : /* istanbul ignore next */ []));
58
+ constructor() {
59
+ super();
60
+ effect(() => {
61
+ const params = this.routeParams();
62
+ if (!params || this.initialized)
63
+ return;
64
+ this.initialized = true;
65
+ const configId = params.get('id');
66
+ if (configId && configId !== 'new') {
67
+ this.loadConfig(configId);
68
+ }
69
+ });
70
+ }
71
+ async loadConfig(id) {
72
+ this.isLoading.set(true);
73
+ try {
74
+ const response = await this.configService.findById(id);
75
+ if (response.success && response.data) {
76
+ const config = response.data;
77
+ this.existingConfig.set(config);
78
+ this.formModel.update((m) => ({
79
+ ...m,
80
+ id: config.id,
81
+ name: config.name,
82
+ storage: config.storage,
83
+ isActive: config.isActive ?? true,
84
+ isDefault: config.isDefault ?? false,
85
+ ...this.extractProviderConfig(config),
86
+ }));
87
+ }
88
+ }
89
+ catch {
90
+ this.navigateTo(['/storage/configs']);
91
+ }
92
+ finally {
93
+ this.isLoading.set(false);
94
+ }
95
+ }
96
+ async onSubmit() {
97
+ if (!this.isFormValid())
98
+ return;
99
+ this.isLoading.set(true);
100
+ try {
101
+ const formValue = this.formModel();
102
+ const config = this.buildProviderConfig(formValue);
103
+ const response = this.isEditMode()
104
+ ? await this.configService.update({
105
+ id: formValue.id,
106
+ name: formValue.name,
107
+ storage: formValue.storage,
108
+ config,
109
+ isActive: formValue.isActive,
110
+ isDefault: formValue.isDefault,
111
+ })
112
+ : await this.configService.insert({
113
+ name: formValue.name,
114
+ storage: formValue.storage,
115
+ config,
116
+ isActive: formValue.isActive,
117
+ isDefault: formValue.isDefault,
118
+ });
119
+ this.showSuccess(response.messageKey
120
+ ? this.translateService.translate(response.messageKey, response.messageVariables)
121
+ : (response.message ?? ''));
122
+ this.navigateTo(['/storage/configs']);
123
+ }
124
+ catch {
125
+ }
126
+ finally {
127
+ this.isLoading.set(false);
128
+ }
129
+ }
130
+ onCancel() {
131
+ this.navigateTo(['/storage/configs']);
132
+ }
133
+ extractProviderConfig(config) {
134
+ const c = config.config ?? {};
135
+ switch (config.storage) {
136
+ case FileLocationEnum.AWS:
137
+ return {
138
+ awsRegion: c['region'] || '',
139
+ awsBucket: c['bucket'] || '',
140
+ awsAccessKeyId: c['accessKeyId'] || '',
141
+ awsSecretAccessKey: c['secretAccessKey'] || '',
142
+ awsEndpoint: c['endpoint'] || '',
143
+ };
144
+ case FileLocationEnum.AZURE:
145
+ return {
146
+ azureAccountName: c['accountName'] || '',
147
+ azureAccountKey: c['accountKey'] || '',
148
+ azureContainerName: c['containerName'] || '',
149
+ };
150
+ case FileLocationEnum.SFTP:
151
+ return {
152
+ sftpHost: c['host'] || '',
153
+ sftpPort: (c['port'] || 22).toString(),
154
+ sftpUsername: c['username'] || '',
155
+ sftpPassword: c['password'] || '',
156
+ sftpBasePath: c['basePath'] || '',
157
+ };
158
+ case FileLocationEnum.LOCAL:
159
+ return { localBasePath: c['basePath'] || '' };
160
+ default:
161
+ return {};
162
+ }
163
+ }
164
+ buildProviderConfig(formValue) {
165
+ switch (formValue.storage) {
166
+ case FileLocationEnum.AWS:
167
+ return {
168
+ region: formValue.awsRegion,
169
+ bucket: formValue.awsBucket,
170
+ accessKeyId: formValue.awsAccessKeyId,
171
+ secretAccessKey: formValue.awsSecretAccessKey,
172
+ ...(formValue.awsEndpoint && { endpoint: formValue.awsEndpoint }),
173
+ };
174
+ case FileLocationEnum.AZURE:
175
+ return {
176
+ accountName: formValue.azureAccountName,
177
+ accountKey: formValue.azureAccountKey,
178
+ containerName: formValue.azureContainerName,
179
+ };
180
+ case FileLocationEnum.SFTP:
181
+ return {
182
+ host: formValue.sftpHost,
183
+ port: formValue.sftpPort ? parseInt(formValue.sftpPort, 10) : 22,
184
+ username: formValue.sftpUsername,
185
+ password: formValue.sftpPassword,
186
+ basePath: formValue.sftpBasePath,
187
+ };
188
+ case FileLocationEnum.LOCAL:
189
+ return { basePath: formValue.localBasePath };
190
+ default:
191
+ return {};
192
+ }
193
+ }
194
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StorageConfigFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
195
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.6", type: StorageConfigFormComponent, isStandalone: true, selector: "lib-storage-config-form", usesInheritance: true, ngImport: i0, template: `
196
+ <div class="card">
197
+ <h3 class="text-lg sm:text-xl font-semibold mb-4">
198
+ {{
199
+ (isEditMode()
200
+ ? 'storage.config.edit.config'
201
+ : 'storage.config.new.config'
202
+ ) | translate
203
+ }}
204
+ </h3>
205
+ @if (showCompanyInfo()) {
206
+ <p class="text-sm text-muted-color mb-4">
207
+ {{ 'shared.company' | translate }}: {{ currentCompanyName() }}
208
+ </p>
209
+ }
210
+
211
+ <form (ngSubmit)="onSubmit()">
212
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
213
+ <div class="field">
214
+ <label
215
+ for="name"
216
+ class="block font-medium mb-2 text-sm sm:text-base"
217
+ >{{ 'storage.config.config.name.required' | translate }}</label
218
+ >
219
+ <input
220
+ fInputText
221
+ id="name"
222
+ [formField]="configForm.name"
223
+ [placeholder]="
224
+ 'storage.config.config.name.placeholder' | translate
225
+ "
226
+ class="w-full"
227
+ />
228
+ </div>
229
+
230
+ <div class="field">
231
+ <label
232
+ for="storage"
233
+ class="block font-medium mb-2 text-sm sm:text-base"
234
+ >{{ 'storage.config.provider.required' | translate }}</label
235
+ >
236
+ <f-select
237
+ inputId="storage"
238
+ [options]="[...storageProviderOptions]"
239
+ optionValue="value"
240
+ [formField]="configForm.storage"
241
+ >
242
+ <ng-template #item let-provider>{{ provider.labelKey | translate }}</ng-template>
243
+ <ng-template #selectedItem let-provider>{{ provider.labelKey | translate }}</ng-template>
244
+ </f-select>
245
+ </div>
246
+
247
+ <div class="field flex items-center gap-2">
248
+ <f-toggleswitch [formField]="configForm.isActive" />
249
+ <label class="text-sm sm:text-base">{{
250
+ 'shared.active' | translate
251
+ }}</label>
252
+ </div>
253
+
254
+ <div class="field flex items-center gap-2">
255
+ <f-toggleswitch [formField]="configForm.isDefault" />
256
+ <label class="text-sm sm:text-base">{{
257
+ 'storage.set.as.default' | translate
258
+ }}</label>
259
+ </div>
260
+ </div>
261
+
262
+ @if (selectedProvider() === fileLocationEnum.AWS) {
263
+ <div
264
+ class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
265
+ >
266
+ <div class="md:col-span-2 mb-2">
267
+ <span
268
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
269
+ >{{ 'storage.aws.title' | translate }}</span
270
+ >
271
+ </div>
272
+ <div class="field">
273
+ <label
274
+ for="awsRegion"
275
+ class="block font-medium mb-2 text-sm sm:text-base"
276
+ >{{ 'storage.config.region.required' | translate }}</label
277
+ >
278
+ <input
279
+ fInputText
280
+ id="awsRegion"
281
+ [formField]="configForm.awsRegion"
282
+ [placeholder]="'storage.aws.region.placeholder' | translate"
283
+ class="w-full"
284
+ />
285
+ </div>
286
+ <div class="field">
287
+ <label
288
+ for="awsBucket"
289
+ class="block font-medium mb-2 text-sm sm:text-base"
290
+ >{{ 'storage.config.bucket.required' | translate }}</label
291
+ >
292
+ <input
293
+ fInputText
294
+ id="awsBucket"
295
+ [formField]="configForm.awsBucket"
296
+ [placeholder]="'storage.aws.bucket.placeholder' | translate"
297
+ class="w-full"
298
+ />
299
+ </div>
300
+ <div class="field">
301
+ <label
302
+ for="awsAccessKeyId"
303
+ class="block font-medium mb-2 text-sm sm:text-base"
304
+ >{{ 'storage.config.access.key.required' | translate }}</label
305
+ >
306
+ <input
307
+ fInputText
308
+ id="awsAccessKeyId"
309
+ [formField]="configForm.awsAccessKeyId"
310
+ class="w-full"
311
+ />
312
+ </div>
313
+ <div class="field">
314
+ <label
315
+ for="awsSecretAccessKey"
316
+ class="block font-medium mb-2 text-sm sm:text-base"
317
+ >{{ 'storage.config.secret.key.required' | translate }}</label
318
+ >
319
+ <input
320
+ type="password"
321
+ fInputText
322
+ id="awsSecretAccessKey"
323
+ [formField]="configForm.awsSecretAccessKey"
324
+ class="w-full"
325
+ />
326
+ </div>
327
+ <div class="field md:col-span-2">
328
+ <label
329
+ for="awsEndpoint"
330
+ class="block font-medium mb-2 text-sm sm:text-base"
331
+ >{{ 'storage.config.endpoint.optional' | translate }}</label
332
+ >
333
+ <input
334
+ fInputText
335
+ id="awsEndpoint"
336
+ [formField]="configForm.awsEndpoint"
337
+ [placeholder]="
338
+ 'storage.config.endpoint.placeholder' | translate
339
+ "
340
+ class="w-full"
341
+ />
342
+ </div>
343
+ </div>
344
+ }
345
+
346
+ @if (selectedProvider() === fileLocationEnum.AZURE) {
347
+ <div
348
+ class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
349
+ >
350
+ <div class="md:col-span-2 mb-2">
351
+ <span
352
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
353
+ >{{ 'storage.azure.title' | translate }}</span
354
+ >
355
+ </div>
356
+ <div class="field">
357
+ <label
358
+ for="azureAccountName"
359
+ class="block font-medium mb-2 text-sm sm:text-base"
360
+ >{{ 'storage.azure.account.name.required' | translate }}</label
361
+ >
362
+ <input
363
+ fInputText
364
+ id="azureAccountName"
365
+ [formField]="configForm.azureAccountName"
366
+ class="w-full"
367
+ />
368
+ </div>
369
+ <div class="field">
370
+ <label
371
+ for="azureContainerName"
372
+ class="block font-medium mb-2 text-sm sm:text-base"
373
+ >{{
374
+ 'storage.azure.container.name.required' | translate
375
+ }}</label
376
+ >
377
+ <input
378
+ fInputText
379
+ id="azureContainerName"
380
+ [formField]="configForm.azureContainerName"
381
+ class="w-full"
382
+ />
383
+ </div>
384
+ <div class="field md:col-span-2">
385
+ <label
386
+ for="azureAccountKey"
387
+ class="block font-medium mb-2 text-sm sm:text-base"
388
+ >{{ 'storage.azure.account.key.required' | translate }}</label
389
+ >
390
+ <input
391
+ type="password"
392
+ fInputText
393
+ id="azureAccountKey"
394
+ [formField]="configForm.azureAccountKey"
395
+ class="w-full"
396
+ />
397
+ </div>
398
+ </div>
399
+ }
400
+
401
+ @if (selectedProvider() === fileLocationEnum.SFTP) {
402
+ <div
403
+ class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
404
+ >
405
+ <div class="md:col-span-2 mb-2">
406
+ <span
407
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
408
+ >{{ 'storage.sftp.title' | translate }}</span
409
+ >
410
+ </div>
411
+ <div class="field">
412
+ <label
413
+ for="sftpHost"
414
+ class="block font-medium mb-2 text-sm sm:text-base"
415
+ >{{ 'storage.sftp.host.required' | translate }}</label
416
+ >
417
+ <input
418
+ fInputText
419
+ id="sftpHost"
420
+ [formField]="configForm.sftpHost"
421
+ [placeholder]="'storage.sftp.host.placeholder' | translate"
422
+ class="w-full"
423
+ />
424
+ </div>
425
+ <div class="field">
426
+ <label
427
+ for="sftpPort"
428
+ class="block font-medium mb-2 text-sm sm:text-base"
429
+ >{{ 'storage.sftp.port.required' | translate }}</label
430
+ >
431
+ <input
432
+ type="number"
433
+ fInputText
434
+ id="sftpPort"
435
+ [formField]="configForm.sftpPort"
436
+ [placeholder]="'storage.sftp.port.placeholder' | translate"
437
+ class="w-full"
438
+ />
439
+ </div>
440
+ <div class="field">
441
+ <label
442
+ for="sftpUsername"
443
+ class="block font-medium mb-2 text-sm sm:text-base"
444
+ >{{ 'storage.sftp.username.required' | translate }}</label
445
+ >
446
+ <input
447
+ fInputText
448
+ id="sftpUsername"
449
+ [formField]="configForm.sftpUsername"
450
+ class="w-full"
451
+ />
452
+ </div>
453
+ <div class="field">
454
+ <label
455
+ for="sftpPassword"
456
+ class="block font-medium mb-2 text-sm sm:text-base"
457
+ >{{ 'storage.sftp.password.required' | translate }}</label
458
+ >
459
+ <input
460
+ type="password"
461
+ fInputText
462
+ id="sftpPassword"
463
+ [formField]="configForm.sftpPassword"
464
+ class="w-full"
465
+ />
466
+ </div>
467
+ <div class="field md:col-span-2">
468
+ <label
469
+ for="sftpBasePath"
470
+ class="block font-medium mb-2 text-sm sm:text-base"
471
+ >{{ 'storage.sftp.base.path.required' | translate }}</label
472
+ >
473
+ <input
474
+ fInputText
475
+ id="sftpBasePath"
476
+ [formField]="configForm.sftpBasePath"
477
+ [placeholder]="'storage.sftp.base.path.placeholder' | translate"
478
+ class="w-full"
479
+ />
480
+ </div>
481
+ </div>
482
+ }
483
+
484
+ @if (selectedProvider() === fileLocationEnum.LOCAL) {
485
+ <div
486
+ class="grid grid-cols-1 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
487
+ >
488
+ <div class="mb-2">
489
+ <span
490
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
491
+ >{{ 'storage.local.title' | translate }}</span
492
+ >
493
+ </div>
494
+ <div class="field">
495
+ <label
496
+ for="localBasePath"
497
+ class="block font-medium mb-2 text-sm sm:text-base"
498
+ >{{ 'storage.local.base.path.required' | translate }}</label
499
+ >
500
+ <input
501
+ fInputText
502
+ id="localBasePath"
503
+ [formField]="configForm.localBasePath"
504
+ [placeholder]="
505
+ 'storage.local.base.path.placeholder' | translate
506
+ "
507
+ class="w-full"
508
+ />
509
+ </div>
510
+ </div>
511
+ }
512
+
513
+ <div class="flex justify-end gap-2 mt-4">
514
+ <button
515
+ fButton
516
+ severity="secondary"
517
+ [outlined]="true"
518
+ (click)="onCancel()"
519
+ >
520
+ <span pButtonLabel>{{ 'shared.cancel' | translate }}</span>
521
+ </button>
522
+ <button
523
+ fButton
524
+ type="submit"
525
+ [disabled]="!isFormValid() || isLoading()"
526
+ >
527
+ @if (isLoading()) {
528
+ <ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
529
+ }
530
+ <span pButtonLabel>{{
531
+ (isEditMode() ? 'shared.update' : 'shared.create') | translate
532
+ }}</span>
533
+ </button>
534
+ </div>
535
+ </form>
536
+ </div>
537
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: AngularModule }, { kind: "directive", type: i1.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i1.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],[formArray],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i1.NgForm, selector: "form:not([ngNoForm]):not([formGroup]):not([formArray]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "ngmodule", type: UiModule }, { kind: "directive", type: i1$1.FButtonDirective, selector: "[fButton]", inputs: ["severity", "text", "outlined", "link", "variant", "rounded", "raised", "fluid", "disabled", "loading", "loadingIcon", "size", "label", "icon", "iconPos", "ariaLabel", "plain"] }, { kind: "directive", type: i1$1.InputTextDirective, selector: "[fInputText]", inputs: ["invalid", "touched", "variant", "size", "fluid"] }, { kind: "component", type: i1$1.SelectComponent, selector: "f-select", inputs: ["options", "optionLabel", "optionValue", "placeholder", "disabled", "filter", "filterBy", "filterMatchMode", "filterLocale", "filterPlaceholder", "resetFilterOnHide", "autofocusFilter", "emptyMessage", "emptyFilterMessage", "showClear", "loading", "loadingIcon", "dropdownIcon", "clearIcon", "inputId", "invalid", "touched", "styleClass", "style", "editable", "readonly", "autofocus", "checkmark", "group", "optionGroupLabel", "optionGroupChildren", "virtualScroll", "virtualScrollItemSize", "lazy"], outputs: ["onFilter", "onChange", "onShow", "onHide", "onBlur", "onFocus", "onClear", "onLazyLoad"] }, { kind: "component", type: i1$1.ToggleSwitchComponent, selector: "f-toggleswitch", inputs: ["disabled", "readonly", "invalid", "ariaLabel", "trueValue", "falseValue", "inputId", "size", "tabindex", "styleClass", "style"] }, { kind: "component", type: i1$1.UiIconComponent, selector: "ui-icon", inputs: ["name", "size", "spin", "fill", "severity"] }, { kind: "directive", type: FormField, selector: "[formField]", inputs: ["formField"], exportAs: ["formField"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }] });
538
+ }
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.6", ngImport: i0, type: StorageConfigFormComponent, decorators: [{
540
+ type: Component,
541
+ args: [{
542
+ selector: 'lib-storage-config-form',
543
+ imports: [AngularModule, UiModule, FormField, TranslatePipe],
544
+ template: `
545
+ <div class="card">
546
+ <h3 class="text-lg sm:text-xl font-semibold mb-4">
547
+ {{
548
+ (isEditMode()
549
+ ? 'storage.config.edit.config'
550
+ : 'storage.config.new.config'
551
+ ) | translate
552
+ }}
553
+ </h3>
554
+ @if (showCompanyInfo()) {
555
+ <p class="text-sm text-muted-color mb-4">
556
+ {{ 'shared.company' | translate }}: {{ currentCompanyName() }}
557
+ </p>
558
+ }
559
+
560
+ <form (ngSubmit)="onSubmit()">
561
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
562
+ <div class="field">
563
+ <label
564
+ for="name"
565
+ class="block font-medium mb-2 text-sm sm:text-base"
566
+ >{{ 'storage.config.config.name.required' | translate }}</label
567
+ >
568
+ <input
569
+ fInputText
570
+ id="name"
571
+ [formField]="configForm.name"
572
+ [placeholder]="
573
+ 'storage.config.config.name.placeholder' | translate
574
+ "
575
+ class="w-full"
576
+ />
577
+ </div>
578
+
579
+ <div class="field">
580
+ <label
581
+ for="storage"
582
+ class="block font-medium mb-2 text-sm sm:text-base"
583
+ >{{ 'storage.config.provider.required' | translate }}</label
584
+ >
585
+ <f-select
586
+ inputId="storage"
587
+ [options]="[...storageProviderOptions]"
588
+ optionValue="value"
589
+ [formField]="configForm.storage"
590
+ >
591
+ <ng-template #item let-provider>{{ provider.labelKey | translate }}</ng-template>
592
+ <ng-template #selectedItem let-provider>{{ provider.labelKey | translate }}</ng-template>
593
+ </f-select>
594
+ </div>
595
+
596
+ <div class="field flex items-center gap-2">
597
+ <f-toggleswitch [formField]="configForm.isActive" />
598
+ <label class="text-sm sm:text-base">{{
599
+ 'shared.active' | translate
600
+ }}</label>
601
+ </div>
602
+
603
+ <div class="field flex items-center gap-2">
604
+ <f-toggleswitch [formField]="configForm.isDefault" />
605
+ <label class="text-sm sm:text-base">{{
606
+ 'storage.set.as.default' | translate
607
+ }}</label>
608
+ </div>
609
+ </div>
610
+
611
+ @if (selectedProvider() === fileLocationEnum.AWS) {
612
+ <div
613
+ class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
614
+ >
615
+ <div class="md:col-span-2 mb-2">
616
+ <span
617
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
618
+ >{{ 'storage.aws.title' | translate }}</span
619
+ >
620
+ </div>
621
+ <div class="field">
622
+ <label
623
+ for="awsRegion"
624
+ class="block font-medium mb-2 text-sm sm:text-base"
625
+ >{{ 'storage.config.region.required' | translate }}</label
626
+ >
627
+ <input
628
+ fInputText
629
+ id="awsRegion"
630
+ [formField]="configForm.awsRegion"
631
+ [placeholder]="'storage.aws.region.placeholder' | translate"
632
+ class="w-full"
633
+ />
634
+ </div>
635
+ <div class="field">
636
+ <label
637
+ for="awsBucket"
638
+ class="block font-medium mb-2 text-sm sm:text-base"
639
+ >{{ 'storage.config.bucket.required' | translate }}</label
640
+ >
641
+ <input
642
+ fInputText
643
+ id="awsBucket"
644
+ [formField]="configForm.awsBucket"
645
+ [placeholder]="'storage.aws.bucket.placeholder' | translate"
646
+ class="w-full"
647
+ />
648
+ </div>
649
+ <div class="field">
650
+ <label
651
+ for="awsAccessKeyId"
652
+ class="block font-medium mb-2 text-sm sm:text-base"
653
+ >{{ 'storage.config.access.key.required' | translate }}</label
654
+ >
655
+ <input
656
+ fInputText
657
+ id="awsAccessKeyId"
658
+ [formField]="configForm.awsAccessKeyId"
659
+ class="w-full"
660
+ />
661
+ </div>
662
+ <div class="field">
663
+ <label
664
+ for="awsSecretAccessKey"
665
+ class="block font-medium mb-2 text-sm sm:text-base"
666
+ >{{ 'storage.config.secret.key.required' | translate }}</label
667
+ >
668
+ <input
669
+ type="password"
670
+ fInputText
671
+ id="awsSecretAccessKey"
672
+ [formField]="configForm.awsSecretAccessKey"
673
+ class="w-full"
674
+ />
675
+ </div>
676
+ <div class="field md:col-span-2">
677
+ <label
678
+ for="awsEndpoint"
679
+ class="block font-medium mb-2 text-sm sm:text-base"
680
+ >{{ 'storage.config.endpoint.optional' | translate }}</label
681
+ >
682
+ <input
683
+ fInputText
684
+ id="awsEndpoint"
685
+ [formField]="configForm.awsEndpoint"
686
+ [placeholder]="
687
+ 'storage.config.endpoint.placeholder' | translate
688
+ "
689
+ class="w-full"
690
+ />
691
+ </div>
692
+ </div>
693
+ }
694
+
695
+ @if (selectedProvider() === fileLocationEnum.AZURE) {
696
+ <div
697
+ class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
698
+ >
699
+ <div class="md:col-span-2 mb-2">
700
+ <span
701
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
702
+ >{{ 'storage.azure.title' | translate }}</span
703
+ >
704
+ </div>
705
+ <div class="field">
706
+ <label
707
+ for="azureAccountName"
708
+ class="block font-medium mb-2 text-sm sm:text-base"
709
+ >{{ 'storage.azure.account.name.required' | translate }}</label
710
+ >
711
+ <input
712
+ fInputText
713
+ id="azureAccountName"
714
+ [formField]="configForm.azureAccountName"
715
+ class="w-full"
716
+ />
717
+ </div>
718
+ <div class="field">
719
+ <label
720
+ for="azureContainerName"
721
+ class="block font-medium mb-2 text-sm sm:text-base"
722
+ >{{
723
+ 'storage.azure.container.name.required' | translate
724
+ }}</label
725
+ >
726
+ <input
727
+ fInputText
728
+ id="azureContainerName"
729
+ [formField]="configForm.azureContainerName"
730
+ class="w-full"
731
+ />
732
+ </div>
733
+ <div class="field md:col-span-2">
734
+ <label
735
+ for="azureAccountKey"
736
+ class="block font-medium mb-2 text-sm sm:text-base"
737
+ >{{ 'storage.azure.account.key.required' | translate }}</label
738
+ >
739
+ <input
740
+ type="password"
741
+ fInputText
742
+ id="azureAccountKey"
743
+ [formField]="configForm.azureAccountKey"
744
+ class="w-full"
745
+ />
746
+ </div>
747
+ </div>
748
+ }
749
+
750
+ @if (selectedProvider() === fileLocationEnum.SFTP) {
751
+ <div
752
+ class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
753
+ >
754
+ <div class="md:col-span-2 mb-2">
755
+ <span
756
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
757
+ >{{ 'storage.sftp.title' | translate }}</span
758
+ >
759
+ </div>
760
+ <div class="field">
761
+ <label
762
+ for="sftpHost"
763
+ class="block font-medium mb-2 text-sm sm:text-base"
764
+ >{{ 'storage.sftp.host.required' | translate }}</label
765
+ >
766
+ <input
767
+ fInputText
768
+ id="sftpHost"
769
+ [formField]="configForm.sftpHost"
770
+ [placeholder]="'storage.sftp.host.placeholder' | translate"
771
+ class="w-full"
772
+ />
773
+ </div>
774
+ <div class="field">
775
+ <label
776
+ for="sftpPort"
777
+ class="block font-medium mb-2 text-sm sm:text-base"
778
+ >{{ 'storage.sftp.port.required' | translate }}</label
779
+ >
780
+ <input
781
+ type="number"
782
+ fInputText
783
+ id="sftpPort"
784
+ [formField]="configForm.sftpPort"
785
+ [placeholder]="'storage.sftp.port.placeholder' | translate"
786
+ class="w-full"
787
+ />
788
+ </div>
789
+ <div class="field">
790
+ <label
791
+ for="sftpUsername"
792
+ class="block font-medium mb-2 text-sm sm:text-base"
793
+ >{{ 'storage.sftp.username.required' | translate }}</label
794
+ >
795
+ <input
796
+ fInputText
797
+ id="sftpUsername"
798
+ [formField]="configForm.sftpUsername"
799
+ class="w-full"
800
+ />
801
+ </div>
802
+ <div class="field">
803
+ <label
804
+ for="sftpPassword"
805
+ class="block font-medium mb-2 text-sm sm:text-base"
806
+ >{{ 'storage.sftp.password.required' | translate }}</label
807
+ >
808
+ <input
809
+ type="password"
810
+ fInputText
811
+ id="sftpPassword"
812
+ [formField]="configForm.sftpPassword"
813
+ class="w-full"
814
+ />
815
+ </div>
816
+ <div class="field md:col-span-2">
817
+ <label
818
+ for="sftpBasePath"
819
+ class="block font-medium mb-2 text-sm sm:text-base"
820
+ >{{ 'storage.sftp.base.path.required' | translate }}</label
821
+ >
822
+ <input
823
+ fInputText
824
+ id="sftpBasePath"
825
+ [formField]="configForm.sftpBasePath"
826
+ [placeholder]="'storage.sftp.base.path.placeholder' | translate"
827
+ class="w-full"
828
+ />
829
+ </div>
830
+ </div>
831
+ }
832
+
833
+ @if (selectedProvider() === fileLocationEnum.LOCAL) {
834
+ <div
835
+ class="grid grid-cols-1 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface"
836
+ >
837
+ <div class="mb-2">
838
+ <span
839
+ class="text-sm font-semibold text-muted-color uppercase tracking-wide"
840
+ >{{ 'storage.local.title' | translate }}</span
841
+ >
842
+ </div>
843
+ <div class="field">
844
+ <label
845
+ for="localBasePath"
846
+ class="block font-medium mb-2 text-sm sm:text-base"
847
+ >{{ 'storage.local.base.path.required' | translate }}</label
848
+ >
849
+ <input
850
+ fInputText
851
+ id="localBasePath"
852
+ [formField]="configForm.localBasePath"
853
+ [placeholder]="
854
+ 'storage.local.base.path.placeholder' | translate
855
+ "
856
+ class="w-full"
857
+ />
858
+ </div>
859
+ </div>
860
+ }
861
+
862
+ <div class="flex justify-end gap-2 mt-4">
863
+ <button
864
+ fButton
865
+ severity="secondary"
866
+ [outlined]="true"
867
+ (click)="onCancel()"
868
+ >
869
+ <span pButtonLabel>{{ 'shared.cancel' | translate }}</span>
870
+ </button>
871
+ <button
872
+ fButton
873
+ type="submit"
874
+ [disabled]="!isFormValid() || isLoading()"
875
+ >
876
+ @if (isLoading()) {
877
+ <ui-icon pButtonIcon name="spinner" [spin]="true"></ui-icon>
878
+ }
879
+ <span pButtonLabel>{{
880
+ (isEditMode() ? 'shared.update' : 'shared.create') | translate
881
+ }}</span>
882
+ </button>
883
+ </div>
884
+ </form>
885
+ </div>
886
+ `,
887
+ }]
888
+ }], ctorParameters: () => [] });
889
+
890
+ export { StorageConfigFormComponent };
891
+ //# sourceMappingURL=flusys-ng-storage-storage-config-form.component-Da-pWR7d.mjs.map