X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Fosm-repositories%2Fosm-repo-create-update%2FOsmRepoCreateUpdateComponent.ts;h=16ecadd496e895ee991a409d64b184cfd0a047e0;hb=382448fed3f9d4d4cf9ac614e1275208d18b752f;hp=e653e7ccb419b029177905a1c03d0985dcc74555;hpb=c6c72e359f949e7595f3e7594d5d811ee7fd9d39;p=osm%2FNG-UI.git diff --git a/src/app/osm-repositories/osm-repo-create-update/OsmRepoCreateUpdateComponent.ts b/src/app/osm-repositories/osm-repo-create-update/OsmRepoCreateUpdateComponent.ts index e653e7c..16ecadd 100644 --- a/src/app/osm-repositories/osm-repo-create-update/OsmRepoCreateUpdateComponent.ts +++ b/src/app/osm-repositories/osm-repo-create-update/OsmRepoCreateUpdateComponent.ts @@ -139,7 +139,6 @@ export class OsmRepoCreateUpdateComponent implements OnInit { if (this.osmrepoForm.invalid) { return; } - this.isLoadingResults = true; const modalData: MODALCLOSERESPONSEDATA = { message: 'Done' }; @@ -160,10 +159,11 @@ export class OsmRepoCreateUpdateComponent implements OnInit { /** This function used to add the osm repo @public */ public addOsmRepo(apiURLHeader: APIURLHEADER, modalData: MODALCLOSERESPONSEDATA): void { + this.isLoadingResults = true; this.restService.postResource(apiURLHeader, this.osmrepoForm.value).subscribe(() => { + this.isLoadingResults = false; this.activeModal.close(modalData); this.notifierService.notify('success', this.translateService.instant('PAGE.OSMREPO.CREATEDSUCCESSFULLY')); - this.isLoadingResults = false; }, (error: ERRORDATA) => { this.isLoadingResults = false; this.restService.handleError(error, 'post'); @@ -172,10 +172,15 @@ export class OsmRepoCreateUpdateComponent implements OnInit { /** This function used to Edit the osm repo @public */ public editOsmRepo(apiURLHeader: APIURLHEADER, modalData: MODALCLOSERESPONSEDATA): void { + if (!this.osmrepoForm.dirty) { + this.notifierService.notify('warning', this.translateService.instant('PAGE.TOPOLOGY.DATAEMPTY')); + return; + } + this.isLoadingResults = true; this.restService.patchResource(apiURLHeader, this.osmrepoForm.value).subscribe(() => { - this.activeModal.close(modalData); - this.notifierService.notify('success', this.translateService.instant('PAGE.OSMREPO.UPDATEDSUCCESSFULLY')); this.isLoadingResults = false; + this.notifierService.notify('success', this.translateService.instant('PAGE.OSMREPO.UPDATEDSUCCESSFULLY')); + this.activeModal.close(modalData); }, (error: ERRORDATA) => { this.isLoadingResults = false; this.restService.handleError(error, 'patch');