/** options @public */
public options: {} = {
+ // eslint-disable-next-line no-invalid-this
mode: this.modeDefault,
showCursorWhenSelecting: true,
autofocus: true,
/** Data @private */
private data: string = '';
+ /** Contains updated data @private */
+ private updateData: string;
+
/** contains http options @private */
private httpOptions: HttpHeaders;
Accept: 'text/plain',
'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0'
});
- // tslint:disable-next-line: no-backbone-get-set-outside-model
this.paramsID = this.activatedRoute.snapshot.paramMap.get('id');
- // tslint:disable-next-line: no-backbone-get-set-outside-model
this.pacakgeType = this.activatedRoute.snapshot.paramMap.get('type');
this.generateURLPath();
}
this.updateFileContentType = 'package_content';
this.navigatePath = 'vnf';
this.fileTypes = [{ value: 'text/x-yaml', viewValue: 'yaml' }, { value: 'text/json', viewValue: 'json' }];
- this.httpOptions = this.getHeadersWithContentAccept('application/zip', 'application/json');
+ this.httpOptions = this.getHeadersWithContentAccept('application/gzip', 'application/json');
this.getEditFileData();
} else if (this.pacakgeType === 'netslice') {
this.getUpdateURL = environment.NETWORKSLICETEMPLATE_URL;
this.pacakgeType = 'nsd';
this.navigatePath = 'ns';
this.fileTypes = [{ value: 'text/x-yaml', viewValue: 'yaml' }, { value: 'text/json', viewValue: 'json' }];
- this.httpOptions = this.getHeadersWithContentAccept('application/zip', 'application/json');
+ this.httpOptions = this.getHeadersWithContentAccept('application/gzip', 'application/json');
this.getEditFileData();
}
}
/** 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);
(packageType !== 'netslice') ? 'PAGE.NSPACKAGE.EDITPACKAGES.UPDATEDSUCCESSFULLY' : 'PAGE.NETSLICE.UPDATEDSUCCESSFULLY'));
if (showgraph) {
if (packageType === 'nsd') {
- this.router.navigate(['/packages/ns/compose/' + this.paramsID]).catch();
+ 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();
+ this.router.navigate(['/packages/vnf/compose/' + this.paramsID]).catch((): void => {
+ // Catch Navigation Error
+ });
}
}
this.getEditFileData();
};
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 => {
this.restService.getResource(this.getUpdateURL + '/' + this.paramsID + '/' + this.getFileContentType, httpOptions)
.subscribe((nsData: NSDDetails[]) => {
const getJson: string = jsyaml.load(nsData.toString(), { json: true });
- //tslint:disable-next-line:no-string-literal
this.defaults['text/x-yaml'] = nsData.toString();
this.defaults['text/json'] = JSON.stringify(getJson, null, '\t');
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 ) {
- this.router.navigateByUrl('404', { skipLocationChange: true }).catch();
+ 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');
}