Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resetting Pega store after cancel assignment #234

Draft
wants to merge 1 commit into
base: support/pnc
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</div>
<div [hidden]="!showPega$">
<div class="mc-info">
<div class="mc-info-pega">
<div class="mc-info-pega" *ngIf="pConn$">
<component-mapper name="RootContainer" [props]="{ pConn$, displayOnlyFA$: true }"></component-mapper>
<div style="padding-left: 50px">* - required fields</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ComponentMapperComponent } from '../../../../../../../packages/angular-
imports: [CommonModule, BundleSwatchComponent, ComponentMapperComponent, ResolutionScreenComponent]
})
export class MainScreenComponent implements OnInit, OnDestroy {
@Input() pConn$: typeof PConnect;
@Input() pConn$: typeof PConnect | null;

firstConfig$: any;
secondConfig$: any;
Expand Down Expand Up @@ -126,7 +126,27 @@ export class MainScreenComponent implements OnInit, OnDestroy {
});
}

openAssignment() {
this.showTriplePlayOptions$ = false;
this.showPega$ = true;
this.scservice.getSdkConfig().then(sdkConfig => {
const mashupAssignmentID = sdkConfig.serverConfig.appMashupAssignmentID;
const options: any = {
pageName: 'pyEmbedAssignment'
};
PCore.getMashupApi()
.openAssignment(mashupAssignmentID, PCore.getConstants().APP.APP, options)
.then(() => {
console.log('openAssignment rendering is complete');
});
});
}

onShopNow(sLevel: string) {
this.createWork(sLevel);
if (sLevel === 'Basic') {
this.createWork(sLevel);
} else {
this.openAssignment();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ declare global {
})
export class MCNavComponent implements OnInit, OnDestroy {
starterPackVersion$: string = endpoints.SP_VERSION;
pConn$: typeof PConnect;
pConn$: typeof PConnect | null;

applicationLabel = '';
bLoggedIn$ = false;
Expand Down Expand Up @@ -67,6 +67,7 @@ export class MCNavComponent implements OnInit, OnDestroy {
ngOnDestroy() {
this.progressSpinnerSubscription.unsubscribe();
this.resetPConnectSubscription.unsubscribe();
PCore.getPubSubUtils().unsubscribe(PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL, 'cancelAssignment');
}

async initialize() {
Expand Down Expand Up @@ -100,6 +101,17 @@ export class MCNavComponent implements OnInit, OnDestroy {
// Add event listener for when logged in and constellation bootstrap is loaded
document.addEventListener('SdkConstellationReady', () => {
this.bLoggedIn$ = true;

PCore.getPubSubUtils().subscribe(
PCore.getConstants().PUB_SUB_EVENTS.EVENT_CANCEL,
() => {
// reset store and start mashup freshely when assignment is cancelled
PCore.resetStore();
this.pConn$ = null;
this.startMashup();
},
'cancelAssignment'
);
// start the portal
this.startMashup();
});
Expand Down Expand Up @@ -187,7 +199,7 @@ export class MCNavComponent implements OnInit, OnDestroy {

this.pConn$ = props.getPConnect();

this.pConn$.getContainerManager().initializeContainers({
this.pConn$?.getContainerManager().initializeContainers({
type: 'multiple',
name: 'modal',
context: 'app'
Expand Down