[POLICY-67] Add new Rainy Day Decision Policy
[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 the Policy Name without any spaces" />
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                                 </div>
17                         </div>
18                         <div class="form-group row">
19                                 <div class="form-group col-sm-6">
20                                         <label>Ecomp Name:<sup><b>*</b></sup></label> <select
21                                                 class="form-control" ng-disabled="temp.policy.readOnly"
22                                                 ng-model="temp.policy.ecompName"
23                                                 ng-options="option for option in ecompNameDictionaryDatas track by option"
24                                                 required pattern="\S+" title="EcompName is required"></select>
25                                 </div>
26                                 <div class="form-group col-sm-6">
27                                         <label>Rule Provider:<sup><b>*</b></sup></label><select
28                                                 class="form-control" ng-disabled="temp.policy.readOnly"
29                                                 ng-model="temp.policy.ruleProvider"
30                                                 ng-init="providerListener(temp.policy.ruleProvider);"
31                                                 ng-click="providerListener(temp.policy.ruleProvider);">
32                                                 <option>Custom</option>
33                                                 <option>AAF</option>
34                                                 <option>Rainy_Day</option>
35                                                 <option>GUARD_YAML</option>
36                                                 <option>GUARD_BL_YAML<option>
37                                         </select>
38                                 </div>
39                         </div>
40                 </div>
41                 <div ng-if="temp.policy.ruleProvider == 'Rainy_Day'">
42                         <div class="well">
43                                 <div class="form-group row">
44                                         <div class="form-group row">
45                                                 <div class="form-group col-sm-1">
46                                                         <label>Service Type:<sup><b>*</b></sup></label>
47                                                 </div>
48                                                 <div class="form-group col-sm-2">
49                                                         <input type="text" class="form-control"
50                                                                 ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.serviceType"
51                                                                 placeholder="Service Type" />
52                                                 </div>
53                                                 <div class="form-group col-sm-1">
54                                                         <label>VNF Type:<sup><b>*</b></sup></label>
55                                                 </div>
56                                                 <div class="form-group col-sm-2">
57                                                         <input type="text" class="form-control"
58                                                                 ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.vnfType"
59                                                                 placeholder="VNF Type" />
60                                                 </div>
61                                                 <div class="form-group col-sm-1">
62                                                         <label>Building Block ID:<sup><b>*</b></sup></label>
63                                                 </div>
64                                                 <div class="form-group col-sm-2">
65                                                         <input type="text" class="form-control"
66                                                                 ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.bbid"
67                                                                 placeholder="Building Block ID" />
68                                                 </div>
69                                                 <div class="form-group col-sm-1">
70                                                         <label>Work Step:<sup><b>*</b></sup></label>
71                                                 </div>
72                                                 <div class="form-group col-sm-2">
73                                                         <input type="text" class="form-control"
74                                                                 ng-disabled="temp.policy.readOnly" ng-model="temp.policy.rainyday.workstep"
75                                                                 placeholder="Work Step" />
76                                                 </div>
77                                         </div>
78                                         <div class="form-group row">
79                                                 <div class="form-group col-sm-3">
80                                                         <label>Desired Automated Treatments:</label>
81                                                         <button type="button" class="btn btn-default"
82                                                                 ng-disabled="temp.policy.readOnly"
83                                                                 ng-click="addNewTreatment()">
84                                                                 <i class="fa fa-plus"></i>
85                                                         </button>
86                                                 </div>
87                                         </div>
88                                         <div class="form-group row">
89                                         <div data-ng-repeat="treatmentTableChoice in temp.policy.rainyday.treatmentTableChoices">
90                                                 <div class="form-group row" style="margin-left: 2%">
91                                                         <div class="form-group col-sm-1">
92                                                                 <label>Error Code:<sup><b>*</b></sup></label>
93                                                         </div>
94                                                         <div class="form-group col-sm-3">
95                                                                 <input type="text" class="form-control"
96                                                                         ng-disabled="temp.policy.readOnly"
97                                                                         ng-model="treatmentTableChoice.errorcode"
98                                                                         placeholder="Error Code" />
99                                                         </div>
100                                                         <div class="form-group col-sm-1">
101                                                                 <label>Desired Treatment:<sup><b>*</b></sup></label>
102                                                         </div>          
103                                                         <div class="form-group col-sm-3">                                               
104                                                                 <select class="form-control" id="mySelect"
105                                                                         ng-disabled="temp.policy.readOnly"
106                                                                         ng-model="treatmentTableChoice.treatment"
107                                                                         placeholder="Desired Treatment">
108 <!--                                                            <option value="">{{tableChoice.desiredtreatment}}</option> -->
109                                                                         <option>Rollback</option>
110                                                                         <option>Manual Handling</option>
111                                                                         <option>Abort</option>
112                                                                         <option>Auto Rollback</option>
113                                                                         <option>Retry</option>
114                                                                         <option>Skip</option>
115                                                                 </select>
116                                                         </div>
117                                                         <div class="form-group col-sm-1">
118                                                                 <button type="button" class="btn btn-default"
119                                                                         ng-disabled="temp.policy.readOnly"
120                                                                         ng-click="removeTreatment()">
121                                                                         <i class="fa fa-minus"></i>
122                                                                 </button>
123                                                         </div>
124                                                 </div>
125                                         </div>
126                                         </div>
127                                 </div>
128                         </div>
129                 </div>
130                 <div ng-if="temp.policy.ruleProvider == 'GUARD_BL_YAML'">
131                         <div class="well">
132                                 <div class="form-group row">
133                                         <div class="form-group col-sm-1">
134                                                 <label>Guard YAML Attributes:</label><br>
135                                         </div>
136                                 </div>
137                                 <div class="form-group row">
138                                                 <div class="form-group row" style="margin-left: 2%">
139                                                         <div class="form-group col-sm-3">
140                                                                 <label> actor: </label>
141                                                         </div>
142                                                         <div class="form-group col-sm-3">
143                                                                 <input type="text" class="form-control"
144                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.actor"
145                                                                         placeholder="Actor" />
146                                                         </div>
147                                                 </div>
148                                                 <div class="form-group row" style="margin-left: 2%">
149                                                         <div class="form-group col-sm-3">
150                                                                 <label> recipe: </label>
151                                                         </div>
152                                                         <div class="form-group col-sm-3">
153                                                                 <input type="text" class="form-control"
154                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.recipe"
155                                                                         placeholder="Recipe" />
156                                                         </div>
157                                                 </div>
158                                                 <div class="form-group row" style="margin-left: 2%">
159                                                         <div class="form-group col-sm-3">
160                                                                 <label> guardActiveStart: </label>
161                                                         </div>
162                                                         <div class="form-group col-sm-3">
163                                                                 <input type="text" class="form-control"
164                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart"
165                                                                         placeholder="00:00:00-05:00" />
166                                                         </div>
167                                                 </div>
168                                                 <div class="form-group row" style="margin-left: 2%">
169                                                         <div class="form-group col-sm-3">
170                                                                 <label> guardActiveEnd: </label>
171                                                         </div>
172                                                         <div class="form-group col-sm-3">
173                                                                 <input type="text" class="form-control"
174                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd"
175                                                                         placeholder="00:00:00-05:00" />
176                                                         </div>
177                                                 </div>
178                                                 <div class="form-group row" style="margin-left: 2%">
179                                                         <div class="form-group col-sm-3">
180                                                                 <label> BlackList: </label>
181                                                                 <button type="button" class="btn btn-default"
182                                                                         ng-disabled="temp.policy.readOnly" ng-click="addNewBL()">
183                                                                         <i class="fa fa-plus"></i>
184                                                                 </button>
185                                                         </div>
186                                                         <div class="form-group col-sm-4">
187                                                                 <div data-ng-repeat="choice in temp.policy.yamlparams.blackList track by $index">
188                                                                         <div class="form-group row">
189                                                                         <div class="form-group col-sm-9">
190                                                                                 <input type="text" class="form-control"
191                                                                                 ng-disabled="temp.policy.readOnly"
192                                                                                 ng-model="temp.policy.yamlparams.blackList[$index]" placeholder="BlackList" />
193                                                                         </div>
194                                                                         <div class="form-group col-sm-1">
195                                                                                 <button type="button" class="btn btn-default" ng-show="$last"
196                                                                                 ng-disabled="temp.policy.readOnly" ng-click="removeBL()">
197                                                                                 <i class="fa fa-minus"></i>
198                                                                                 </button>
199                                                                         </div>
200                                                                         </div>
201                                                                 </div>
202                                                         </div>
203                                                 </div>
204                                 </div>
205                         </div>
206                 </div>
207                 
208                 <div ng-if="temp.policy.ruleProvider == 'GUARD_YAML'">
209                         <div class="well">
210                                 <div class="form-group row">
211                                         <div class="form-group col-sm-1">
212                                                 <label>Guard YAML Attributes:</label><br>
213                                         </div>
214                                 </div>
215                                 <div class="form-group row">
216                                                 <div class="form-group row" style="margin-left: 2%">
217                                                         <div class="form-group col-sm-3">
218                                                                 <label> actor: </label>
219                                                         </div>
220                                                         <div class="form-group col-sm-3">
221                                                                 <input type="text" class="form-control"
222                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.actor"
223                                                                         placeholder="Actor" />
224                                                         </div>
225                                                 </div>
226                                                 <div class="form-group row" style="margin-left: 2%">
227                                                         <div class="form-group col-sm-3">
228                                                                 <label> recipe: </label>
229                                                         </div>
230                                                         <div class="form-group col-sm-3">
231                                                                 <input type="text" class="form-control"
232                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.recipe"
233                                                                         placeholder="Recipe" />
234                                                         </div>
235                                                 </div>
236                                                 <div class="form-group row" style="margin-left: 2%">
237                                                         <div class="form-group col-sm-3">
238                                                                 <label> limit: </label>
239                                                         </div>
240                                                         <div class="form-group col-sm-3">
241                                                                 <input type="text" class="form-control"
242                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.limit"
243                                                                         placeholder="Limit" />
244                                                         </div>
245                                                 </div>
246                                                 <div class="form-group row" style="margin-left: 2%">
247                                                         <div class="form-group col-sm-3">
248                                                                 <label> timeWindow: </label>
249                                                         </div>
250                                                         <div class="form-group col-sm-3">
251                                                                 <select class="form-control" ng-disabled="temp.policy.readOnly" 
252                                                                 ng-model="temp.policy.yamlparams.timeWindow">
253                                                                 <option>tw5min</option>
254                                                                 <option>tw10min</option>
255                                                                 <option>tw30min</option>
256                                                                 <option>tw1h</option>
257                                                                 <option>tw12h</option>
258                                                                 <option>tw1d</option>
259                                                                 <option>tw5d</option>
260                                                                 <option>tw1w</option>
261                                                                 <option>tw1mon</option>
262                                                                 </select>
263                                                         </div>
264                                                 </div>
265                                                 <div class="form-group row" style="margin-left: 2%">
266                                                         <div class="form-group col-sm-3">
267                                                                 <label> guardActiveStart: </label>
268                                                         </div>
269                                                         <div class="form-group col-sm-3">
270                                                                 <input type="text" class="form-control"
271                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveStart"
272                                                                         placeholder="00:00:00-05:00" />
273                                                         </div>
274                                                 </div>
275                                                 <div class="form-group row" style="margin-left: 2%">
276                                                         <div class="form-group col-sm-3">
277                                                                 <label> guardActiveEnd: </label>
278                                                         </div>
279                                                         <div class="form-group col-sm-3">
280                                                                 <input type="text" class="form-control"
281                                                                         ng-disabled="temp.policy.readOnly" ng-model="temp.policy.yamlparams.guardActiveEnd"
282                                                                         placeholder="00:00:00-05:00" />
283                                                         </div>
284                                                 </div>
285                                 </div>
286                         </div>
287                 </div>
288
289
290                 <div ng-if="temp.policy.ruleProvider == 'Custom'">
291                         <div class="well">
292                                 <div class="form-group row">
293                                         <div class="form-group col-sm-1">
294                                                 <label>Component Attributes:</label><br>
295                                                 <button type="button" class="btn btn-default"
296                                                         ng-disabled="temp.policy.readOnly" ng-click="addNewChoice()">
297                                                         <i class="fa fa-plus"></i>
298                                                 </button>
299                                         </div>
300                                 </div>
301                                 <div class="form-group row">
302                                         <div data-ng-repeat="choice in temp.policy.attributes">
303                                                 <div class="form-group row" style="margin-left: 2%">
304                                                         <div class="form-group col-sm-3">
305                                                                 <select class="form-control" ng-disabled="temp.policy.readOnly"
306                                                                         ng-model="choice.key"
307                                                                         ng-options="option for option in attributeDictionaryDatas track by option">
308                                                                         <option value="">{{choice.key}}</option>
309                                                                 </select>
310                                                         </div>
311                                                         <div class="form-group col-sm-3">
312                                                                 <input type="text" class="form-control"
313                                                                         ng-disabled="temp.policy.readOnly" ng-model="choice.value"
314                                                                         placeholder="Attribute Value" />
315                                                         </div>
316                                                         <div class="form-group col-sm-1">
317                                                                 <button type="button" class="btn btn-default" ng-show="$last"
318                                                                         ng-disabled="temp.policy.readOnly" ng-click="removeChoice()">
319                                                                         <i class="fa fa-minus"></i>
320                                                                 </button>
321                                                         </div>
322                                                 </div>
323                                         </div>
324                                 </div>
325                         </div>
326                 </div>
327
328                 <div ng-if="temp.policy.ruleProvider == 'Custom'">
329                         <div class="well">
330                                 <div class="form-group row">
331                                         <div class="form-group col-sm-1">
332                                                 <label>Settings Attributes:</label><br>
333                                                 <button type="button" class="btn btn-default"
334                                                         ng-disabled="temp.policy.readOnly"
335                                                         ng-click="addNewSettingsChoice()">
336                                                         <i class="fa fa-plus"></i>
337                                                 </button>
338                                         </div>
339                                 </div>
340                                 <div class="form-group row">
341                                         <div data-ng-repeat="settingschoice in temp.policy.settings">
342                                                 <div class="form-group row" style="margin-left: 2%">
343                                                         <div class="form-group col-sm-3">
344                                                                 <select class="form-control" ng-disabled="temp.policy.readOnly"
345                                                                         ng-model="settingschoice.key"
346                                                                         ng-options="option for option in settingsDictionaryDatas track by option">
347                                                                         <option value="">{{settingschoice.key}}</option>
348                                                                 </select>
349                                                         </div>
350                                                         <div class="form-group col-sm-3">
351                                                                 <input type="text" class="form-control"
352                                                                         ng-disabled="temp.policy.readOnly"
353                                                                         ng-model="settingschoice.value" placeholder="Settings Value" />
354                                                         </div>
355                                                         <div class="form-group col-sm-1">
356                                                                 <button type="button" class="btn btn-default" ng-show="$last"
357                                                                         ng-disabled="temp.policy.readOnly"
358                                                                         ng-click="removeSettingsChoice()">
359                                                                         <i class="fa fa-minus"></i>
360                                                                 </button>
361                                                         </div>
362                                                 </div>
363                                         </div>
364                                 </div>
365                         </div>
366                 </div>
367
368                 <div ng-if="temp.policy.ruleProvider == 'Custom'">
369                         <div class="well">
370                                 <label>Decision Rule Algorithms:<sup><b></b></sup></label><br>
371                                 <div class="form-group row">
372                                         <div class="form-group col-sm-1">
373                                                 <button type="button" class="btn btn-default"
374                                                         ng-disabled="temp.policy.readOnly"
375                                                         ng-click="addNewRuleAlgorithm()">
376                                                         <i class="fa fa-plus"></i>
377                                                 </button>
378                                         </div>
379                                 </div>
380                                 <div class="form-group row">
381                                         <div
382                                                 data-ng-repeat="ruleAlgorithmschoice in temp.policy.ruleAlgorithmschoices">
383                                                 <div class="form-group row" style="margin-left: 2%">
384                                                         <div class="form-group col-sm-1">
385                                                                 <label
386                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmLabels"
387                                                                         name="dynamicRuleAlgorithmLabels">{{ruleAlgorithmschoice.id}}</label>
388                                                         </div>
389                                                         <div class="form-group col-sm-3">
390                                                                 <select class="form-control" id="mySelect"
391                                                                         ng-disabled="temp.policy.readOnly"
392                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField1"
393                                                                         ng-options="option for option in attributeDictionaryDatas track by option"
394                                                                         name="dynamicRuleAlgorithmField1">
395                                                                         <option value="">{{ruleAlgorithmschoice.dynamicRuleAlgorithmField1}}</option>
396                                                                 </select>
397                                                         </div>
398                                                         <div class="form-group col-sm-3">
399                                                                 <select type="text" class="form-control"
400                                                                         ng-disabled="temp.policy.readOnly"
401                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmCombo"
402                                                                         ng-options="option for option in functionDefinitionDatas track by option"
403                                                                         name="dynamicRuleAlgorithmCombo"></select>
404                                                         </div>
405                                                         <div class="form-group col-sm-3">
406                                                                 <input type="text" class="form-control"
407                                                                         ng-disabled="temp.policy.readOnly"
408                                                                         ng-model="ruleAlgorithmschoice.dynamicRuleAlgorithmField2"
409                                                                         name="dynamicRuleAlgorithmField2" />
410                                                         </div>
411                                                         <div class="form-group col-sm-1">
412                                                                 <button type="button" class="btn btn-default"
413                                                                         ng-disabled="temp.policy.readOnly"
414                                                                         ng-click="removeRuleAlgorithm()">
415                                                                         <i class="fa fa-minus"></i>
416                                                                 </button>
417                                                         </div>
418                                                 </div>
419                                         </div>
420                                 </div>
421                         </div>
422                 </div>
423                 <br>
424                 <div id="validate" style="width: 70%"></div>
425                 <br>
426                 <div class="modal-footer">
427                         <button class="btn btn-primary" herf="javascript:void(0)"
428                                 ng-disabled="temp.policy.readOnly"
429                                 ng-click="validatePolicy(temp.policy);">Validate</button>
430                         <button class="btn btn-success" herf="javascript:void(0)"
431                                 ng-disabled="savebutton" ng-disabled="temp.policy.readOnly"
432                                 ng-click="saveDecisionPolicy(temp);">Save</button>
433                         <button type="button" class="btn btn-default" ng-click="refresh();">Close</button>
434                 </div>
435         </form>
436 </div>