diff --git a/web-server/plugins/slycat-cca/js/new-ui.js b/web-server/plugins/slycat-cca/js/new-ui.js index eade25ce8..02a320b1f 100644 --- a/web-server/plugins/slycat-cca/js/new-ui.js +++ b/web-server/plugins/slycat-cca/js/new-ui.js @@ -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 { diff --git a/web-server/plugins/slycat-cca/js/rerun-ui.js b/web-server/plugins/slycat-cca/js/rerun-ui.js index 161033572..4510105a3 100644 --- a/web-server/plugins/slycat-cca/js/rerun-ui.js +++ b/web-server/plugins/slycat-cca/js/rerun-ui.js @@ -15,6 +15,7 @@ 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(), @@ -22,7 +23,7 @@ define(["slycat-server-root", "slycat-web-client", "slycat-dialog", "knockout", 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) { @@ -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;