cloud-ide-layout 1.0.297 → 1.0.302

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 (18) hide show
  1. package/fesm2022/cloud-ide-layout-api-endpoint-manager.component-h6VzYckg.mjs +288 -0
  2. package/fesm2022/cloud-ide-layout-api-endpoint-manager.component-h6VzYckg.mjs.map +1 -0
  3. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-DgwU-sCr.mjs → cloud-ide-layout-cloud-ide-layout-B3aNlPnd.mjs} +36 -21
  4. package/fesm2022/{cloud-ide-layout-cloud-ide-layout-DgwU-sCr.mjs.map → cloud-ide-layout-cloud-ide-layout-B3aNlPnd.mjs.map} +1 -1
  5. package/fesm2022/cloud-ide-layout-dashboard-manager.component-DdEEGw7d.mjs +706 -0
  6. package/fesm2022/cloud-ide-layout-dashboard-manager.component-DdEEGw7d.mjs.map +1 -0
  7. package/fesm2022/{cloud-ide-layout-drawer-theme.component-BWSMDvLy.mjs → cloud-ide-layout-drawer-theme.component-DZxUoK7a.mjs} +4 -4
  8. package/fesm2022/{cloud-ide-layout-drawer-theme.component-BWSMDvLy.mjs.map → cloud-ide-layout-drawer-theme.component-DZxUoK7a.mjs.map} +1 -1
  9. package/fesm2022/{cloud-ide-layout-home-wrapper.component-CH7LlO1x.mjs → cloud-ide-layout-home-wrapper.component-1SSET2sB.mjs} +2 -2
  10. package/fesm2022/{cloud-ide-layout-home-wrapper.component-CH7LlO1x.mjs.map → cloud-ide-layout-home-wrapper.component-1SSET2sB.mjs.map} +1 -1
  11. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-DVj6eU3V.mjs → cloud-ide-layout-sidedrawer-notes.component-D4UliYnP.mjs} +4 -4
  12. package/fesm2022/{cloud-ide-layout-sidedrawer-notes.component-DVj6eU3V.mjs.map → cloud-ide-layout-sidedrawer-notes.component-D4UliYnP.mjs.map} +1 -1
  13. package/fesm2022/cloud-ide-layout.mjs +1 -1
  14. package/index.d.ts +1 -1
  15. package/package.json +1 -1
  16. package/README.md +0 -63
  17. package/fesm2022/cloud-ide-layout-dashboard-manager.component-CHthRoQj.mjs +0 -653
  18. package/fesm2022/cloud-ide-layout-dashboard-manager.component-CHthRoQj.mjs.map +0 -1
@@ -0,0 +1,706 @@
1
+ import * as i0 from '@angular/core';
2
+ import { input, output, inject, signal, computed, Component } from '@angular/core';
3
+ import { CommonModule } from '@angular/common';
4
+ import * as i2 from '@angular/forms';
5
+ import { FormsModule } from '@angular/forms';
6
+ import { C as CideLytSharedWrapperComponent } from './cloud-ide-layout-cloud-ide-layout-B3aNlPnd.mjs';
7
+ import { D as DashboardCardsService } from './cloud-ide-layout-dashboard-cards.service-BGaKcq7H.mjs';
8
+ import { NotificationService, CideEleFloatingContainerService, CideEleButtonComponent, CideInputComponent, CideSelectComponent, ConfirmationService, CideEleDataGridComponent } from 'cloud-ide-element';
9
+
10
+ class DashboardCardFormComponent {
11
+ // Inputs from floating container config
12
+ containerId = input('', ...(ngDevMode ? [{ debugName: "containerId" }] : []));
13
+ editCardData = input(null, ...(ngDevMode ? [{ debugName: "editCardData" }] : []));
14
+ // Outputs
15
+ saved = output();
16
+ cancelled = output();
17
+ dashboardCardsService = inject(DashboardCardsService);
18
+ notificationService = inject(NotificationService);
19
+ floatingContainerService = inject(CideEleFloatingContainerService);
20
+ saving = signal(false, ...(ngDevMode ? [{ debugName: "saving" }] : []));
21
+ apiEndpoints = signal([], ...(ngDevMode ? [{ debugName: "apiEndpoints" }] : []));
22
+ cardTypes = [
23
+ { value: 'stats', label: 'Stats' },
24
+ { value: 'chart', label: 'Chart' },
25
+ { value: 'table', label: 'Table' },
26
+ { value: 'module-card', label: 'Module Card' },
27
+ { value: 'activity-feed', label: 'Activity Feed' },
28
+ { value: 'events', label: 'Events' },
29
+ { value: 'custom', label: 'Custom' }
30
+ ];
31
+ cardForm = {
32
+ title: '',
33
+ description: '',
34
+ type: 'custom',
35
+ apiEndpoint: '',
36
+ icon: '',
37
+ color: '#3B82F6',
38
+ position: {
39
+ row: 1,
40
+ col: 1,
41
+ colspan: 1,
42
+ rowspan: 1
43
+ }
44
+ };
45
+ apiEndpointsOptions = computed(() => {
46
+ return this.apiEndpoints().map(api => ({
47
+ value: api.endpoint,
48
+ label: `${api.method} ${api.endpoint} - ${api.description}`
49
+ }));
50
+ }, ...(ngDevMode ? [{ debugName: "apiEndpointsOptions" }] : []));
51
+ ngOnInit() {
52
+ this.loadApiEndpoints();
53
+ // Initialize form if editing
54
+ const card = this.editCardData();
55
+ if (card) {
56
+ this.cardForm = {
57
+ title: card.cdc_title || '',
58
+ description: card.cdc_description || '',
59
+ type: card.cdc_type || 'custom',
60
+ apiEndpoint: card.cdc_api_endpoint || '',
61
+ icon: card.cdc_icon || '',
62
+ color: card.cdc_color || '#3B82F6',
63
+ position: card.cdc_position && typeof card.cdc_position === 'object' &&
64
+ 'row' in card.cdc_position && 'col' in card.cdc_position &&
65
+ 'colspan' in card.cdc_position && 'rowspan' in card.cdc_position
66
+ ? {
67
+ row: card.cdc_position.row || 1,
68
+ col: card.cdc_position.col || 1,
69
+ colspan: card.cdc_position.colspan || 1,
70
+ rowspan: card.cdc_position.rowspan || 1
71
+ }
72
+ : {
73
+ row: 1,
74
+ col: 1,
75
+ colspan: 1,
76
+ rowspan: 1
77
+ }
78
+ };
79
+ }
80
+ }
81
+ loadApiEndpoints() {
82
+ this.dashboardCardsService.getApiList().subscribe({
83
+ next: (response) => {
84
+ if (response.success && response.data) {
85
+ this.apiEndpoints.set(response.data);
86
+ }
87
+ },
88
+ error: (error) => {
89
+ console.error('Error loading API endpoints:', error);
90
+ }
91
+ });
92
+ }
93
+ saveCard() {
94
+ this.saving.set(true);
95
+ const card = this.editCardData();
96
+ const payload = {
97
+ core_dashboard_cards: {
98
+ _id: card?._id,
99
+ cdc_title: this.cardForm.title,
100
+ cdc_description: this.cardForm.description,
101
+ cdc_type: this.cardForm.type,
102
+ cdc_api_endpoint: this.cardForm.apiEndpoint,
103
+ cdc_icon: this.cardForm.icon,
104
+ cdc_color: this.cardForm.color,
105
+ cdc_position: this.cardForm.position,
106
+ cdc_visible: true,
107
+ cdc_draggable: true
108
+ }
109
+ };
110
+ this.dashboardCardsService.saveUpdateDashboardCard(payload).subscribe({
111
+ next: (response) => {
112
+ if (response.success) {
113
+ this.notificationService.success(card ? 'Card updated successfully' : 'Card created successfully');
114
+ this.saved.emit();
115
+ this.closeForm();
116
+ }
117
+ else {
118
+ this.notificationService.error(response.message || 'Error saving card');
119
+ }
120
+ this.saving.set(false);
121
+ },
122
+ error: (error) => {
123
+ console.error('Error saving card:', error);
124
+ this.notificationService.error('Error saving card');
125
+ this.saving.set(false);
126
+ }
127
+ });
128
+ }
129
+ closeForm() {
130
+ const id = this.containerId();
131
+ if (id) {
132
+ this.floatingContainerService.hide(id);
133
+ }
134
+ this.cancelled.emit();
135
+ }
136
+ onTypeChange(value) {
137
+ this.cardForm.type = value;
138
+ }
139
+ onApiEndpointChange(value) {
140
+ this.cardForm.apiEndpoint = String(value);
141
+ }
142
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: DashboardCardFormComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
143
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "20.3.15", type: DashboardCardFormComponent, isStandalone: true, selector: "cide-lyt-dashboard-card-form", inputs: { containerId: { classPropertyName: "containerId", publicName: "containerId", isSignal: true, isRequired: false, transformFunction: null }, editCardData: { classPropertyName: "editCardData", publicName: "editCardData", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { saved: "saved", cancelled: "cancelled" }, ngImport: i0, template: `
144
+ <div class="tw-p-4 tw-space-y-4">
145
+ <form (ngSubmit)="saveCard()" class="tw-space-y-4">
146
+ <div class="tw-grid tw-grid-cols-2 tw-gap-4">
147
+ <div>
148
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Title</label>
149
+ <cide-ele-input
150
+ [(ngModel)]="cardForm.title"
151
+ [name]="'title'"
152
+ [required]="true"
153
+ [placeholder]="'Enter card title'">
154
+ </cide-ele-input>
155
+ </div>
156
+
157
+ <div>
158
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Type</label>
159
+ <cide-ele-select
160
+ [ngModel]="cardForm.type || 'custom'"
161
+ (ngModelChange)="onTypeChange($event)"
162
+ [options]="cardTypes"
163
+ [required]="true">
164
+ </cide-ele-select>
165
+ </div>
166
+ </div>
167
+
168
+ <div>
169
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Description</label>
170
+ <cide-ele-input
171
+ [(ngModel)]="cardForm.description"
172
+ [name]="'description'"
173
+ [type]="'text'"
174
+ [placeholder]="'Enter card description'">
175
+ </cide-ele-input>
176
+ </div>
177
+
178
+ <div>
179
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">API Endpoint</label>
180
+ <cide-ele-select
181
+ [ngModel]="cardForm.apiEndpoint"
182
+ (ngModelChange)="onApiEndpointChange($event)"
183
+ [options]="apiEndpointsOptions()"
184
+ [placeholder]="'Select API endpoint'">
185
+ </cide-ele-select>
186
+ </div>
187
+
188
+ <div class="tw-grid tw-grid-cols-2 tw-gap-4">
189
+ <div>
190
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Icon</label>
191
+ <cide-ele-input
192
+ [(ngModel)]="cardForm.icon"
193
+ [name]="'icon'"
194
+ [placeholder]="'e.g., dashboard, analytics'">
195
+ </cide-ele-input>
196
+ </div>
197
+
198
+ <div>
199
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Color</label>
200
+ <cide-ele-input
201
+ [(ngModel)]="cardForm.color"
202
+ [name]="'color'"
203
+ [type]="'text'"
204
+ [placeholder]="'#3B82F6'">
205
+ </cide-ele-input>
206
+ </div>
207
+ </div>
208
+
209
+ <div class="tw-grid tw-grid-cols-4 tw-gap-4">
210
+ <div>
211
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Row</label>
212
+ <cide-ele-input
213
+ [(ngModel)]="cardForm.position.row"
214
+ [name]="'row'"
215
+ [type]="'number'"
216
+ [min]="1">
217
+ </cide-ele-input>
218
+ </div>
219
+
220
+ <div>
221
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Col</label>
222
+ <cide-ele-input
223
+ [(ngModel)]="cardForm.position.col"
224
+ [name]="'col'"
225
+ [type]="'number'"
226
+ [min]="1">
227
+ </cide-ele-input>
228
+ </div>
229
+
230
+ <div>
231
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Col Span</label>
232
+ <cide-ele-input
233
+ [(ngModel)]="cardForm.position.colspan"
234
+ [name]="'colspan'"
235
+ [type]="'number'"
236
+ [min]="1"
237
+ [max]="12">
238
+ </cide-ele-input>
239
+ </div>
240
+
241
+ <div>
242
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Row Span</label>
243
+ <cide-ele-input
244
+ [(ngModel)]="cardForm.position.rowspan"
245
+ [name]="'rowspan'"
246
+ [type]="'number'"
247
+ [min]="1">
248
+ </cide-ele-input>
249
+ </div>
250
+ </div>
251
+
252
+ <div class="tw-flex tw-gap-2 tw-pt-4 tw-justify-end">
253
+ <cide-ele-button
254
+ [label]="'Cancel'"
255
+ variant="secondary"
256
+ (click)="closeForm()">
257
+ </cide-ele-button>
258
+ <cide-ele-button
259
+ [label]="'Save'"
260
+ variant="primary"
261
+ [type]="'submit'"
262
+ [loading]="saving()">
263
+ </cide-ele-button>
264
+ </div>
265
+ </form>
266
+ </div>
267
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "directive", type: i2.ɵNgNoValidate, selector: "form:not([ngNoForm]):not([ngNativeValidate])" }, { kind: "directive", type: i2.NgControlStatus, selector: "[formControlName],[ngModel],[formControl]" }, { kind: "directive", type: i2.NgControlStatusGroup, selector: "[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]" }, { kind: "directive", type: i2.RequiredValidator, selector: ":not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]", inputs: ["required"] }, { kind: "directive", type: i2.NgModel, selector: "[ngModel]:not([formControlName]):not([formControl])", inputs: ["name", "disabled", "ngModel", "ngModelOptions"], outputs: ["ngModelChange"], exportAs: ["ngModel"] }, { kind: "directive", type: i2.NgForm, selector: "form:not([ngNoForm]):not([formGroup]),ng-form,[ngForm]", inputs: ["ngFormOptions"], outputs: ["ngSubmit"], exportAs: ["ngForm"] }, { kind: "component", type: CideEleButtonComponent, selector: "button[cideEleButton], a[cideEleButton], cide-ele-button", inputs: ["label", "variant", "size", "type", "shape", "elevation", "disabled", "id", "loading", "fullWidth", "leftIcon", "rightIcon", "customClass", "tooltip", "ariaLabel", "testId", "routerLink", "routerExtras", "preventDoubleClick", "animated", "adaptive"], outputs: ["btnClick", "doubleClick"] }, { kind: "component", type: CideInputComponent, selector: "cide-ele-input", inputs: ["fill", "label", "labelHide", "disabled", "clearInput", "labelPlacement", "labelDir", "placeholder", "leadingIcon", "trailingIcon", "helperText", "helperTextCollapse", "hideHelperAndErrorText", "errorText", "maxlength", "minlength", "required", "autocapitalize", "autocomplete", "type", "width", "id", "ngModel", "option", "min", "max", "step", "size"], outputs: ["ngModelChange"] }, { kind: "component", type: CideSelectComponent, selector: "cide-ele-select", inputs: ["label", "labelHide", "placeholder", "helperText", "errorText", "required", "disabled", "id", "ngModel", "size", "fill", "labelPlacement", "labelDir", "leadingIcon", "trailingIcon", "clearInput", "options", "multiple", "searchable", "showSearchInput", "loading", "valueKey", "labelKey", "treeView"], outputs: ["ngModelChange", "change", "searchChange"] }] });
268
+ }
269
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: DashboardCardFormComponent, decorators: [{
270
+ type: Component,
271
+ args: [{
272
+ selector: 'cide-lyt-dashboard-card-form',
273
+ standalone: true,
274
+ imports: [
275
+ CommonModule,
276
+ FormsModule,
277
+ CideEleButtonComponent,
278
+ CideInputComponent,
279
+ CideSelectComponent
280
+ ],
281
+ template: `
282
+ <div class="tw-p-4 tw-space-y-4">
283
+ <form (ngSubmit)="saveCard()" class="tw-space-y-4">
284
+ <div class="tw-grid tw-grid-cols-2 tw-gap-4">
285
+ <div>
286
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Title</label>
287
+ <cide-ele-input
288
+ [(ngModel)]="cardForm.title"
289
+ [name]="'title'"
290
+ [required]="true"
291
+ [placeholder]="'Enter card title'">
292
+ </cide-ele-input>
293
+ </div>
294
+
295
+ <div>
296
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Type</label>
297
+ <cide-ele-select
298
+ [ngModel]="cardForm.type || 'custom'"
299
+ (ngModelChange)="onTypeChange($event)"
300
+ [options]="cardTypes"
301
+ [required]="true">
302
+ </cide-ele-select>
303
+ </div>
304
+ </div>
305
+
306
+ <div>
307
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Description</label>
308
+ <cide-ele-input
309
+ [(ngModel)]="cardForm.description"
310
+ [name]="'description'"
311
+ [type]="'text'"
312
+ [placeholder]="'Enter card description'">
313
+ </cide-ele-input>
314
+ </div>
315
+
316
+ <div>
317
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">API Endpoint</label>
318
+ <cide-ele-select
319
+ [ngModel]="cardForm.apiEndpoint"
320
+ (ngModelChange)="onApiEndpointChange($event)"
321
+ [options]="apiEndpointsOptions()"
322
+ [placeholder]="'Select API endpoint'">
323
+ </cide-ele-select>
324
+ </div>
325
+
326
+ <div class="tw-grid tw-grid-cols-2 tw-gap-4">
327
+ <div>
328
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Icon</label>
329
+ <cide-ele-input
330
+ [(ngModel)]="cardForm.icon"
331
+ [name]="'icon'"
332
+ [placeholder]="'e.g., dashboard, analytics'">
333
+ </cide-ele-input>
334
+ </div>
335
+
336
+ <div>
337
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Color</label>
338
+ <cide-ele-input
339
+ [(ngModel)]="cardForm.color"
340
+ [name]="'color'"
341
+ [type]="'text'"
342
+ [placeholder]="'#3B82F6'">
343
+ </cide-ele-input>
344
+ </div>
345
+ </div>
346
+
347
+ <div class="tw-grid tw-grid-cols-4 tw-gap-4">
348
+ <div>
349
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Row</label>
350
+ <cide-ele-input
351
+ [(ngModel)]="cardForm.position.row"
352
+ [name]="'row'"
353
+ [type]="'number'"
354
+ [min]="1">
355
+ </cide-ele-input>
356
+ </div>
357
+
358
+ <div>
359
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Col</label>
360
+ <cide-ele-input
361
+ [(ngModel)]="cardForm.position.col"
362
+ [name]="'col'"
363
+ [type]="'number'"
364
+ [min]="1">
365
+ </cide-ele-input>
366
+ </div>
367
+
368
+ <div>
369
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Col Span</label>
370
+ <cide-ele-input
371
+ [(ngModel)]="cardForm.position.colspan"
372
+ [name]="'colspan'"
373
+ [type]="'number'"
374
+ [min]="1"
375
+ [max]="12">
376
+ </cide-ele-input>
377
+ </div>
378
+
379
+ <div>
380
+ <label class="tw-block tw-text-sm tw-font-medium tw-mb-1">Row Span</label>
381
+ <cide-ele-input
382
+ [(ngModel)]="cardForm.position.rowspan"
383
+ [name]="'rowspan'"
384
+ [type]="'number'"
385
+ [min]="1">
386
+ </cide-ele-input>
387
+ </div>
388
+ </div>
389
+
390
+ <div class="tw-flex tw-gap-2 tw-pt-4 tw-justify-end">
391
+ <cide-ele-button
392
+ [label]="'Cancel'"
393
+ variant="secondary"
394
+ (click)="closeForm()">
395
+ </cide-ele-button>
396
+ <cide-ele-button
397
+ [label]="'Save'"
398
+ variant="primary"
399
+ [type]="'submit'"
400
+ [loading]="saving()">
401
+ </cide-ele-button>
402
+ </div>
403
+ </form>
404
+ </div>
405
+ `
406
+ }]
407
+ }], propDecorators: { containerId: [{ type: i0.Input, args: [{ isSignal: true, alias: "containerId", required: false }] }], editCardData: [{ type: i0.Input, args: [{ isSignal: true, alias: "editCardData", required: false }] }], saved: [{ type: i0.Output, args: ["saved"] }], cancelled: [{ type: i0.Output, args: ["cancelled"] }] } });
408
+
409
+ class DashboardManagerComponent {
410
+ dashboardCardsService = inject(DashboardCardsService);
411
+ notificationService = inject(NotificationService);
412
+ confirmationService = inject(ConfirmationService);
413
+ floatingContainerService = inject(CideEleFloatingContainerService);
414
+ shared_wrapper_setup_param = {
415
+ sypg_page_code: "cide_lyt_dashboard_manager"
416
+ };
417
+ cardsList = signal([], ...(ngDevMode ? [{ debugName: "cardsList" }] : []));
418
+ loading = signal(false, ...(ngDevMode ? [{ debugName: "loading" }] : []));
419
+ constructor() {
420
+ this.floatingContainerService.registerComponent('dashboard-card-form', DashboardCardFormComponent);
421
+ }
422
+ gridConfig = computed(() => ({
423
+ id: 'dashboard-cards-grid',
424
+ columns: [
425
+ {
426
+ key: 'cdc_title',
427
+ header: 'Title',
428
+ type: 'text',
429
+ sortable: true
430
+ },
431
+ {
432
+ key: 'cdc_type',
433
+ header: 'Type',
434
+ type: 'text',
435
+ sortable: true
436
+ },
437
+ {
438
+ key: 'cdc_api_endpoint',
439
+ header: 'API Endpoint',
440
+ type: 'text'
441
+ },
442
+ {
443
+ key: 'cdc_visible',
444
+ header: 'Visible',
445
+ type: 'status',
446
+ statusConfig: {
447
+ activeValue: true,
448
+ activeLabel: 'Visible',
449
+ inactiveLabel: 'Hidden',
450
+ activeClass: 'tw-bg-green-100 tw-text-green-800',
451
+ inactiveClass: 'tw-bg-gray-100 tw-text-gray-800'
452
+ }
453
+ },
454
+ {
455
+ key: 'actions',
456
+ header: 'Actions',
457
+ type: 'actions',
458
+ actions: [
459
+ {
460
+ key: 'edit',
461
+ label: 'Edit',
462
+ icon: 'edit',
463
+ variant: 'primary',
464
+ onClick: 'edit'
465
+ },
466
+ {
467
+ key: 'delete',
468
+ label: 'Delete',
469
+ icon: 'delete',
470
+ variant: 'danger',
471
+ onClick: 'delete'
472
+ },
473
+ {
474
+ key: 'toggle',
475
+ label: 'Toggle Visibility',
476
+ icon: 'visibility',
477
+ variant: 'outline',
478
+ onClick: 'toggle'
479
+ }
480
+ ]
481
+ }
482
+ ],
483
+ data: this.cardsList(),
484
+ pagination: {
485
+ enabled: true,
486
+ pageSize: 10,
487
+ pageSizeOptions: [10, 25, 50, 100],
488
+ showQuickJump: true,
489
+ showPageInfo: true,
490
+ showRefresh: true
491
+ },
492
+ search: {
493
+ enabled: true,
494
+ placeholder: 'Search cards...',
495
+ searchableColumns: ['cdc_title', 'cdc_type', 'cdc_api_endpoint']
496
+ },
497
+ loading: {
498
+ useDefer: true,
499
+ skeletonRows: 5,
500
+ showOverlay: false
501
+ },
502
+ responsive: true,
503
+ striped: false,
504
+ bordered: true,
505
+ compact: true
506
+ }), ...(ngDevMode ? [{ debugName: "gridConfig" }] : []));
507
+ ngOnInit() {
508
+ this.loadCards();
509
+ }
510
+ loadCards() {
511
+ this.loading.set(true);
512
+ this.dashboardCardsService.getDashboardCardsList({}).subscribe({
513
+ next: (response) => {
514
+ if (response.success && response.data) {
515
+ // Map DashboardCardsListResponse to CoreDashboardCards
516
+ const mappedCards = response.data.map((card) => ({
517
+ ...card,
518
+ cdc_entity_id_syen: card.cdc_entity_id_syen?._id || card.cdc_entity_id_syen,
519
+ cdc_created_by_user: card.cdc_created_by_user?._id || card.cdc_created_by_user,
520
+ cdc_modified_by_user: card.cdc_modified_by_user?._id || card.cdc_modified_by_user
521
+ }));
522
+ this.cardsList.set(mappedCards);
523
+ }
524
+ this.loading.set(false);
525
+ },
526
+ error: (error) => {
527
+ console.error('Error loading cards:', error);
528
+ this.notificationService.error('Error loading dashboard cards');
529
+ this.loading.set(false);
530
+ }
531
+ });
532
+ }
533
+ openAddCardModal() {
534
+ const containerId = 'dashboard-card-create';
535
+ this.floatingContainerService.show({
536
+ id: containerId,
537
+ title: 'Create Dashboard Card',
538
+ icon: 'add_card',
539
+ width: '800px',
540
+ height: 'auto',
541
+ componentId: 'dashboard-card-form',
542
+ componentConfig: {
543
+ inputs: {
544
+ containerId: signal(containerId),
545
+ editCardData: signal(null)
546
+ },
547
+ outputs: {
548
+ saved: () => {
549
+ this.loadCards();
550
+ this.floatingContainerService.hide(containerId);
551
+ },
552
+ cancelled: () => this.floatingContainerService.hide(containerId)
553
+ }
554
+ }
555
+ });
556
+ }
557
+ editCard(card) {
558
+ const containerId = `dashboard-card-edit-${card._id}`;
559
+ this.floatingContainerService.show({
560
+ id: containerId,
561
+ title: `Edit Card: ${card.cdc_title}`,
562
+ icon: 'edit',
563
+ width: '800px',
564
+ height: 'auto',
565
+ componentId: 'dashboard-card-form',
566
+ componentConfig: {
567
+ inputs: {
568
+ containerId: signal(containerId),
569
+ editCardData: signal(card)
570
+ },
571
+ outputs: {
572
+ saved: () => {
573
+ this.loadCards();
574
+ this.floatingContainerService.hide(containerId);
575
+ },
576
+ cancelled: () => this.floatingContainerService.hide(containerId)
577
+ }
578
+ }
579
+ });
580
+ }
581
+ deleteCard(card) {
582
+ if (!card._id)
583
+ return;
584
+ this.confirmationService.ask({
585
+ title: 'Delete Card',
586
+ message: `Are you sure you want to delete "\${card.cdc_title}"?`,
587
+ type: 'danger',
588
+ icon: 'delete_forever',
589
+ confirmText: 'Delete',
590
+ cancelText: 'Cancel'
591
+ }).then((confirmed) => {
592
+ if (confirmed) {
593
+ this.dashboardCardsService.deleteDashboardCard(card._id).subscribe({
594
+ next: (response) => {
595
+ if (response.success) {
596
+ this.notificationService.success('Card deleted successfully');
597
+ this.loadCards();
598
+ }
599
+ else {
600
+ this.notificationService.error(response.message || 'Error deleting card');
601
+ }
602
+ },
603
+ error: (error) => {
604
+ console.error('Error deleting card:', error);
605
+ this.notificationService.error('Error deleting card');
606
+ }
607
+ });
608
+ }
609
+ });
610
+ }
611
+ toggleVisibility(card) {
612
+ const payload = {
613
+ core_dashboard_cards: {
614
+ _id: card._id,
615
+ cdc_visible: !card.cdc_visible
616
+ }
617
+ };
618
+ this.dashboardCardsService.saveUpdateDashboardCard(payload).subscribe({
619
+ next: (response) => {
620
+ if (response.success) {
621
+ this.loadCards();
622
+ }
623
+ },
624
+ error: (error) => {
625
+ console.error('Error toggling visibility:', error);
626
+ this.notificationService.error('Error updating card');
627
+ }
628
+ });
629
+ }
630
+ onGridEvent(event) {
631
+ if (event.type === 'action' && event.action) {
632
+ const card = event.data;
633
+ if (event.action.key === 'edit') {
634
+ this.editCard(card);
635
+ }
636
+ else if (event.action.key === 'delete') {
637
+ this.deleteCard(card);
638
+ }
639
+ else if (event.action.key === 'toggle') {
640
+ this.toggleVisibility(card);
641
+ }
642
+ }
643
+ }
644
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: DashboardManagerComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
645
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "20.3.15", type: DashboardManagerComponent, isStandalone: true, selector: "cide-lyt-dashboard-manager", ngImport: i0, template: `
646
+ <cide-lyt-shared-wrapper [shared_wrapper_setup_param]="shared_wrapper_setup_param">
647
+ <div class="tw-p-4 tw-space-y-4">
648
+ <div breadcrumb-actions>
649
+ <cide-ele-button
650
+ [label]="'Add New Card'"
651
+ leftIcon="add"
652
+ (click)="openAddCardModal()"
653
+ variant="primary"
654
+ size="xs"
655
+ [adaptive]="true">
656
+ </cide-ele-button>
657
+ </div>
658
+
659
+ <!-- Cards Grid -->
660
+ <cide-ele-data-grid
661
+ [config]="gridConfig()"
662
+ (gridEvent)="onGridEvent($event)">
663
+ </cide-ele-data-grid>
664
+ </div>
665
+ </cide-lyt-shared-wrapper>
666
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: FormsModule }, { kind: "component", type: CideLytSharedWrapperComponent, selector: "cide-lyt-shared-wrapper", inputs: ["shared_wrapper_setup_param", "breadcrumb_data"] }, { kind: "component", type: CideEleDataGridComponent, selector: "cide-ele-data-grid", inputs: ["config", "templateRenderers", "customFormatters", "actionHandlers", "serverSidePagination", "totalServerItems", "currentServerPage", "currentServerPageSize", "dragDropEnabled"], outputs: ["gridEvent"] }, { kind: "component", type: CideEleButtonComponent, selector: "button[cideEleButton], a[cideEleButton], cide-ele-button", inputs: ["label", "variant", "size", "type", "shape", "elevation", "disabled", "id", "loading", "fullWidth", "leftIcon", "rightIcon", "customClass", "tooltip", "ariaLabel", "testId", "routerLink", "routerExtras", "preventDoubleClick", "animated", "adaptive"], outputs: ["btnClick", "doubleClick"] }] });
667
+ }
668
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "20.3.15", ngImport: i0, type: DashboardManagerComponent, decorators: [{
669
+ type: Component,
670
+ args: [{
671
+ selector: 'cide-lyt-dashboard-manager',
672
+ standalone: true,
673
+ imports: [
674
+ CommonModule,
675
+ FormsModule,
676
+ CideLytSharedWrapperComponent,
677
+ CideEleDataGridComponent,
678
+ CideEleButtonComponent
679
+ ],
680
+ template: `
681
+ <cide-lyt-shared-wrapper [shared_wrapper_setup_param]="shared_wrapper_setup_param">
682
+ <div class="tw-p-4 tw-space-y-4">
683
+ <div breadcrumb-actions>
684
+ <cide-ele-button
685
+ [label]="'Add New Card'"
686
+ leftIcon="add"
687
+ (click)="openAddCardModal()"
688
+ variant="primary"
689
+ size="xs"
690
+ [adaptive]="true">
691
+ </cide-ele-button>
692
+ </div>
693
+
694
+ <!-- Cards Grid -->
695
+ <cide-ele-data-grid
696
+ [config]="gridConfig()"
697
+ (gridEvent)="onGridEvent($event)">
698
+ </cide-ele-data-grid>
699
+ </div>
700
+ </cide-lyt-shared-wrapper>
701
+ `
702
+ }]
703
+ }], ctorParameters: () => [] });
704
+
705
+ export { DashboardManagerComponent };
706
+ //# sourceMappingURL=cloud-ide-layout-dashboard-manager.component-DdEEGw7d.mjs.map