Improved D3 task selection
diff --git a/exp_portal/templates/status.html b/exp_portal/templates/status.html
index 79546a9..b9397a9 100644
--- a/exp_portal/templates/status.html
+++ b/exp_portal/templates/status.html
@@ -345,14 +345,20 @@
<div class="selectTitle">Task</div>
<select name="tasks" id="tasksSelect">
<option value="all">All</option>
- {% for expObjKey, expObjVal in experimentVal.items %}
+ <!-- {% for expObjKey, expObjVal in experimentVal.items %}
{% if 'tasks' in expObjKey %}
{% for task in expObjVal %}
<option value="{{ task.name }}">{{ task.name }}</option>
{% endfor %}
{% endif %}
- {% endfor %}
+ {% endfor %} -->
</select>
+ {% for expObjKey, expObjVal in experimentVal.items %}
+ {% if 'tasklists' in expObjKey %}
+ <div id="tasklists" style="display:none;" data-tasklists="{{ expObjVal }}"></div>
+ {% endif %}
+ {% endfor %}
+
</div>
<div id="canvasD3" class="metricsSection active" data-experiment="{{ experimentName }}"></div>
</div>
diff --git a/exp_portal/views.py b/exp_portal/views.py
index cd970f8..32989b7 100644
--- a/exp_portal/views.py
+++ b/exp_portal/views.py
@@ -73,6 +73,7 @@
usp = sorted(userprofiles)
products = []
tasks = []
+ tasklists = {}
completedTasks = []
incompleteTasks = []
experimentList = {}
@@ -80,7 +81,13 @@
tasklistitems = userprofile.tasklistitem_set.all()
for tasklistitem in tasklistitems:
products.append(tasklistitem.product)
+ # tasklist[product][task]
+ # {"A":[t1, t2, t3], "B":[t4, t5], "C":[t6]}
tasks.append(tasklistitem.op_task)
+ if not (tasklistitem.product.name in tasklists):
+ tasklists[tasklistitem.product.name] = []
+ if not (tasklistitem.op_task.name in tasklists[tasklistitem.product.name]):
+ tasklists[tasklistitem.product.name].append(tasklistitem.op_task.name)
if tasklistitem.task_complete is True:
completedTasks.append(tasklistitem)
else:
@@ -97,6 +104,8 @@
experimentList["users"] = usp
experimentList["products"] = sortedProd
experimentList["tasks"] = sortedTasks
+ experimentList["tasklists"] = json.dumps(tasklists)
+ #experimentList["tasklists"] = tasklists
experimentList["completedTasks"] = sortedCompletedTasks
experimentList["incompleteTasks"] = sortedIncompleteTasks
experimentList["percentageComplete"] = percentageComplete
diff --git a/requirements.txt b/requirements.txt
index 7721621..3a89de4 100644
--- a/requirements.txt
+++ b/requirements.txt
@@ -22,5 +22,8 @@
python-dateutil==2.5.3
pytz==2015.6
requests==2.9.1
+simplejson==3.8.2
six==1.10.0
+Twisted==16.1.1
urllib3==1.10.4
+zope.interface==4.1.3
diff --git a/static/javascript/base.js b/static/javascript/base.js
index 993add3..b5160f7 100644
--- a/static/javascript/base.js
+++ b/static/javascript/base.js
@@ -112,7 +112,22 @@
var $this = $(this).parents(".expTray");
var experiment = $(this).parents(".experimentStatusRow").attr("id");
var category = $this.find(".metricsNavBtn.active").attr("data-category");
- var mparams = {"experiment":experiment,"tool":$this.find("#toolsSelect").val(),"task":$this.find("#tasksSelect").val(),"category":category};
+
+ var tasklists = JSON.parse($this.find("#tasklists").attr("data-tasklists"));
+
+ if($(this).attr("id")=="toolsSelect") {
+ // populate the task select
+ var toolName = $(this).val();
+ var opStr = '<option value="all" selected>All</option>';
+ if(toolName!="all" && tasklists[toolName]) {
+ for(var i=0; i<tasklists[toolName].length; i++) {
+ opStr += '<option value="'+tasklists[toolName][i]+'">'+tasklists[toolName][i]+'</option>';
+ }
+ }
+ $this.find("#tasksSelect").html(opStr);
+ }
+
+ var mparams = {"experiment":experiment,"tool":$this.find("#toolsSelect").val(),"task":$this.find("#tasksSelect").val(),"category":category};
//console.log(".metricsNavBtn experiment = ", mparams);
getHistData(experiment, category, JSON.stringify(mparams));