@flusys/ng-storage 4.1.1 → 5.0.0

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