2 ============LICENSE_START=======================================================
3 Copyright (C) 2016-2018 Ericsson. All rights reserved.
4 ================================================================================
5 Licensed under the Apache License, Version 2.0 (the "License");
6 you may not use this file except in compliance with the License.
7 You may obtain a copy of the License at
9 http://www.apache.org/licenses/LICENSE-2.0
11 Unless required by applicable law or agreed to in writing, software
12 distributed under the License is distributed on an "AS IS" BASIS,
13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 See the License for the specific language governing permissions and
15 limitations under the License.
17 SPDX-License-Identifier: Apache-2.0
18 ============LICENSE_END=========================================================
21 <!-- http://localhost:3904/events/toApex -->
25 <script src="http://code.jquery.com/jquery-latest.js"></script>
27 $(document).ready(function() {
28 $("#answerspost").click(function(e) {
29 var elements = document.getElementById("answerform").elements;
31 var formValues = new Object;
32 formValues["name"] = "AnswerEvent";
33 for (var i = 0, element; element = elements[i++];) {
34 if (element.type === "text" && element.value != "") {
35 formValues[element.name] = element.value;
38 console.log(formValues);
39 var stringifiedForm = JSON.stringify(formValues);
40 console.log(stringifiedForm);
43 url : "http://localhost:3904/events/toApex",
44 data : stringifiedForm,
46 contentType : "application/json; charset=utf-8",
47 success : function(data) {
48 alert("Answers Set Successfully !!!");
50 failure : function(errMsg) {
54 e.preventDefault(); //STOP default action
60 $(document).ready(function() {
61 $("#modepost").click(function(e) {
62 var elements = document.getElementById("modeform").elements;
64 var formValues = new Object;
65 formValues["name"] = "MakeDecisionEvent";
66 for (var i = 0, element; element = elements[i++];) {
67 if (element.type === "radio" && element.checked) {
68 formValues[element.name] = element.value;
71 console.log(formValues);
72 var stringifiedForm = JSON.stringify(formValues);
73 console.log(stringifiedForm);
76 url : "http://localhost:3904/events/toApex",
77 data : stringifiedForm,
79 contentType : "application/json; charset=utf-8",
80 success : function(data) {
81 alert("Decision Taken: " + data.decision);
83 failure : function(errMsg) {
87 e.preventDefault(); //STOP default action
94 <h3>Decision Maker Answers</h3>
95 <form name="answerform" id="answerform" method="POST">
98 <td>First Answer:</td>
99 <td><input type="text" name="a0" value="Never Ever" /></td>
102 <td>Second Answer:</td>
103 <td><input type="text" name="a1" value="No" /></td>
106 <td>Third Answer:</td>
107 <td><input type="text" name="a2" value="Maybe not" /></td>
110 <td>Fourth Answer</td>
111 <td><input type="text" name="a3" value="Wait" /></td>
114 <td>Fifth Answer:</td>
115 <td><input type="text" name="a4" value="Maybe" /></td>
118 <td>Sixth Answer:</td>
119 <td><input type="text" name="a5" value="Yes" /></td>
122 <td>Seventh Answer:</td>
123 <td><input type="text" name="a6" value="Absolutely" /></td>
127 <td><input type="button" class="btn btn-info" id="answerspost"
128 value="Set Answers"></td>
132 <h3>Decision Maker Mode</h3>
133 <form name="modeform" id="modeform" method="POST">
136 <td><input name="mode" type="radio" value="random"
137 checked="checked">random</td>
138 <td><input name="mode" type="radio" value="pessimistic">pessimistic</td>
139 <td><input name="mode" type="radio" value="optimistic">
141 <td><input name="mode" type="radio" value="dithering">dithering</td>
142 <td><input name="mode" type="radio" value="roundrobin">round
150 <td><input type="button" class="btn btn-info" id="modepost"
151 value="Make Decision"></td>