You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by an...@apache.org on 2019/06/04 10:56:54 UTC

[incubator-dlab] 01/02: [DLAB-741]: manage roles fixes

This is an automated email from the ASF dual-hosted git repository.

ankovalyshyn pushed a commit to branch feature/projects
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 72c4a8617f3d29439c1ed659afd722c318e54830
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Tue Jun 4 13:02:17 2019 +0300

    [DLAB-741]: manage roles fixes
---
 .../app/administration/roles/roles.component.html  |  1 -
 .../app/administration/roles/roles.component.scss  |  1 -
 .../app/administration/roles/roles.component.ts    | 47 ++++++++++------------
 3 files changed, 22 insertions(+), 27 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
index 0c91936..8ea280d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.html
@@ -48,7 +48,6 @@
       <ng-template matStepLabel>Roles</ng-template>
       <div class="inner-step mat-reset">
         <div class="selector-wrapper">
-          <!-- <multi-select-dropdown (selectionChange)="onUpdate($event)" [type]="'role'" [items]="rolesList" [model]="setupRoles"></multi-select-dropdown> -->
           <mat-form-field>
             <mat-select multiple [compareWith]="compareObjects" name="roles" [(value)]="setupRoles"
               placeholder="Select roles">
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss
index 4285e20..a7d1478 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.scss
@@ -36,7 +36,6 @@
   }
 }
 
-
 .content-box {
   padding: 20px 30px 35px;
   height: 85vh;
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
index b5dce66..16e5a67 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/roles/roles.component.ts
@@ -22,7 +22,7 @@ import { ValidatorFn, FormControl } from '@angular/forms';
 import { MatDialog, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material';
 import { ToastrService } from 'ngx-toastr';
 
-import { RolesGroupsService } from '../../core/services';
+import { RolesGroupsService, HealthStatusService } from '../../core/services';
 import { DICTIONARY } from '../../../dictionary/global.dictionary';
 
 @Component({
@@ -41,27 +41,36 @@ export class RolesComponent implements OnInit {
   public manageUser: string = '';
   public setupRoles: Array<string> = [];
   public updatedRoles: Array<string> = [];
+  public healthStatus: any;
   public delimitersRegex = /[-_]?/g;
   public groupnamePattern = new RegExp(/^[a-zA-Z0-9_\-]+$/);
-
+  
+  stepperView: boolean = false;
   displayedColumns: string[] = ['name', 'roles', 'users', 'actions'];
   @Output() manageRolesGroupAction: EventEmitter<{}> = new EventEmitter();
-  stepperView: boolean = false;
 
   constructor(
     public toastr: ToastrService,
     public dialog: MatDialog,
-    private rolesService: RolesGroupsService
+    private rolesService: RolesGroupsService,
+    private healthStatusService: HealthStatusService
   ) { }
 
   ngOnInit() {
-  this.openManageRolesDialog()
+  this.openManageRolesDialog();
+  this.getEnvironmentHealthStatus();
   }
 
   openManageRolesDialog() {
-    this.rolesService.getGroupsData().subscribe(group => {
+    this.rolesService.getGroupsData().subscribe(groups => {
       this.rolesService.getRolesData().subscribe(
-        roles => this.open(group, roles),
+        (roles: any) => {
+          this.roles = roles;
+          this.rolesList = roles.map(role => role.description);
+          this.updateGroupData(groups);
+      
+          this.stepperView = false;
+        },
         error => this.toastr.error(error.message, 'Oops!'));
     },
     error => this.toastr.error(error.message, 'Oops!'));
@@ -73,23 +82,6 @@ export class RolesComponent implements OnInit {
       error => this.toastr.error(error.message, 'Oops!'));
   }
 
-  public open(groups, roles): void {
-    this.roles = roles;
-    this.rolesList = roles.map(role => role.description);
-    this.updateGroupData(groups);
-
-    this.stepperView = false;
-  }
-
-  public onUpdate($event) {
-    if ($event.type === 'role') {
-      this.setupRoles = $event.model;
-    } else {
-      this.updatedRoles = $event.model;
-    }
-    $event.$event.preventDefault();
-  }
-
   public selectAllOptions(item, values, byKey?) {
     byKey ? (item[byKey] = values ? values : []) : this.setupRoles = values ? values : [];
   }
@@ -128,7 +120,7 @@ export class RolesComponent implements OnInit {
     this.resetDialog();
   }
 
-  manageRolesGroups($event) {
+  public manageRolesGroups($event) {
     switch ($event.action) {
       case 'create':
         this.rolesService.setupNewGroup($event.value).subscribe(res => {
@@ -215,6 +207,11 @@ export class RolesComponent implements OnInit {
       item.users instanceof Array ? item.users.push(value.trim()) : item.users = [value.trim()];
     }
   }
+
+  private getEnvironmentHealthStatus() {
+    this.healthStatusService.getEnvironmentHealthStatus()
+      .subscribe((result: any) => this.healthStatus = result);
+  }
 }
 
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@dlab.apache.org
For additional commands, e-mail: commits-help@dlab.apache.org