@pega/angular-sdk-overrides 0.23.14 → 0.23.15
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.
|
@@ -119,6 +119,14 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
|
|
|
119
119
|
},
|
|
120
120
|
'cancelPressed'
|
|
121
121
|
);
|
|
122
|
+
|
|
123
|
+
PCore.getPubSubUtils().subscribe(
|
|
124
|
+
'clearBannerMessages',
|
|
125
|
+
() => {
|
|
126
|
+
this.banners = [];
|
|
127
|
+
},
|
|
128
|
+
'CLEAR_BANNER_MESSAGES'
|
|
129
|
+
);
|
|
122
130
|
}
|
|
123
131
|
|
|
124
132
|
ngOnDestroy() {
|
|
@@ -129,6 +137,7 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
|
|
|
129
137
|
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'cancelAssignment');
|
|
130
138
|
|
|
131
139
|
PCore.getPubSubUtils().unsubscribe('cancelPressed', 'cancelPressed');
|
|
140
|
+
PCore.getPubSubUtils().unsubscribe('clearBannerMessages', 'CLEAR_BANNER_MESSAGES');
|
|
132
141
|
}
|
|
133
142
|
|
|
134
143
|
handleCancel() {
|
|
@@ -152,14 +161,15 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
|
|
|
152
161
|
const pConn = this.pConnectOfActiveContainerItem || this.pConn$;
|
|
153
162
|
const caseViewModeFromProps = this.angularPConnect.getComponentProp(this, 'caseViewMode');
|
|
154
163
|
const caseViewModeFromRedux = pConn.getValue('context_data.caseViewMode', '');
|
|
164
|
+
const completeProps = this.angularPConnect.getCurrentCompleteProps(this) as FlowContainerProps;
|
|
155
165
|
|
|
156
166
|
// ONLY call updateSelf when the component should update
|
|
157
167
|
// AND removing the "gate" that was put there since shouldComponentUpdate
|
|
158
168
|
// should be the real "gate"
|
|
169
|
+
// eslint-disable-next-line sonarjs/no-collapsible-if
|
|
159
170
|
if (bUpdateSelf || caseViewModeFromProps !== caseViewModeFromRedux) {
|
|
160
171
|
// don't want to redraw the flow container when there are page messages, because
|
|
161
172
|
// the redraw causes us to loose the errors on the elements
|
|
162
|
-
const completeProps = this.angularPConnect.getCurrentCompleteProps(this) as FlowContainerProps;
|
|
163
173
|
if (!completeProps.pageMessages || completeProps.pageMessages.length == 0) {
|
|
164
174
|
// with a cancel, need to timeout so todo will update correctly
|
|
165
175
|
if (this.bHasCancel) {
|
|
@@ -170,10 +180,10 @@ export class FlowContainerComponent extends FlowContainerBaseComponent implement
|
|
|
170
180
|
} else {
|
|
171
181
|
this.updateSelf();
|
|
172
182
|
}
|
|
173
|
-
} else {
|
|
174
|
-
this.showPageMessages(completeProps);
|
|
175
183
|
}
|
|
176
184
|
}
|
|
185
|
+
|
|
186
|
+
this.showPageMessages(completeProps);
|
|
177
187
|
}
|
|
178
188
|
|
|
179
189
|
showPageMessages(completeProps: FlowContainerProps) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<div>
|
|
2
|
-
<div><component-mapper name="AlertBanner" [props]="{ banners }" [parent]="this"></component-mapper></div>
|
|
2
|
+
<div><component-mapper name="AlertBanner" [props]="{ banners: bannerService.banners }" [parent]="this"></component-mapper></div>
|
|
3
3
|
<div *ngIf="bHasNavigation$" class="psdk-stepper">
|
|
4
4
|
<component-mapper
|
|
5
5
|
name="MultiStep"
|
|
@@ -8,6 +8,7 @@ import { ErrorMessagesService } from '@pega/angular-sdk-components';
|
|
|
8
8
|
import { ProgressSpinnerService } from '@pega/angular-sdk-components';
|
|
9
9
|
import { ReferenceComponent } from '@pega/angular-sdk-components';
|
|
10
10
|
import { ComponentMapperComponent } from '@pega/angular-sdk-components';
|
|
11
|
+
import { BannerService } from '@pega/angular-sdk-components';
|
|
11
12
|
|
|
12
13
|
function getRefreshProps(refreshConditions) {
|
|
13
14
|
// refreshConditions cuurently supports only "Changes" event
|
|
@@ -37,7 +38,6 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
37
38
|
@Input() isCreateStage$: boolean;
|
|
38
39
|
@Input() updateToken$: number;
|
|
39
40
|
@Input() isInModal$ = false;
|
|
40
|
-
@Input() banners;
|
|
41
41
|
|
|
42
42
|
// For interaction with AngularPConnect
|
|
43
43
|
angularPConnectData: AngularPConnectData = {};
|
|
@@ -75,12 +75,15 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
75
75
|
localeCategory = 'Assignment';
|
|
76
76
|
localeReference;
|
|
77
77
|
|
|
78
|
+
snackBarRef;
|
|
79
|
+
|
|
78
80
|
constructor(
|
|
79
81
|
private angularPConnect: AngularPConnectService,
|
|
80
82
|
private psService: ProgressSpinnerService,
|
|
81
83
|
private erService: ErrorMessagesService,
|
|
82
84
|
private ngZone: NgZone,
|
|
83
|
-
private snackBar: MatSnackBar
|
|
85
|
+
private snackBar: MatSnackBar,
|
|
86
|
+
public bannerService: BannerService
|
|
84
87
|
) {}
|
|
85
88
|
|
|
86
89
|
ngOnInit(): void {
|
|
@@ -111,6 +114,8 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
111
114
|
// Should always check the bridge to see if the component should update itself (re-render)
|
|
112
115
|
const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this);
|
|
113
116
|
|
|
117
|
+
this.bannerService.updateBanners(this.itemKey$);
|
|
118
|
+
|
|
114
119
|
// ONLY call updateSelf when the component should update
|
|
115
120
|
// AND removing the "gate" that was put there since shouldComponentUpdate
|
|
116
121
|
// should be the real "gate"
|
|
@@ -300,6 +305,10 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
300
305
|
}
|
|
301
306
|
|
|
302
307
|
buttonClick(sAction, sButtonType) {
|
|
308
|
+
this.snackBarRef?.dismiss();
|
|
309
|
+
this.bannerService.clearBanners();
|
|
310
|
+
// @ts-ignore
|
|
311
|
+
PCore.getPubSubUtils().publish('clearBannerMessages');
|
|
303
312
|
// right now, done on an individual basis, setting bReInit to true
|
|
304
313
|
// upon the next flow container state change, will cause the flow container
|
|
305
314
|
// to re-initialize
|
|
@@ -335,7 +344,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
335
344
|
})
|
|
336
345
|
.catch(() => {
|
|
337
346
|
this.psService.sendMessage(false);
|
|
338
|
-
this.snackBar.open(`${this.localizedVal('Navigation failed!', this.localeCategory)}`, 'Ok');
|
|
347
|
+
this.snackBarRef = this.snackBar.open(`${this.localizedVal('Navigation failed!', this.localeCategory)}`, 'Ok');
|
|
339
348
|
});
|
|
340
349
|
}
|
|
341
350
|
break;
|
|
@@ -354,7 +363,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
354
363
|
})
|
|
355
364
|
.catch(() => {
|
|
356
365
|
this.psService.sendMessage(false);
|
|
357
|
-
this.snackBar.open(`${this.localizedVal('Save failed', this.localeCategory)}`, 'Ok');
|
|
366
|
+
this.snackBarRef = this.snackBar.open(`${this.localizedVal('Save failed', this.localeCategory)}`, 'Ok');
|
|
358
367
|
});
|
|
359
368
|
|
|
360
369
|
break;
|
|
@@ -381,7 +390,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
381
390
|
})
|
|
382
391
|
.catch(() => {
|
|
383
392
|
this.psService.sendMessage(false);
|
|
384
|
-
this.snackBar.open(`${this.localizedVal('Cancel failed!', this.localeCategory)}`, 'Ok');
|
|
393
|
+
this.snackBarRef = this.snackBar.open(`${this.localizedVal('Cancel failed!', this.localeCategory)}`, 'Ok');
|
|
385
394
|
});
|
|
386
395
|
} else {
|
|
387
396
|
this.psService.sendMessage(true);
|
|
@@ -400,7 +409,7 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
400
409
|
})
|
|
401
410
|
.catch(() => {
|
|
402
411
|
this.psService.sendMessage(false);
|
|
403
|
-
this.snackBar.open(`${this.localizedVal('Cancel failed!', this.localeCategory)}`, 'Ok');
|
|
412
|
+
this.snackBarRef = this.snackBar.open(`${this.localizedVal('Cancel failed!', this.localeCategory)}`, 'Ok');
|
|
404
413
|
});
|
|
405
414
|
}
|
|
406
415
|
break;
|
|
@@ -413,23 +422,18 @@ export class AssignmentComponent implements OnInit, OnDestroy, OnChanges {
|
|
|
413
422
|
switch (sAction) {
|
|
414
423
|
case 'finishAssignment':
|
|
415
424
|
this.erService.sendMessage('publish', '');
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
.
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
.
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
});
|
|
429
|
-
} else {
|
|
430
|
-
// let snackBarRef = this.snackBar.open("Please fix errors on form.", "Ok");
|
|
431
|
-
this.erService.sendMessage('show', this.localizedVal('Please fix errors on form.', this.localeCategory));
|
|
432
|
-
}
|
|
425
|
+
this.bReInit = true;
|
|
426
|
+
this.psService.sendMessage(true);
|
|
427
|
+
const finishPromise = this.finishAssignment(this.itemKey$); // JA - was itemID but Nebula/Constellation uses itemKey
|
|
428
|
+
finishPromise
|
|
429
|
+
.then(() => {
|
|
430
|
+
this.psService.sendMessage(false);
|
|
431
|
+
this.updateChanges();
|
|
432
|
+
})
|
|
433
|
+
.catch(() => {
|
|
434
|
+
this.psService.sendMessage(false);
|
|
435
|
+
this.snackBarRef = this.snackBar.open(`${this.localizedVal('Submit failed!', this.localeCategory)}`, 'Ok');
|
|
436
|
+
});
|
|
433
437
|
break;
|
|
434
438
|
default:
|
|
435
439
|
break;
|