@@ -77,7 +77,7 @@ <h3 class="modal-title text-center">Subscription Form</h3>
77
77
< input type ="hidden " value ="" name ="id " />
78
78
< div class ="form-body ">
79
79
80
- <!-- ko foreach: $root. subscription() -->
80
+ <!-- ko foreach: subscription -->
81
81
< div class ="form-group ">
82
82
< label class ="control-label col-md-3 "> SubscriptionName</ label >
83
83
< div class ="col-md-9 ">
@@ -134,49 +134,37 @@ <h3 class="modal-title text-center">Subscription Form</h3>
134
134
</ div >
135
135
</ div >
136
136
137
- <!-- ko foreach: $ data. requirements() -->
137
+ <!-- ko foreach: { data: requirements, as: 'requirements_item' } -->
138
138
< div class ="form-group ">
139
139
< label class ="control-label col-md-3 "> Requirements</ label >
140
140
< div class ="col-md-9 ">
141
141
142
- <!-- ko foreach: $data .conditions() -->
142
+ <!-- ko foreach: requirements_item .conditions -->
143
143
< div class ="form-group ">
144
144
< label class ="control-label col-md-3 "> Conditions</ label >
145
145
< div class ="col-md-9 ">
146
- < textarea data-toggle ="tooltip " title ="Write a Subscription Rule(JmePath) " data-bind ="textInput:$data.jmespath() " name ="jmespath " placeholder ="jmespath " class ="form-control " type ="text " />
147
- < span class ="help-block "> </ span >
148
- </ div >
149
- </ div >
150
-
151
- < div class ="form-group ">
152
- < label class ="control-label col-md-3 "> </ label >
153
- < div class ="col-md-9 ">
154
- < button data-toggle ="tooltip " title ="Delete condition " class ="btn btn-danger condition_delete " > < i class ="glyphicon glyphicon-trash "> </ i > Delete</ button >
146
+ < p data-bind ="text: $parentContext.$index() + ':' + $index() "> </ p >
147
+ < textarea data-toggle ="tooltip " title ="Write a Subscription Rule(JmePath) " data-bind ="textInput:$data.jmespath() " name ="jmespath " placeholder ="jmespath " class ="form-control " type ="text " />
148
+ < button data-bind ="click: function(data, event) { $root.delete_condition(data, event, requirements_item , $index(), $parentContext.$index() ); }, clickBubble: false " data-toggle ="tooltip " title ="Delete condition " class ="btn btn-danger float-right " > < i class ="glyphicon glyphicon-trash "> </ i > Delete</ button >
155
149
< span class ="help-block "> </ span >
156
150
</ div >
157
151
</ div >
158
152
159
153
160
- < div class ="form-group ">
161
- < label class ="control-label col-md-3 "> </ label >
162
- < div class ="col-md-9 ">
163
- < button data-bind ="click: $root.add_conditions_test, clickBubble: false " data-toggle ="tooltip " title ="Add a new condition " class ="btn btn-success "> < i class ="glyphicon glyphicon-plus "> </ i > Add Condition XX</ button >
164
- < span class ="help-block "> </ span >
165
- </ div >
166
- </ div >
167
154
<!-- /ko -->
168
155
169
156
</ div >
170
157
158
+ < button data-bind ="click: function(data, event) { $root.add_condition(data, event, $index()); }, clickBubble: false " data-toggle ="tooltip " title ="Add a new condition " class ="btn btn-success float-right "> < i class ="glyphicon glyphicon-plus "> </ i > Add Condition</ button >
171
159
172
160
173
161
174
162
175
163
</ div >
176
164
<!-- /ko -->
177
165
< div class ="container ">
178
- < button data-toggle ="tooltip " title ="Add a new condition " class ="btn btn-success add_condition "> < i class ="glyphicon glyphicon-plus "> </ i > Add Condition </ button >
179
- </ div >
166
+ < button data-bind =" click: $root.add_requirement, clickBubble: false " data- toggle ="tooltip " title ="Add a new requirement " class ="btn btn-success float-right "> < i class ="glyphicon glyphicon-plus "> </ i > Add Requirement </ button >
167
+ </ div >
180
168
181
169
182
170
<!-- /ko -->
@@ -207,109 +195,6 @@ <h3 class="modal-title text-center">Subscription Form</h3>
207
195
</ div >
208
196
209
197
210
- <!-- ko foreach: $root.subscription() -->
211
- < div class ="form-group ">
212
- < label class ="control-label col-md-3 "> SubscriptionName</ label >
213
- < div class ="col-md-9 ">
214
- < input data-toggle ="tooltip " title ="Specify a SubsciptionName " data-bind ="textInput:$data.subscriptionName " name ="subscriptionName " placeholder ="subscriptionName " class ="form-control " type ="text " />
215
- < span class ="help-block "> </ span >
216
- </ div >
217
- </ div >
218
- < div class ="form-group " data-bind ="visible: created() ">
219
- < label class ="control-label col-md-3 "> Created</ label >
220
- < div class ="col-md-9 ">
221
- < span data-toggle ="tooltip " title ="Specify the creation date " data-bind ="text:$data.created " name ="created " placeholder ="created " class ="form-control " type ="text " />
222
- < span class ="help-block "> </ span >
223
- </ div >
224
- </ div >
225
- < div class ="form-group ">
226
- < label class ="control-label col-md-3 "> Type</ label >
227
- < div class ="col-md-9 ">
228
- < span data-toggle ="tooltip " title ="Specify the creation date " data-bind ="text:$data.aggregationtype " name ="aggregationtype " placeholder ="aggregation_type " class ="form-control " type ="text " />
229
- < span class ="help-block "> </ span >
230
- </ div >
231
- </ div >
232
- < div class ="form-group ">
233
- < label class ="control-label col-md-3 "> NotificationType</ label >
234
- < div class ="col-md-9 ">
235
- < select data-toggle ="tooltip " title ="Choose a notification type " data-bind ="options: $root.notificationType_in,
236
- optionsText: 'text',
237
- optionsValue: 'value',
238
- value: $data.notificationType,
239
- optionsCaption: 'Choose...' "> </ select >
240
- </ div >
241
- </ div >
242
- < div class ="form-group ">
243
- < label class ="control-label col-md-3 "> NotificationMeta</ label >
244
- < div class ="col-md-9 ">
245
- < input data-toggle ="tooltip " title ="Specify notification meta data " data-bind ="textInput:$data.notificationMeta " name ="notificationMeta " placeholder ="notificationMeta " class ="form-control " type ="text " />
246
- < span class ="help-block "> </ span >
247
- </ div >
248
- </ div >
249
- < div class ="form-group ">
250
- < label class ="control-label col-md-3 "> Repeat</ label >
251
- < div class ="col-md-9 ">
252
- < select data-toggle ="tooltip " title ="Choose if to repeat or not to repeat " data-bind ="options: $root.repeat_in,
253
- optionsText: $data.repeat(),
254
- value: $data.repeat,
255
- optionsCaption: 'Choose...' "> </ select >
256
- < span class ="help-block "> </ span >
257
- </ div >
258
- </ div >
259
- < div class ="form-group ">
260
- < label class ="control-label col-md-3 "> NotificationMessage</ label >
261
- < div class ="col-md-9 ">
262
- < input data-toggle ="tooltip " title ="Choose a notification message " data-bind ="textInput:$data.notificationMessage " name ="notificationMessage " placeholder ="notificationMessage " class ="form-control " type ="text " />
263
- < span class ="help-block "> </ span >
264
- </ div >
265
- </ div >
266
-
267
- <!-- ko foreach: $data.requirements() -->
268
- < div class ="form-group ">
269
- < label class ="control-label col-md-3 "> Requirements</ label >
270
- < div class ="col-md-9 ">
271
-
272
- <!-- ko foreach: $data.conditions() -->
273
- < div class ="form-group ">
274
- < label class ="control-label col-md-3 "> Conditions</ label >
275
- < div class ="col-md-9 ">
276
- < textarea data-toggle ="tooltip " title ="Write a Subscription Rule(JmePath) " data-bind ="textInput:$data.jmespath() " name ="jmespath " placeholder ="jmespath " class ="form-control " type ="text " />
277
- < span class ="help-block "> </ span >
278
- </ div >
279
- </ div >
280
-
281
- < div class ="form-group ">
282
- < label class ="control-label col-md-3 "> </ label >
283
- < div class ="col-md-9 ">
284
- < button data-toggle ="tooltip " title ="Delete condition " class ="btn btn-danger condition_delete " > < i class ="glyphicon glyphicon-trash "> </ i > Delete</ button >
285
- < span class ="help-block "> </ span >
286
- </ div >
287
- </ div >
288
-
289
-
290
- < div class ="form-group ">
291
- < label class ="control-label col-md-3 "> </ label >
292
- < div class ="col-md-9 ">
293
- < button data-bind ="click: $root.add_conditions_test, clickBubble: false " data-toggle ="tooltip " title ="Add a new condition " class ="btn btn-success "> < i class ="glyphicon glyphicon-plus "> </ i > Add Condition XX</ button >
294
- < span class ="help-block "> </ span >
295
- </ div >
296
- </ div >
297
- <!-- /ko -->
298
-
299
- </ div >
300
-
301
-
302
-
303
-
304
-
305
- </ div >
306
- <!-- /ko -->
307
- < div class ="container ">
308
- < button data-toggle ="tooltip " title ="Add a new condition " class ="btn btn-success add_condition "> < i class ="glyphicon glyphicon-plus "> </ i > Add Condition</ button >
309
- </ div >
310
-
311
-
312
- <!-- /ko -->
313
198
314
199
315
200
</ body >
0 commit comments