aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
blob: 564cd32269771d91b79bd84da4aef96d0d6a0aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
<!--
============LICENSE_START==========================================
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================

Unless otherwise specified, all software contained herein is licensed
under the Apache License, Version 2.0 (the License);
you may not use this software 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.

============LICENSE_END============================================
-->

<simple-notifications [options]="options"></simple-notifications>
<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'" [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress>
<form class="" novalidate #userForm="ngForm" (ngSubmit)="save(userForm.value,userForm.valid)">
    <div class="card">

        <div class="card-block" style="    border-top: 5px solid #6ab344; border-top-right-radius: 7px;border-top-left-radius: 7px;">
            <div class="row" style="padding: 15px 25px">
                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
                    <label>Action*</label>
                    <select class="form-control" required id="cmbAction" [(ngModel)]="referenceDataObject.action" (ngModelChange)="updateSessionValues($event,'action');actionChange($event,userForm);handleVMBlockDisplay()" #action="ngModel" name="action">
                        <option [value]="actionType"
                                [ngClass]="{'selectedAction':selectedActions.indexOf(actionType)>-1}"
                                [selected]="referenceDataObject.action===actionType"
                                *ngFor="let actionType of actions ">{{actionType}}
                        </option>
                    </select>

                </div>
                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
                    <label>VNF Type* </label>
                    <input type="text" readonly class="form-control" id="txtVnfType" required [(ngModel)]="referenceDataObject['scope']['vnf-type']" (ngModelChange)="updateSessionValues($event,'vnfType')" #vnftype="ngModel" name="vnftype">
                    <span class="error-message" [hidden]="vnfParams?.vnfType || vnftype.valid || (vnftype.pristine && !userForm.submitted)">Required Field</span>
                </div>

                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="((displayVnfc=='true') || isVnfcType) && (referenceDataObject['action']=='Configure' || referenceDataObject['action']=='ConfigModify' || referenceDataObject['action']=='DistributeTraffic')">
                    <label>VNFC Type</label>
                    <input *ngIf="isVnfcType" type="text" class="form-control" readonly id="txtVnfcType" [(ngModel)]="referenceDataObject.scope['vnfc-type']" (blur)="setVnfcType($event.target.value)" (ngModelChange)="updateSessionValues($event,'vnfcType')" #vnfcType="ngModel"
                        name="vnfcType">
                    <select *ngIf="isVnfcTypeList" class="form-control" id="vnfcType" (ngModelChange)="vnfcChanged($event,content,userForm)" [ngModel]="vnfcIdentifier" #deviceProtocol="ngModel" name="templateIdentifier">
                            <option [value]="val" *ngFor="let val of referenceDataObject.scope['vnfc-type-list']">{{val}}
                            </option>
                        </select>
                    <a *ngIf="isVnfcTypeList" style="    color: blue;" href="javascript:void(0)" (click)="vnfcModal.open()">Add New VNFC Type</a>
                </div>

                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="displayVnfc!='true' || (referenceDataObject['action']!='Configure' && referenceDataObject['action']!='ConfigModify' && referenceDataObject['action']!='DistributeTraffic')">
                </div>
                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
                    <label>Device Protocol*</label>
                    <select class="form-control" required id="txtDeviceProtocol" [(ngModel)]="referenceDataObject['device-protocol']" (ngModelChange)="deviceProtocolChange()" #deviceProtocol="ngModel" name="deviceProtocol">
                        <option [value]="device" [selected]="referenceDataObject.deviceProtocol===device"
                                *ngFor="let device of deviceProtocols">{{device}}
                        </option>
                    </select>

                </div>
                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="isConfigScaleOut">
                    <label>Template Identifier</label>
                    <select class="form-control" required id="tempIdentifier" (ngModelChange)="dataModified();idChange($event,userForm)" [(ngModel)]="templateIdentifier" #deviceProtocol="ngModel" name="templateIdentifier">
                        <option [value]="val" *ngFor="let val of referenceDataObject['template-id-list']">{{val}}
                        </option>
                    </select>
                   <!-- <span class="error-message" [hidden]="deviceProtocol.valid || (deviceProtocol.pristine && !userForm.submitted)">Required Field</span> -->
                </div>

                <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="referenceDataObject['action']== 'ConfigScaleOut'" style="margin-top: 30px">
                    <span *ngIf="referenceDataObject.action === 'ConfigScaleOut'">   <a style="    color: blue;"
                    href="javascript:void(0)"
                    (click)="showIdentifier()">Assign New Template Identifier</a></span>

                </div>
            </div>
            <div class="col-12" *ngIf="!(referenceDataObject.action === 'OpenStack Actions')">
                <div class="input-group">
                    <input id="inputFile" class="file" #myInput type='file' (change)="fileChange($event)">
                    <input [(ngModel)]="fileName" type="text" class="input-lg" disabled placeholder="Upload Reference File from PC" name="browse" style="width:80%">
                    <button (click)="browseOption($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" type="button">Upload Reference File
                    </button>
                </div>
            </div>
            <div class="col-12" *ngIf="referenceDataObject.action === 'OpenStack Actions'">
                <div class="input-group">
                    <input id="excelInputFile" #myInput1 class="file" type="file" (change)="upload($event)">
                    <input [(ngModel)]="uploadFileName" type="text" class="input-lg" disabled placeholder="Upload VM Capabilities File" name="uploadFileName" style="width:80%">
                    <button (click)="excelBrowseOption($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" type="button">Upload VM Capabilities File
                    </button>
                </div>
            </div>
        </div>
        <div class="card-block" style="padding: 10px">
            <div>
                <div class="create-wrapper" style="padding: 0px 25px">
                    <div class="row" style="margin-bottom: 30px">
                        <div class=" col-6">

                        </div>
                        <div class="text-right col-6">
                            <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="submit">Download All To PC
                            </button>&emsp;&emsp;
                            <button id="saveToAppc" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="button" (click)="validateDataAndSaveToAppc(userForm.valid, userForm)">Save All to APPC
                            </button>&emsp;&emsp;
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-12">
                            <div class="row" *ngIf="!(referenceDataObject.action === 'OpenStack Actions')">
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label>Template</label>
                                    <select class="form-control" id="txtDeviceProtocol" [(ngModel)]="referenceDataObject['template']" #template="ngModel" name="template">
                                        <option [value]="template" *ngFor="let template of deviceTemplates">
                                            {{template}}
                                        </option>
                                    </select>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label>User Name</label>
                                    <input type="text" class="form-control" id="txtIpaddress" [(ngModel)]="referenceDataObject['user-name']" name="loginUserName">
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label>Port Number</label>
                                    <input type="text" class="form-control" id="txtIpaddress" [(ngModel)]="referenceDataObject['port-number']" name="portNumber">
                                </div>
                                <div *ngIf="actionHealthCheck && referenceDataObject['device-protocol'] =='REST' " class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
                                    <label>Context Url</label>
                                    <input type="text" class="form-control" id="txtIpaddress" [(ngModel)]="referenceDataObject['url']" name="contextUrl">
                                </div>
                            </div>
                            <div class="card-block" *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action ==''  || referenceDataObject.action ==undefined)" style="border-top: 5px solid #6ab344;border-top-right-radius: 7px;border-top-left-radius: 7px;">
                                <div class="col-12">
                                    <h5 style="margin-top: 0.5rem;font-family: Roboto"> VNFC Information
                                        <span class="pull-right">
                                            <i (click)="isCollapsedContent = !isCollapsedContent"
                                               [ngClass]="{'fa-minus-circle':isCollapsedContent,'fa-plus-circle':!isCollapsedContent}"
                                               class="fa" aria-hidden="true"></i>
                                        </span>
                                    </h5>
                                </div>
                            </div>
                            <div class="row" *ngIf="(( referenceDataObject.action =='ConfigScaleOut' ||referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ) && isCollapsedContent) ">
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label style="font-size:12px;">VNFC Type</label>
                                    <input type="text" class="form-control" id="txtVnfcTypeInColl" [(ngModel)]="Sample['vnfc-type']" (blur)="checkVnfcTypeEqual(vnfcType.value)" #vnfcType="ngModel" name="samplevnfcType">
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label style="font-size:12px">VNFC Function Code</label>
                                    <input type="text" class="form-control" id="txtVnfcFunctionCode" [(ngModel)]="Sample['vnfc-function-code']" #vnfcFunctionCode="ngModel" name="samplevnfcFunctionCode">
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label style="font-size:12px;">IPAddress V4</label>
                                    <select class="form-control" id="cmbIpAddedBoo" [(ngModel)]="Sample['ipaddress-v4-oam-vip']" name="sampleIpaddress">
                                        <option [value]="hasIp" *ngFor="let hasIp of ipAddressBoolean">{{hasIp}}
                                        </option>
                                    </select>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label style="font-size:12px;">Group Notation Type</label>
                                    <select class="form-control" id="cmbGroupType" [(ngModel)]="Sample['group-notation-type']" name="sampleGroupNotation" (change)="resetGroupNotation()">
                                        <option [value]="type" *ngFor="let type of groupAnotationType">{{type}}</option>
                                    </select>
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <label style="font-size:12px;">Group Notation Value</label>
                                    <input type="text" class="form-control" [readonly]="disableGrpNotationValue" id="txtGroupValue" [(ngModel)]="Sample['group-notation-value']" name="sampleGroupValue">
                                </div>
                                <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                    <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent clear-btn" (click)="clearVnfcData()">Clear VNFC Info
                                    </button>
                                </div>
                            </div>
                            <hr>
                            <div *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' )" class="row">
                                <div class="col-lg-2 col-md-2 hdden-sm-down">
                                    <label style="margin-top: 17px;" class="headlinesInBold"> Number Of VM(s): </label>

                                </div>
                                <div class="col-lg-5 col-md-5 col-sm-6 col-xs-6">
                                    <div class="form-group">
                                        <input type="text" placeholder="Number of VM(s)" class="form-control" id="txtVmnumber22" [(ngModel)]="refernceScopeObj.from" (ngModelChange)="numberValidation($event)" name="txtNumber23">
                                    </div>
                                </div>
                                <div class="col-lg-5 col-md-5 col-sm-6 col-xs-6 text-right">
                                    <div class="form-group">
                                        <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="button" [disabled]="!refernceScopeObj.from || !numberOfVmTest" (click)="addVms()">Add VM Information
                                        </button>
                                    </div>
                                </div>
                            </div>
                            <div *ngIf="referenceDataObject.vm?.length>0">
                                <div class="row" *ngFor="let noOfvm of referenceDataObject.vm  | vmFiltering:referenceDataObject?.action:templateIdentifier; trackBy:trackByFn;let j=index">
                                    <div *ngIf="((referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ))" class="col-12">
                                        <div class="row" *ngFor="let item of noOfvm.vnfc;trackBy:trackByFn, let i=index">
                                            <div class="col-md-12" *ngIf="i==0">
                                                <h5 class="headlinesInBold">VM Number: {{j+1}}</h5>

                                            </div>
                                            <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                                <label style="font-size:12px;">VNFC Instance No.</label>
                                                <input type="text" class="form-control" id="txtVmnumber" disabled='true' [(ngModel)]="item['vnfc-instance']" name="vmNumber{{j}}">
                                            </div>
                                            <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                                <label style="font-size:12px;">VNFC Type</label>
                                                <input type="text" class="form-control" id="txtVnfcTypeInColl" required [(ngModel)]="item['vnfc-type']" #vnfcType="ngModel" name="vnfcType{{j}}">
                                                <span class="error-message" [hidden]="vnfcType.valid || (vnfcType.pristine && !userForm.submitted)">Required Field</span>
                                            </div>
                                            <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                                <label style="font-size:12px;">VNFC Function Code</label>
                                                <input type="text" class="form-control" id="txtVnfcFunctionCode" required [(ngModel)]="item['vnfc-function-code']" #vnfcFunctionCode="ngModel" name="vnfcFunctionCode{{j}}">
                                                <span class="error-message" [hidden]="vnfcFunctionCode.valid || (vnfcFunctionCode.pristine && !userForm.submitted)">Required Field</span>
                                            </div>
                                            <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                                <label style="font-size:12px;">IPAddress V4</label>
                                                <select class="form-control" id="cmbIpAddress" [(ngModel)]="item['ipaddress-v4-oam-vip']" name="ipaddress{{j}}">
                                                    <option [value]="hasIP" [selected]="item.ipAddressBoolean===hasIP"
                                                            *ngFor="let hasIP of ipAddressBoolean">{{hasIP}}
                                                    </option>
                                                </select>
                                            </div>
                                            <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                                <label style="font-size:12px;">Group Notation Type</label>
                                                <select class="form-control" id="cmbGroupType" [(ngModel)]="item['group-notation-type']" name="selectedGroupType{{j}}">
                                                    <option [value]="type" [selected]="item.groupNotationType===type"
                                                            *ngFor="let type of groupAnotationType">{{type}}
                                                    </option>
                                                </select>
                                            </div>
                                            <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
                                                <label style="font-size:12px;">Group Notation Value</label>
                                                <input type="text" [readonly]="item['group-notation-type'] =='existing-group-name'" class="form-control" id="txtGroupValue" [(ngModel)]="item['group-notation-value']" name="selectedGroupValue{{j}}">
                                            </div>
                                            <div class="col-lg-12 col-sm-12 col-md-12 col-xs-12">
                                                <div class="removevnfcClass" *ngIf="refernceScopeObj.sourceType !='vnfcType'">
                                                    <a role="button" style="color: white" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="removeFeature(j,i,templateIdentifier)">Remove Vm</a>
                                                </div>
                                                <div>
                                                    <a *ngIf="(referenceDataObject.vm[j].vnfc.length-1) == i " [hidden]="true" role="button" (click)="addVnfcData(j)">Add VNFC
                                                        Information</a>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </div>
                    </div>
                    <div class="row" *ngIf="(referenceDataObject.action === 'OpenStack Actions')">
                        <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
                            <div class="table-responsive" style="height:auto; overflow: auto;">
                                <table>
                                    <thead>
                                        <tr>
                                            <td *ngFor="let item of firstArrayElement">
                                                <div>
                                                    <h1 style="font-size: 110%"> {{item}} </h1>
                                                </div>
                                            </td>
                                        </tr>
                                    </thead>
                                    <tbody>
                                        <tr *ngFor="let item of remUploadedDataArray; let i=index">
                                            <td *ngFor="let subItem of item; let j=index">
                                                {{subItem}}
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</form>
<!-- Modal -->
<div id="messageModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="android-more-button mdl-button mdl-js-button mdl-button--accent" data-dismiss="modal">&times;
                </button>
                <h4 class="modal-title">Warning</h4>
            </div>
            <div class="modal-body">
                <div *ngIf="allowAction==false" class="alert  alert-danger">
                    <b> Configure </b> action not yet saved
                </div>
                <div *ngIf="actionExist" class="alert  alert-danger">
                    <b> {{referenceDataObject.action}}</b> already exists. Please continue...
                </div>
            </div>
            <div class="modal-footer">
                <button type="close" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" data-dismiss="modal">Close
                </button>
            </div>
        </div>
    </div>
</div>

<!-- Modal for Vnfc Identifier -->
<modal #vnfcModal>
    <modal-header [show-close]="true">
        <h4 class="modal-title">Enter New VNFC Type</h4>
    </modal-header>
    <modal-body>
        <div>
            <input pattern=".*[^ ].*" name="test" type="text" class="" (ngModelChange)="validateVnfcName($event)" [(ngModel)]="newVnfcType" placeholder="vnfctype">
            <span class="error-message">{{errorMessage}}</span>
        </div>
    </modal-body>
    <modal-footer [show-default-buttons]="false">
        <div>
            <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="templateId=''" data-dismiss="modal">cancel</button>
            <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" data-dismiss="modal" (click)="addVnfc()" [disabled]="invalid">Add</button>
        </div>
    </modal-footer>
</modal>

<div id="identifierModal" class="modal fade" role="dialog">
    <div class="modal-dialog">
        <!-- Modal content-->
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="android-more-button mdl-button mdl-js-button mdl-button--accent" data-dismiss="modal">&times;
                </button>
                <h4 class="modal-title">Enter New Template Identifier</h4>
            </div>
            <div class="modal-body">
                <div>
                    <div>
                        <input pattern=".*[^ ].*" name="test" type="text" class="" [(ngModel)]="templateId" placeholder="identifier">
                    </div>
                </div>
            </div>
            <div class="modal-footer">
                <div>
                    <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" data-dismiss="modal" (click)="addToIdentDrp()">Add</button>
                    <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="templateId=''" data-dismiss="modal">cancel</button>
                </div>
            </div>
        </div>
    </div>
</div>
<ng-template #content let-c="close" let-d="dismiss">
    <div class="modal-header">
        <h6 class="modal-title">Save all changes for current action to APPC database.</h6>
        <button type="button" class="close" aria-label="Close" (click)="d('Cross click')">
            <span aria-hidden="true">&times;</span>
        </button>
    </div>
    <div class="modal-body">
        <p>Do you want to save the changes?</p>
    </div>
    <div class="modal-footer">
        <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent" (click)="c('no')">No
        </button>
        <button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" (click)="c('yes')">Yes
        </button>
    </div>
</ng-template>