if (this.osmrepoForm.invalid) {
return;
}
- this.isLoadingResults = true;
const modalData: MODALCLOSERESPONSEDATA = {
message: 'Done'
};
/** 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');
/** 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');
}
/** Edit project @public */
public editProject(): void {
+ if (!this.projectForm.dirty) {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.TOPOLOGY.DATAEMPTY'));
+ return;
+ }
this.isLoadingResults = true;
const apiURLHeader: APIURLHEADER = {
url: environment.PROJECTS_URL + '/' + this.projectRef
this.isLoadingResults = false;
this.projectService.setHeaderProjects();
this.notifierService.notify('success', this.translateService.instant('PAGE.PROJECT.UPDATEDSUCCESSFULLY'));
+ this.activeModal.close(this.modalData);
}, (error: ERRORDATA): void => {
this.restService.handleError(error, 'patch');
this.isLoadingResults = false;
/** Contains view selection value either text or preview @public */
public viewMode: string = 'text';
+ /** Contains current permissions data @private */
+ private currentPermissions: string;
+
+ /** Contains current role name @private */
+ private currentRoleName: string;
+
+ /** Contains modified role name @private */
+ private modifiedRoleName: string;
+
/** Contains role id value @private */
private roleRef: string;
this.notifierService.notify('success', this.translateService.instant('PAGE.ROLES.CREATEDSUCCESSFULLY'));
this.router.navigate(['/roles/details']).catch((): void => {
// Catch Navigation Error
- });
+ });
}, (error: ERRORDATA) => {
this.isLoadingResults = false;
this.restService.handleError(error, 'post');
url: environment.ROLES_URL + '/' + this.roleRef,
httpOptions: { headers: this.headers }
};
+ this.modifiedRoleName = this.roleForm.value.roleName;
let permissionData: Object = {};
this.sharedService.cleanForm(this.roleForm);
if (!this.roleForm.invalid) {
if (this.viewMode === 'preview') {
- this.isLoadingResults = true;
permissionData = this.generatePermissions();
this.roleEditAPI(apiURLHeader, permissionData);
} else {
if (this.checkPermission()) {
- this.isLoadingResults = true;
permissionData = this.roleForm.value.permissions !== '' ? JSON.parse(this.roleForm.value.permissions) : {};
this.roleEditAPI(apiURLHeader, permissionData);
}
/** Method to handle role edit API call */
public roleEditAPI(apiURLHeader: APIURLHEADER, permissionData: {}): void {
+ if ((JSON.stringify(permissionData, null, '\t') === this.currentPermissions) && (this.modifiedRoleName === this.currentRoleName)) {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.TOPOLOGY.DATAEMPTY'));
+ return;
+ }
+ this.isLoadingResults = true;
const postData: {} = {
name: this.roleForm.value.roleName,
permissions: !isNullOrUndefined(permissionData) ? permissionData : {}
this.notifierService.notify('success', this.translateService.instant('PAGE.ROLES.UPDATEDSUCCESSFULLY'));
this.router.navigate(['/roles/details']).catch((): void => {
// Catch Navigation Error
- });
+ });
}, (error: ERRORDATA) => {
this.isLoadingResults = false;
this.restService.handleError(error, 'patch');
this.roleForm.setValue({ roleName: data.name, permissions: JSON.stringify(data.permissions, null, '\t') });
this.filterRoleData(data.permissions);
this.isLoadingResults = false;
+ this.currentRoleName = data.name;
+ this.currentPermissions = JSON.stringify(data.permissions, null, '\t');
}, (error: ERRORDATA) => {
this.router.navigate(['/roles/details']).catch((): void => {
// Catch Navigation Error
- });
+ });
this.restService.handleError(error, 'get');
});
}
this.projectRoleMap.project_role_mappings.push({ project: res.project_name, role: res.role_name });
});
if (this.projectRoleMap.project_role_mappings.length !== 0) {
+ if (!this.projectRoleForm.dirty) {
+ this.notifierService.notify('warning', this.translateService.instant('PAGE.TOPOLOGY.DATAEMPTY'));
+ return;
+ }
this.isLoadingResults = true;
this.restService.patchResource(apiURLHeader, this.projectRoleMap).subscribe((result: {}): void => {
this.isLoadingResults = false;
/** Data @private */
private data: string = '';
+ /** Contains updated data @private */
+ private updateData: string;
+
/** contains http options @private */
private httpOptions: HttpHeaders;
/** 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);
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();
};
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.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');
}