@flusys/ng-storage 1.0.0-beta → 1.0.0-rc

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 (28) hide show
  1. package/README.md +209 -5
  2. package/fesm2022/flusys-ng-storage-file-manager-form.component-CMS_ddbs.mjs +485 -0
  3. package/fesm2022/flusys-ng-storage-file-manager-form.component-CMS_ddbs.mjs.map +1 -0
  4. package/fesm2022/flusys-ng-storage-file-manager-list.component-DDOFAPRD.mjs +305 -0
  5. package/fesm2022/flusys-ng-storage-file-manager-list.component-DDOFAPRD.mjs.map +1 -0
  6. package/fesm2022/flusys-ng-storage-folder-form.component-ClYATZkh.mjs +157 -0
  7. package/fesm2022/flusys-ng-storage-folder-form.component-ClYATZkh.mjs.map +1 -0
  8. package/fesm2022/flusys-ng-storage-folder-list.component-CzONANHt.mjs +200 -0
  9. package/fesm2022/flusys-ng-storage-folder-list.component-CzONANHt.mjs.map +1 -0
  10. package/fesm2022/{flusys-ng-storage-storage-config-form.component-Bc95TVD0.mjs → flusys-ng-storage-storage-config-form.component-CODLLCtg.mjs} +209 -236
  11. package/fesm2022/flusys-ng-storage-storage-config-form.component-CODLLCtg.mjs.map +1 -0
  12. package/fesm2022/flusys-ng-storage-storage-config-list.component-BbBx0iSL.mjs +213 -0
  13. package/fesm2022/flusys-ng-storage-storage-config-list.component-BbBx0iSL.mjs.map +1 -0
  14. package/fesm2022/flusys-ng-storage.mjs +384 -96
  15. package/fesm2022/flusys-ng-storage.mjs.map +1 -1
  16. package/package.json +5 -5
  17. package/types/flusys-ng-storage.d.ts +187 -8
  18. package/fesm2022/flusys-ng-storage-file-manager-form.component-DVZsFYrj.mjs +0 -715
  19. package/fesm2022/flusys-ng-storage-file-manager-form.component-DVZsFYrj.mjs.map +0 -1
  20. package/fesm2022/flusys-ng-storage-file-manager-list.component-CwnyNoYb.mjs +0 -475
  21. package/fesm2022/flusys-ng-storage-file-manager-list.component-CwnyNoYb.mjs.map +0 -1
  22. package/fesm2022/flusys-ng-storage-folder-form.component-DH-KCz21.mjs +0 -253
  23. package/fesm2022/flusys-ng-storage-folder-form.component-DH-KCz21.mjs.map +0 -1
  24. package/fesm2022/flusys-ng-storage-folder-list.component-iIys4NvL.mjs +0 -267
  25. package/fesm2022/flusys-ng-storage-folder-list.component-iIys4NvL.mjs.map +0 -1
  26. package/fesm2022/flusys-ng-storage-storage-config-form.component-Bc95TVD0.mjs.map +0 -1
  27. package/fesm2022/flusys-ng-storage-storage-config-list.component-Bfomqyr3.mjs +0 -328
  28. package/fesm2022/flusys-ng-storage-storage-config-list.component-Bfomqyr3.mjs.map +0 -1
@@ -1,80 +1,70 @@
1
1
  import * as i0 from '@angular/core';
2
- import { inject, signal, computed, Component } from '@angular/core';
2
+ import { inject, signal, computed, effect, ChangeDetectionStrategy, Component } from '@angular/core';
3
+ import { toSignal } from '@angular/core/rxjs-interop';
3
4
  import { form, required, FormField } from '@angular/forms/signals';
4
- import { Router, ActivatedRoute } from '@angular/router';
5
+ import { ActivatedRoute } from '@angular/router';
5
6
  import { AngularModule, PrimeModule } from '@flusys/ng-shared';
6
- import { APP_CONFIG } from '@flusys/ng-core';
7
- import { MessageService } from 'primeng/api';
8
- import { StorageConfigApiService, FileLocationEnum } from './flusys-ng-storage.mjs';
7
+ import { BaseStoragePage, StorageConfigApiService, FileLocationEnum, STORAGE_PROVIDERS } from './flusys-ng-storage.mjs';
9
8
  import * as i1 from '@angular/forms';
10
- import * as i2 from 'primeng/inputtext';
11
- import * as i3 from 'primeng/button';
9
+ import * as i1$1 from 'primeng/button';
10
+ import * as i3 from 'primeng/inputtext';
11
+ import * as i4 from 'primeng/toggleswitch';
12
12
 
13
13
  /**
14
14
  * Storage Config Form Component
15
15
  * Create and edit storage configurations
16
16
  */
17
- class StorageConfigFormComponent {
18
- router = inject(Router);
17
+ class StorageConfigFormComponent extends BaseStoragePage {
19
18
  route = inject(ActivatedRoute);
20
- messageService = inject(MessageService);
21
19
  configService = inject(StorageConfigApiService);
22
- appConfig = inject(APP_CONFIG);
20
+ // Route params as signal
21
+ routeParams = toSignal(this.route.paramMap);
22
+ initialized = false;
23
23
  fileLocationEnum = FileLocationEnum;
24
- isLoading = signal(false, ...(ngDevMode ? [{ debugName: "isLoading" }] : []));
24
+ storageProviders = STORAGE_PROVIDERS;
25
25
  existingConfig = signal(null, ...(ngDevMode ? [{ debugName: "existingConfig" }] : []));
26
26
  isEditMode = computed(() => !!this.existingConfig(), ...(ngDevMode ? [{ debugName: "isEditMode" }] : []));
27
- showCompanyInfo = computed(() => this.appConfig.enableCompanyFeature, ...(ngDevMode ? [{ debugName: "showCompanyInfo" }] : []));
28
- currentCompanyName = computed(() => 'Current Company', ...(ngDevMode ? [{ debugName: "currentCompanyName" }] : []));
29
- storageProviders = [
30
- { label: 'AWS S3', value: FileLocationEnum.AWS },
31
- { label: 'Azure Blob Storage', value: FileLocationEnum.AZURE },
32
- { label: 'SFTP', value: FileLocationEnum.SFTP },
33
- { label: 'Local Storage', value: FileLocationEnum.LOCAL },
34
- ];
35
- // ============================================
36
- // Form (Signal Forms)
37
- // ============================================
38
27
  /** Form model */
39
28
  formModel = signal({
40
29
  id: '',
41
30
  name: '',
42
31
  storage: FileLocationEnum.AWS,
43
- // AWS S3
32
+ isActive: true,
33
+ isDefault: false,
44
34
  awsRegion: '',
45
35
  awsBucket: '',
46
36
  awsAccessKeyId: '',
47
37
  awsSecretAccessKey: '',
48
38
  awsEndpoint: '',
49
- // Azure
50
39
  azureAccountName: '',
51
40
  azureAccountKey: '',
52
41
  azureContainerName: '',
53
- // SFTP
54
42
  sftpHost: '',
55
43
  sftpPort: '22',
56
44
  sftpUsername: '',
57
45
  sftpPassword: '',
58
46
  sftpBasePath: '',
59
- // Local
60
47
  localBasePath: '',
61
48
  }, ...(ngDevMode ? [{ debugName: "formModel" }] : []));
62
- /** Form with validation schema */
49
+ /** Form with validation */
63
50
  configForm = form(this.formModel, (f) => {
64
51
  required(f.name, { message: 'Configuration name is required' });
65
52
  });
66
- /** Selected provider */
67
53
  selectedProvider = computed(() => this.formModel().storage, ...(ngDevMode ? [{ debugName: "selectedProvider" }] : []));
68
- /** Check if form is valid */
69
- isFormValid = computed(() => {
70
- const model = this.formModel();
71
- return model.name.trim().length > 0;
72
- }, ...(ngDevMode ? [{ debugName: "isFormValid" }] : []));
73
- ngOnInit() {
74
- const configId = this.route.snapshot.paramMap.get('id');
75
- if (configId) {
76
- this.loadConfig(configId);
77
- }
54
+ isFormValid = computed(() => this.formModel().name.trim().length > 0, ...(ngDevMode ? [{ debugName: "isFormValid" }] : []));
55
+ constructor() {
56
+ super();
57
+ // Effect to handle route-based initialization
58
+ effect(() => {
59
+ const params = this.routeParams();
60
+ if (!params || this.initialized)
61
+ return;
62
+ this.initialized = true;
63
+ const configId = params.get('id');
64
+ if (configId && configId !== 'new') {
65
+ this.loadConfig(configId);
66
+ }
67
+ });
78
68
  }
79
69
  async loadConfig(id) {
80
70
  this.isLoading.set(true);
@@ -83,13 +73,13 @@ class StorageConfigFormComponent {
83
73
  if (response.success && response.data) {
84
74
  const config = response.data;
85
75
  this.existingConfig.set(config);
86
- // Base form values
87
76
  const formData = {
88
77
  id: config.id,
89
78
  name: config.name,
90
79
  storage: config.storage,
80
+ isActive: config.isActive ?? true,
81
+ isDefault: config.isDefault ?? false,
91
82
  };
92
- // Load provider-specific config
93
83
  if (config.storage === FileLocationEnum.AWS && config.config) {
94
84
  formData.awsRegion = config.config['region'] || '';
95
85
  formData.awsBucket = config.config['bucket'] || '';
@@ -115,13 +105,9 @@ class StorageConfigFormComponent {
115
105
  this.formModel.update((m) => ({ ...m, ...formData }));
116
106
  }
117
107
  }
118
- catch (error) {
119
- this.messageService.add({
120
- severity: 'error',
121
- summary: 'Error',
122
- detail: 'Failed to load storage configuration.',
123
- });
124
- this.router.navigate(['/storage/configs']);
108
+ catch {
109
+ this.showError('Failed to load storage configuration.');
110
+ this.navigateTo(['/storage/configs']);
125
111
  }
126
112
  finally {
127
113
  this.isLoading.set(false);
@@ -133,381 +119,368 @@ class StorageConfigFormComponent {
133
119
  this.isLoading.set(true);
134
120
  try {
135
121
  const formValue = this.formModel();
136
- let config = {};
137
- // Build provider-specific config
138
- if (formValue.storage === FileLocationEnum.AWS) {
139
- config = {
140
- region: formValue.awsRegion,
141
- bucket: formValue.awsBucket,
142
- accessKeyId: formValue.awsAccessKeyId,
143
- secretAccessKey: formValue.awsSecretAccessKey,
144
- ...(formValue.awsEndpoint && { endpoint: formValue.awsEndpoint }),
145
- };
146
- }
147
- else if (formValue.storage === FileLocationEnum.AZURE) {
148
- config = {
149
- accountName: formValue.azureAccountName,
150
- accountKey: formValue.azureAccountKey,
151
- containerName: formValue.azureContainerName,
152
- };
153
- }
154
- else if (formValue.storage === FileLocationEnum.SFTP) {
155
- config = {
156
- host: formValue.sftpHost,
157
- port: formValue.sftpPort ? parseInt(formValue.sftpPort, 10) : 22,
158
- username: formValue.sftpUsername,
159
- password: formValue.sftpPassword,
160
- basePath: formValue.sftpBasePath,
161
- };
162
- }
163
- else if (formValue.storage === FileLocationEnum.LOCAL) {
164
- config = {
165
- basePath: formValue.localBasePath,
166
- };
167
- }
122
+ const config = this.buildProviderConfig(formValue);
168
123
  if (this.isEditMode()) {
169
124
  await this.configService.updateAsync({
170
125
  id: formValue.id,
171
126
  name: formValue.name,
172
127
  storage: formValue.storage,
173
128
  config,
129
+ isActive: formValue.isActive,
130
+ isDefault: formValue.isDefault,
174
131
  });
175
- this.messageService.add({
176
- severity: 'success',
177
- summary: 'Success',
178
- detail: 'Storage configuration updated successfully.',
179
- });
132
+ this.showSuccess('Storage configuration updated successfully.');
180
133
  }
181
134
  else {
182
- await this.configService.insertAsync({
135
+ const createDto = {
183
136
  name: formValue.name,
184
137
  storage: formValue.storage,
185
138
  config,
186
- });
187
- this.messageService.add({
188
- severity: 'success',
189
- summary: 'Success',
190
- detail: 'Storage configuration created successfully.',
191
- });
139
+ isActive: formValue.isActive,
140
+ isDefault: formValue.isDefault,
141
+ };
142
+ await this.configService.insertAsync(createDto);
143
+ this.showSuccess('Storage configuration created successfully.');
192
144
  }
193
- this.router.navigate(['/storage/configs']);
145
+ this.navigateTo(['/storage/configs']);
194
146
  }
195
- catch (error) {
196
- this.messageService.add({
197
- severity: 'error',
198
- summary: 'Error',
199
- detail: `Failed to ${this.isEditMode() ? 'update' : 'create'} storage configuration.`,
200
- });
147
+ catch {
148
+ this.showError(`Failed to ${this.isEditMode() ? 'update' : 'create'} storage configuration.`);
201
149
  }
202
150
  finally {
203
151
  this.isLoading.set(false);
204
152
  }
205
153
  }
206
154
  onCancel() {
207
- this.router.navigate(['/storage/configs']);
155
+ this.navigateTo(['/storage/configs']);
156
+ }
157
+ buildProviderConfig(formValue) {
158
+ switch (formValue.storage) {
159
+ case FileLocationEnum.AWS:
160
+ return {
161
+ region: formValue.awsRegion,
162
+ bucket: formValue.awsBucket,
163
+ accessKeyId: formValue.awsAccessKeyId,
164
+ secretAccessKey: formValue.awsSecretAccessKey,
165
+ ...(formValue.awsEndpoint && { endpoint: formValue.awsEndpoint }),
166
+ };
167
+ case FileLocationEnum.AZURE:
168
+ return {
169
+ accountName: formValue.azureAccountName,
170
+ accountKey: formValue.azureAccountKey,
171
+ containerName: formValue.azureContainerName,
172
+ };
173
+ case FileLocationEnum.SFTP:
174
+ return {
175
+ host: formValue.sftpHost,
176
+ port: formValue.sftpPort ? parseInt(formValue.sftpPort, 10) : 22,
177
+ username: formValue.sftpUsername,
178
+ password: formValue.sftpPassword,
179
+ basePath: formValue.sftpBasePath,
180
+ };
181
+ case FileLocationEnum.LOCAL:
182
+ return { basePath: formValue.localBasePath };
183
+ default:
184
+ return {};
185
+ }
208
186
  }
209
187
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: StorageConfigFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
210
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: StorageConfigFormComponent, isStandalone: true, selector: "lib-storage-config-form", ngImport: i0, template: `
188
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.1.3", type: StorageConfigFormComponent, isStandalone: true, selector: "lib-storage-config-form", usesInheritance: true, ngImport: i0, template: `
211
189
  <div class="card">
212
- <div class="flex justify-between items-center mb-4">
213
- <div>
214
- <h3 class="text-xl font-semibold">
215
- {{ isEditMode() ? 'Edit Storage Configuration' : 'New Storage Configuration' }}
216
- </h3>
217
- @if (showCompanyInfo()) {
218
- <p class="text-sm text-gray-600 mt-1">
219
- Company: {{ currentCompanyName() }}
220
- </p>
221
- }
222
- </div>
223
- <p-button
224
- label="Back"
225
- icon="pi pi-arrow-left"
226
- severity="secondary"
227
- [text]="true"
228
- (onClick)="onCancel()" />
229
- </div>
190
+ <h3 class="text-lg sm:text-xl font-semibold mb-4">
191
+ {{ isEditMode() ? 'Edit Storage Configuration' : 'New Storage Configuration' }}
192
+ </h3>
193
+ @if (showCompanyInfo()) {
194
+ <p class="text-sm text-muted-color mb-4">
195
+ Company: {{ currentCompanyName() }}
196
+ </p>
197
+ }
230
198
 
231
199
  <form (ngSubmit)="onSubmit()">
232
200
  <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
233
- <!-- Name -->
234
- <div class="field md:col-span-2">
235
- <label for="name" class="block font-medium mb-2">Configuration Name *</label>
236
- <input
237
- pInputText
238
- id="name"
239
- [formField]="configForm.name"
240
- placeholder="e.g., Production AWS S3"
241
- class="w-full" />
201
+ <div class="field">
202
+ <label for="name" class="block font-medium mb-2 text-sm sm:text-base">Configuration Name *</label>
203
+ <input pInputText id="name" [formField]="configForm.name" placeholder="e.g., Production AWS S3" class="w-full" />
242
204
  </div>
243
205
 
244
- <!-- Storage Provider -->
245
- <div class="field md:col-span-2">
246
- <label for="storage" class="block font-medium mb-2">Storage Provider *</label>
247
- <select
248
- id="storage"
249
- class="p-select-native"
250
- [formField]="configForm.storage">
206
+ <div class="field">
207
+ <label for="storage" class="block font-medium mb-2 text-sm sm:text-base">Storage Provider *</label>
208
+ <select id="storage" class="p-select-native w-full" [formField]="configForm.storage">
251
209
  @for (provider of storageProviders; track provider.value) {
252
210
  <option [value]="provider.value">{{ provider.label }}</option>
253
211
  }
254
212
  </select>
255
213
  </div>
214
+
215
+ <div class="field flex items-center gap-2">
216
+ <p-toggleswitch [formField]="configForm.isActive" />
217
+ <label class="text-sm sm:text-base">Active</label>
218
+ </div>
219
+
220
+ <div class="field flex items-center gap-2">
221
+ <p-toggleswitch [formField]="configForm.isDefault" />
222
+ <label class="text-sm sm:text-base">Set as Default</label>
223
+ </div>
256
224
  </div>
257
225
 
258
- <!-- AWS S3 Fields -->
259
226
  @if (selectedProvider() === fileLocationEnum.AWS) {
260
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
227
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
228
+ <div class="md:col-span-2 mb-2">
229
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">AWS S3 Configuration</span>
230
+ </div>
261
231
  <div class="field">
262
- <label for="awsRegion" class="block font-medium mb-2">AWS Region *</label>
232
+ <label for="awsRegion" class="block font-medium mb-2 text-sm sm:text-base">AWS Region *</label>
263
233
  <input pInputText id="awsRegion" [formField]="configForm.awsRegion" placeholder="us-east-1" class="w-full" />
264
234
  </div>
265
235
  <div class="field">
266
- <label for="awsBucket" class="block font-medium mb-2">Bucket Name *</label>
236
+ <label for="awsBucket" class="block font-medium mb-2 text-sm sm:text-base">Bucket Name *</label>
267
237
  <input pInputText id="awsBucket" [formField]="configForm.awsBucket" placeholder="my-bucket" class="w-full" />
268
238
  </div>
269
239
  <div class="field">
270
- <label for="awsAccessKeyId" class="block font-medium mb-2">Access Key ID *</label>
240
+ <label for="awsAccessKeyId" class="block font-medium mb-2 text-sm sm:text-base">Access Key ID *</label>
271
241
  <input pInputText id="awsAccessKeyId" [formField]="configForm.awsAccessKeyId" class="w-full" />
272
242
  </div>
273
243
  <div class="field">
274
- <label for="awsSecretAccessKey" class="block font-medium mb-2">Secret Access Key *</label>
244
+ <label for="awsSecretAccessKey" class="block font-medium mb-2 text-sm sm:text-base">Secret Access Key *</label>
275
245
  <input type="password" pInputText id="awsSecretAccessKey" [formField]="configForm.awsSecretAccessKey" class="w-full" />
276
246
  </div>
277
247
  <div class="field md:col-span-2">
278
- <label for="awsEndpoint" class="block font-medium mb-2">Custom Endpoint (Optional)</label>
248
+ <label for="awsEndpoint" class="block font-medium mb-2 text-sm sm:text-base">Custom Endpoint (Optional)</label>
279
249
  <input pInputText id="awsEndpoint" [formField]="configForm.awsEndpoint" placeholder="https://s3.custom-endpoint.com" class="w-full" />
280
250
  </div>
281
251
  </div>
282
252
  }
283
253
 
284
- <!-- Azure Blob Fields -->
285
254
  @if (selectedProvider() === fileLocationEnum.AZURE) {
286
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
255
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
256
+ <div class="md:col-span-2 mb-2">
257
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">Azure Blob Configuration</span>
258
+ </div>
287
259
  <div class="field">
288
- <label for="azureAccountName" class="block font-medium mb-2">Account Name *</label>
260
+ <label for="azureAccountName" class="block font-medium mb-2 text-sm sm:text-base">Account Name *</label>
289
261
  <input pInputText id="azureAccountName" [formField]="configForm.azureAccountName" class="w-full" />
290
262
  </div>
291
263
  <div class="field">
292
- <label for="azureContainerName" class="block font-medium mb-2">Container Name *</label>
264
+ <label for="azureContainerName" class="block font-medium mb-2 text-sm sm:text-base">Container Name *</label>
293
265
  <input pInputText id="azureContainerName" [formField]="configForm.azureContainerName" class="w-full" />
294
266
  </div>
295
267
  <div class="field md:col-span-2">
296
- <label for="azureAccountKey" class="block font-medium mb-2">Account Key *</label>
268
+ <label for="azureAccountKey" class="block font-medium mb-2 text-sm sm:text-base">Account Key *</label>
297
269
  <input type="password" pInputText id="azureAccountKey" [formField]="configForm.azureAccountKey" class="w-full" />
298
270
  </div>
299
271
  </div>
300
272
  }
301
273
 
302
- <!-- SFTP Fields -->
303
274
  @if (selectedProvider() === fileLocationEnum.SFTP) {
304
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
275
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
276
+ <div class="md:col-span-2 mb-2">
277
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">SFTP Configuration</span>
278
+ </div>
305
279
  <div class="field">
306
- <label for="sftpHost" class="block font-medium mb-2">Host *</label>
280
+ <label for="sftpHost" class="block font-medium mb-2 text-sm sm:text-base">Host *</label>
307
281
  <input pInputText id="sftpHost" [formField]="configForm.sftpHost" placeholder="sftp.example.com" class="w-full" />
308
282
  </div>
309
283
  <div class="field">
310
- <label for="sftpPort" class="block font-medium mb-2">Port *</label>
284
+ <label for="sftpPort" class="block font-medium mb-2 text-sm sm:text-base">Port *</label>
311
285
  <input type="number" pInputText id="sftpPort" [formField]="configForm.sftpPort" placeholder="22" class="w-full" />
312
286
  </div>
313
287
  <div class="field">
314
- <label for="sftpUsername" class="block font-medium mb-2">Username *</label>
288
+ <label for="sftpUsername" class="block font-medium mb-2 text-sm sm:text-base">Username *</label>
315
289
  <input pInputText id="sftpUsername" [formField]="configForm.sftpUsername" class="w-full" />
316
290
  </div>
317
291
  <div class="field">
318
- <label for="sftpPassword" class="block font-medium mb-2">Password *</label>
292
+ <label for="sftpPassword" class="block font-medium mb-2 text-sm sm:text-base">Password *</label>
319
293
  <input type="password" pInputText id="sftpPassword" [formField]="configForm.sftpPassword" class="w-full" />
320
294
  </div>
321
295
  <div class="field md:col-span-2">
322
- <label for="sftpBasePath" class="block font-medium mb-2">Base Path *</label>
296
+ <label for="sftpBasePath" class="block font-medium mb-2 text-sm sm:text-base">Base Path *</label>
323
297
  <input pInputText id="sftpBasePath" [formField]="configForm.sftpBasePath" placeholder="/uploads" class="w-full" />
324
298
  </div>
325
299
  </div>
326
300
  }
327
301
 
328
- <!-- Local Fields -->
329
302
  @if (selectedProvider() === fileLocationEnum.LOCAL) {
330
- <div class="grid grid-cols-1 gap-4 mt-4">
303
+ <div class="grid grid-cols-1 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
304
+ <div class="mb-2">
305
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">Local Storage Configuration</span>
306
+ </div>
331
307
  <div class="field">
332
- <label for="localBasePath" class="block font-medium mb-2">Base Path *</label>
308
+ <label for="localBasePath" class="block font-medium mb-2 text-sm sm:text-base">Base Path *</label>
333
309
  <input pInputText id="localBasePath" [formField]="configForm.localBasePath" placeholder="/var/www/uploads" class="w-full" />
334
310
  </div>
335
311
  </div>
336
312
  }
337
313
 
338
- <div class="flex gap-2 mt-4">
314
+ <div class="flex justify-end gap-2 mt-4">
315
+ <p-button
316
+ label="Cancel"
317
+ severity="secondary"
318
+ [outlined]="true"
319
+ (onClick)="onCancel()"
320
+ />
339
321
  <p-button
340
322
  type="submit"
341
323
  [label]="isEditMode() ? 'Update' : 'Create'"
342
- icon="pi pi-check"
343
324
  [loading]="isLoading()"
344
- [disabled]="!isFormValid() || isLoading()" />
345
- <p-button
346
- type="button"
347
- label="Cancel"
348
- severity="secondary"
349
- icon="pi pi-times"
350
- [text]="true"
351
- (onClick)="onCancel()" />
325
+ [disabled]="!isFormValid() || isLoading()"
326
+ />
352
327
  </div>
353
328
  </form>
354
329
  </div>
355
- `, 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: "directive", type: i2.InputText, selector: "[pInputText]", inputs: ["hostName", "ptInputText", "pInputTextPT", "pInputTextUnstyled", "pSize", "variant", "fluid", "invalid"] }, { kind: "component", type: i3.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: FormField, selector: "[formField]", inputs: ["formField"] }] });
330
+ `, 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"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
356
331
  }
357
332
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.1.3", ngImport: i0, type: StorageConfigFormComponent, decorators: [{
358
333
  type: Component,
359
334
  args: [{
360
335
  selector: 'lib-storage-config-form',
361
336
  standalone: true,
337
+ changeDetection: ChangeDetectionStrategy.OnPush,
362
338
  imports: [AngularModule, PrimeModule, FormField],
363
339
  template: `
364
340
  <div class="card">
365
- <div class="flex justify-between items-center mb-4">
366
- <div>
367
- <h3 class="text-xl font-semibold">
368
- {{ isEditMode() ? 'Edit Storage Configuration' : 'New Storage Configuration' }}
369
- </h3>
370
- @if (showCompanyInfo()) {
371
- <p class="text-sm text-gray-600 mt-1">
372
- Company: {{ currentCompanyName() }}
373
- </p>
374
- }
375
- </div>
376
- <p-button
377
- label="Back"
378
- icon="pi pi-arrow-left"
379
- severity="secondary"
380
- [text]="true"
381
- (onClick)="onCancel()" />
382
- </div>
341
+ <h3 class="text-lg sm:text-xl font-semibold mb-4">
342
+ {{ isEditMode() ? 'Edit Storage Configuration' : 'New Storage Configuration' }}
343
+ </h3>
344
+ @if (showCompanyInfo()) {
345
+ <p class="text-sm text-muted-color mb-4">
346
+ Company: {{ currentCompanyName() }}
347
+ </p>
348
+ }
383
349
 
384
350
  <form (ngSubmit)="onSubmit()">
385
351
  <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
386
- <!-- Name -->
387
- <div class="field md:col-span-2">
388
- <label for="name" class="block font-medium mb-2">Configuration Name *</label>
389
- <input
390
- pInputText
391
- id="name"
392
- [formField]="configForm.name"
393
- placeholder="e.g., Production AWS S3"
394
- class="w-full" />
352
+ <div class="field">
353
+ <label for="name" class="block font-medium mb-2 text-sm sm:text-base">Configuration Name *</label>
354
+ <input pInputText id="name" [formField]="configForm.name" placeholder="e.g., Production AWS S3" class="w-full" />
395
355
  </div>
396
356
 
397
- <!-- Storage Provider -->
398
- <div class="field md:col-span-2">
399
- <label for="storage" class="block font-medium mb-2">Storage Provider *</label>
400
- <select
401
- id="storage"
402
- class="p-select-native"
403
- [formField]="configForm.storage">
357
+ <div class="field">
358
+ <label for="storage" class="block font-medium mb-2 text-sm sm:text-base">Storage Provider *</label>
359
+ <select id="storage" class="p-select-native w-full" [formField]="configForm.storage">
404
360
  @for (provider of storageProviders; track provider.value) {
405
361
  <option [value]="provider.value">{{ provider.label }}</option>
406
362
  }
407
363
  </select>
408
364
  </div>
365
+
366
+ <div class="field flex items-center gap-2">
367
+ <p-toggleswitch [formField]="configForm.isActive" />
368
+ <label class="text-sm sm:text-base">Active</label>
369
+ </div>
370
+
371
+ <div class="field flex items-center gap-2">
372
+ <p-toggleswitch [formField]="configForm.isDefault" />
373
+ <label class="text-sm sm:text-base">Set as Default</label>
374
+ </div>
409
375
  </div>
410
376
 
411
- <!-- AWS S3 Fields -->
412
377
  @if (selectedProvider() === fileLocationEnum.AWS) {
413
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
378
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
379
+ <div class="md:col-span-2 mb-2">
380
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">AWS S3 Configuration</span>
381
+ </div>
414
382
  <div class="field">
415
- <label for="awsRegion" class="block font-medium mb-2">AWS Region *</label>
383
+ <label for="awsRegion" class="block font-medium mb-2 text-sm sm:text-base">AWS Region *</label>
416
384
  <input pInputText id="awsRegion" [formField]="configForm.awsRegion" placeholder="us-east-1" class="w-full" />
417
385
  </div>
418
386
  <div class="field">
419
- <label for="awsBucket" class="block font-medium mb-2">Bucket Name *</label>
387
+ <label for="awsBucket" class="block font-medium mb-2 text-sm sm:text-base">Bucket Name *</label>
420
388
  <input pInputText id="awsBucket" [formField]="configForm.awsBucket" placeholder="my-bucket" class="w-full" />
421
389
  </div>
422
390
  <div class="field">
423
- <label for="awsAccessKeyId" class="block font-medium mb-2">Access Key ID *</label>
391
+ <label for="awsAccessKeyId" class="block font-medium mb-2 text-sm sm:text-base">Access Key ID *</label>
424
392
  <input pInputText id="awsAccessKeyId" [formField]="configForm.awsAccessKeyId" class="w-full" />
425
393
  </div>
426
394
  <div class="field">
427
- <label for="awsSecretAccessKey" class="block font-medium mb-2">Secret Access Key *</label>
395
+ <label for="awsSecretAccessKey" class="block font-medium mb-2 text-sm sm:text-base">Secret Access Key *</label>
428
396
  <input type="password" pInputText id="awsSecretAccessKey" [formField]="configForm.awsSecretAccessKey" class="w-full" />
429
397
  </div>
430
398
  <div class="field md:col-span-2">
431
- <label for="awsEndpoint" class="block font-medium mb-2">Custom Endpoint (Optional)</label>
399
+ <label for="awsEndpoint" class="block font-medium mb-2 text-sm sm:text-base">Custom Endpoint (Optional)</label>
432
400
  <input pInputText id="awsEndpoint" [formField]="configForm.awsEndpoint" placeholder="https://s3.custom-endpoint.com" class="w-full" />
433
401
  </div>
434
402
  </div>
435
403
  }
436
404
 
437
- <!-- Azure Blob Fields -->
438
405
  @if (selectedProvider() === fileLocationEnum.AZURE) {
439
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
406
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
407
+ <div class="md:col-span-2 mb-2">
408
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">Azure Blob Configuration</span>
409
+ </div>
440
410
  <div class="field">
441
- <label for="azureAccountName" class="block font-medium mb-2">Account Name *</label>
411
+ <label for="azureAccountName" class="block font-medium mb-2 text-sm sm:text-base">Account Name *</label>
442
412
  <input pInputText id="azureAccountName" [formField]="configForm.azureAccountName" class="w-full" />
443
413
  </div>
444
414
  <div class="field">
445
- <label for="azureContainerName" class="block font-medium mb-2">Container Name *</label>
415
+ <label for="azureContainerName" class="block font-medium mb-2 text-sm sm:text-base">Container Name *</label>
446
416
  <input pInputText id="azureContainerName" [formField]="configForm.azureContainerName" class="w-full" />
447
417
  </div>
448
418
  <div class="field md:col-span-2">
449
- <label for="azureAccountKey" class="block font-medium mb-2">Account Key *</label>
419
+ <label for="azureAccountKey" class="block font-medium mb-2 text-sm sm:text-base">Account Key *</label>
450
420
  <input type="password" pInputText id="azureAccountKey" [formField]="configForm.azureAccountKey" class="w-full" />
451
421
  </div>
452
422
  </div>
453
423
  }
454
424
 
455
- <!-- SFTP Fields -->
456
425
  @if (selectedProvider() === fileLocationEnum.SFTP) {
457
- <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4">
426
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
427
+ <div class="md:col-span-2 mb-2">
428
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">SFTP Configuration</span>
429
+ </div>
458
430
  <div class="field">
459
- <label for="sftpHost" class="block font-medium mb-2">Host *</label>
431
+ <label for="sftpHost" class="block font-medium mb-2 text-sm sm:text-base">Host *</label>
460
432
  <input pInputText id="sftpHost" [formField]="configForm.sftpHost" placeholder="sftp.example.com" class="w-full" />
461
433
  </div>
462
434
  <div class="field">
463
- <label for="sftpPort" class="block font-medium mb-2">Port *</label>
435
+ <label for="sftpPort" class="block font-medium mb-2 text-sm sm:text-base">Port *</label>
464
436
  <input type="number" pInputText id="sftpPort" [formField]="configForm.sftpPort" placeholder="22" class="w-full" />
465
437
  </div>
466
438
  <div class="field">
467
- <label for="sftpUsername" class="block font-medium mb-2">Username *</label>
439
+ <label for="sftpUsername" class="block font-medium mb-2 text-sm sm:text-base">Username *</label>
468
440
  <input pInputText id="sftpUsername" [formField]="configForm.sftpUsername" class="w-full" />
469
441
  </div>
470
442
  <div class="field">
471
- <label for="sftpPassword" class="block font-medium mb-2">Password *</label>
443
+ <label for="sftpPassword" class="block font-medium mb-2 text-sm sm:text-base">Password *</label>
472
444
  <input type="password" pInputText id="sftpPassword" [formField]="configForm.sftpPassword" class="w-full" />
473
445
  </div>
474
446
  <div class="field md:col-span-2">
475
- <label for="sftpBasePath" class="block font-medium mb-2">Base Path *</label>
447
+ <label for="sftpBasePath" class="block font-medium mb-2 text-sm sm:text-base">Base Path *</label>
476
448
  <input pInputText id="sftpBasePath" [formField]="configForm.sftpBasePath" placeholder="/uploads" class="w-full" />
477
449
  </div>
478
450
  </div>
479
451
  }
480
452
 
481
- <!-- Local Fields -->
482
453
  @if (selectedProvider() === fileLocationEnum.LOCAL) {
483
- <div class="grid grid-cols-1 gap-4 mt-4">
454
+ <div class="grid grid-cols-1 gap-4 mt-4 p-4 bg-surface-ground rounded-lg border border-surface">
455
+ <div class="mb-2">
456
+ <span class="text-sm font-semibold text-muted-color uppercase tracking-wide">Local Storage Configuration</span>
457
+ </div>
484
458
  <div class="field">
485
- <label for="localBasePath" class="block font-medium mb-2">Base Path *</label>
459
+ <label for="localBasePath" class="block font-medium mb-2 text-sm sm:text-base">Base Path *</label>
486
460
  <input pInputText id="localBasePath" [formField]="configForm.localBasePath" placeholder="/var/www/uploads" class="w-full" />
487
461
  </div>
488
462
  </div>
489
463
  }
490
464
 
491
- <div class="flex gap-2 mt-4">
465
+ <div class="flex justify-end gap-2 mt-4">
466
+ <p-button
467
+ label="Cancel"
468
+ severity="secondary"
469
+ [outlined]="true"
470
+ (onClick)="onCancel()"
471
+ />
492
472
  <p-button
493
473
  type="submit"
494
474
  [label]="isEditMode() ? 'Update' : 'Create'"
495
- icon="pi pi-check"
496
475
  [loading]="isLoading()"
497
- [disabled]="!isFormValid() || isLoading()" />
498
- <p-button
499
- type="button"
500
- label="Cancel"
501
- severity="secondary"
502
- icon="pi pi-times"
503
- [text]="true"
504
- (onClick)="onCancel()" />
476
+ [disabled]="!isFormValid() || isLoading()"
477
+ />
505
478
  </div>
506
479
  </form>
507
480
  </div>
508
481
  `,
509
482
  }]
510
- }] });
483
+ }], ctorParameters: () => [] });
511
484
 
512
485
  export { StorageConfigFormComponent };
513
- //# sourceMappingURL=flusys-ng-storage-storage-config-form.component-Bc95TVD0.mjs.map
486
+ //# sourceMappingURL=flusys-ng-storage-storage-config-form.component-CODLLCtg.mjs.map