X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=src%2Fapp%2Fusers%2Fproject-role%2FProjectRoleComponent.ts;h=0c1121b722dfaa048e1cdb42e44184d12f9cf0ec;hb=refs%2Fchanges%2F14%2F14414%2F3;hp=600cecd6dceb61a5b98095a4f201973f04d68c03;hpb=42fe05d7cabccbb55bf79956d6a2ed861b14361a;p=osm%2FNG-UI.git diff --git a/src/app/users/project-role/ProjectRoleComponent.ts b/src/app/users/project-role/ProjectRoleComponent.ts index 600cecd..0c1121b 100644 --- a/src/app/users/project-role/ProjectRoleComponent.ts +++ b/src/app/users/project-role/ProjectRoleComponent.ts @@ -141,7 +141,6 @@ export class ProjectRoleComponent implements OnInit { /** Handle FormArray Controls @public */ public getControls(): AbstractControl[] { - // tslint:disable-next-line:no-backbone-get-set-outside-model return (this.projectRoleForm.get('project_role_mappings') as FormArray).controls; } @@ -185,7 +184,6 @@ export class ProjectRoleComponent implements OnInit { /** Set all roles and project values to the form @public */ public loadMapping(): void { this.userDetails.project_role_mappings.forEach((data: ProjectRoleMappings): void => { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.projectRoleFormArray = this.projectRoleForm.get('project_role_mappings') as FormArray; this.projectRoleFormArray.push(this.projectRoleParamsBuilder); }); @@ -212,6 +210,10 @@ export class ProjectRoleComponent implements OnInit { 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; @@ -229,7 +231,6 @@ export class ProjectRoleComponent implements OnInit { /** Add extra mapping and set empty project and roles @public */ public addMapping(): void { - // tslint:disable-next-line:no-backbone-get-set-outside-model this.projectRoleFormArray = this.projectRoleForm.get('project_role_mappings') as FormArray; this.projectRoleFormArray.push(this.projectRoleParamsBuilder); }