blob: dcf1c2518f165f1c5422de0a9ed58d49bc15da6c [file] [log] [blame]
<!--
~ Licensed to the Apache Software Foundation (ASF) under one
~ or more contributor license agreements. See the NOTICE file
~ distributed with this work for additional information
~ regarding copyright ownership. The ASF licenses this file
~ to you under the Apache License, Version 2.0 (the
~ "License"); you may not use this file except in compliance
~ with the License. You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<modal-dialog #bindDialog modalClass="create-cluster modal-xxl">
<modal-header>
<h4 class="modal-title">Add computational resources</h4>
</modal-header>
<modal-content>
<div class="content-box">
<form [formGroup]="resourceForm"
(submit)="createComputationalResource($event, resourceForm.value, shapes.master_shape, shapes.slave_shape)"
*ngIf="model.availableTemplates && resourceForm">
<div class="form-wrapper" [ngClass]="{ compress: model.selectedImage?.image === 'docker.dlab-dataengine' }">
<div class="col">
<div class="control-group" *ngIf="PROVIDER !== 'azure'" [hidden]="model.resourceImages.length === 1">
<label class="label">Select cluster type</label>
<div class="control">
<dropdown-list #clusterType (selectedItem)="onUpdate($event)"></dropdown-list>
</div>
<!-- <div class="mt-5" *ngIf="model.resourceImages">
<small *ngIf="model.selectedImage">{{ model.selectedImage.description }}</small>
</div> -->
</div>
<div class="control-group" *ngIf="PROVIDER !== 'azure'" [hidden]="!model.templates.length">
<label class="label">Select template</label>
<div class="control">
<dropdown-list #templatesList (selectedItem)="onUpdate($event)"></dropdown-list>
</div>
</div>
<div class="control-group alias-name" *ngIf="model.selectedImage?.image">
<label class="label">Cluster alias</label>
<div class="control">
<input [class.danger_field]="computationalResourceExist || !resourceForm?.controls['cluster_alias_name'].valid
&& resourceForm?.controls['cluster_alias_name'].dirty && resourceForm?.controls['cluster_alias_name'].hasError('duplication')"
type="text" class="form-control" placeholder="Enter cluster alias" formControlName="cluster_alias_name" />
<span class="danger_color" *ngIf="resourceForm?.controls['cluster_alias_name'].hasError('duplication')">This cluster name already exists.</span>
<span class="danger_color" *ngIf="!resourceForm?.controls.cluster_alias_name.valid
&& resourceForm?.controls['cluster_alias_name'].dirty
&& !resourceForm?.controls['cluster_alias_name'].hasError('duplication')">
Cluster name <span *ngIf="DICTIONARY.cloud_provider !== 'aws'">cannot be longer than 10 characters and</span> can only contain letters, numbers, hyphens and '_' but can not end with special characters
</span>
</div>
</div>
</div>
<div class="col">
<div class="control-group" *ngIf="model.selectedImage?.image">
<label class="label">{{ DICTIONARY[model.selectedImage.image].instance_number }}</label>
<div class="control">
<input type="number" class="form-control" min="{{minInstanceNumber}}" max="{{maxInstanceNumber}}"
formControlName="instance_number" (keypress)="CheckUtils.isNumberKey($event)" />
<span class="danger_color" *ngIf="!resourceForm?.controls.instance_number.valid">
<span>Only integer values greater than or equal to {{ minInstanceNumber }} and less than {{ maxInstanceNumber }} are allowed</span>
</span>
</div>
</div>
<div class="control-group" *ngIf="model.selectedImage?.image">
<label class="label" *ngIf="model.selectedImage">{{ DICTIONARY[model.selectedImage.image].data_engine_master_instance_size}}</label>
<div class="control">
<dropdown-list #masterShapesList (selectedItem)="onUpdate($event)"></dropdown-list>
</div>
</div>
<div class="control-group" *ngIf="model.selectedImage?.image" [hidden]="model.selectedImage?.image === 'docker.dlab-dataengine'">
<label class="label">{{ DICTIONARY[model.selectedImage.image].data_engine_slave_instance_size }}</label>
<div class="control">
<dropdown-list #shapesSlaveList (selectedItem)="onUpdate($event)"></dropdown-list>
</div>
</div>
</div>
</div>
<div class="preemptible checkbox-group control-group m-top-30 m-bott-10" *ngIf="PROVIDER === 'gcp' && model.selectedImage?.image === 'docker.dlab-dataengine-service'">
<label class="label">
<input #preemptibleNode type="checkbox" (change)="selectPreemptibleNodes($event)" />
<span>Preemptible node</span>
<span class="align" *ngIf="preemptible?.nativeElement['checked'] || false"> count</span>
</label>
<div *ngIf="preemptible?.nativeElement['checked']"
class="preemptible-details control"
[ngClass]="{ show: preemptible?.nativeElement['checked'] || false}">
<input type="text" class="form-control"
formControlName="preemptible_instance_number"
(keypress)="CheckUtils.isNumberKey($event)"
(keydown.arrowup)="preemptibleCounter($event, 'increment')"
(keydown.arrowdown)="preemptibleCounter($event, 'decrement')" />
<span class="danger_color" *ngIf="!resourceForm?.controls.preemptible_instance_number.valid">
<span *ngIf="minPreemptibleInstanceNumber !== maxPreemptibleInstanceNumber; else equal">
Only integer values greater than or equal to {{ minPreemptibleInstanceNumber }} and less than {{ maxPreemptibleInstanceNumber }} are allowed
</span>
<ng-template #equal>Please manage total machines count</ng-template>
</span>
</div>
</div>
<div class="checkbox-group control-group m-top-15" *ngIf="PROVIDER === 'aws'"
[hidden]="!model.templates.length || !isAvailableSpots()">
<label class="spot-label label">
<input #spotInstancesCheck type="checkbox" (change)="selectSpotInstances($event)" />
<span>Spot instance</span>
<span *ngIf="spotInstancesSelect?.nativeElement['checked'] || false"> bit, %</span>
</label>
<div class="control spot-details" [ngClass]="{ show: spotInstancesSelect?.nativeElement['checked'] || false }" *ngIf="spotInstancesSelect?.nativeElement['checked'] || false">
<input type="number" class="form-control" step="5" min="{{minSpotPrice}}" max="{{maxSpotPrice}}" formControlName="instance_price" (keypress)="CheckUtils.isNumberKey($event)">
<span class="danger_color" *ngIf="!resourceForm?.controls.instance_price.valid">
Only integer values greater than or equal to {{minSpotPrice}} and less than {{maxSpotPrice}} are allowed
</span>
</div>
<span class="info" *ngIf="spotInstancesSelect?.nativeElement['checked'] || false">When the current Spot price rises above your bid price, the Spot instance is reclaimed by AWS so that it can be given to another customer. Make sure to backup your data on periodic basis.</span>
</div>
<div class="checkbox-group" [hidden]="PROVIDER === 'gcp' && model.selectedImage?.image === 'docker.dlab-dataengine-service'"
*ngIf="notebook_instance?.image !== 'docker.dlab-zeppelin'">
<label>
<input #configurationNode type="checkbox" (change)="selectConfiguration()"/> Cluster configurations
</label>
<div class="config-link" *ngIf="(configuration?.nativeElement['checked'] || false)
&& model.selectedImage?.image === 'docker.dlab-dataengine-service'
&& DICTIONARY.cloud_provider === 'aws'">
To view example JSON of configurations refer for <a href="https://docs.aws.amazon.com/emr/latest/ReleaseGuide/emr-configure-apps.html" target="_blank">AWS official documentation</a>
</div>
</div>
<div class="checkbox-group">
<div class="config-details" [ngClass]="{ show: configuration?.nativeElement['checked'] || false }">
<textarea formControlName="configuration_parameters" placeholder="Cluster configuration template, JSON" data-gramm_editor="false"></textarea>
<span class="danger_color" *ngIf="!resourceForm?.controls.configuration_parameters.valid && resourceForm?.controls['configuration_parameters'].dirty">Configuration parameters is not in a valid format</span>
</div>
</div>
<div *ngIf="notebook_instance?.image === 'docker.dlab-zeppelin'">
<small>Spark default configuration for Apache Zeppelin can not be changed from DLab UI. Currently it can be done directly through Apache Zeppelin interpreter menu.
For more details please refer for Apache Zeppelin <a href="https://zeppelin.apache.org/docs/0.8.0/usage/interpreter/overview.html" target="_blank">official documentation</a>.
</small>
</div>
<div class="text-center m-top-30">
<button mat-raised-button type="button" (click)="bindDialog.close()" class="butt action">Cancel</button>
<button mat-raised-button type="submit" [disabled]="!resourceForm?.valid"
class="butt butt-success action" [ngClass]="{'not-allowed': !resourceForm?.valid}">Create</button>
</div>
</form>
<div *ngIf="!model.availableTemplates" class="info message">Computational resource creations are not available.<br>Please, check your permissions.</div>
</div>
</modal-content>
</modal-dialog>