Skip to content
This repository has been archived by the owner on Jan 24, 2023. It is now read-only.

Deploy App: Add notification toast #3242

Merged
merged 4 commits into from
Dec 5, 2018
Merged
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 @@ -49,7 +49,7 @@ export class DeployApplicationStep3Component implements OnDestroy {
constructor(
private store: Store<AppState>,
private snackBar: MatSnackBar,
public cfOrgSpaceService: CfOrgSpaceDataService,
public cfOrgSpaceService: CfOrgSpaceDataService
) {
this.valid$ = observableOf(false);
this.closeable$ = observableOf(false);
Expand Down Expand Up @@ -96,11 +96,28 @@ export class DeployApplicationStep3Component implements OnDestroy {
ngOnDestroy() {
this.store.dispatch(new DeleteDeployAppSection());
this.destroyDeployer();
if (this.deployer) {
if (this.deployer && !this.deployer.deploying) {
this.deployer.close();
} else {
this.setupCompletionNotification();
}
}

private setupCompletionNotification() {
this.deployer.status$.pipe(
filter(status => !status.deploying),
first()
).subscribe(status => {
if (status.error) {
this.snackBar.open(status.errorMsg, 'Dismiss');
} else {
const ref = this.snackBar.open('Application deployment complete', 'View', { duration: 5000 });
ref.onAction().subscribe(() => { this.goToAppSummary(); });
}
this.deployer.close();
});
}

onEnter = (fsDeployer: DeployApplicationDeployer) => {
// If we were passed data, then we came from the File System step
if (fsDeployer) {
Expand All @@ -122,14 +139,18 @@ export class DeployApplicationStep3Component implements OnDestroy {
onNext: StepOnNextFunction = () => {
// Delete Deploy App Section
this.store.dispatch(new DeleteDeployAppSection());
this.goToAppSummary();
return observableOf({ success: true });
}

goToAppSummary() {
// Take user to applications
const { cfGuid } = this.deployer;
this.store.dispatch(new RouterNav({ path: ['applications', cfGuid, this.appGuid] }));
if (this.appGuid) {
this.store.dispatch(new GetAppEnvVarsAction(this.appGuid, cfGuid));
// Ensure the application package_state is correct
this.store.dispatch(new GetApplication(this.appGuid, cfGuid));
this.store.dispatch(new RouterNav({ path: ['applications', cfGuid, this.appGuid] }));
}
return observableOf({ success: true });
}
}