Added provider checkbox

This commit is contained in:
Mokaddem 2016-08-15 15:16:31 +02:00
parent f90987d284
commit 82f70e61f4
2 changed files with 29 additions and 12 deletions

View file

@ -468,13 +468,27 @@ def sentiment_analysis_getplotdata():
@app.route("/sentiment_analysis_plot_tool/") @app.route("/sentiment_analysis_plot_tool/")
def sentiment_analysis_plot_tool(): def sentiment_analysis_plot_tool():
return render_template("sentiment_analysis_plot_tool.html") return render_template("sentiment_analysis_plot_tool.html")
@app.route("/sentiment_analysis_plot_tool_getdata/")
def sentiment_analysis_plot_tool_getdata():
getProviders = request.args.get('getProviders')
if getProviders:
providers = []
for cur_provider in r_serv_charts.smembers('providers_set'):
providers.append(cur_provider)
return jsonify(providers)
else:
return 0
@app.route("/showsavedpaste/") #completely shows the paste in a new tab @app.route("/showsavedpaste/") #completely shows the paste in a new tab
def showsavedpaste(): def showsavedpaste():
return showpaste(0) return showpaste(0)

View file

@ -75,21 +75,13 @@
<!-- providers charts --> <!-- providers charts -->
<div class="col-lg-6"> <div class="col-lg-6">
<div class="sparkLineStats"> <div class="sparkLineStats">
<ul> <ul id="providerList1">
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 1</label></li>
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 2</label></li>
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 3</label></li>
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 4</label></li>
</ul> </ul>
</div> </div>
</div> </div>
<div class="col-lg-6"> <div class="col-lg-6">
<div class="sparkLineStats"> <div class="sparkLineStats">
<ul> <ul id="providerList2">
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 5</label></li>
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 6</label></li>
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 7</label></li>
<li><div class="checkbox"></div><label><input value="" type="checkbox"></input> Provider 8</label></li>
</ul> </ul>
</div> </div>
</div> </div>
@ -147,6 +139,17 @@
$(document).ready(function(){ $(document).ready(function(){
activePage = $('h1.page-header').attr('data-page'); activePage = $('h1.page-header').attr('data-page');
$("#"+activePage).addClass("active"); $("#"+activePage).addClass("active");
var li_text = "<li><div class='checkbox'></div><label class='provider'><input value='' type='checkbox'></input> "
var li_text_end = "</label></li>"
$.getJSON('/sentiment_analysis_plot_tool_getdata/?getProviders=True', function(data){
console.log(data);
for(i=0; i<data.length; i++){
var providerList = i%2 == 0 ? '#providerList1' : '#providerList2';
$(providerList).append(li_text + data[i] + li_text_end);
}
});
var today = Date.now(); var today = Date.now();
var old_day = today - (31*24*60*60)*1000; var old_day = today - (31*24*60*60)*1000;