Commit e1f475c5 authored by Piers Williams's avatar Piers Williams

Added a save model button

parent a2697a55
Pipeline #894 passed with stages
in 20 seconds
......@@ -11,7 +11,14 @@ function setupDoc(){
frame.attr("width", 800);
frame.attr("height", 600);
frame.attr("src", $(this).attr('data-src'));
});
}
function setupSave(){
$("#saveBtn").on('click', function(e){
var model = buildModelString();
console.log("MODEL", model);
$("#modelSaveText").text(model);
});
}
......@@ -185,18 +192,22 @@ function doStuffGraph(){
}
}
function buildModelString(){
var ruleList = [];
$("#agent .list-group-item .ruleid").each(function(x, i) {
ruleList.push(i.innerHTML);
});
var model = ruleList.join(",");
return model;
}
function buildAgent() {
if (testPending) {
return;
}
testPending = true;
$("#testBtn .fa-spinner").css("display", "inline");
var ruleList = [];
$("#agent .list-group-item .ruleid").each(function(x, i) {
ruleList.push(i.innerHTML);
});
var model = ruleList.join(",");
var model = buildModelString();
models.unshift(model);
if(models.length > 4){
models.pop();
......@@ -217,4 +228,4 @@ var allData = [];
var tableData = [];
var models = [];
$(document).ready(function(){loadAndDisplay();doStuffGraph();filterInit();});
$(document).ready(function(){loadAndDisplay();doStuffGraph();filterInit();setupSave();});
......@@ -24,6 +24,7 @@
<ul class="list-inline pull-right">
<li><a href="#" id="testBtn" onclick="buildAgent()" class="btn btn-default"><i class="fa fa-spinner fa-spin fa-fw" style="display: none" aria-hidden="true"></i> Test</a></li>
<li><a href="#" class="btn btn-primary">Submit</a></li>
<li><a href="#" class="btn btn-success" id="saveBtn" data-toggle="modal" data-target="#saveModal">Save Model</a></li>
</ul>
</div>
<div class="col-md-6">
......@@ -104,6 +105,20 @@
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<div class="modal fade" tabindex="-1" role="dialog" id="saveModal">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<h4 class="modal-title">Save Model</h4>
</div>
<div class="modal-body">
<p id="modelSaveText"> Exporting Model ... </p>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
<script src="assets/js/loadAndDisplayRules.js"></script>
<script type="text/javascript">
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment