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

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


The following commit(s) were added to refs/heads/develop by this push:
     new 5e03cd4  [DLAB-1647]: Action for notebook depend on edge node status. 
(#669)
5e03cd4 is described below

commit 5e03cd47a400519a21609205f756fac221dfc428
Author: Dmytro Gnatyshyn <[email protected]>
AuthorDate: Mon Mar 23 12:45:55 2020 +0200

    [DLAB-1647]: Action for notebook depend on edge node status. (#669)
---
 .../app/resources/resources-grid/resources-grid.component.html |  6 +++---
 .../app/resources/resources-grid/resources-grid.component.ts   | 10 +++++++++-
 .../webapp/src/app/resources/resources.component.html          |  2 +-
 3 files changed, 13 insertions(+), 5 deletions(-)

diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
index bfd1484..965f9d8 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.html
@@ -168,10 +168,10 @@
                     </div>
                   </li>
                   <li *ngIf="element.status.toLowerCase() === 'stopped' || 
element.status.toLowerCase() === 'stopping'"
-                    matTooltip="Unable to run notebook until it will be 
stopped" matTooltipPosition="above"
-                    [matTooltipDisabled]="!isResourcesInProgress(element) && 
element.status.toLowerCase() !== 'stopping'">
+                    matTooltip="{{isEdgeNodeStopped(element) ? 'Unable to run 
notebook if edge node is stopped.' : 'Unable to run notebook until it will be 
stopped.'}}" matTooltipPosition="above"
+                    [matTooltipDisabled]="!isResourcesInProgress(element) && 
element.status.toLowerCase() !== 'stopping' && !isEdgeNodeStopped(element)">
                     <div (click)="exploratoryAction(element, 'run')"
-                      [ngClass]="{'not-allowed': 
isResourcesInProgress(element) || element.status.toLowerCase() === 'stopping' 
}">
+                      [ngClass]="{'not-allowed': 
isResourcesInProgress(element) || element.status.toLowerCase() === 'stopping' 
|| isEdgeNodeStopped(element) }">
                       <i class="material-icons">play_circle_outline</i>
                       <span>Run</span>
                     </div>
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
index 977f302..3052d84 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources-grid/resources-grid.component.ts
@@ -18,7 +18,7 @@
  */
 /* tslint:disable:no-empty */
 
-import { Component, OnInit } from '@angular/core';
+import {Component, Input, OnInit} from '@angular/core';
 import { animate, state, style, transition, trigger } from 
'@angular/animations';
 import { ToastrService } from 'ngx-toastr';
 import { MatDialog } from '@angular/material/dialog';
@@ -62,6 +62,8 @@ import {NotebookModel} from '../exploratory/notebook.model';
 export class ResourcesGridComponent implements OnInit {
   readonly DICTIONARY = DICTIONARY;
 
+  @Input() projects: Array<any>;
+
   environments: Exploratory[];
 
   collapseFilterRow: boolean = false;
@@ -149,6 +151,12 @@ export class ResourcesGridComponent implements OnInit {
     return false;
   }
 
+  public isEdgeNodeStopped(resource) {
+    const currProject = this.projects.filter(proj => proj.name === 
resource.project);
+    const currEdgenodeStatus =  currProject[0].endpoints.filter(node => 
node.name === resource.endpoint)[0].status;
+    return currEdgenodeStatus === 'STOPPED' || currEdgenodeStatus === 
'STOPPING';
+  }
+
   public filterActiveInstances(): FilterConfigurationModel {
     return (<FilterConfigurationModel | any>Object).assign({}, 
this.filterConfiguration, {
       statuses: SortUtils.activeStatuses(),
diff --git 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
index b705c38..091ccb7 100644
--- 
a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
+++ 
b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.html
@@ -63,5 +63,5 @@
     </div>
   </div>
   <mat-divider></mat-divider>
-  <resources-grid></resources-grid>
+  <resources-grid [projects] = "projects"></resources-grid>
 </div>


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to