forked from rwth-acis/OCD-Web-Client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmarks.html
179 lines (169 loc) · 7.64 KB
/
benchmarks.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
<!DOCTYPE html>
<!--
Benchmarks
-->
<html>
<head>
<title>OCD - Benchmarks</title>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" type="text/css" href="node_modules/bootstrap/dist/css/bootstrap.min.css">
<link rel="stylesheet" type="text/css" href="CSS/layout.css">
<script src="//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="//npmcdn.com/[email protected]/dist/js/tether.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js"></script>
<script src="node_modules/bootstrap/dist/js/bootstrap.min.js"></script>
<script src="JS/contentHandler.js"></script>
<script src="node_modules/js-base64/base64.js"></script>
<script src="JS/ServiceAPI/moduleHelper.js"></script>
<script src="JS/ServiceAPI/serviceAPI.js"></script>
<script src="JS/requestHandler.js"></script>
<script type="text/javascript">
/* Benchmark Names */
var benchmarkNames;
/* Document load handler */
$(document).ready(function() {
/* Obtains benchmark names */
getBenchmarkNames(function() {
/* Adds benchmark names to select */
$(benchmarkNames).find('Name').each(function() {
if($(this).text() !== 'UNDEFINED' && $(this).text() !== 'REAL_WORLD')
$("#benchmark").append(
'<option value="' + $(this).text()
+ '">' + $(this).attr("displayName") + '</option>');
});
});
/* Registers parameter select */
registerParameterSelect("#benchmark", "#benchmarkParamsRow", getBenchmarkParameters);
/*
* Submit form handler
* Reads in parameters and starts benchmark execution
* */
$("#runBenchmarkForm").submit(function( event ) {
event.preventDefault();
var benchmark = $('#benchmark').val();
if(benchmark !== getSelectOptionVal()) {
var params = getParameterXml("#benchmarkParamsRow");
var coverName = $("#coverName").val();
var graphName = $("#graphName").val();
if(graphName === "") {
console.log("nograph");
showErrorMessage('Please define a graph name.');
return;
}
if(coverName === "") {
showErrorMessage('Please define a cover name.');
return;
}
/* Send benchmark execution request */
sendRequest("post", "graphs/benchmarks?benchmark=" + benchmark + "&graphName=" + graphName + "&coverName=" + coverName, params,
/* Response handler */
function(response) {
window.location.href = 'index.html';
},
/* Error handler */
function(errorData) {
/*
* GraphIds request failed
*/
showConnectionErrorMessage("Benchmark request failed.", errorData);
});
}
return false;
});
});
/*
* Requests and stores benchmark names.
*/
function getBenchmarkNames(callback) {
/* Requests benchmark names */
sendRequest("get", "benchmarks", "",
/* Response handler */
function(response) {
/* Saves names */
benchmarkNames = response;
if(typeof callback !== 'undefined') {
callback();
}
},
/* Error handler */
function(errorData) {
/*
* GraphIds request failed
*/
showConnectionErrorMessage("Benchmark names were not received.", errorData);
});
}
/*
* Requests parameter names for a given benchmark
* and passes them to a callback function.
*/
function getBenchmarkParameters(benchmarkName, callback) {
/*
* Requests parameters names.
*/
sendRequest("get", "benchmarks/" + benchmarkName + "/parameters/default", "",
/* Response handler */
function(response) {
if(typeof callback !== 'undefined') {
callback(response);
}
},
/* Error handler */
function(errorData) {
/*
* GraphIds request failed
*/
showConnectionErrorMessage("Benchmark parameters were not received.", errorData);
});
}
</script>
</head>
<body>
<div id="wrapper">
<div id="contentWrapper">
<div id="content">
<!-- Error Messages Container -->
<div id="errorMessageWrapper">
<div id="errorMessage"></div>
</div>
<!-- Page Header -->
<div class="page-header graphColor">
<h3>Benchmark</h3>
</div>
<div class="container-fluid">
<!-- Benchmark Form -->
<form id="runBenchmarkForm">
<div class="">
<!-- Benchmark Types -->
<div class="form-group">
<label for="benchmark" class="col-form-label">Benchmark</label>
<select id="benchmark" class="form-control custom-select"></select>
</div>
<!-- Benchmark Parameters -->
<div class="" id="benchmarkParamsRow">
</div>
<!-- Name for the graph to be created -->
<div class="form-group">
<label for="graphName" class="col-form-label">Graph Name</label>
<input id="graphName" type="text" class="form-control" placeholder="graph name">
</div>
<!-- Name for the cover to be created -->
<div class="form-group">
<label for="coverName" class="col-form-label">Cover Name</label>
<input id="coverName" type="text" class="form-control" placeholder="cover name">
</div>
<div class="form-group row">
<div class="col-sm-10">
<button name="submit" type="submit" class="btn btn-primary">Run Benchmark</button>
</div>
</div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</body>
</html>