X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FNG-UI.git;a=blobdiff_plain;f=src%2Fapp%2Futilities%2Fedit-packages%2FEditPackagesComponent.ts;fp=src%2Fapp%2Futilities%2Fedit-packages%2FEditPackagesComponent.ts;h=3cf75c918312c44939b8bd98140f70dbf933b468;hp=42998b8fff13d64bc8ce7f6aa435ac48faca98df;hb=382448fed3f9d4d4cf9ac614e1275208d18b752f;hpb=c6c72e359f949e7595f3e7594d5d811ee7fd9d39 diff --git a/src/app/utilities/edit-packages/EditPackagesComponent.ts b/src/app/utilities/edit-packages/EditPackagesComponent.ts index 42998b8..3cf75c9 100644 --- a/src/app/utilities/edit-packages/EditPackagesComponent.ts +++ b/src/app/utilities/edit-packages/EditPackagesComponent.ts @@ -141,6 +141,9 @@ export class EditPackagesComponent implements OnInit { /** Data @private */ private data: string = ''; + /** Contains updated data @private */ + private updateData: string; + /** contains http options @private */ private httpOptions: HttpHeaders; @@ -239,7 +242,7 @@ export class EditPackagesComponent implements OnInit { /** Update function @public */ public update(showgraph: boolean): void { - if (this.data === '') { + if (this.data === '' || this.data === this.updateData) { this.notifierService.notify('warning', this.translateService.instant('PAGE.TOPOLOGY.DATAEMPTY')); } else { this.updateCheck(showgraph); @@ -255,11 +258,11 @@ export class EditPackagesComponent implements OnInit { if (packageType === 'nsd') { this.router.navigate(['/packages/ns/compose/' + this.paramsID]).catch((): void => { // Catch Navigation Error - }); + }); } else if (packageType === 'vnf') { this.router.navigate(['/packages/vnf/compose/' + this.paramsID]).catch((): void => { // Catch Navigation Error - }); + }); } } this.getEditFileData(); @@ -277,10 +280,11 @@ export class EditPackagesComponent implements OnInit { }; let descriptorInfo: string = ''; if (this.mode === 'text/json') { - descriptorInfo = jsyaml.dump(JSON.parse(this.data), {sortKeys: true}); + descriptorInfo = jsyaml.dump(JSON.parse(this.data), { sortKeys: true }); } else { descriptorInfo = this.data; } + this.updateData = this.data; if (this.getFileContentType !== 'nst') { this.sharedService.targzFile({ packageType: this.pacakgeType, id: this.paramsID, descriptor: descriptorInfo }) .then((content: ArrayBuffer): void => { @@ -309,10 +313,10 @@ export class EditPackagesComponent implements OnInit { this.isLoadingResults = false; }, (error: ERRORDATA) => { error.error = typeof error.error === 'string' ? jsyaml.load(error.error) : error.error; - if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED ) { + if (error.error.status === HttpStatus.NOT_FOUND || error.error.status === HttpStatus.UNAUTHORIZED) { this.router.navigateByUrl('404', { skipLocationChange: true }).catch((): void => { // Catch Navigation Error - }); + }); } else { this.restService.handleError(error, 'get'); }