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 4ccff545714b764142131caa81dd000c8ec6ea64
Author: Andriana Kovalyshyn <andriana_kovalys...@epam.com>
AuthorDate: Tue Jun 25 17:16:08 2019 +0300

    [DLAB-652]: added check assignment to project; add inform dialog fading
---
 .../src/app/shared/navbar/navbar.component.html    |  3 +-
 .../src/app/shared/navbar/navbar.component.ts      | 43 +++++++++++++---------
 2 files changed, 27 insertions(+), 19 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
index b7eec53..10abf9c 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.html
@@ -35,8 +35,7 @@
     <a *ngIf="healthStatus.status" [routerLink]="['/environment_management']" 
class="statusbar">
       <span class="material-icons" ngClass="{{healthStatus.status || 
''}}">radio_button_checked</span>
     </a>
-    <!-- *ngIf="metadata" -->
-    <a class="statusbar" #info (click)="actions.toggle($event, info)">
+    <a class="statusbar" #info (click)="actions.toggle($event, info)" 
*ngIf="metadata">
       <span class="material-icons meta">info</span>
     </a>
     <bubble-up #actions class="list-menu" position="bottom-right">
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
index 18b8f0d..af6958d 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/shared/navbar/navbar.component.ts
@@ -70,6 +70,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
         
this.subscriptions.add(this.healthStatusService.statusData.subscribe(result => {
           this.healthStatus = result;
           result.status && this.checkQuoteUsed(this.healthStatus);
+          result.status && !result.projectAssigned && 
this.checkAssignment(this.healthStatus);
         }));
         this.subscriptions.add(timer(0, 
this.CHECK_ACTIVE_SCHEDULE_TIMEOUT).subscribe(() => 
this.refreshSchedulerData()));
         this.currentUserName = this.getUserName();
@@ -102,7 +103,7 @@ export class NavbarComponent implements OnInit, OnDestroy {
 
   public emitQuotes(alert, user_quota?, total_quota?): void {
     const dialogRef: MatDialogRef<NotificationDialogComponent> = 
this.dialog.open(NotificationDialogComponent, {
-      data: { template: this.selectQuotesAlert(alert, user_quota, 
total_quota), type: 'message' },
+      data: { template: this.selectAlert(alert, user_quota, total_quota), 
type: 'message' },
       width: '550px'
     });
     dialogRef.afterClosed().subscribe(() => {
@@ -124,22 +125,27 @@ export class NavbarComponent implements OnInit, OnDestroy 
{
     }
   }
 
+  private checkAssignment(params): void {
+    if (this.dialog.openDialogs.length > 0) return;
+    this.emitQuotes('permissions');
+  }
+
   private refreshSchedulerData(): void {
-      
this.schedulerService.getActiveSchcedulersData(this.CHECK_ACTIVE_SCHEDULE_PERIOD).subscribe((list:
 Array<any>) => {
-        if (list.length) {
-          if (this.dialog.openDialogs.length > 0) return;
-          const filteredData = this.groupSchedulerData(list);
-          this.dialog.open(NotificationDialogComponent, {
-            data: { template: filteredData, type: 'list' },
-            width: '550px'
-          });
-        }
+    
this.schedulerService.getActiveSchcedulersData(this.CHECK_ACTIVE_SCHEDULE_PERIOD).subscribe((list:
 Array<any>) => {
+      if (list.length) {
+        if (this.dialog.openDialogs.length > 0) return;
+        const filteredData = this.groupSchedulerData(list);
+        this.dialog.open(NotificationDialogComponent, {
+          data: { template: filteredData, type: 'list' },
+          width: '550px'
+        });
+      }
     });
   }
 
   private groupSchedulerData(sheduler_data) {
     const memo = { notebook: [], cluster: [] };
-    sheduler_data.map(item =>  !item.computational_name ? 
memo.notebook.push(item) : memo.cluster.push(item));
+    sheduler_data.map(item => !item.computational_name ? 
memo.notebook.push(item) : memo.cluster.push(item));
     memo.cluster = memo.cluster.filter(el => !memo.notebook.some(elm => 
el.exploratory_name === elm.exploratory_name));
     return memo;
   }
@@ -153,24 +159,27 @@ export class NavbarComponent implements OnInit, OnDestroy 
{
       });
   }
 
-  private selectQuotesAlert(type: string, user_quota?: number, total_quota?: 
number): string {
+  private selectAlert(type: string, user_quota?: number, total_quota?: 
number): string {
     const alerts = {
-      user_exceed: `Dear <b>${ this.currentUserName }</b>,<br />
+      user_exceed: `Dear <b>${this.currentUserName}</b>,<br />
           DLab cloud infrastructure usage quota associated with your user has 
been exceeded.
           All your analytical environment will be stopped. To proceed working 
with environment,
           request increase of user quota from DLab administrator.`,
-      total_exceed: `Dear <b>${ this.currentUserName }</b>,<br />
+      total_exceed: `Dear <b>${this.currentUserName}</b>,<br />
           DLab cloud infrastructure usage quota has been exceeded.
           All your analytical environment will be stopped. To proceed working 
with environment,
           request increase application quota from DLab administrator.`,
-      user_quota: `Dear <b>${ this.currentUserName }</b>,<br />
+      user_quota: `Dear <b>${this.currentUserName}</b>,<br />
           Cloud infrastructure usage quota associated with your user has been 
used for <b>${user_quota}%</b>.
           Once quota is depleted all your analytical environment will be 
stopped.
           To proceed working with environment you'll have to request increase 
of user quota from DLab administrator.`,
-      total_quota: `Dear <b>${ this.currentUserName }</b>,<br />
+      total_quota: `Dear <b>${this.currentUserName}</b>,<br />
           DLab cloud infrastructure usage quota has been used for 
<b>${total_quota}%</b>.
           Once quota is depleted all your analytical environment will be 
stopped.
-          To proceed working with environment you'll have to request increase 
of user quota from DLab administrator. `
+          To proceed working with environment you'll have to request increase 
of user quota from DLab administrator. `,
+      permissions: `Dear <b>${this.currentUserName}</b>,<br />
+          Currently, you are not assigned to any project. To start working 
with the environment
+          request permission from DLab administrator.`
     };
 
     return alerts[type];


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

Reply via email to