vc-create-dashboard 3.0.82 → 3.0.83
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.
|
@@ -3926,14 +3926,6 @@ class CreateDashboardComponent {
|
|
|
3926
3926
|
if (selected.length < this.pendingEditRcIds.length) {
|
|
3927
3927
|
selected = this.resolveRcFromTree(this.responsibilityCentersList, this.pendingEditRcIds);
|
|
3928
3928
|
}
|
|
3929
|
-
if (!selected.length && this.pendingEditRcIds.length) {
|
|
3930
|
-
selected = this.pendingEditRcIds.map((id) => ({
|
|
3931
|
-
item_id: id,
|
|
3932
|
-
rc_id: id,
|
|
3933
|
-
rcid: id,
|
|
3934
|
-
item_name: `Responsibility Center ${id}`,
|
|
3935
|
-
}));
|
|
3936
|
-
}
|
|
3937
3929
|
this.dashboardForm.selectedResponsibilityCenters = selected;
|
|
3938
3930
|
this.cdr.detectChanges();
|
|
3939
3931
|
}
|
|
@@ -3971,59 +3963,6 @@ class CreateDashboardComponent {
|
|
|
3971
3963
|
error: (err) => console.error(err),
|
|
3972
3964
|
});
|
|
3973
3965
|
}
|
|
3974
|
-
loadCustomDashboardDetailForEdit(recordId, cdid) {
|
|
3975
|
-
const applyResponse = (res) => {
|
|
3976
|
-
if (!res) {
|
|
3977
|
-
return;
|
|
3978
|
-
}
|
|
3979
|
-
const payload = res?.data ?? res;
|
|
3980
|
-
const detail = payload?.dashboard ?? payload;
|
|
3981
|
-
this.mergeEditDashboardDetails(detail);
|
|
3982
|
-
this.cdr.detectChanges();
|
|
3983
|
-
};
|
|
3984
|
-
const fetchDetail$ = (id) => this.createDashboardService.fetchCustomDashboardById(id);
|
|
3985
|
-
let request$ = null;
|
|
3986
|
-
if (recordId != null && recordId !== '') {
|
|
3987
|
-
request$ = fetchDetail$(recordId).pipe(catchError(() => cdid && String(cdid) !== String(recordId)
|
|
3988
|
-
? fetchDetail$(cdid)
|
|
3989
|
-
: of(null)));
|
|
3990
|
-
}
|
|
3991
|
-
else if (cdid) {
|
|
3992
|
-
request$ = fetchDetail$(cdid).pipe(catchError(() => of(null)));
|
|
3993
|
-
}
|
|
3994
|
-
if (!request$) {
|
|
3995
|
-
return;
|
|
3996
|
-
}
|
|
3997
|
-
this.wrapEditRequest(request$, applyResponse);
|
|
3998
|
-
}
|
|
3999
|
-
mergeEditDashboardDetails(detail) {
|
|
4000
|
-
if (!detail) {
|
|
4001
|
-
return;
|
|
4002
|
-
}
|
|
4003
|
-
this.patchDashboardMetaFromDetail(detail);
|
|
4004
|
-
this.syncProgramsForEdit(detail);
|
|
4005
|
-
}
|
|
4006
|
-
patchDashboardMetaFromDetail(detail) {
|
|
4007
|
-
if (!detail) {
|
|
4008
|
-
return;
|
|
4009
|
-
}
|
|
4010
|
-
if (detail.name) {
|
|
4011
|
-
this.dashboardForm.dashboardName = detail.name;
|
|
4012
|
-
}
|
|
4013
|
-
if (detail.description != null) {
|
|
4014
|
-
const descriptionText = typeof detail.description === 'string'
|
|
4015
|
-
? detail.description
|
|
4016
|
-
: detail.description?.[0]?.content ?? '';
|
|
4017
|
-
if (descriptionText) {
|
|
4018
|
-
this.dashboardForm.dashboardDescriptionText = descriptionText;
|
|
4019
|
-
}
|
|
4020
|
-
}
|
|
4021
|
-
const rcIds = extractRcIdsFromDashboard(detail);
|
|
4022
|
-
if (rcIds.length) {
|
|
4023
|
-
this.pendingEditRcIds = rcIds;
|
|
4024
|
-
this.applyPendingResponsibilityCenters();
|
|
4025
|
-
}
|
|
4026
|
-
}
|
|
4027
3966
|
syncProgramsForEdit(data) {
|
|
4028
3967
|
if (!data) {
|
|
4029
3968
|
return;
|
|
@@ -4313,6 +4252,27 @@ class CreateDashboardComponent {
|
|
|
4313
4252
|
};
|
|
4314
4253
|
this.createDashboardService.saveWidgetDetails(payload).subscribe({
|
|
4315
4254
|
next: (res) => {
|
|
4255
|
+
// saveWidgetDetails can return freshest bridge id; merge it for redirect.
|
|
4256
|
+
const widgetPayload = res?.data ?? res ?? {};
|
|
4257
|
+
this.createdDashboard = {
|
|
4258
|
+
...(this.createdDashboard ?? {}),
|
|
4259
|
+
...(widgetPayload?.dashboard ?? {}),
|
|
4260
|
+
cddid: this.createdDashboard?.cddid ??
|
|
4261
|
+
widgetPayload?.cddid ??
|
|
4262
|
+
widgetPayload?.cdid ??
|
|
4263
|
+
widgetPayload?.dashboard_bridge_id,
|
|
4264
|
+
cdid: this.createdDashboard?.cdid ??
|
|
4265
|
+
widgetPayload?.cdid ??
|
|
4266
|
+
widgetPayload?.cddid ??
|
|
4267
|
+
widgetPayload?.dashboard_bridge_id,
|
|
4268
|
+
dashboard_bridge_id: this.createdDashboard?.dashboard_bridge_id ??
|
|
4269
|
+
widgetPayload?.dashboard_bridge_id ??
|
|
4270
|
+
widgetPayload?.dashboardBridgeId,
|
|
4271
|
+
dashboardBridgeId: this.createdDashboard?.dashboardBridgeId ??
|
|
4272
|
+
widgetPayload?.dashboardBridgeId ??
|
|
4273
|
+
widgetPayload?.dashboard_bridge_id,
|
|
4274
|
+
};
|
|
4275
|
+
this.dashboardId = this.getCreatedDashboardCdid();
|
|
4316
4276
|
this.vLoader = false;
|
|
4317
4277
|
this.isSmiley = true;
|
|
4318
4278
|
this.smileyMessage = this.mode === 'EDIT' ? 'The dashboard has been updated.' : 'The dashboard has been created.';
|
|
@@ -4320,7 +4280,7 @@ class CreateDashboardComponent {
|
|
|
4320
4280
|
this.isSmiley = false;
|
|
4321
4281
|
const cdid = this.getCreatedDashboardCdid();
|
|
4322
4282
|
this.close.emit({
|
|
4323
|
-
mode: 'created',
|
|
4283
|
+
mode: this.mode === 'EDIT' ? 'updated' : 'created',
|
|
4324
4284
|
id: cdid,
|
|
4325
4285
|
cdid,
|
|
4326
4286
|
dashboardBridgeId: this.createdDashboard?.dashboard_bridge_id ??
|
|
@@ -4447,7 +4407,6 @@ class CreateDashboardComponent {
|
|
|
4447
4407
|
data?.createdBy ?? data?.created_by,
|
|
4448
4408
|
].filter((x) => x != null);
|
|
4449
4409
|
this.populateDashboardForm(data);
|
|
4450
|
-
this.loadCustomDashboardDetailForEdit(data?.recordId ?? data?.id, editCdid || data?.cdid);
|
|
4451
4410
|
if (this.mode === 'EDIT' && editCdid) {
|
|
4452
4411
|
this.loadEditModeWidgets(editCdid);
|
|
4453
4412
|
}
|