You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dlab.apache.org by dg...@apache.org on 2020/03/30 09:59:44 UTC

[incubator-dlab] branch DLAB-1571 updated: [DLAB-1591]: Update roles for admin per project

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

dgnatyshyn pushed a commit to branch DLAB-1571
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git


The following commit(s) were added to refs/heads/DLAB-1571 by this push:
     new d797b19  [DLAB-1591]: Update roles for admin per project
d797b19 is described below

commit d797b193283eea9f08e68b676dd6e46ef6c8d412
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Mon Mar 30 11:59:10 2020 +0300

    [DLAB-1591]: Update roles for admin per project
---
 .../administration/project/project.component.html  |  6 +++++-
 .../app/administration/roles/roles.component.html  | 24 ++++++++++++++++++----
 .../app/administration/roles/roles.component.scss  |  7 +++++++
 .../app/administration/roles/roles.component.ts    |  7 ++-----
 4 files changed, 34 insertions(+), 10 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
index aed7d1c..3be7a10 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project.component.html
@@ -20,7 +20,11 @@
 
 <div *ngIf="projectList" class="base-retreat">
   <div class="sub-nav">
-    <div>
+    <div
+      matTooltip="Only admin can create new project."
+      matTooltipPosition="above"
+      [matTooltipDisabled]="healthStatus?.admin"
+    >
       <button mat-raised-button class="butt butt-create" (click)="createProject()" [disabled]="!projectList.length || !healthStatus?.admin && healthStatus?.projectAdmin">
         <i class="material-icons">add</i>Create new
       </button>
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 d5496ac..87e27a2 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
@@ -19,8 +19,12 @@
 
 <div class="manage-roles base-retreat">
   <div class="sub-nav">
-    <div>
-      <button mat-raised-button class="butt add-group" (click)="stepperView = !stepperView">
+    <div matTooltip="Only admin can add group."
+         matTooltipPosition="above"
+         [matTooltipDisabled]="healthStatus?.admin"
+    >
+      <button mat-raised-button class="butt add-group" (click)="stepperView = !stepperView" [disabled]="!healthStatus?.admin"
+              >
         <i class="material-icons">people_outline</i>Add group
       </button>
     </div>
@@ -132,9 +136,21 @@
         <th mat-header-cell *matHeaderCellDef class="actions"></th>
         <td mat-cell *matCellDef="let element" class="actions">
           <div class="actions-wrapper">
-            <span (click)="manageAction('delete', 'group', element)" class="reset ani">
-              <mat-icon>delete_forever</mat-icon>
+            <span class="action-disabled"
+              matTooltip="Only admin can delete group."
+              matTooltipPosition="above"
+              [matTooltipDisabled]="healthStatus?.admin"
+            >
+              <span
+                (click)="manageAction('delete', 'group', element)"
+                class="reset ani"
+                [ngClass]="{ 'not-allowed' : !healthStatus?.admin}"
+
+              >
+              <mat-icon >delete_forever</mat-icon>
+            </span>
             </span>
+
             <span class="apply ani big-icon" matTooltip="Group cannot be updated without any selected role"
               matTooltipPosition="above" [matTooltipDisabled]="element.selected_roles.length > 0"
               [ngClass]="{ 'not-allowed' : !element.selected_roles.length || isGroupChanded(element)}"
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 66b1898..1167084 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
@@ -203,6 +203,7 @@
   }
 }
 
+
 .expanded-panel {
   display: flex;
   align-items: flex-end;
@@ -359,16 +360,22 @@ table {
     color: #607d8b;
     width: 10%;
     text-align: center;
+
     .actions-wrapper{
       height: 41px;
       display: flex;
       align-items: center;
       justify-content: flex-end;
     }
+
     span {
       transition: all .35s ease-in-out;
       cursor: pointer;
 
+      &.action-disabled{
+        cursor: not-allowed;
+      }
+
       .mat-icon {
         font-size: 18px;
         padding-top: 12px;
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 19ab0ed..e178d27 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
@@ -27,8 +27,6 @@ import { CheckUtils } from '../../core/util';
 import { DICTIONARY } from '../../../dictionary/global.dictionary';
 import {ProgressBarService} from '../../core/services/progress-bar.service';
 import {ConfirmationDialogComponent, ConfirmationDialogType} from '../../shared/modal-dialog/confirmation-dialog';
-import {logger} from 'codelyzer/util/logger';
-
 
 @Component({
   selector: 'dlab-roles',
@@ -65,7 +63,6 @@ export class RolesComponent implements OnInit {
 
   ngOnInit() {
     this.openManageRolesDialog();
-    this.getEnvironmentHealthStatus();
   }
 
   openManageRolesDialog() {
@@ -80,7 +77,7 @@ export class RolesComponent implements OnInit {
           this.rolesList = this.rolesList.sort((a, b) => (a.cloud > b.cloud) ? 1 : ((b.cloud > a.cloud) ? -1 : 0));
           this.rolesList = this.rolesList.sort((a, b) => (a.type > b.type) ? 1 : ((b.type > a.type) ? -1 : 0));
           this.updateGroupData(groups);
-
+          this.getEnvironmentHealthStatus();
           this.stepperView = false;
         },
         error => this.toastr.error(error.message, 'Oops!'));
@@ -307,4 +304,4 @@ export class ConfirmDeleteUserAccountDialogComponent {
     public dialogRef: MatDialogRef<ConfirmDeleteUserAccountDialogComponent>,
     @Inject(MAT_DIALOG_DATA) public data: any
   ) { }
-}
+};


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