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/02/05 16:00:51 UTC

[incubator-dlab] 01/02: [DLAB-1509]: Removed actions from quota popup

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

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

commit 1f9f1185eabe0c54e47f7e64b271c11fc2e67fb7
Author: Dmytro Gnatyshyn <di...@ukr.net>
AuthorDate: Fri Jan 31 15:01:58 2020 +0200

    [DLAB-1509]: Removed actions from quota popup
---
 .../manage-environment-dilog.component.html        | 73 +++++++++++++---------
 .../manage-environment-dilog.component.scss        | 40 ++----------
 .../manage-environment-dilog.component.ts          | 14 ++---
 .../management-grid/management-grid.component.ts   |  6 +-
 .../management/management.component.ts             | 26 ++++----
 .../project/project-list/project-list.component.ts | 30 ++++-----
 .../resources/webapp/src/assets/styles/_theme.scss |  8 +--
 7 files changed, 87 insertions(+), 110 deletions(-)

diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
index d4380ba..ba8e6f7 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.html
@@ -30,7 +30,7 @@
             <mat-list-item class="list-header">
               <div class="username">Project</div>
               <div class="quotes">Limit</div>
-              <div class="action">Actions</div>
+<!--              <div class="action">Actions</div>-->
             </mat-list-item>
             <div class="scrolling-content" id="scrolling" formArrayName="projects">
               <mat-list-item *ngFor="let item of usersEnvironments.controls; let i=index" [formGroupName]="i"
@@ -48,41 +48,52 @@
                     *ngIf="manageUsersForm?.controls['projects']['controls'][i].controls['budget'].hasError('overrun')">Per-user
                     quotes cannot be greater than total budget</span>
                 </div>
-                <div class="action">
-                  <span
-                    *ngIf="manageUsersForm?.controls['projects']['controls'][i].controls['canBeStopped'].value; else not_allowed_stop"
-                    matTooltip="Stop" matTooltipPosition="above" (click)="applyAction('stop', item)">
-                    <i class="material-icons">pause_circle_outline</i>
-                  </span>
-                  <ng-template #not_allowed_stop>
-                    <span matTooltip="Unable to stop project because all resources are already stopped'"
-                      matTooltipPosition="above" class="not-active">
-                      <i class="material-icons">pause_circle_outline</i>
-                    </span>
-                  </ng-template>
+<!--                <div class="action">-->
+<!--                  <span-->
+<!--                    *ngIf="manageUsersForm?.controls['projects']['controls'][i].controls['canBeStopped'].value; else not_allowed_stop"-->
+<!--                    matTooltip="Stop" matTooltipPosition="above" (click)="applyAction('stop', item)">-->
+<!--                    <i class="material-icons">pause_circle_outline</i>-->
+<!--                  </span>-->
+<!--                  <ng-template #not_allowed_stop>-->
+<!--                    <span matTooltip="Unable to stop project because all resources are already stopped'"-->
+<!--                      matTooltipPosition="above" class="not-active">-->
+<!--                      <i class="material-icons">pause_circle_outline</i>-->
+<!--                    </span>-->
+<!--                  </ng-template>-->
 
-                  <span
-                    *ngIf="manageUsersForm?.controls['projects']['controls'][i].controls['canBeTerminated'].value; else not_allowed_terminate"
-                    matTooltip="Terminate" matTooltipPosition="above" (click)="applyAction('terminate', item)">
-                    <i class="material-icons">phonelink_off</i>
-                  </span>
-                  <ng-template #not_allowed_terminate>
-                    <span matTooltip="Unable to terminate project because all resources are already terminated"
-                      matTooltipPosition="above" class="not-active">
-                      <i class="material-icons">phonelink_off</i>
-                    </span>
-                  </ng-template>
+<!--                  <span-->
+<!--                    *ngIf="manageUsersForm?.controls['projects']['controls'][i].controls['canBeTerminated'].value; else not_allowed_terminate"-->
+<!--                    matTooltip="Terminate" matTooltipPosition="above" (click)="applyAction('terminate', item)">-->
+<!--                    <i class="material-icons">phonelink_off</i>-->
+<!--                  </span>-->
+<!--                  <ng-template #not_allowed_terminate>-->
+<!--                    <span matTooltip="Unable to terminate project because all resources are already terminated"-->
+<!--                      matTooltipPosition="above" class="not-active">-->
+<!--                      <i class="material-icons">phonelink_off</i>-->
+<!--                    </span>-->
+<!--                  </ng-template>-->
 
-                </div>
+<!--                </div>-->
               </mat-list-item>
             </div>
             <div class="control-group total-budget">
-              <label class="label">Total budget</label>
-              <div class="control">
-                <input type="number" (keypress)="CheckUtils.numberOnly($event)" formControlName="total"
-                  placeholder="Enter total budget, in USD">
-                <span class="error" *ngIf="manageUsersForm?.controls['total'].hasError('overrun')">Total budget cannot be lower than a sum of users quotes</span>
-              </div>
+
+              <mat-list-item class="list-item">
+                <div class="username ellipsis">
+                  <span class="ellipsis">Total budget</span>
+                </div>
+                <div class="quotes">
+                  <input type="number" (keypress)="CheckUtils.numberOnly($event)" formControlName="total"
+                         placeholder="Enter total budget, in USD">
+                  <span class="error" *ngIf="manageUsersForm?.controls['total'].hasError('overrun')">Total budget cannot be lower than a sum of users quotes</span>
+                </div>
+<!--              <label class="username">Total budget</label>-->
+<!--              <div class="quotes">-->
+<!--                <input type="number" (keypress)="CheckUtils.numberOnly($event)" formControlName="total"-->
+<!--                  placeholder="Enter total budget, in USD">-->
+<!--                <span class="error" *ngIf="manageUsersForm?.controls['total'].hasError('overrun')">Total budget cannot be lower than a sum of users quotes</span>-->
+<!--              </div>-->
+              </mat-list-item>
             </div>
             <div class="text-center m-top-30">
               <button mat-raised-button type="button" (click)="dialogRef.close()" class="butt action">Cancel</button>
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.scss b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.scss
index a034d8f..0245506 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.scss
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.scss
@@ -43,7 +43,7 @@
   }
 
   .quotes {
-    width: 40%;
+    width: 55%;
     margin-right: 10px;
     position: relative;
 
@@ -55,46 +55,14 @@
     }
   }
 
-  .action {
-    width: 15%;
-
-    span {
-      padding: 3px;
-      cursor: pointer;
-
-      &:hover {
-        color: #35afd5;
-      }
-
-      &.not-active {
-        &:hover {
-          color: #6b8299;
-        }
-      }
-
-      i {
-        font-size: 20px;
-      }
-    }
-
-    .disabled {
-      cursor: not-allowed !important;
-      pointer-events: all;
-      opacity: .6;
-
-      &:hover {
-        color: #6b8299;
-      }
-    }
-  }
-
   .total-budget {
     border-top: 1px solid #edf1f5;
     padding-top: 15px;
 
     .control {
       position: relative;
-      width: 56%;
+      width: 45%;
+      margin-right: 10px;
 
       .error {
         position: absolute;
@@ -104,7 +72,7 @@
     }
 
     .label {
-      width: 44%;
+      width: 55%;
     }
   }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
index c9bc231..a3ae8d2 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/manage-environment/manage-environment-dilog.component.ts
@@ -49,19 +49,19 @@ export class ManageEnvironmentComponent implements OnInit {
     !this.manageUsersForm && this.initForm();
     this.setProjectsControl();
     this.manageUsersForm.controls['total'].setValue(this.data.total.conf_max_budget || '');
-    this.onFormChange()
+    this.onFormChange();
   }
 
   public onFormChange() {
     this.manageUsersForm.valueChanges.subscribe(value => {
-      if((this.getCurrentTotalValue() && this.getCurrentTotalValue() >= this.getCurrentUsersTotal())) {
+      if ((this.getCurrentTotalValue() && this.getCurrentTotalValue() >= this.getCurrentUsersTotal())) {
         this.manageUsersForm.controls['projects']['controls'].forEach(v => {
             v.controls['budget'].setErrors(null);
         }
         );
-        this.manageUsersForm.controls['total'].setErrors(null)
+        this.manageUsersForm.controls['total'].setErrors(null);
       }
-    })
+    });
   }
 
   get usersEnvironments(): FormArray {
@@ -69,10 +69,10 @@ export class ManageEnvironmentComponent implements OnInit {
   }
 
   public setBudgetLimits(value) {
-    if(this.getCurrentTotalValue() >= this.getCurrentUsersTotal()){
+    if (this.getCurrentTotalValue() >= this.getCurrentUsersTotal()) {
       this.dialogRef.close(value);
-    }else{
-      this.manageUsersForm.controls['total'].setErrors({ overrun: true })
+    } else {
+      this.manageUsersForm.controls['total'].setErrors({ overrun: true });
     }
   }
 
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
index f13f0b5..216d79c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management-grid/management-grid.component.ts
@@ -27,7 +27,7 @@ import { ConfirmationDialogType } from '../../../shared';
 import { ConfirmationDialogComponent } from '../../../shared/modal-dialog/confirmation-dialog';
 import { EnvironmentsDataService } from '../management-data.service';
 import { EnvironmentModel, ManagementConfigModel } from '../management.model';
-import {ProgressBarService} from "../../../core/services/progress-bar.service";
+import {ProgressBarService} from '../../../core/services/progress-bar.service';
 
 export interface ManageAction {
   action: string;
@@ -72,11 +72,11 @@ export class ManagementGridComponent implements OnInit {
   ) { }
 
   ngOnInit() {
-  this.getEnvironmentData()
+  this.getEnvironmentData();
   }
 
   getEnvironmentData() {
-    setTimeout(() => {this.progressBarService.startProgressBar()} , 0);
+    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
     this.environmentsDataService._data.subscribe(data => {
       if (data) {
         this.allEnvironmentData = EnvironmentModel.loadEnvironments(data);
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
index 0449e08..da2122b 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/management/management.component.ts
@@ -97,8 +97,8 @@ export class ManagementComponent implements OnInit {
   openManageEnvironmentDialog() {
     this.projectService.getProjectsManagingList().subscribe(projectsList => {
       this.getTotalBudgetData().subscribe(total => {
-        this.dialogRef = this.dialog.open(ManageEnvironmentComponent, { data: { projectsList, total }, panelClass: 'modal-xl-s' });
-        this.dialogRef.componentInstance.manageEnv.subscribe((data) => this.manageEnvironment(data));
+        this.dialogRef = this.dialog.open(ManageEnvironmentComponent, { data: { projectsList, total }, panelClass: 'modal-sm' });
+        // this.dialogRef.componentInstance.manageEnv.subscribe((data) => this.manageEnvironment(data));
         this.dialogRef.afterClosed().subscribe(result => result && this.setBudgetLimits(result));
       }, () => this.toastr.error('Failed users list loading!', 'Oops!'));
     });
@@ -126,23 +126,23 @@ export class ManagementComponent implements OnInit {
     }, error => this.toastr.error(error.message, 'Oops!'));
   }
 
-  manageEnvironment(event: { action: string, project: any }) {
-    if (event.action === 'stop')
-      this.projectService.stopProjectAction(event.project.project_name)
-        .subscribe(() => this.handleSuccessAction(event.action), error => this.toastr.error(error.message, 'Oops!'));
-
-    if (event.action === 'terminate')
-      this.projectService.deleteProject(event.project.project_name)
-        .subscribe(() => this.handleSuccessAction(event.action), error => this.toastr.error(error.message, 'Oops!'));
-  }
+  // manageEnvironment(event: { action: string, project: any }) {
+  //   if (event.action === 'stop')
+  //     this.projectService.stopProjectAction(event.project.project_name)
+  //       .subscribe(() => this.handleSuccessAction(event.action), error => this.toastr.error(error.message, 'Oops!'));
+  //
+  //   if (event.action === 'terminate')
+  //     this.projectService.deleteProject(event.project.project_name)
+  //       .subscribe(() => this.handleSuccessAction(event.action), error => this.toastr.error(error.message, 'Oops!'));
+  // }
 
   handleSuccessAction(action) {
     this.toastr.success(`Action ${action} is processing!`, 'Processing!');
     this.projectService.getProjectsManagingList().subscribe(data => {
-      this.dialogRef.componentInstance.data.projectsList = data
+      this.dialogRef.componentInstance.data.projectsList = data;
       this.dialogRef.componentInstance.setProjectsControl();
     });
-    this.buildGrid()
+    this.buildGrid();
   }
 
   get creatingBackup(): boolean {
diff --git a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
index b57dd29..2ec9501 100644
--- a/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/administration/project/project-list/project-list.component.ts
@@ -26,9 +26,9 @@ import { MatDialogRef, MAT_DIALOG_DATA, MatDialog } from '@angular/material/dial
 import { ProjectDataService } from '../project-data.service';
 import { Project, Endpoint } from '../project.component';
 import { CheckUtils } from '../../../core/util';
-import {ProgressBarService} from "../../../core/services/progress-bar.service";
-import {EdgeActionDialogComponent} from "../../../shared/modal-dialog/edge-action-dialog";
-import {EndpointService} from "../../../core/services";
+import {ProgressBarService} from '../../../core/services/progress-bar.service';
+import {EdgeActionDialogComponent} from '../../../shared/modal-dialog/edge-action-dialog';
+import {EndpointService} from '../../../core/services';
 
 @Component({
   selector: 'project-list',
@@ -65,8 +65,8 @@ export class ProjectListComponent implements OnInit, OnDestroy {
     this.subscriptions.unsubscribe();
   }
 
-  private getProjectList(){
-    setTimeout(() => {this.progressBarService.startProgressBar()} , 0);
+  private getProjectList() {
+    setTimeout(() => {this.progressBarService.startProgressBar(); } , 0);
     this.subscriptions.add(this.projectDataService._projects.subscribe((value: Project[]) => {
       this.projectList = value;
       if (value) this.dataSource = new MatTableDataSource(value);
@@ -97,7 +97,7 @@ export class ProjectListComponent implements OnInit, OnDestroy {
 
   public isInProgress(project) {
     if (project)
-      return project.endpoints.some(e => e.status !== 'RUNNING' && e.status !== 'STOPPED' && e.status !== 'TERMINATED' && e.status !== 'FAILED')
+      return project.endpoints.some(e => e.status !== 'RUNNING' && e.status !== 'STOPPED' && e.status !== 'TERMINATED' && e.status !== 'FAILED');
   }
 
   public isActiveEndpoint(project) {
@@ -111,19 +111,19 @@ export class ProjectListComponent implements OnInit, OnDestroy {
 
   public openEdgeDialog(action, project) {
       const endpoints = project.endpoints.filter(endpoint => {
-        if(action === "stop"){
-          return endpoint.status == 'RUNNING'
+        if (action === 'stop') {
+          return endpoint.status === 'RUNNING';
         }
-        if(action === "start"){
-          return endpoint.status == 'STOPPED'
+        if (action === 'start') {
+          return endpoint.status === 'STOPPED';
         }
-        if(action === "terminate"){
-          return endpoint.status == 'RUNNING' || endpoint.status == 'STOPPED'
+        if (action === 'terminate') {
+          return endpoint.status === 'RUNNING' || endpoint.status === 'STOPPED';
         }
       });
       this.dialog.open(EdgeActionDialogComponent, {data: {type: action, item: endpoints}, panelClass: 'modal-sm'})
         .afterClosed().subscribe(endpoint => {
-        if(endpoint && endpoint.length){
+        if (endpoint && endpoint.length) {
         this.toggleStatus.emit({project, endpoint, action});
         }
       }, error => this.toastr.error(error.message || `Endpoint ${action} failed!`, 'Oops!')
@@ -131,10 +131,10 @@ export class ProjectListComponent implements OnInit, OnDestroy {
     }
 
   public areStartedEndpoints(project) {
-    return project.endpoints.filter(endpoint => endpoint.status == 'RUNNING').length > 0;
+    return project.endpoints.filter(endpoint => endpoint.status === 'RUNNING').length > 0;
   }
 
   public areStoppedEndpoints(project) {
-    return project.endpoints.filter(endpoint => endpoint.status == 'STOPPED').length > 0;
+    return project.endpoints.filter(endpoint => endpoint.status === 'STOPPED').length > 0;
   }
 }
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 7ac6252..abf72ad 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
@@ -301,7 +301,7 @@ span.mat-slide-toggle-content {
 
 .project-form,
 .create-environment{
-  .ng-invalid{
+  .mat-select:not(.ng-pristine){
     .mat-form-field-label {
       line-height: 22px !important;
       font-size: 15px !important;
@@ -316,18 +316,16 @@ span.mat-slide-toggle-content {
 .project-form,
 .create-environment,
 .create-cluster{
-
-
   .mat-select-value{
     overflow: visible;
   }
 }
 
 .create-cluster {
-  .ng-invalid {
+  .mat-select:not(.ng-pristine) {
     .mat-form-field-label {
       padding-top: 5px;
-      line-height: 16px !important;
+      line-height: 55px !important;
       font-size: 15px !important;
     }
   }


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