New VIM Design with the config implemented.
[osm/NG-UI.git] / src / app / vim-accounts / new-vimaccount / NewVimaccountComponent.html
1 <!--
2 Copyright 2020 TATA ELXSI
3
4 Licensed under the Apache License, Version 2.0 (the 'License');
5 you may not use this file except in compliance with the License.
6 You may obtain a copy of the License at
7
8 http://www.apache.org/licenses/LICENSE-2.0
9
10 Unless required by applicable law or agreed to in writing, software
11 distributed under the License is distributed on an "AS IS" BASIS,
12 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 See the License for the specific language governing permissions and
14 limitations under the License.
15
16 Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.in), BARATH KUMAR R (barath.r@tataelxsi.co.in)
17 -->
18 <form [formGroup]="vimNewAccountForm" (ngSubmit)="newVimAccountSubmit()" autocomplete="off">
19 <div class="row d-flex flex-row justify-content-between">
20 <div class="d-flex align-items-center header-style">{{'PAGE.VIMDETAILS.NEWVIMACCOUNT' | translate}} </div>
21 </div>
22 <div class="context-style bg-white p-3">
23 <div class="row form-group content-style">
24 <label class="col-sm-12 col-form-label mandatory-label"
25 [ngClass]="{'text-danger': vimNewAccountForm.invalid === true && submitted === true}">{{'MANDATORYCHECK' | translate}}</label>
26 <div class="col-sm-3">
27 <label for="name">{{'PAGE.VIMDETAILS.NAME' | translate}}*</label>
28 </div>
29 <div class="col-sm-3">
30 <input autocomplete="off" class="form-control" placeholder="{{'PAGE.VIMDETAILS.NAME' | translate}}"
31 type="text" formControlName="name" id="name"
32 [ngClass]="{ 'is-invalid': submitted && f.name.errors }">
33 </div>
34 <div class="col-sm-3">
35 <label for="vim_tenant_name">{{'PAGE.VIMDETAILS.TENANTNAME' | translate}}*</label>
36 </div>
37 <div class="col-sm-3">
38 <input autocomplete="off" class="form-control"
39 placeholder="{{'PAGE.VIMDETAILS.TENANTNAME' | translate}}" type="text"
40 formControlName="vim_tenant_name" id="vim_tenant_name"
41 [ngClass]="{ 'is-invalid': submitted && f.vim_tenant_name.errors }">
42 </div>
43 </div>
44 <div class="row form-group content-style">
45 <div class="col-sm-3">
46 <label for="vim_type">{{'PAGE.VIMDETAILS.VIMTYPE' | translate}}*</label>
47 </div>
48 <div class="col-sm-3">
49 <ng-select bindLabel="title" bindValue="value" [items]="vimType" placeholder="{{'SELECT' | translate}}"
50 formControlName="vim_type" id="vim_type" [(ngModel)]="selectedVimType" [addTag]="sharedService.addCustomTag"
51 [ngClass]="{ 'is-invalid': submitted && f.vim_type.errors }" (change)="clearConfig()">
52 </ng-select>
53 <small class="text-info">{{'TYPEINFO' | translate}}</small>
54 </div>
55 <div class="col-sm-3">
56 <label for="description">{{'PAGE.VIMDETAILS.DESCRIPTION' | translate}}</label>
57 </div>
58 <div class="col-sm-3">
59 <textarea class="form-control" placeholder="{{'PAGE.VIMDETAILS.DESCRIPTION' | translate}}" type="text"
60 formControlName="description" id="description"></textarea>
61 </div>
62 </div>
63 <div class="row form-group content-style">
64 <div class="col-sm-3">
65 <label for="vim_url">{{'PAGE.VIMDETAILS.VIMURL' | translate}}*</label>
66 </div>
67 <div class="col-sm-3">
68 <input autocomplete="off" class="form-control" placeholder="{{'PAGE.VIMDETAILS.VIMURL' | translate}}"
69 type="url" formControlName="vim_url" id="vim_url"
70 [ngClass]="{ 'is-invalid': submitted && f.vim_url.errors }">
71 <div *ngIf="vimNewAccountForm.invalid" class="invalid-feedback">
72 <div *ngIf="f.vim_url.errors && f.vim_url.value">{{'DOMVALIDATIONS.INVALIDURL' | translate}}</div>
73 </div>
74 </div>
75 <div class="col-sm-3">
76 <label for="schema_type">{{'PAGE.VIMDETAILS.SCHEMATYPE' | translate}}</label>
77 </div>
78 <div class="col-sm-3">
79 <input autocomplete="off" class="form-control"
80 placeholder="{{'PAGE.VIMDETAILS.SCHEMATYPE' | translate}}" type="text" formControlName="schema_type"
81 id="schema_type">
82 </div>
83 </div>
84 <div class="row form-group content-style">
85 <div class="col-sm-3">
86 <label for="vim_user">{{'PAGE.VIMDETAILS.VIMUSERNAME' | translate}}*</label>
87 </div>
88 <div class="col-sm-3">
89 <input autocomplete="off" class="form-control"
90 placeholder="{{'PAGE.VIMDETAILS.VIMUSERNAME' | translate}}" type="text" formControlName="vim_user"
91 id="vim_user" [ngClass]="{ 'is-invalid': submitted && f.vim_user.errors }">
92 </div>
93 <div class="col-sm-3">
94 <label for="vim_password">{{'PAGE.VIMDETAILS.VIMPASSWORD' | translate}}*</label>
95 </div>
96 <div class="col-sm-3">
97 <input autocomplete="off" class="form-control" placeholder="VIM Password" type="password"
98 formControlName="vim_password" id="vim_password"
99 [ngClass]="{ 'is-invalid': submitted && f.vim_password.errors }">
100 </div>
101 </div>
102 <div class="row form-group content-style">
103 <div class="col-sm-3">
104 <label for="location">{{'PAGE.VIMDETAILS.VIMLOCATION' | translate}}</label>
105 </div>
106 <div class="col-sm-3" formGroupName="config">
107 <ng-select [items]="getVIMLocation" bindLabel="label" bindValue="value"
108 placeholder="{{'PAGE.VIMDETAILS.VIMLOCATION' | translate}}" formControlName="location" id="location"
109 (keydown.enter)="fetchLocationLatLong($event.target.value)" (change)="locationChange($event)">
110 </ng-select>
111 <small class="text-info">{{'PAGE.VIM.LOCATIONINFO' | translate}}</small>
112 </div>
113 <div class="col-sm-3">
114 <label>{{'UPLOADCONFIG' | translate}}</label>
115 </div>
116 <div class="col-sm-3 form-group">
117 <div class="custom-file">
118 <input [disabled]="!selectedVimType" type="file" #fileInput class="custom-file-input"
119 (change)="filesDropped($event.target.files)" id="customFile">
120 <label class="custom-file-label" #fileInputLabel
121 for="customFile">{{'CHOOSEFILE' | translate}}</label>
122 </div>
123 <small class="text-info">{{'UPLOADCONFIGLABEL' | translate}}</small>
124 </div>
125 </div>
126 <div class="row" [hidden]="!selectedVimType">
127 <div class="col-12">
128 <button type="button" class="btn btn-block border-0 bg-light text-dark"
129 (click)="isCollapsed = !isCollapsed"
130 [attr.aria-expanded]="!isCollapsed">{{'PAGE.VIMDETAILS.CONFIGPARAMETERS' | translate}}</button>
131 </div>
132 </div>
133 <div id="configurationparameters" class="row collapse mt-3" [ngbCollapse]="isCollapsed">
134 <div class="col-sm-12">
135 <div class="ngx-codemirror new-vim" [hidden]="!selectedVimType">
136 <div class="form-group">
137 <button type="button" class="btn btn-warning btn-sm mr-3" (click)="loadSampleConfig()">
138 <i class="fa fa-clone" aria-hidden="true"></i>
139 {{'PAGE.VIMDETAILS.LOADSAMPLECONFIG' | translate}}</button>
140 <button type="button" class="btn btn-danger btn-sm" (click)="clearConfig()">
141 <i class="fa fa-times-circle" aria-hidden="true"></i>
142 {{'PAGE.VIMDETAILS.CLEARCONFIG' | translate}}</button>
143 </div>
144 <ngx-codemirror [options]="options" [ngModel]="defaults[mode]" [autoFocus]="true"
145 (ngModelChange)="handleChange($event)" [ngModelOptions]="{standalone: true}">
146 </ngx-codemirror>
147 </div>
148 </div>
149 </div>
150 <div class="modal-footer border-0">
151 <button type="button" (click)="onVimAccountBack()"
152 class="btn btn-danger">{{'PAGE.VIMDETAILS.BACKTOVIMACCOUNTS' | translate}}</button>
153 <button type="submit" class="btn btn-primary">{{'CREATE' | translate}}</button>
154 </div>
155 </div>
156 </form>
157 <app-loader [waitingMessage]="message" *ngIf="isLocationLoadingResults"></app-loader>