Commit 9c4651a0 authored by Jérome Perrin's avatar Jérome Perrin

show how to integrate KE in the GUI

parent e94c4f34
......@@ -138,6 +138,22 @@ def getGUIInstance():
def getConfigurationDict():
return jsonify(getGUIInstance().getConfigurationDict())
@app.route("/runKnowledgeExtraction", methods=["POST", "OPTIONS"])
def runKnowledgeExtraction():
parameter_dict = request.json['json']
# TODO: really run knowledge extraction and change values:
import time
time.sleep(.2)
parameter_dict['general']['trace'] = "ahah"
parameter_dict['nodes']['M1']['processingTime'] = {
'distributionType': 'Normal',
'stdev': 1.23,
'max': 123
}
return jsonify(parameter_dict)
def main(*args):
parser = argparse.ArgumentParser(description='Launch the DREAM simulation platform.')
parser.add_argument('gui_class', metavar='GUI_KLASS', nargs="?", default="Default",
......
......@@ -37,6 +37,9 @@
<form id="import_form" style="display:none">
<input id="import_file" name="file" type="file"></input>
</form>
<a id="run_knowledge_extraction">
<i class="fa fa-spinner fa-spin" id="ke_loading_spinner" style="display:none"></i>
Run Knowledge Extraction</a>
<a id="run_simulation">
<i class="fa fa-spinner fa-spin" id="loading_spinner" style="display:none"></i>
Run Simulation</a>
......
......@@ -153,6 +153,30 @@
});
});
// Enable "Run Knowledge Extraction" button
$("#run_knowledge_extraction").button().click(
function (e) {
$("#run_knowledge_extraction").button('disable');
$("#ke_loading_spinner").show();
$.ajax(
'/runKnowledgeExtraction', {
data: JSON.stringify({
json: dream_instance.getData()
}),
contentType: 'application/json',
type: 'POST',
success: function (data, textStatus, jqXHR) {
loadData(data);
$("#ke_loading_spinner").hide();
$("#run_knowledge_extraction").button('enable');
},
error: function() {
$("#ke_loading_spinner").hide();
$("#run_knowledge_extraction").button('enable');
}
});
}
)
// Enable "Run Simulation" button
$("#run_simulation").button().click(
......
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