Skip to content

Commit

Permalink
Adding prompt to rerun interface. Addresses #503
Browse files Browse the repository at this point in the history
  • Loading branch information
alexsielicki committed Oct 29, 2015
1 parent 7976aee commit 45d504c
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 33 deletions.
7 changes: 5 additions & 2 deletions web-server/plugins/slycat-cca/js/new-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,11 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
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."
})();
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. You have selected " + input_columns.length +
" inputs and " + output_columns.length + " outputs."

});
}
else
{
Expand Down
75 changes: 44 additions & 31 deletions web-server/plugins/slycat-cca/js/rerun-ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
});
component.attributes = mapping.fromJS([]);
component.scale_inputs = ko.observable(false);
component.row_count = ko.observable(null);

client.get_model_arrayset_metadata({
mid: component.original._id(),
aid: "data-table",
arrays: "0",
statistics: "0/...",
success: function(metadata) {
console.log(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 @@ -126,44 +127,56 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout",
output_columns.push(i);
}

client.put_model_parameter(
if( input_columns.length > component.row_count() || output_columns.length > component.row_count() )
{
mid: component.model._id(),
aid: "input-columns",
value: input_columns,
input: true,
success: function()
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. You have selected " + input_columns.length +
" inputs and " + output_columns.length + " outputs."

});
}
else
{
client.put_model_parameter(
{
client.put_model_parameter(
mid: component.model._id(),
aid: "input-columns",
value: input_columns,
input: true,
success: function()
{
mid: component.model._id(),
aid: "output-columns",
value: output_columns,
input: true,
success: function()
client.put_model_parameter(
{
client.put_model_parameter(
mid: component.model._id(),
aid: "output-columns",
value: output_columns,
input: true,
success: function()
{
mid: component.model._id(),
aid: "scale-inputs",
value: component.scale_inputs(),
input: true,
success: function()
client.put_model_parameter(
{
client.post_model_finish(
mid: component.model._id(),
aid: "scale-inputs",
value: component.scale_inputs(),
input: true,
success: function()
{
mid: component.model._id(),
success: function()
client.post_model_finish(
{
component.tab(2);
}
});
}
});
}
});
}
});
mid: component.model._id(),
success: function()
{
component.tab(2);
}
});
}
});
}
});
}
});
}
}

return component;
Expand Down

0 comments on commit 45d504c

Please sign in to comment.