Skip to content

Commit 1637869

Browse files
Add usage information in test rules (#110)
1 parent 827b4bd commit 1637869

File tree

4 files changed

+103
-25
lines changed

4 files changed

+103
-25
lines changed

src/main/resources/static/css/style.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,3 +193,26 @@ input:checked + .slider:before {
193193
width: 100%;
194194
}
195195
}
196+
197+
button.rules_info {
198+
text-align: center;
199+
max-height: auto;
200+
max-width: auto;
201+
margin: 0px;
202+
padding: 0px;
203+
background: white;
204+
border: none;
205+
}
206+
207+
button.rules_info:active {
208+
outline: none;
209+
}
210+
211+
button.rules_info:focus {
212+
outline:0;
213+
outline:none;
214+
}
215+
216+
#infoContent{
217+
font: 16px "Calibri";
218+
}

src/main/resources/static/js/testrules.js

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,7 @@
22
var frontendServiceUrl;
33
var i = 0;
44
var isReplacing = true;
5-
var ruleTemplate = {
6-
"TemplateName" : "",
7-
"Type" : "",
8-
"TypeRule" : "",
9-
"IdRule" : "",
10-
"StartEvent" : "",
11-
"IdentifyRules" : "",
12-
"MatchIdRules" : {},
13-
"ExtractionRules" : "",
14-
"DownstreamIdentifyRules" : "",
15-
"DownstreamMergeRules" : "",
16-
"DownstreamExtractionRules" : "",
17-
"ArrayMergeOptions" : "",
18-
"HistoryIdentifyRules" : "",
19-
"HistoryExtractionRules" : "",
20-
"HistoryPathRules" : "",
21-
"ProcessRules" : null,
22-
"ProcessFunction" : null
23-
};
5+
246
jQuery(document).ready(
257
function() {
268

@@ -168,6 +150,14 @@ jQuery(document).ready(
168150
return self;
169151
}
170152

153+
//Create information modal
154+
$(".container").on("click", "button.rules_info", function(event) {
155+
event.stopPropagation();
156+
event.preventDefault();
157+
$('#infoContent').text(test_rule_info);
158+
$('#infoModal').modal('show');
159+
});
160+
171161
var vm = new AppViewModel();
172162
ko.applyBindings(vm, $("#submitButton")[0]);
173163
ko.applyBindings(vm, $("#testRulesDOMObject")[0]);
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
// Short usage description of test rules
2+
var test_rule_info = '1. Load buttons are for loading rules/events from external files.\n' +
3+
' It is possible to choose if you want to append or replace\n' +
4+
' aready written rules/events in the text areas.\n'+
5+
' * The file content should be formatted as JSON objects in\n' +
6+
' a JSON list, ex. [{Object1}, {Object2}].\n' +
7+
'\n2. By clicking on "Get Template" buttons you will download rules\n' +
8+
' respective events template. Rule´s template contains 3 rules\n' +
9+
' and event´s template contains 3 events.\n'+
10+
'\n3. Add buttons are for adding new rules/events. When you click\n' +
11+
' on one of them, a new text area will show up.\n'+
12+
' * There can be only one JSON object per text area. One\n' +
13+
' rule/event per text area.\n' +
14+
'\n4. Download buttons are for downloading edited rules/events.\n'+
15+
' * This enables you to edit rules/events locally and\n' +
16+
' then upload them using above mentioned load rules/\n' +
17+
' events buttons.\n' +
18+
'\n5. "Clear All" buttons remove all rules respective events. It\n' +
19+
' is possible to remove single rule/event by clicking on trash\n' +
20+
' can button next to specific text area.\n'+
21+
'\n6. Clicking on "Find Aggregated Object" button will start\n' +
22+
' the aggregation process. If rules and events are correct,\n' +
23+
' a pop up window with the aggregated object will show up on\n' +
24+
' the screen.\n' +
25+
'\nFor more information visit:';
26+
27+
// Default template for rules
28+
var ruleTemplate = {
29+
"TemplateName" : "",
30+
"Type" : "",
31+
"TypeRule" : "",
32+
"IdRule" : "",
33+
"StartEvent" : "",
34+
"IdentifyRules" : "",
35+
"MatchIdRules" : {},
36+
"ExtractionRules" : "",
37+
"DownstreamIdentifyRules" : "",
38+
"DownstreamMergeRules" : "",
39+
"DownstreamExtractionRules" : "",
40+
"ArrayMergeOptions" : "",
41+
"HistoryIdentifyRules" : "",
42+
"HistoryExtractionRules" : "",
43+
"HistoryPathRules" : "",
44+
"ProcessRules" : null,
45+
"ProcessFunction" : null
46+
};

src/main/resources/templates/testRules.html

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<meta name="author" content="" />
1010
<script type="text/javascript" src="js/testrules.js"></script>
1111
<script type="text/javascript" src="js/downloadFile.js"></script>
12+
<script type="text/javascript" src="resources/testRules_constants.js"></script>
1213
</head>
1314

1415
<body>
@@ -38,9 +39,6 @@ <h1 id="test_rules_header">Test Rules</h1>
3839
<i class="fa fa-fw fa-trash"></i>
3940
</button>
4041
</div>
41-
<div>
42-
<img class="cursor-pointer" id="uploadRulesInfo" alt="Upload Information" src="assets/images/information.png" data-toggle="tooltip" data-placement="top" title="Upload rules must be in a json list, Ex: [{},{}]"/>
43-
</div>
4442
</div>
4543
<div class="col-12 pt-2">
4644
<h3>Rules</h3>
@@ -83,9 +81,6 @@ <h6>
8381
<i class="fa fa-fw fa-trash"></i>
8482
</button>
8583
</div>
86-
<div>
87-
<img class="cursor-pointer" id="uploadEventsInfo" alt="Upload Information" src="assets/images/information.png" data-toggle="tooltip" data-placement="top" title="Upload events must be in a json list, Ex: [{},{}]"/>
88-
</div>
8984
</div>
9085
<div class="col-12 pt-2">
9186
<h3>Events</h3>
@@ -118,6 +113,9 @@ <h6>
118113
</div>
119114
<div class="col-4 text-center">
120115
<button class="btn btn-success find_aggregated_object white-space-normal" data-bind="click : $root.submit.bind($data)">Find Aggregated Object</button>
116+
<button class="rules_info">
117+
<img src="assets/images/information.png"/>
118+
</button>
121119
</div>
122120
<div class="col-4">
123121
<button class="btn btn-success download_events white-space-normal float-right">
@@ -159,5 +157,26 @@ <h5 class="modal-title">Aggregated Object</h5>
159157
</div>
160158
</div>
161159
</div>
160+
<div id="infoModal" class="modal fade" role="dialog">
161+
<div class="modal-dialog" role="document">
162+
<div class="modal-content">
163+
<div class="modal-header">
164+
<h5 class="modal-title">Usage Information</h5>
165+
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
166+
<span aria-hidden="true">&times;</span>
167+
</button>
168+
</div>
169+
<div class="modal-body modal-height-fit">
170+
<p id="infoContent" class="pre"></p>
171+
<div class="text-center">
172+
<a href="https://github.com/eiffel-community/eiffel-intelligence/blob/master/wiki/TestRulesUserGuide.md" target="_blank" rel="noopener noreferrer" style="text-decoration: none;">Test Rules User Guide</a>
173+
</div>
174+
</div>
175+
<div class="modal-footer">
176+
<button type="button" class="btn btn-secondary" data-dismiss="modal">Close</button>
177+
</div>
178+
</div>
179+
</div>
180+
</div>
162181
</body>
163182
</html>

0 commit comments

Comments
 (0)