Skip to content

Commit

Permalink
Updating UI for rerunning CCA models to go directly to new model when…
Browse files Browse the repository at this point in the history
… generated. Clicking green checkbox goes directly to model. Using different colors for null waveforms depending on selected colormap.
  • Loading branch information
alexsielicki committed May 21, 2014
1 parent 874e5ad commit 690d9e5
Show file tree
Hide file tree
Showing 5 changed files with 100 additions and 10 deletions.
11 changes: 11 additions & 0 deletions web-server/js/color-switcher.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ $.widget("slycat.colorswitcher",
{
"label": "Night",
"background": d3.rgb("#333333"),
"null_color": "gray",
"opacity": "0.5",
"colors":
[
Expand Down Expand Up @@ -63,6 +64,7 @@ $.widget("slycat.colorswitcher",
{
"label": "Day",
"background": d3.rgb(255, 255, 255),
"null_color": "gray",
"opacity": "0.7",
"colors":
[
Expand Down Expand Up @@ -105,6 +107,7 @@ $.widget("slycat.colorswitcher",
{
"label": "Rainbow",
"background": d3.rgb(128, 128, 128),
"null_color": "rgb(75,75,75)",
"opacity": "0.6",
"colors":
[
Expand Down Expand Up @@ -164,6 +167,14 @@ $.widget("slycat.colorswitcher",
return this.color_maps[name].background;
},

// Return the null color value for the given color map.
get_null_color: function(name)
{
if(name === undefined)
name = this.options.colormap;
return this.color_maps[name]["null_color"];
},

// Return the suggested opacity value for the given color map.
get_opacity: function(name)
{
Expand Down
8 changes: 4 additions & 4 deletions web-server/js/timeseries-waveformplot.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ $.widget("timeseries.waveformplot",
highlight : [],
color_array : null,
color_scale : null,
nullWaveformColor: "#666655",
nullWaveformColor: "gray",
nullWaveformDasharray: "5,5",
},

Expand Down Expand Up @@ -185,7 +185,7 @@ $.widget("timeseries.waveformplot",
if (self.options.color_scale != null && self.options.color_array != null && self.options.color_array[ d["input-index"] ] !== null)
return self.options.color_scale( self.options.color_array[ d["input-index"] ] );
else
return self.options.nullWaveformColor;
return $("#color-switcher").colorswitcher("get_null_color");
})
.style("stroke-dasharray", function(d,i){
if (self.options.color_array != null && self.options.color_array[ d["input-index"] ] !== null)
Expand Down Expand Up @@ -329,7 +329,7 @@ $.widget("timeseries.waveformplot",
if (self.options.color_scale != null && self.options.color_array != null && self.options.color_array[ d["input-index"] ] !== null)
return self.options.color_scale( self.options.color_array[ d["input-index"] ] );
else
return self.options.nullWaveformColor;
return $("#color-switcher").colorswitcher("get_null_color");
})
.style("stroke-dasharray", function(d,i){
if (self.options.color_array != null && self.options.color_array[ d["input-index"] ] !== null)
Expand Down Expand Up @@ -405,7 +405,7 @@ $.widget("timeseries.waveformplot",
if (self.options.color_scale != null && self.options.color_array != null && self.options.color_array[ d["input-index"] ] !== null)
return self.options.color_scale( self.options.color_array[ d["input-index"] ] );
else
return self.options.nullWaveformColor;
return $("#color-switcher").colorswitcher("get_null_color");
})
.style("stroke-dasharray", function(d,i){
if (self.options.color_array != null && self.options.color_array[ d["input-index"] ] !== null)
Expand Down
4 changes: 4 additions & 0 deletions web-server/style/model-cca.css
Original file line number Diff line number Diff line change
Expand Up @@ -275,4 +275,8 @@ rights in this software.
}
.barplotHeaderColumn.mask.col0 {
vertical-align: top;
}
#rerun-cca-running {
text-align: center;
margin-top: 20px;
}
11 changes: 9 additions & 2 deletions web-server/templates/header.mustache
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,8 @@
{
return $("<div class='worker'>")
.attr('id', model["_id"])
.append($("<div>").addClass("message").click(function(e){window.location= "{{server-root}}models/" + model["_id"];}))
.append($("<div>").addClass("name").click(function(e){window.location= "{{server-root}}models/" + model["_id"];}))
.append($("<div>").addClass("message").click(function(e){window.location="{{server-root}}models/" + model["_id"];}))
.append($("<div>").addClass("name").click(function(e){window.location="{{server-root}}models/" + model["_id"];}))
.append($("<div>").addClass("close").append($("<button>").html("&times;").attr("title", "Close model.").click(close_model.bind(this, model["_id"]))))
.qtip({
position: {
Expand Down Expand Up @@ -161,6 +161,13 @@
(model["name"] || "")
);
if(model["finished"]) {
line.click(function(e){
window.location="{{server-root}}models/" + model["_id"];
e.stopPropagation();
});
}
if( $('#workers-container').hasClass('workersDetail') ) {
disable_tooltips(line);
}
Expand Down
76 changes: 72 additions & 4 deletions web-server/templates/model-cca3.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,15 @@ <h2>{{name}}</h2>
<p><input id="rerun-cca-scale-inputs" type="checkbox"></input>Scale inputs to unit variance.</p>
</div>
</div>

<div id="rerun-cca-running">
<p>Your model is being generated.</p>
<div id="model-progress">
<input class="modelPie" value="1" />
</div>
<p>You can close this dialog and watch top status bar for a green checkmark to see when it completes.</p>
<p>If you leave this dialog open, we will take you to the model as soon as it's generated.</p>
</div>
</div>


Expand Down Expand Up @@ -468,6 +477,7 @@ <h2>{{name}}</h2>
{
$("#rerun-cca-basics").css("display", "block");
$("#rerun-cca-parameters").css("display", "none");
$("#rerun-cca-running").css("display", "none");
$(".ui-dialog-buttonpane button:contains('Previous')").button("disable");
$(".ui-dialog-buttonpane button:contains('Next')").button("enable");
$(".ui-dialog-buttonpane button:contains('Run')").button("disable");
Expand Down Expand Up @@ -627,9 +637,21 @@ <h2>{{name}}</h2>
url : "{{server-root}}models/" + rerun_cca_model + "/finish",
success: function(result)
{
var mid = rerun_cca_model;
rerun_cca_model = null;
window.alert("Model scheduled for generation. Watch the worker pane to see when it completes.");
$("#rerun-cca-form").dialog("close");
$(".ui-dialog-buttonpane button:contains('Next')").button("disable");
$(".ui-dialog-buttonpane button:contains('Run')").button("disable");
$(".ui-dialog-buttonpane button:contains('Previous')").button("disable");
$(".ui-dialog-buttonpane button:contains('Cancel')").button({ label: "Close" });
$("#rerun-cca-basics").css("display", "none");
$("#rerun-cca-parameters").css("display", "none");

window.modelGenerationTimeout = setTimeout(function(){
get_model_status(mid, process_model_status);
}, 1000);

//window.alert("Model scheduled for generation. Watch the worker pane to see when it completes.");
//$("#rerun-cca-form").dialog("close");
},
error: function(request, status, reason_phrase)
{
Expand All @@ -638,11 +660,57 @@ <h2>{{name}}</h2>
});
},
Cancel : function(){
clearTimeout(window.modelGenerationTimeout);
$(this).dialog("close");
}
}
},
},
});

function process_model_status(results) {
if(results.finished === null) {
$("#rerun-cca-running").css("display", "block");
var modelPie = $("#model-progress .modelPie");
modelPie.knob({
'min':0,
'max':1,
'readOnly':true,
'displayInput':false,
'fgColor':'#4D720C',
'bgColor':'#D7D7D6',
'width':200,
'height':200,
'thickness':0.35,
'step':0.01,
});
modelPie.val(results["progress"]).trigger('change');
window.modelGenerationTimeout = setTimeout(function(){
get_model_status(results._id, process_model_status);
}, 1000);
}
else {
window.location = "{{server-root}}models/" + results._id;
}
}

function get_model_status(mid, callback)
{
$.ajax(
{
dataType : "json",
type : "GET",
cache : false, // Don't cache this request; otherwise, the browser will display the JSON if the user leaves this page then returns.
url : "{{server-root}}models/" + mid,
success : function(results)
{
callback(results);
},
error : function(request, status, reason_phrase)
{
callback(reason_phrase);
},
});
}

$("#rerun-cca-all-inputs-on").button().click(function()
{
$(".rerun-cca-input-variable").attr("checked", "checked");
Expand Down

0 comments on commit 690d9e5

Please sign in to comment.