Skip to content
Open
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 @@ -31,7 +31,7 @@ <h4 class="marginless">New Data Model</h4>
</button>
</div>
<div fxFlex fxLayout="row-reverse" fxLayout.md="column" fxLayout.sm="column" fxLayout.xs="column" fxFlex="50" fxFlex.md="100" fxFlex.sm="100" fxFlex.xs="100">
<button mat-flat-button type="button" color="primary" class="custom" *ngIf="(i+1) === steps.length" [disabled]="step.invalid" (click)="save()">Submit Data Model</button>
<button mat-flat-button type="button" color="primary" class="custom" *ngIf="(i+1) === steps.length" [disabled]="step.invalid || isSaving" (click)="save()">Submit Data Model</button>
<button mat-stroked-button type="button" color="primary" class="custom" *ngIf="(i+1) !== steps.length" [disabled]="step.invalid" matStepperNext>
Next step
<i class="fas fa-chevron-right"></i>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { MdmResourcesService } from '@mdm/modules/resources';
import { MessageHandlerService } from '@mdm/services/utility/message-handler.service';
import { UIRouterGlobals } from '@uirouter/core';
import { Title } from '@angular/platform-browser';
import { catchError } from 'rxjs/operators';
import { catchError, finalize } from 'rxjs/operators';
import { EMPTY } from 'rxjs';
import { CatalogueItemDomainType, Container, DataModelCreatePayload, DataModelDetailResponse, Uuid } from '@maurodatamapper/mdm-resources';
import { FolderService } from '@mdm/folders-tree/folder.service';
Expand All @@ -42,15 +42,14 @@ export class DataModelMainComponent implements OnInit {
parentFolderId: Uuid;
parentDomainType: CatalogueItemDomainType;
parentFolder: Container;

isSaving = false;
constructor(
private stateHandler: StateHandlerService,
private uiRouterGlobals: UIRouterGlobals,
private resources: MdmResourcesService,
private messageHandler: MessageHandlerService,
private folders: FolderService,
private title: Title) { }

ngOnInit() {
this.title.setTitle('New Data Model');

Expand Down Expand Up @@ -90,6 +89,7 @@ export class DataModelMainComponent implements OnInit {
};

save() {
this.isSaving = true;
const details = this.steps[0].compRef.instance as DataModelStep1Component;
const types = this.steps[1].compRef.instance as DataModelStep2Component;

Expand All @@ -116,6 +116,9 @@ export class DataModelMainComponent implements OnInit {
catchError(error => {
this.messageHandler.showError('There was a problem saving the Data Model.', error);
return EMPTY;
}),
finalize(() => {
this.isSaving = false;
}))
.subscribe((response: DataModelDetailResponse) => {
this.messageHandler.showSuccess('Data Model saved successfully.');
Expand Down