blob: be535d2259d7028abcf75ef1caff975fb9a15e13 [file] [log] [blame]
<!--
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]="vimNewAccountForm" (ngSubmit)="newVimAccountSubmit()" autocomplete="off">
<div class="row d-flex flex-row justify-content-between">
<div *ngIf="vimID;else empty" class="d-flex align-items-center header-style">{{'PAGE.VIMDETAILS.EDITVIMACCOUNT'
| translate}} </div>
<ng-template #empty>
<div class="d-flex align-items-center header-style">{{'PAGE.VIMDETAILS.NEWVIMACCOUNT' | translate}} </div>
</ng-template>
</div>
<div class="context-style bg-white p-3">
<div class="row form-group content-style">
<label class="col-sm-12 col-form-label mandatory-label"
[ngClass]="{'text-danger': vimNewAccountForm.invalid === true && submitted === true}">
{{'MANDATORYCHECK' | translate}}
</label>
<div class="col-sm-3">
<label for="name">{{'PAGE.VIMDETAILS.NAME' | translate}}*</label>
</div>
<div class="col-sm-3">
<input autocomplete="off" class="form-control" placeholder="{{'PAGE.VIMDETAILS.NAME' | translate}}"
type="text" formControlName="name" id="name"
[ngClass]="{ 'is-invalid': submitted && f.name.errors }">
</div>
<div class="col-sm-3">
<label for="vim_tenant_name">{{'PAGE.VIMDETAILS.TENANTNAME' | translate}}*</label>
</div>
<div class="col-sm-3">
<input autocomplete="off" class="form-control"
placeholder="{{'PAGE.VIMDETAILS.TENANTNAME' | translate}}" type="text"
formControlName="vim_tenant_name" id="vim_tenant_name"
[ngClass]="{ 'is-invalid': submitted && f.vim_tenant_name.errors }">
</div>
</div>
<div class="row form-group content-style">
<div class="col-sm-3">
<label for="vim_type">{{'PAGE.VIMDETAILS.VIMTYPE' | translate}}*</label>
</div>
<div class="col-sm-3">
<ng-select bindLabel="title" bindValue="value" [items]="vimType" placeholder="{{'SELECT' | translate}}"
formControlName="vim_type" id="vim_type" [(ngModel)]="selectedVimType"
[addTag]="sharedService.addCustomTag" [ngClass]="{ 'is-invalid': submitted && f.vim_type.errors }"
(change)="clearConfig()">
</ng-select>
<small class="text-info">{{'TYPEINFO' | translate}}</small>
</div>
<div class="col-sm-3">
<label for="description">{{'PAGE.VIMDETAILS.DESCRIPTION' | translate}}</label>
</div>
<div class="col-sm-3">
<textarea class="form-control" placeholder="{{'PAGE.VIMDETAILS.DESCRIPTION' | translate}}" type="text"
formControlName="description" id="description"></textarea>
</div>
</div>
<div class="row form-group content-style">
<div class="col-sm-3">
<label for="vim_url">{{'PAGE.VIMDETAILS.VIMURL' | translate}}*</label>
</div>
<div class="col-sm-3">
<input autocomplete="off" class="form-control" placeholder="{{'PAGE.VIMDETAILS.VIMURL' | translate}}"
type="url" formControlName="vim_url" id="vim_url"
[ngClass]="{ 'is-invalid': submitted && f.vim_url.errors }">
<div *ngIf="vimNewAccountForm.invalid" class="invalid-feedback">
<div *ngIf="f.vim_url.errors && f.vim_url.value">{{'DOMVALIDATIONS.INVALIDURL' | translate}}</div>
</div>
</div>
<div class="col-sm-3">
<label for="schema_type">{{'PAGE.VIMDETAILS.SCHEMATYPE' | translate}}</label>
</div>
<div class="col-sm-3">
<input autocomplete="off" class="form-control"
placeholder="{{'PAGE.VIMDETAILS.SCHEMATYPE' | translate}}" type="text" formControlName="schema_type"
id="schema_type">
</div>
</div>
<div class="row form-group content-style">
<div class="col-sm-3">
<label for="vim_user">{{'PAGE.VIMDETAILS.VIMUSERNAME' | translate}}*</label>
</div>
<div class="col-sm-3">
<input autocomplete="off" class="form-control"
placeholder="{{'PAGE.VIMDETAILS.VIMUSERNAME' | translate}}" type="text" formControlName="vim_user"
id="vim_user" [ngClass]="{ 'is-invalid': submitted && f.vim_user.errors }">
</div>
<div class="col-sm-3">
<label for="vim_password">{{'PAGE.VIMDETAILS.VIMPASSWORD' | translate}}*</label>
</div>
<div class="col-sm-3">
<input autocomplete="off" class="form-control" placeholder="VIM Password" type="password"
formControlName="vim_password" id="vim_password"
[ngClass]="{ 'is-invalid': submitted && f.vim_password.errors }">
</div>
</div>
<div class="row form-group content-style">
<div class="col-sm-3">
<label for="location">{{'PAGE.VIMDETAILS.VIMLOCATION' | translate}}</label>
</div>
<div class="col-sm-9 form-inline">
<div class="input-group">
<input autocomplete="off" formControlName="locationName" type="text" class="form-control"
placeholder="{{'PAGE.VIMDETAILS.NAME' | translate}}"
[ngClass]="{ 'is-invalid': submitted && f.locationName.errors }">
<input autocomplete="off" formControlName="latitude" type="text" class="form-control"
placeholder="Latitude" [ngClass]="{ 'is-invalid': submitted && f.latitude.errors }">
<input autocomplete="off" formControlName="longitude" type="text" class="form-control"
placeholder="Longitude" [ngClass]="{ 'is-invalid': submitted && f.longitude.errors }">
</div>
<small class="text-info mt-1 ml-1">{{'PAGE.VIM.LOCATIONINFO' | translate}}</small>
</div>
</div>
<div class="row form-group content-style">
<div class="col-sm-3">
<label>{{'UPLOADCONFIG' | translate}}</label>
</div>
<div class="col-sm-3 form-group">
<div class="custom-file">
<input [disabled]="!selectedVimType" type="file" #fileInput class="custom-file-input"
(change)="filesDropped($event.target.files)" id="customFile">
<label class="custom-file-label" #fileInputLabel for="customFile">
{{'CHOOSEFILE' | translate}}
</label>
</div>
<small class="text-info">{{'UPLOADCONFIGLABEL' | translate}}</small>
</div>
</div>
<div class="row" [hidden]="!selectedVimType">
<div class="col-12">
<button type="button" class="btn btn-block border-0 bg-light text-dark"
(click)="isCollapsed = !isCollapsed"
[attr.aria-expanded]="!isCollapsed">{{'PAGE.VIMDETAILS.CONFIGPARAMETERS' | translate}}</button>
</div>
</div>
<div id="configurationparameters" class="row collapse mt-3" [ngbCollapse]="isCollapsed">
<div class="col-sm-12">
<div class="ngx-codemirror new-vim" [hidden]="!selectedVimType">
<div class="form-group" *ngIf="!vimID">
<button type="button" class="btn btn-warning btn-sm mr-3" (click)="checkData()">
<i class="fa fa-clone" aria-hidden="true"></i>
{{'PAGE.VIMDETAILS.LOADSAMPLECONFIG' | translate}}</button>
<button type="button" class="btn btn-danger btn-sm" (click)="clearConfig()">
<i class="fa fa-times-circle" aria-hidden="true"></i>
{{'PAGE.VIMDETAILS.CLEARCONFIG' | translate}}</button>
</div>
<ngx-codemirror *ngIf="check" [options]="options" [ngModel]="defaults[mode]" [autoFocus]="false"
(ngModelChange)="handleChange($event)" [ngModelOptions]="{standalone: true}">
</ngx-codemirror>
</div>
</div>
</div>
<div class="modal-footer border-0">
<button type="button" (click)="onVimAccountBack()"
class="btn btn-danger">{{'PAGE.VIMDETAILS.BACKTOVIMACCOUNTS' | translate}}</button>
<button *ngIf="!vimID" type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
<button *ngIf="vimID" type="submit" class="btn btn-primary">{{'UPDATE' | translate}}</button>
</div>
</div>
</form>
<app-loader [waitingMessage]="message" *ngIf="isLocationLoadingResults"></app-loader>