Skip to content

Commit

Permalink
Adding dialog prompting user to select the correct number of inputs a…
Browse files Browse the repository at this point in the history
…nd output. Addresses #503
  • Loading branch information
alexsielicki committed Oct 29, 2015
1 parent d054af2 commit 7976aee
Showing 1 changed file with 43 additions and 30 deletions.
73 changes: 43 additions & 30 deletions web-server/plugins/slycat-cca/js/new-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
component.attributes = mapping.fromJS([]);
component.scale_inputs = ko.observable(true);
component.cca_type = ko.observable("local"); // local is selected by default...
component.row_count = ko.observable(null);

component.cancel = function() {
if(component.remote.sid())
Expand Down Expand Up @@ -57,6 +58,7 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
arrays: "0",
statistics: "0/...",
success: function(metadata) {
component.row_count(metadata.arrays[0].shape[0]); // Set number of rows
var attributes = [];
for(var i = 0; i != metadata.arrays[0].attributes.length; ++i)
{
Expand Down Expand Up @@ -156,36 +158,47 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
output_columns.push(i);
}

client.put_model_parameter({
mid: component.model._id(),
aid: "input-columns",
value: input_columns,
input: true,
success: function() {
client.put_model_parameter({
mid: component.model._id(),
aid: "output-columns",
value: output_columns,
input: true,
success: function() {
client.put_model_parameter({
mid: component.model._id(),
aid: "scale-inputs",
value: component.scale_inputs(),
input: true,
success: function() {
client.post_model_finish({
mid: component.model._id(),
success: function() {
component.tab(6);
}
});
}
});
}
});
}
});
if( input_columns.length > component.row_count() || output_columns.length > component.row_count() )
{
dialog.dialog({
message:"The number of outputs and inputs must be less than or equal to " + component.row_count() + ", because that is the number of rows in the data."
})();
}
else
{
client.put_model_parameter({
mid: component.model._id(),
aid: "input-columns",
value: input_columns,
input: true,
success: function() {
client.put_model_parameter({
mid: component.model._id(),
aid: "output-columns",
value: output_columns,
input: true,
success: function() {
client.put_model_parameter({
mid: component.model._id(),
aid: "scale-inputs",
value: component.scale_inputs(),
input: true,
success: function() {
client.post_model_finish({
mid: component.model._id(),
success: function() {
component.tab(6);
}
});
}
});
}
});
}
});
}


};

return component;
Expand Down

0 comments on commit 7976aee

Please sign in to comment.