| <!-- |
| Copyright 2020 TATA ELXSI |
| |
| Licensed 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. |
| |
| Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in) |
| --> |
| <form [formGroup]="instantiateForm" (ngSubmit)="instantiateNsSubmit();"> |
| <div class="modal-header"> |
| <h4 class="modal-title" id="modal-basic-title">{{'PAGE.INSTANCEINSTANTIATE.NEWINSTANCE' | translate}}</h4> |
| <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()"> |
| <i class="fas fa-times-circle text-danger"></i> |
| </button> |
| </div> |
| <div class="modal-body modal-body-custom-height instantiate-ns"> |
| <div class="form-group row mb-3"> |
| <label class="col-sm-12 col-form-label mandatory-label" |
| [ngClass]="{'text-danger': instantiateForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | translate}}</label> |
| <label class="col-sm-4 col-form-label" |
| for="nsName">{{'PAGE.INSTANCEINSTANTIATE.NSNAME' | translate}}*</label> |
| <div class="col-sm-8"> |
| <input autocomplete="off" class="form-control" |
| placeholder="{{'PAGE.INSTANCEINSTANTIATE.NSNAME' | translate}}" type="text" formControlName="nsName" |
| id="nsName" (keydown.space)="$event.preventDefault();" |
| [ngClass]="{ 'is-invalid': submitted && f.nsName.errors }" required> |
| </div> |
| </div> |
| <div class="form-group row mb-3"> |
| <label class="col-sm-4 col-form-label" |
| for="nsDescription">{{'PAGE.INSTANCEINSTANTIATE.DESCRIPTION' | translate}}*</label> |
| <div class="col-sm-8"> |
| <textarea class="form-control" placeholder="{{'PAGE.INSTANCEINSTANTIATE.DESCRIPTION' | translate}}" |
| type="text" formControlName="nsDescription" id="nsDescription" |
| [ngClass]="{ 'is-invalid': submitted && f.nsDescription.errors }" required></textarea> |
| </div> |
| </div> |
| <div class="form-group row mb-3"> |
| <label class="col-sm-4 col-form-label" for="nsdId">{{'PAGE.INSTANCEINSTANTIATE.NSID' | translate}}*</label> |
| <div class="col-sm-8"> |
| <ng-select (change)="getDetailsconfigtemplateAccount()" [items]="nsdSelect" bindLabel="name" bindValue="_id" |
| placeholder="{{'SELECT' | translate}} {{'PAGE.INSTANCEINSTANTIATE.NSID' | translate}}" |
| formControlName="nsdId" [(ngModel)]="nsdId" id="nsdId" |
| [ngClass]="{ 'is-invalid': submitted && f.nsdId.errors }" required> |
| </ng-select> |
| </div> |
| </div> |
| <div class="form-group row mb-3"> |
| <label class="col-sm-4 col-form-label" |
| for="vimAccountId">{{'PAGE.INSTANCEINSTANTIATE.VIMACCOUNT' | translate}}*</label> |
| <div class="col-sm-6"> |
| <ng-select (change)="getSelectedVIMDetails($event)" [items]="vimAccountSelect" bindLabel="name" bindValue="_id" |
| placeholder="{{'SELECT' | translate}} {{'PAGE.INSTANCEINSTANTIATE.VIMACCOUNT' | translate}}" |
| formControlName="vimAccountId" [(ngModel)]="vimAccountId" id="vimAccountId" |
| [ngClass]="{ 'is-invalid': submitted && f.vimAccountId.errors }" required> |
| </ng-select> |
| </div> |
| <div class="col-sm-2" *ngIf="selectedVIMDetails !== null && selectedVIMDetails !== undefined" > |
| <ng-template #graphTitle> |
| <span class="text-primary"><strong>{{'PAGE.VIMDETAILS.VIMRESOURCES' | translate}}</strong></span> |
| <button class="button-xs close" type="button" (click)="chart.close()"> |
| <i class="fas fa-times-circle text-danger"></i> |
| </button> |
| </ng-template> |
| <ng-template #graphContent> |
| <app-resources-overview *ngIf="selectedVIMDetails !== null && selectedVIMDetails !== undefined" |
| [resourcesData]="selectedVIMDetails"></app-resources-overview> |
| </ng-template> |
| <button type="button" class="btn btn-primary" placement="left" container="body" |
| [ngbPopover]="graphContent" triggers="manual" #chart="ngbPopover" |
| (click)="chart.open()" [autoClose]="'outside'" [popoverTitle]="graphTitle" popoverClass="resources-chart-popover"> |
| <i class="fas fa-chart-pie"></i> |
| </button> |
| </div> |
| </div> |
| <div class="form-group row mb-3"> |
| <label class="col-sm-4 col-form-label" |
| for="ssh_keys">{{'PAGE.INSTANCEINSTANTIATE.SSHKEY' | translate}}</label> |
| <div class="col-sm-8"> |
| <textarea class="form-control" placeholder="{{'PAGE.INSTANCEINSTANTIATE.SSHKEYMSG' | translate}}" |
| formControlName="ssh_keys" id="ssh_keys"></textarea> |
| <div class="fileupload-text mt-1 mb-1">{{'FILEUPLOADLABEL' | translate}}</div> |
| <div class="custom-file"> |
| <input type="file" #fileInputSSH class="fileupload custom-file-input" (change)="sshFile($event.target.files)" |
| id="customSSHFile"> |
| </div> |
| </div> |
| </div> |
| <div class="form-group row mb-3"> |
| <label class="col-sm-4 col-form-label" for="config">{{'CONFIG' | translate}}</label> |
| <div class="col-sm-8"> |
| <ng-select [items]="nsConfigSelect" bindLabel="name" bindValue="_id" |
| placeholder="{{'SELECT' | translate}} {{'PAGE.DASHBOARD.NSCONFIGTEMPLATE' | translate}}" |
| formControlName="nsConfigTemplateId" id="nsConfigTemplateId" |
| [ngClass]="{ 'is-invalid': submitted && f.nsConfigTemplateId.errors }"> |
| </ng-select> |
| <div class="fileupload-text mt-1 mb-1">{{'CONFIGFILEUPLOADLABEL' | translate}}</div> |
| <textarea class="form-control" placeholder="{{'YAMLCONFIG' | translate}}" formControlName="config" |
| id="config"></textarea> |
| <div class="fileupload-text mt-1 mb-1">{{'FILEUPLOADLABEL' | translate}}</div> |
| <div class="custom-file"> |
| <input type="file" #fileInputConfig class="fileupload custom-file-input" |
| (change)="configFile($event.target.files)" id="customConfigFile"> |
| </div> |
| </div> |
| </div> |
| </div> |
| <div class="modal-footer"> |
| <button type="button" class="btn btn-danger" (click)="activeModal.close()">{{'CANCEL' | translate}}</button> |
| <button type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button> |
| </div> |
| </form> |
| <app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader> |