This is an automated email from the ASF dual-hosted git repository. ytykhun pushed a commit to branch DATALAB-2490 in repository https://gitbox.apache.org/repos/asf/incubator-datalab.git
commit f879e508c1cb1ddbf3f6000cfcb47fa5c0b805ce Author: Yurii Tykhun <[email protected]> AuthorDate: Tue Jul 6 11:02:11 2021 +0300 [DATALAB-2490] added t-shirt sizes for dataproc and apache standalone cluster --- .../resources/webapp/src/app/core/util/helpUtils.ts | 17 +++++++++++++++-- .../computational-resource-create-dialog.component.html | 8 ++++---- .../computational-resource-create-dialog.component.ts | 4 +++- .../create-environment/create-environment.component.ts | 14 +------------- 4 files changed, 23 insertions(+), 20 deletions(-) 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 1ebed41..e078fde 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 @@ -36,10 +36,23 @@ export class HelpUtils { } } - public static sortGpuTypes(gpuType: Array<string>): Array<string> { + public static addSizeToGpuType(gpuType: string = ''): string { + switch (gpuType) { + case 'nvidia-tesla-t4': + return 'S'; + + case 'nvidia-tesla-p100': + return 'M'; + + case 'nvidia-tesla-v100': + return 'L'; + } + } + + public static sortGpuTypes(gpuType: Array<string> = []): Array<string> { let sortedTypes = []; - gpuType.forEach(type => checkType(type)); + gpuType?.forEach(type => checkType(type)); function checkType(type) { switch (type) { 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 00c7a9c..461c6ad 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 @@ -170,9 +170,9 @@ <mat-select formControlName="master_GPU_type" disableOptionCentering placeholder="Select master GPU type" [disabled]="!resourceForm.controls['shape_master'].value"> - <mat-option *ngFor="let type of selectedImage.computationGPU" + <mat-option *ngFor="let type of sortGpuTypes(selectedImage.computationGPU)" [value]="type" > - {{ type }} + <strong class="highlight icon-label">{{ addSizeToGpuType(type) }}</strong> {{ type }} </mat-option> <mat-option *ngIf="!selectedImage.computationGPU?.length" class="multiple-select ml-10" disabled> Master GPU types list is empty @@ -223,8 +223,8 @@ <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"> - {{ type }} + <mat-option *ngFor="let type of sortGpuTypes(selectedImage.computationGPU)" [value]="type"> + <strong class="highlight icon-label">{{ addSizeToGpuType(type) }}</strong> {{ type }} </mat-option> <mat-option *ngIf="!selectedImage.computationGPU?.length" class="multiple-select ml-10" disabled> Slave GPU types list is empty 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 2d3fa9a..714eb92 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 @@ -24,7 +24,7 @@ import { ToastrService } from 'ngx-toastr'; import { ComputationalResourceModel } from './computational-resource-create.model'; import { UserResourceService } from '../../../core/services'; -import {HTTP_STATUS_CODES, PATTERNS, CheckUtils, SortUtils} from '../../../core/util'; +import {HTTP_STATUS_CODES, PATTERNS, CheckUtils, SortUtils, HelpUtils} from '../../../core/util'; import { DICTIONARY } from '../../../../dictionary/global.dictionary'; import { CLUSTER_CONFIGURATION } from './cluster-configuration-templates'; @@ -65,6 +65,8 @@ export class ComputationalResourceCreateDialogComponent implements OnInit { spotInstances: false, configuration: false, }; + public sortGpuTypes = HelpUtils.sortGpuTypes; + public addSizeToGpuType = HelpUtils.addSizeToGpuType; constructor( @Inject(MAT_DIALOG_DATA) public data: any, 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 7e4a90e..4468a18 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 @@ -54,6 +54,7 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit { public selectedCloud: string = ''; public gpuCount: Array<number>; public gpuTypes: Array<string> = []; + public addSizeToGpuType = HelpUtils.addSizeToGpuType; public additionalParams = { configurationNode: false, @@ -150,19 +151,6 @@ export class ExploratoryEnvironmentCreateComponent implements OnInit { } - public addSizeToGpuType(gpuType: string): string { - switch (gpuType) { - case 'nvidia-tesla-t4': - return 'S'; - - case 'nvidia-tesla-p100': - return 'M'; - - case 'nvidia-tesla-v100': - return 'L'; - } - } - public getShapes(template) { this.selectedImage = null; const controls = ['notebook_image_name', 'shape', 'gpu_type', 'gpu_count']; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
