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/05 14:14:43 UTC

[incubator-dlab] 01/09: [DLAB-747]: cleanup status and keys check from resources list

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 94851312f2308f0182f0f7e08e83babbfe70b370
Author: Andriana Kovalyshyn <An...@epam.com>
AuthorDate: Wed Jun 5 14:02:17 2019 +0300

    [DLAB-747]: cleanup status and keys check from resources list
---
 .../management-grid/management-grid.component.html | 138 ---------------------
 .../create-environment.component.html}             |   0
 .../create-environment.component.scss              |   0
 .../create-environment.component.ts}               |   4 +-
 .../index.ts                                       |   6 +-
 .../src/app/resources/resources.component.html     |  12 +-
 .../src/app/resources/resources.component.ts       |  57 ++-------
 .../webapp/src/app/resources/resources.module.ts   |   2 +-
 .../resources/webapp/src/assets/styles/_theme.scss |   2 +-
 9 files changed, 23 insertions(+), 198 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
index bd6efa4..5d68686 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.html
@@ -17,144 +17,6 @@
   ~ under the License.
   -->
 
-<!-- <table class="dashboard_table" *ngIf="isAdmin; else users">
-  <tr>
-    <th class="th_user">User</th>
-    <th class="th_name">Name</th>
-    <th class="th_status">Status</th>
-    <th class="th_shape">Shape / Resource id</th>
-    <th class="th_resources">Computational resources</th>
-    <th class="th_actions">Action</th>
-  </tr>
-
-  <tr *ngFor="let env of allEnvironmentData" class="dashboard_table_body">
-    <td>{{ env.user }}</td>
-    <td [ngClass]="{'capitalize': env.name === 'edge node'}">{{ env.name }}</td>
-    <td class="status" ngClass="{{env.status || ''}}">{{env.status}}</td>
-    <td>{{ env.shape || env.ip }}</td>
-    <td>
-      <div class="source" *ngIf="env.resources">
-        <div *ngIf="!env.resources?.length">
-          <span *ngIf="!env.resources.length" class="no-details">no details</span>
-        </div>
-        <div *ngIf="env.resources?.length">
-          <div *ngFor="let resource of env.resources" class="resource-wrap">
-            <div class="resource-name">
-              <a class="detailed-link">
-                {{ resource.computational_name }}
-              </a>
-            </div>
-            <span ngClass="{{resource.status || ''}}" class="resource-status">{{ resource.status }}</span>
-            <div class="resource-actions">
-              <a class="start-stop-action" *ngIf="resource.image === 'docker.dlab-dataengine'">
-                <i class="material-icons" (click)="toggleResourceAction(env, 'stop', resource)"
-                  [ngClass]="{'not-allowed' : resource.status !== 'running' || env.user.toLowerCase() === currentUser && healthStatus !== 'ok' }">pause_circle_outline</i>
-              </a>
-
-              <a class="remove_butt" (click)="toggleResourceAction(env, 'terminate', resource)"
-                [ngClass]="{ 'disabled' : env.status !== 'running' || resource.status !== 'running'
-                              && resource.status !== 'stopped' || env.user.toLowerCase() === currentUser && healthStatus !== 'ok' }">
-                <i class="material-icons">highlight_off</i>
-              </a>
-            </div>
-          </div>
-        </div>
-      </div>
-    </td>
-    <td class="settings">
-      <span #settings class="actions" (click)="actions.toggle($event, settings)" [ngClass]="{ 'disabled'
-            : (!uploadKey && env.type === 'notebook' && env.user.toLowerCase() === currentUser)
-            || (env.status !== 'running' && env.status !== 'stopped' && env.status !== 'stopping' && env.status !== 'failed' )
-            || (env.type === 'edge node' && env.user.toLowerCase() === currentUser && env.status === 'stopping')
-            || env.type === 'edge node' && env.user.toLowerCase() !== currentUser && env.status !== 'running'
-            || env.user.toLowerCase() === currentUser && healthStatus !== 'ok' && env.type !== 'edge node' }"></span>
-      <bubble-up #actions class="list-menu" position="bottom-left" alternative="top-left">
-        <ul class="list-unstyled">
-          <li
-            matTooltip="{{ env.type !== 'edge node' ? 'Unable to stop notebook because at least one computational resource is in progress' : 'Unable to stop edge node because at least one resource of this user is in progress' }}"
-            matTooltipPosition="above" [matTooltipDisabled]="!isResourcesInProgress(env)"
-            [hidden]="env.name === 'edge node' && env.status === 'stopped'">
-            <div (click)="toggleResourceAction(env, 'stop')"
-              [ngClass]="{'not-allowed' : env.status === 'stopped' || env.status === 'stopping' || env.status === 'starting' || env.status === 'creating image' || env.status === 'failed' || isResourcesInProgress(env)}">
-              <i class="material-icons">pause_circle_outline</i>
-              <span>Stop</span>
-            </div>
-          </li>
-          <li *ngIf="env.name !== 'edge node'"
-            matTooltip="Unable to terminate notebook because at least one computational resource is in progress"
-            matTooltipPosition="above" [matTooltipDisabled]="!isResourcesInProgress(env)">
-            <div (click)="toggleResourceAction(env, 'terminate')"
-              [ngClass]="{'not-allowed' : env.status !== 'running' && env.status !== 'stopped' || isResourcesInProgress(env)}">
-              <i class="material-icons">phonelink_off</i>
-              <span>Terminate</span>
-            </div>
-          </li>
-
-          <div *ngIf="env.name === 'edge node' && env.user.toLowerCase() === currentUser">
-            <li (click)="toggleResourceAction(env, 'run')" *ngIf="env.status === 'stopped'">
-              <i class="material-icons">play_circle_outline</i>
-              <span>Start</span>
-            </li>
-            <li (click)="toggleResourceAction(env, 'recreate')" *ngIf="env.status === 'terminated'">
-              <i class="material-icons">refresh</i>
-              <span>Recreate</span>
-            </li>
-            <li *ngIf="!isResourcesInProgress(env)" (click)="showReuploaKeydDialog()">
-              <i class="material-icons">sync_problem</i>
-              <span>Reupload key</span>
-            </li>
-          </div>
-        </ul>
-      </bubble-up>
-    </td>
-  </tr>
-</table>
-
-<ng-template #users>
-  <table class="dashboard_table">
-    <tr>
-      <th class="th_name">Type</th>
-      <th>Resource id</th>
-      <th class="th_status">Status</th>
-      <th class="th_actions">Action</th>
-    </tr>
-    <tr *ngFor="let env of environmentsHealthStatuses" class="dashboard_table_body">
-      <td>{{env.type}}</td>
-      <td>{{env.resource_id}}</td>
-      <td class="status" ngClass="{{env.status || ''}}">{{env.status}}</td>
-      <td class="settings">
-        <span #settings (click)="actions.toggle($event, settings)" class="actions" [ngClass]="{'disabled': env.status !== 'running'
-              && env.status !== 'stopped'
-              && env.status !== 'terminated'
-              || notebookInProgress
-              || !uploadKey && env.status !== 'failed' }">
-        </span>
-
-        <bubble-up #actions class="list-menu" position="bottom-left" alternative="top-left">
-          <ul class="list-unstyled">
-            <li (click)="toggleResourceAction(env, 'stop')" *ngIf="env.status === 'running'">
-              <i class="material-icons">pause_circle_outline</i>
-              <span>Stop</span>
-            </li>
-            <li (click)="toggleResourceAction(env, 'run')" *ngIf="env.status === 'stopped'">
-              <i class="material-icons">play_circle_outline</i>
-              <span>Start</span>
-            </li>
-            <li (click)="toggleResourceAction(env, 'recreate')" *ngIf="env.status === 'terminated'">
-              <i class="material-icons">refresh</i>
-              <span>Recreate</span>
-            </li>
-            <li *ngIf="!anyEnvInProgress" (click)="showReuploaKeydDialog()">
-              <i class="material-icons">sync_problem</i>
-              <span>Reupload key</span>
-            </li>
-          </ul>
-        </bubble-up>
-      </td>
-    </tr>
-  </table>
-</ng-template> -->
-
 <div class="ani">
   <table mat-table [dataSource]="allEnvironmentData" class="data-grid mat-elevation-z6">
     <ng-container matColumnDef="user">
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/exploratory-environment-create-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
similarity index 100%
rename from services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/exploratory-environment-create-dialog.component.html
rename to services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.html
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/create-environment.component.scss b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.scss
similarity index 100%
rename from services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/create-environment.component.scss
rename to services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.scss
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/exploratory-environment-create-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
similarity index 97%
rename from services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/exploratory-environment-create-dialog.component.ts
rename to services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
index 2b2f40b..e17dac4 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/exploratory-environment-create-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
@@ -29,8 +29,8 @@ import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { CLUSTER_CONFIGURATION } from '../../computational/computational-resource-create-dialog/cluster-configuration-templates';
 
 @Component({
-  selector: 'exploratory-environment-create-dialog',
-  templateUrl: 'exploratory-environment-create-dialog.component.html',
+  selector: 'create-environment',
+  templateUrl: 'create-environment.component.html',
   styleUrls: ['./create-environment.component.scss']
 })
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/index.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/index.ts
similarity index 87%
rename from services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/index.ts
rename to services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/index.ts
index 91e1ee4..9175d9c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/exploratory-environment-create-dialog/index.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/index.ts
@@ -23,8 +23,10 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 
 import { MaterialModule } from '../../../shared/material.module';
 import { FormControlsModule } from '../../../shared/form-controls';
-import { ExploratoryEnvironmentCreateComponent } from './exploratory-environment-create-dialog.component';
-import { KeysPipeModule, UnderscorelessPipeModule } from './../../../core/pipes';
+import { ExploratoryEnvironmentCreateComponent } from './create-environment.component';
+import { KeysPipeModule, UnderscorelessPipeModule } from '../../../core/pipes';
+
+export * from './create-environment.component';
 
 @NgModule({
   imports: [
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 dbaea83..be44a59 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
@@ -19,7 +19,7 @@
 
 <div class="sub-nav base-retreat">
   <div>
-    <button mat-raised-button class="butt butt-create" [disabled]="userUploadAccessKeyState == 202 || healthStatus?.status === 'error'" (click)="createNotebook_btnClick()">
+    <button mat-raised-button class="butt butt-create" (click)="createEnvironment()">
       <i class="material-icons">add</i>Create new
     </button>
   </div>
@@ -41,12 +41,4 @@
   </div>
 </div>
 
-<div *ngIf="userUploadAccessKeyState == 500" class="warning-alert base-retreat">
-  <span class="material-icons">priority_high</span>
-  Error happened during user access key upload. Please try to reupload the key.
-</div>
-
-<resources-grid></resources-grid>
-
-<!-- <exploratory-environment-create-dialog #createAnalyticalModal (buildGrid)="refreshGrid()"></exploratory-environment-create-dialog> -->
-<!-- <dlab-manage-ungit #manageUngitDialog></dlab-manage-ungit> -->
+<resources-grid></resources-grid>
\ No newline at end of file
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
index fd44bcf..f6725cf 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.component.ts
@@ -23,11 +23,10 @@ import { ToastrService } from 'ngx-toastr';
 import { MatDialog } from '@angular/material';
 
 import { ResourcesGridComponent } from './resources-grid/resources-grid.component';
-import { ExploratoryEnvironmentCreateComponent } from './exploratory/exploratory-environment-create-dialog/exploratory-environment-create-dialog.component';
+import { ExploratoryEnvironmentCreateComponent } from './exploratory/create-environment';
 import { ResourcesGridRowModel } from './resources-grid/resources-grid.model';
-import { UserAccessKeyService, HealthStatusService } from '../core/services';
+import { HealthStatusService } from '../core/services';
 import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
-import { HTTP_STATUS_CODES, FileUtils } from '../core/util';
 
 @Component({
   selector: 'dlab-resources',
@@ -35,52 +34,25 @@ import { HTTP_STATUS_CODES, FileUtils } from '../core/util';
   styleUrls: ['./resources.component.scss']
 })
 
-export class ResourcesComponent implements OnInit, OnDestroy {
-
-  public userUploadAccessKeyState: number;
+export class ResourcesComponent implements OnInit {
   public exploratoryEnvironments: Array<ResourcesGridRowModel> = [];
   public healthStatus: any;
 
-  @ViewChild('createAnalyticalModal') createAnalyticalModal;
-  // @ViewChild('manageUngitDialog') manageUngitDialog;
   @ViewChild(ResourcesGridComponent) resourcesGrid: ResourcesGridComponent;
 
-  subscriptions: Subscription = new Subscription();
-
   constructor(
     public toastr: ToastrService,
-    private userAccessKeyService: UserAccessKeyService,
     private healthStatusService: HealthStatusService,
     private dialog: MatDialog
-  ) {
-    this.userUploadAccessKeyState = HTTP_STATUS_CODES.NOT_FOUND;
-  }
+  ) { }
 
   ngOnInit() {
     this.getEnvironmentHealthStatus();
-    // this.createAnalyticalModal.resourceGrid = this.resourcesGrid;
-
-    this.subscriptions.add(this.userAccessKeyService.accessKeyEmitter.subscribe(response => {
-      if (response) this.userUploadAccessKeyState = response.status;
-    }));
-    this.subscriptions.add(this.userAccessKeyService.keyUploadProccessEmitter.subscribe(response => {
-      if (response) this.refreshGrid();
-    }));
   }
 
-  ngOnDestroy() {
-    this.subscriptions.unsubscribe();
-  }
-
-  public createNotebook_btnClick(): void {
-    if (this.userUploadAccessKeyState === HTTP_STATUS_CODES.OK) {
-      // if (!this.createAnalyticalModal.isOpened) this.createAnalyticalModal.open({ isFooter: false });
-
-      this.dialog.open(ExploratoryEnvironmentCreateComponent, { data: this.resourcesGrid, panelClass: 'modal-lg' })
-               .afterClosed().subscribe(() => this.refreshGrid());
-    } else {
-      this.userAccessKeyService.initialUserAccessKeyCheck();
-    }
+  public createEnvironment(): void {
+    this.dialog.open(ExploratoryEnvironmentCreateComponent, { data: this.resourcesGrid, panelClass: 'modal-lg' })
+      .afterClosed().subscribe(() => this.refreshGrid());
   }
 
   public refreshGrid(): void {
@@ -98,19 +70,16 @@ export class ResourcesComponent implements OnInit, OnDestroy {
   }
 
   public manageUngit(): void {
-    // if (!this.manageUngitDialog.isOpened)
-    //     this.manageUngitDialog.open({ isFooter: false });
-    this.dialog.open(ManageUngitComponent, {panelClass: 'modal-xxl'})
-               .afterClosed().subscribe(() => this.refreshGrid());
+    this.dialog.open(ManageUngitComponent, { panelClass: 'modal-xxl' })
+      .afterClosed().subscribe(() => this.refreshGrid());
   }
 
   private getEnvironmentHealthStatus() {
     this.healthStatusService.getEnvironmentHealthStatus().subscribe(
-        (result: any) => {
-          this.healthStatus = result;
-          this.resourcesGrid.healthStatus = this.healthStatus;
-          this.userAccessKeyService.initialUserAccessKeyCheck();
-        },
+      (result: any) => {
+        this.healthStatus = result;
+        this.resourcesGrid.healthStatus = this.healthStatus;
+      },
       error => this.toastr.error(error.message, 'Oops!'));
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
index 4c5f96b..9f3e25d 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/resources.module.ts
@@ -24,7 +24,7 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms';
 import { MaterialModule } from '../shared/material.module';
 import { ResourcesComponent } from './resources.component';
 import { ResourcesGridModule } from './resources-grid';
-import { ExploratoryEnvironmentCreateModule } from './exploratory/exploratory-environment-create-dialog';
+import { ExploratoryEnvironmentCreateModule } from './exploratory/create-environment';
 import { ManageUngitComponent } from './manage-ungit/manage-ungit.component';
 import { ConfirmDeleteAccountDialog } from './manage-ungit/manage-ungit.component';
 
diff --git a/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss b/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
index bd29aea..301f6ae 100644
--- a/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
+++ b/services/self-service/src/main/resources/webapp/src/assets/styles/_theme.scss
@@ -499,7 +499,7 @@ mat-horizontal-stepper {
   }
   .mat-cell {
     word-break: break-all;
-    vertical-align: initial;
+    vertical-align: top;
     padding: 10px 5px;
   }
 }


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