95bf68964a9bdeaca535bd621a7e31e413d5baf7
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / policy-models / Editor / PolicyTemplates / DecisionPolicyTemplate.html
1 <div ng-controller="decisionPolicyController">
2         <form>
3                 <div class="well">
4                         <div class="form-group row">
5                                 <div class="form-group col-sm-6">
6                                         <label>Policy Name:<sup><b>*</b></sup></label> <input type="text"
7                                                 class="form-control" ng-disabled="temp.policy.readOnly"
8                                                 ng-readonly="temp.policy.editPolicy"
9                                                 ng-model="temp.policy.policyName" required pattern="\S+"
10                                                 title="Enter Policy Name without any spaces and special characters and will accept _." />
11                                 </div>
12                                 <div class="form-group col-sm-6">
13                                         <label>Description:</label> <input type="text" class="form-control"
14                                                 ng-disabled="temp.policy.readOnly"
15                                                 ng-model="temp.policy.policyDescription" 
16                                                 title="Description field will accept any type of data."/>
17                                 </div>
18                         </div>
19                         <div class="form-group row">
20                                 <div class="form-group col-sm-6">
21                                         <label>Onap Name:<sup><b>*</b></sup></label> <select
22                                                 class="form-control" ng-disabled="temp.policy.readOnly"
23                                                 ng-model="temp.policy.onapName"
24                                                 ng-options="option for option in onapNameDictionaryDatas track by option"
25                                                 required pattern="\S+" title="Select the dropdown value driven from OnapName (common)Dictionary."></select>
26                                 </div>
27                                 <div class="form-group col-sm-6">
28                                         <label>Rule Provider:<sup><b>*</b></sup></label><select
29                                                 class="form-control" ng-disabled="temp.policy.readOnly"
30                                                 ng-model="temp.policy.ruleProvider"
31                                                 ng-init="providerListener(temp.policy.ruleProvider);"
32                                                 ng-click="providerListener(temp.policy.ruleProvider);">
33                                                 <option>Custom</option>
34                                                 <option>AAF</option>
35                                                 <option>Rainy_Day</option>
36                                                 <option>GUARD_YAML</option>
37                                                 <option>GUARD_BL_YAML<option>
38                                         </select>
39                                 </div>
40                         </div>
41                 </div>
42                 <div ng-if="temp.policy.ruleProvider == 'Rainy_Day'">
43                         <div class="well">
44                                 <div class="form-group row">
45                                         <div class="form-group row">
46                                                 <div class="form-group col-sm-1">
47                                                         <label>Service Type:<sup><b>*</b></sup></label>
48                                                 </div>
49                                                 <div class="form-group col-sm-2">
50                                                         <input type="text" class="form-control"
51                                                                 ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.serviceType"
52                                                                 placeholder="Service Type" title="Enter Service Type value."/>
53                                                 </div>
54                                                 <div class="form-group col-sm-1">
55                                                         <label>VNF Type:<sup><b>*</b></sup></label>
56                                                 </div>
57                                                 <div class="form-group col-sm-2">
58                                                         <input type="text" class="form-control"
59                                                                 ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.vnfType"
60                                                                 placeholder="VNF Type" title="Enter VNF Type value."/>
61                                                 </div>
62                                                 <div class="form-group col-sm-1">
63                                                         <label>Building Block ID:<sup><b>*</b></sup></label>
64                                                 </div>
65                                                 <div class="form-group col-sm-2">
66                                                                 <select
67                                                                         class="form-control" ng-disabled="temp.policy.readOnly"
68                                                                         ng-model="temp.policy.rainyday.bbid"
69                                                                         ng-options="option for option in rainyDayDictionaryDatas track by option"
70                                                                         ng-change="getWorkstepValues(temp.policy.rainyday.bbid)" title="Select the dropdown value driven from Rainday Allowed Treatments (Decision)Dictionary.">
71                                                                         <option value="">{{temp.policy.rainyday.bbid}}</option>
72                                                                 </select>
73                                                 </div>
74                                                 <div class="form-group col-sm-1">
75                                                         <label>Work Step:<sup><b>*</b></sup></label>
76                                                 </div>
77                                                 <div class="form-group col-sm-2">
78                                                         <select
79                                                                         class="form-control" ng-disabled="temp.policy.readOnly"
80                                                                         ng-model="temp.policy.rainyday.workstep"
81                                                                         ng-options="option for option in workstepDictionaryDatas track by option"
82                                                                         ng-change="getTreatmentValues(temp.policy.rainyday.bbid, temp.policy.rainyday.workstep)">
83                                                                         <option value="">{{temp.policy.rainyday.workstep}}</option>
84                                                         </select>
85                                                 </div>
86                                         </div>
87                                         <div class="form-group row">
88                                                 <div class="form-group col-sm-3">
89                                                         <label>Desired Automated Treatments:</label>
90                                                         <button type="button" class="btn btn-default"
91                                                                 ng-disabled="temp.policy.readOnly"
92                                                                 ng-click="addNewTreatment()">
93                                                                 <i class="fa fa-plus"></i>
94                                                         </button>
95                                                 </div>
96                                         </div>
97                                         <div class="form-group row">
98                                         <div data-ng-repeat="treatmentTableChoice in temp.policy.rainyday.treatmentTableChoices">
99                                                 <div class="form-group row" style="margin-left: 2%">
100                                                         <div class="form-group col-sm-1">
101                                                                 <label>Error Code:<sup><b>*</b></sup></label>
102                                                         </div>
103                                                         <div class="form-group col-sm-3">
104                                                                 <input type="text" class="form-control"
105                                                                         ng-disabled="temp.policy.readOnly"
106                                                                         ng-model="treatmentTableChoice.errorcode"
107                                                                         placeholder="Error Code" />
108                                                         </div>
109                                                         <div class="form-group col-sm-1">
110                                                                 <label>Desired Treatment:<sup><b>*</b></sup></label>
111                                                         </div>          
112                                                         <div class="form-group col-sm-3">
113                                                                 <select
114                                                                         class="form-control" 
115                                                                         ng-disabled="temp.policy.readOnly"
116                                                                         ng-model="treatmentTableChoice.treatment"
117                                                                         ng-options="option for option in allowedTreatmentsDatas track by option">
118                                                                         <option value="">{{treatmentTableChoice.treatment}}</option>
119                                                                 </select>                                               
120                                                         </div>
121                                                         <div class="form-group col-sm-1">
122                                                                 <button type="button" class="btn btn-default"
123                                                                         ng-disabled="temp.policy.readOnly"
124                                                                         ng-click="removeTreatment()">
125                                                                         <i class="fa fa-minus"></i>
126                                                                 </button>
127                                                         </div>
128                                                 </div>
129                                         </div>
130                                         </div>
131                                 </div>
132                         </div>
133                 </div>
134                 <div ng-if="temp.policy.ruleProvider == 'GUARD_BL_YAML'">
135                         <div class="well">
136                                 <div class="form-group row">
137                                         <div class="form-group col-sm-1">
138                                                 <label>Guard BlackList YAML Attributes:</label><br>
139                                         </div>
140                                 </div>
141                                 <div class="form-group row">
142                                                 <div class="form-group row" style="margin-left: 2%">
143                                                         <div class="form-group col-sm-3">
144                                                                 <label> actor: </label>
145                                                         </div>
146                                                         <div class="form-group col-sm-3">
147                                                                 <input type="text" class="form-control"
148                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.actor"
149                                                                         placeholder="Actor" />
150                                                         </div>
151                                                 </div>
152                                                 <div class="form-group row" style="margin-left: 2%">
153                                                         <div class="form-group col-sm-3">
154                                                                 <label> recipe: </label>
155                                                         </div>
156                                                         <div class="form-group col-sm-3">
157                                                                 <input type="text" class="form-control"
158                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.recipe"
159                                                                         placeholder="Recipe" />
160                                                         </div>
161                                                 </div>
162                                                 <div class="form-group row" style="margin-left: 2%">
163                                                         <div class="form-group col-sm-3">
164                                                                 <label> CLName: </label>
165                                                         </div>
166                                                         <div class="form-group col-sm-3">
167                                                                 <input type="text" class="form-control"
168                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.clname"
169                                                                         placeholder="CLName" />
170                                                         </div>
171                                                 </div>
172                                                 <div class="form-group row" style="margin-left: 2%">
173                                                         <div class="form-group col-sm-3">
174                                                                 <label> guardActiveStart: </label>
175                                                         </div>
176                                                         <div class="form-group col-sm-3">
177                                                                 <input type="text" class="form-control"
178                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart"
179                                                                         placeholder="00:00:00-05:00" />
180                                                         </div>
181                                                 </div>
182                                                 <div class="form-group row" style="margin-left: 2%">
183                                                         <div class="form-group col-sm-3">
184                                                                 <label> guardActiveEnd: </label>
185                                                         </div>
186                                                         <div class="form-group col-sm-3">
187                                                                 <input type="text" class="form-control"
188                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd"
189                                                                         placeholder="00:00:00-05:00" />
190                                                         </div>
191                                                 </div>
192                                                 <div class="form-group row" style="margin-left: 2%">
193                                                         <div class="form-group col-sm-3">
194                                                                 <label> BlackList: </label>
195                                                                 <button type="button" class="btn btn-default"
196                                                                         ng-disabled="temp.policy.readOnly" ng-click="addNewBL()">
197                                                                         <i class="fa fa-plus"></i>
198                                                                 </button>
199                                                         </div>
200                                                         <div class="form-group col-sm-4">
201                                                                 <div data-ng-repeat="choice in temp.policy.yamlparams.blackList track by $index">
202                                                                         <div class="form-group row">
203                                                                         <div class="form-group col-sm-9">
204                                                                                 <input type="text" class="form-control"
205                                                                                 ng-disabled="temp.policy.readOnly"
206                                                                                 ng-model="temp.policy.yamlparams.blackList[$index]" placeholder="BlackList" />
207                                                                         </div>
208                                                                         <div class="form-group col-sm-1">
209                                                                                 <button type="button" class="btn btn-default" ng-show="$last"
210                                                                                 ng-disabled="temp.policy.readOnly" ng-click="removeBL()">
211                                                                                 <i class="fa fa-minus"></i>
212                                                                                 </button>
213                                                                         </div>
214                                                                         </div>
215                                                                 </div>
216                                                         </div>
217                                                 </div>
218                                 </div>
219                         </div>
220                 </div>
221                 
222                 <div ng-if="temp.policy.ruleProvider == 'GUARD_YAML'">
223                         <div class="well">
224                                 <div class="form-group row">
225                                         <div class="form-group col-sm-1">
226                                                 <label>Guard YAML Attributes:</label><br>
227                                         </div>
228                                 </div>
229                                 <div class="form-group row">
230                                                 <div class="form-group row" style="margin-left: 2%">
231                                                         <div class="form-group col-sm-3">
232                                                                 <label> actor: </label>
233                                                         </div>
234                                                         <div class="form-group col-sm-3">
235                                                                 <input type="text" class="form-control"
236                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.actor"
237                                                                         placeholder="Actor" />
238                                                         </div>
239                                                 </div>
240                                                 <div class="form-group row" style="margin-left: 2%">
241                                                         <div class="form-group col-sm-3">
242                                                                 <label> recipe: </label>
243                                                         </div>
244                                                         <div class="form-group col-sm-3">
245                                                                 <input type="text" class="form-control"
246                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.recipe"
247                                                                         placeholder="Recipe" />
248                                                         </div>
249                                                 </div>
250                                                 <div class="form-group row" style="margin-left: 2%">
251                                                         <div class="form-group col-sm-3">
252                                                                 <label> CLName: </label>
253                                                         </div>
254                                                         <div class="form-group col-sm-3">
255                                                                 <input type="text" class="form-control"
256                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.clname"
257                                                                         placeholder="CLName" />
258                                                         </div>
259                                                 </div>
260                                                 <div class="form-group row" style="margin-left: 2%">
261                                                         <div class="form-group col-sm-3">
262                                                                 <label> Targets: </label>
263                                                                 <button type="button" class="btn btn-default"
264                                                                         ng-disabled="temp.policy.readOnly" ng-click="addNewTarget()">
265                                                                         <i class="fa fa-plus"></i>
266                                                                 </button>
267                                                         </div>
268                                                         <div class="form-group col-sm-4">
269                                                                 <div data-ng-repeat="choice in temp.policy.yamlparams.targets track by $index">
270                                                                         <div class="form-group row">
271                                                                         <div class="form-group col-sm-9">
272                                                                                 <input type="text" class="form-control"
273                                                                                 ng-disabled="temp.policy.readOnly"
274                                                                                 ng-model="temp.policy.yamlparams.targets[$index]" placeholder="Target" />
275                                                                         </div>
276                                                                         <div class="form-group col-sm-1">
277                                                                                 <button type="button" class="btn btn-default" ng-show="$last"
278                                                                                 ng-disabled="temp.policy.readOnly" ng-click="removeTarget()">
279                                                                                 <i class="fa fa-minus"></i>
280                                                                                 </button>
281                                                                         </div>
282                                                                         </div>
283                                                                 </div>
284                                                         </div>
285                                                 </div>
286                                                 <div class="form-group row" style="margin-left: 2%">
287                                                         <div class="form-group col-sm-3">
288                                                                 <label> limit: </label>
289                                                         </div>
290                                                         <div class="form-group col-sm-3">
291                                                                 <input type="text" class="form-control"
292                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.limit"
293                                                                         placeholder="Limit" title="Enter time limit value."/>
294                                                         </div>
295                                                 </div>
296                                                 <div class="form-group row" style="margin-left: 2%">
297                                                         <div class="form-group col-sm-3">
298                                                                 <label> timeWindow: </label>
299                                                         </div>
300                                                         <div class="form-group col-sm-2">
301                                                                 <input type="text" class="form-control"
302                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.timeWindow"
303                                                                         placeholder="Time Window" title="Enter time window value."/>
304                                                         </div>
305                                                         <div class="form-group col-sm-1">
306                                                                 <select class="form-control" ng-disabled="temp.policy.readOnly" 
307                                                                 ng-model="temp.policy.yamlparams.timeUnits" title="Select the Time Units value from dropdown options.">
308                                                                 <option>minute</option>
309                                                                 <option>hour</option>
310                                                                 <option>day</option>
311                                                                 <option>week</option>
312                                                                 <option>month</option>
313                                                                 <option>year</option>
314                                                                 </select>
315                                                         </div>
316                                                 </div>
317                                                 <div class="form-group row" style="margin-left: 2%">
318                                                         <div class="form-group col-sm-3">
319                                                                 <label> guardActiveStart: </label>
320                                                         </div>
321                                                         <div class="form-group col-sm-3">
322                                                                 <input type="text" class="form-control"
323                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart" title="Enter Guard Active Start value in following patren '00:00:00-05:00'."
324                                                                         placeholder="00:00:00-05:00" />
325                                                         </div>
326                                                 </div>
327                                                 <div class="form-group row" style="margin-left: 2%">
328                                                         <div class="form-group col-sm-3">
329                                                                 <label> guardActiveEnd: </label>
330                                                         </div>
331                                                         <div class="form-group col-sm-3">
332                                                                 <input type="text" class="form-control"
333                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd" title="Enter Guard Active End value in following patren '00:00:00-05:00'."
334                                                                         placeholder="00:00:00-05:00" />
335                                                         </div>
336                                                 </div>
337                                 </div>
338                         </div>
339                 </div>
340
341
342                 <div ng-if="temp.policy.ruleProvider == 'Custom'">
343                         <div class="well">
344                                 <div class="form-group row">
345                                         <div class="form-group col-sm-1">
346                                                 <label>Component Attributes:</label><br>
347                                                 <button type="button" class="btn btn-default"
348                                                         ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()" title="onClick Component Attribute row is added.">
349                                                         <i class="fa fa-plus"></i>
350                                                 </button>
351                                         </div>
352                                 </div>
353                                 <div class="form-group row">
354                                         <div data-ng-repeat="choice in temp.policy.attributes">
355                                                 <div class="form-group row" style="margin-left: 2%">
356                                                         <div class="form-group col-sm-3">
357                                                                 <select class="form-control" ng-disabled="temp.policy.readOnly"
358                                                                         ng-model="choice.key"
359                                                                         ng-options="option for option in attributeDictionaryDatas track by option" title="Select the dropdown value driven from Attribute (common)Dictionary.">
360                                                                         <option value="">{{choice.key}}</option>
361                                                                 </select>
362                                                         </div>
363                                                         <div class="form-group col-sm-3">
364                                                                 <input type="text" class="form-control"
365                                                                         ng-disabled="temp.policy.readOnly" ng-model="choice.value"
366                                                                         placeholder="Attribute Value" title="Enter the Attribute Value without any spaces and special characters"/>
367                                                         </div>
368                                                         <div class="form-group col-sm-1">
369                                                                 <button type="button" class="btn btn-default" ng-show="$last"
370                                                                         ng-disabled="temp.policy.readOnly" ng-click="removeChoice()" title="onClick will remove the last row">
371                                                                         <i class="fa fa-minus"></i>
372                                                                 </button>
373                                                         </div>
374                                                 </div>
375                                         </div>
376                                 </div>
377                         </div>
378                 </div>
379
380                 <div ng-if="temp.policy.ruleProvider == 'Custom'">
381                         <div class="well">
382                                 <div class="form-group row">
383                                         <div class="form-group col-sm-1">
384                                                 <label>Settings Attributes:</label><br>
385                                                 <button type="button" class="btn btn-default"
386                                                         ng-disabled="temp.policy.readOnly"
387                                                         ng-click="addNewSettingsChoice()" title="onClick Settings Attribute row is added.">
388                                                         <i class="fa fa-plus"></i>
389                                                 </button>
390                                         </div>
391                                 </div>
392                                 <div class="form-group row">
393                                         <div data-ng-repeat="settingschoice in temp.policy.settings">
394                                                 <div class="form-group row" style="margin-left: 2%">
395                                                         <div class="form-group col-sm-3">
396                                                                 <select class="form-control" ng-disabled="temp.policy.readOnly"
397                                                                         ng-model="settingschoice.key"
398                                                                         ng-options="option for option in settingsDictionaryDatas track by option" title="Select the dropdown value driven from Settings (Decision)Dictionary.">
399                                                                         <option value="">{{settingschoice.key}}</option>
400                                                                 </select>
401                                                         </div>
402                                                         <div class="form-group col-sm-3">
403                                                                 <input type="text" class="form-control"
404                                                                         ng-disabled="temp.policy.readOnly"
405                                                                         ng-model="settingschoice.value" placeholder="Settings Value" title="Enter the Settings Attribute Value without any spaces and special characters"/>
406                                                         </div>
407                                                         <div class="form-group col-sm-1">
408                                                                 <button type="button" class="btn btn-default" ng-show="$last"
409                                                                         ng-disabled="temp.policy.readOnly"
410                                                                         ng-click="removeSettingsChoice()" title="onClick will remove the last row">
411                                                                         <i class="fa fa-minus"></i>
412                                                                 </button>
413                                                         </div>
414                                                 </div>
415                                         </div>
416                                 </div>
417                         </div>
418                 </div>
419
420                 <div ng-if="temp.policy.ruleProvider == 'Custom'">
421                         <div class="well">
422                                 <label>Decision Rule Algorithms:<sup><b></b></sup></label><br>
423                                 <div class="form-group row">
424                                         <div class="form-group col-sm-1">
425                                                 <button type="button" class="btn btn-default"
426                                                         ng-disabled="temp.policy.readOnly"
427                                                         ng-click="addNewRuleAlgorithm()" title="onClick Rule Algorithms row is added.">
428                                                         <i class="fa fa-plus"></i>
429                                                 </button>
430                                         </div>
431                                 </div>
432                                 <div class="form-group row">
433                                         <div
434                                                 data-ng-repeat="ruleAlgorithmschoice in temp.policy.ruleAlgorithmschoices">
435                                                 <div class="form-group row" style="margin-left: 2%">
436                                                         <div class="form-group col-sm-1">
437                                                                 <label
438                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmLabels"
439                                                                         name="dynamicRuleAlgorithmLabels">{{ruleAlgorithmschoice.id}}</label>
440                                                         </div>
441                                                         <div class="form-group col-sm-3">
442                                                                 <select class="form-control" id="mySelect"
443                                                                         ng-disabled="temp.policy.readOnly"
444                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField1"
445                                                                         ng-options="option for option in attributeDictionaryDatas track by option"
446                                                                         name="dynamicRuleAlgorithmField1" title="Select the dropdown value driven from Attribute (common)Dictionary or Settings (Decision)Dictionary.">
447                                                                         <option value="">{{ruleAlgorithmschoice.dynamicRuleAlgorithmField1}}</option>
448                                                                 </select>
449                                                         </div>
450                                                         <div class="form-group col-sm-3">
451                                                                 <select type="text" class="form-control"
452                                                                         ng-disabled="temp.policy.readOnly"
453                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmCombo"
454                                                                         ng-options="option for option in functionDefinitionDatas track by option"
455                                                                         name="dynamicRuleAlgorithmCombo" title="Select the dropdown value driven from FunctionDataType."></select>
456                                                         </div>
457                                                         <div class="form-group col-sm-3">
458                                                                 <input type="text" class="form-control"
459                                                                         ng-disabled="temp.policy.readOnly"
460                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField2"
461                                                                         name="dynamicRuleAlgorithmField2" title="Enter the Value without any spaces and special characters and for rule formation use A1, A2,..etc., based on above Rules."/>
462                                                         </div>
463                                                         <div class="form-group col-sm-1">
464                                                                 <button type="button" class="btn btn-default"
465                                                                         ng-disabled="temp.policy.readOnly"
466                                                                         ng-click="removeRuleAlgorithm()" title="onClick will remove the last row">
467                                                                         <i class="fa fa-minus"></i>
468                                                                 </button>
469                                                         </div>
470                                                 </div>
471                                         </div>
472                                 </div>
473                         </div>
474                 </div>
475                 <br>
476                 <div id="validate" style="width: 70%"></div>
477                 <br>
478                 <div class="modal-footer">
479                         <button class="btn btn-primary" herf="javascript:void(0)"
480                                 ng-disabled="temp.policy.readOnly"
481                                 ng-click="validatePolicy(temp.policy);" title="Validate the data entered in the Policy fields.">Validate</button>
482                         <button class="btn btn-success" herf="javascript:void(0)"
483                                 ng-disabled="savebutton" ng-disabled="temp.policy.readOnly"
484                                 ng-click="saveDecisionPolicy(temp);" title="Save the Policy with validated data.">Save</button>
485                         <button type="button" class="btn btn-default" ng-click="refresh();" title="Close the template.">Close</button>
486                 </div>
487         </form>
488 </div>