Merge pull request #1212 from apache/DATALAB-2441

[DATALAB-2441] removed gpu count with value 8 for all available instances/GPU type
diff --git a/services/self-service/src/main/resources/webapp/src/app/core/util/helpUtils.ts b/services/self-service/src/main/resources/webapp/src/app/core/util/helpUtils.ts
index edd51c9..68178d5 100644
--- a/services/self-service/src/main/resources/webapp/src/app/core/util/helpUtils.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/core/util/helpUtils.ts
@@ -35,24 +35,4 @@
         return;
     }
   }
-
-  public static setGPUCount(type, gpuType): Array<number> {
-    let count = [];
-    switch (type) {
-      case 'n1-highmem-32' || 'n1-highcpu-32':
-        count = [4, 8];
-        break;
-      case 'n1-highmem-16':
-        count = [2, 4, 8];
-        break;
-      default:
-        count = [1, 2, 4, 8];
-        break;
-    }
-    if (gpuType === 'nvidia-tesla-t4') {
-      count.pop();
-    }
-
-    return count;
-  }
 }
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
index aa8d00b..00c7a9c 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.html
@@ -171,7 +171,7 @@
                                 placeholder="Select master GPU type"
                                 [disabled]="!resourceForm.controls['shape_master'].value">
                       <mat-option *ngFor="let type of selectedImage.computationGPU"
-                                  [value]="type" (click)="setCount('master', type)">
+                                  [value]="type" >
                         {{ type }}
                       </mat-option>
                       <mat-option *ngIf="!selectedImage.computationGPU?.length" class="multiple-select ml-10" disabled>
@@ -196,10 +196,10 @@
                   <mat-form-field>
                     <mat-label>Select master GPU count</mat-label>
                     <mat-select formControlName="master_GPU_count" disableOptionCentering [disabled]="!resourceForm.controls['master_GPU_type'].value">
-                      <mat-option *ngFor="let type of masterGPUcount" [value]="type">
+                      <mat-option *ngFor="let type of gpuCount" [value]="type">
                         {{ type }}
                       </mat-option>
-                      <mat-option *ngIf="!masterGPUcount?.length" class="multiple-select ml-10" disabled>Master GPU counts list is empty</mat-option>
+                      <mat-option *ngIf="!gpuCount?.length" class="multiple-select ml-10" disabled>Master GPU counts list is empty</mat-option>
                     </mat-select>
                     <button class="caret">
                       <i class="material-icons">keyboard_arrow_down</i>
@@ -223,7 +223,7 @@
                   <mat-form-field>
                     <mat-label>Select slave GPU type</mat-label>
                     <mat-select formControlName="slave_GPU_type" disableOptionCentering [disabled]="!resourceForm.controls['shape_slave'].value">
-                      <mat-option *ngFor="let type of selectedImage.computationGPU" [value]="type" (click)="setCount('slave', type)">
+                      <mat-option *ngFor="let type of selectedImage.computationGPU" [value]="type">
                         {{ type }}
                       </mat-option>
                       <mat-option *ngIf="!selectedImage.computationGPU?.length" class="multiple-select ml-10" disabled>
@@ -250,10 +250,10 @@
                   <mat-form-field>
                     <mat-label>Select slave GPU сount</mat-label>
                     <mat-select formControlName="slave_GPU_count" disableOptionCentering [disabled]="!resourceForm.controls['slave_GPU_type'].value">
-                      <mat-option *ngFor="let type of slaveGPUcount" [value]="type">
+                      <mat-option *ngFor="let type of gpuCount" [value]="type">
                         {{ type }}
                       </mat-option>
-                      <mat-option *ngIf="!slaveGPUcount?.length" class="multiple-select ml-10" disabled>
+                      <mat-option *ngIf="!gpuCount?.length" class="multiple-select ml-10" disabled>
                         Slave GPU counts list is empty
                       </mat-option>
                     </mat-select>
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
index 76852a9..2d3fa9a 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/computational/computational-resource-create-dialog/computational-resource-create-dialog.component.ts
@@ -17,18 +17,17 @@
  * under the License.
  */
 
-import { Component, OnInit, ViewChild, Inject, ChangeDetectorRef } from '@angular/core';
-import {FormGroup, FormBuilder, Validators, FormControl} from '@angular/forms';
+import { Component, OnInit, Inject, ChangeDetectorRef } from '@angular/core';
+import {FormGroup, FormBuilder, Validators} from '@angular/forms';
 import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
 import { ToastrService } from 'ngx-toastr';
 
 import { ComputationalResourceModel } from './computational-resource-create.model';
 import { UserResourceService } from '../../../core/services';
-import {HTTP_STATUS_CODES, PATTERNS, CheckUtils, SortUtils, HelpUtils} from '../../../core/util';
+import {HTTP_STATUS_CODES, PATTERNS, CheckUtils, SortUtils} from '../../../core/util';
 
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { CLUSTER_CONFIGURATION } from './cluster-configuration-templates';
-import {Logger} from 'codelyzer/util/logger';
 
 @Component({
   selector: 'computational-resource-create-dialog',
@@ -59,8 +58,7 @@
   public minSpotPrice: number = 0;
   public maxSpotPrice: number = 0;
   public resourceForm: FormGroup;
-  public masterGPUcount: Array<number>;
-  public slaveGPUcount: Array<number>;
+  public gpuCount: Array<number> = [1, 2, 4];
   public isSelected = {
     preemptible: false,
     gpu: false,
@@ -355,17 +353,6 @@
     }
   }
 
-
-  public setCount(type: any, gpuType: any): void {
-    if (type === 'master') {
-      const masterShape = this.resourceForm.controls['shape_master'].value;
-      this.masterGPUcount = HelpUtils.setGPUCount(masterShape, gpuType);
-    } else {
-      const slaveShape = this.resourceForm.controls['shape_slave'].value;
-      this.slaveGPUcount = HelpUtils.setGPUCount(slaveShape, gpuType);
-    }
-  }
-
   public clearGpuType(type) {
     if (type === 'master') {
       this.resourceForm.controls['master_GPU_type'].setValue('');
diff --git a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
index 4d2703d..7399018 100644
--- a/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
+++ b/services/self-service/src/main/resources/webapp/src/app/resources/exploratory/create-environment/create-environment.component.ts
@@ -24,7 +24,7 @@
 
 import { Project } from '../../../administration/project/project.component';
 import { UserResourceService, ProjectService } from '../../../core/services';
-import {CheckUtils, SortUtils, HTTP_STATUS_CODES, PATTERNS, HelpUtils} from '../../../core/util';
+import {CheckUtils, SortUtils, HTTP_STATUS_CODES, PATTERNS} from '../../../core/util';
 import { DICTIONARY } from '../../../../dictionary/global.dictionary';
 import { CLUSTER_CONFIGURATION } from '../../computational/computational-resource-create-dialog/cluster-configuration-templates';
 import {tap} from 'rxjs/operators';
@@ -284,8 +284,7 @@
       this.createExploratoryForm.controls['gpu_count'].updateValueAndValidity();
     }
     // if (type === 'master') {
-      const masterShape = this.createExploratoryForm.controls['shape'].value;
-      this.gpuCount = HelpUtils.setGPUCount(masterShape, gpuType);
+      this.gpuCount = [1, 2, 4];
     // } else {
     //   const slaveShape = this.resourceForm.controls['shape_slave'].value;
     //   this.slaveGPUcount = HelpUtils.setGPUCount(slaveShape, gpuType);