Commit 94d2cb1d authored by Nikhil Rane's avatar Nikhil Rane
Browse files

Fixed some PipeStudio parser and UI issues.

parent 35a12823
......@@ -334,10 +334,10 @@ module.exports = function(app, mongo, io, cookie, transporter) {
var currentStatement = "";
var operatorProps = pstudio_config.get(operator[TYPE_KEY]); //get all properties of *this* operator type
if(operator.type === "example.shape.Use_Predefined") {
if(operator.type === "pipestudio.shape.Use_Predefined") {
/* constructs: <operator_id>_output = macro_name */
currentStatement = operator[ID_KEY] + OUTPUT_KEY + EQUALS_KEY + operator.label;
} else if(operator.type === "example.shape.User_Defined") {
} else if(operator.type === "pipestudio.shape.User_Defined") {
currentStatement = DEFINE_KEY + operator.label;
} else {
/* constructs: <operator_id>_output = <operator> */
......@@ -386,10 +386,12 @@ module.exports = function(app, mongo, io, cookie, transporter) {
if( S(key).contains(COMMENT_KEY) ) { //if this is a comment, we enclose it within /*\n ... \n*/
currentStatement = COMMENT_START_KEY + value + COMMENT_END_KEY + NEW_LINE_KEY + currentStatement + NEW_LINE_KEY;
currentStatement = COMMENT_START_KEY + value + COMMENT_END_KEY + NEW_LINE_KEY + currentStatement;
} else {
currentStatement = currentStatement + BLANK_SPACE_KEY; //This \n removed because pipeflow complains about it
//put the value in () brackets if not already inside one, BELOW PART OF PUTTING () BRACKETS IS COMMENTED AS PIPEFLOW COMPLAINS ABOUT IT
if( operatorProps.parameters[key].bracketsRequired && S(value).trim().length > 0 && !S(value).startsWith(ROUND_OPEN_KEY) ) {
value = ROUND_OPEN_KEY + value;
......@@ -400,12 +402,10 @@ module.exports = function(app, mongo, io, cookie, transporter) {
currentStatement = currentStatement + key + BLANK_SPACE_KEY + value;
//if this is the last parameter, append a ';' otherwise append a new line character
if(j == params.length - 2) { //here it is '-2' because there is one "comment" parameter too
currentStatement = currentStatement + SEMI_COLON_KEY;
} else {
currentStatement = currentStatement + BLANK_SPACE_KEY; //This \n removed because pipeflow complains about it
}
}
if(j == params.length - 1) { //we are done with all parameters, so append semicolon.
currentStatement = currentStatement + SEMI_COLON_KEY + NEW_LINE_KEY;
}
}
......@@ -418,7 +418,7 @@ module.exports = function(app, mongo, io, cookie, transporter) {
// If it is user defined operator, we have to put it at the top
// so that the references below find it
if(operator.type === "example.shape.User_Defined") {
if(operator.type === "pipestudio.shape.User_Defined") {
statusVariables.finalString = currentStatement + statusVariables.finalString;
}
......
......@@ -60,9 +60,8 @@
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
<button type="button" class="btn btn-primary">OK</button>
<button type="button" class="btn btn-primary" data-dismiss="modal">Close</button>
</div>
</div><!-- /.modal-content -->
</div><!-- /.modal-dialog -->
</div><!-- /.modal -->
\ No newline at end of file
</div><!-- /.modal -->
if (!!!templates) var templates = {};
templates["FilterProps"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"propertiesModal\" class=\"modal fade\">");t.b("\n" + i);t.b(" <div class=\"modal-lg\">");t.b("\n" + i);t.b(" <div class=\"modal-content\">");t.b("\n" + i);t.b(" <div class=\"modal-header\">");t.b("\n" + i);t.b(" <button type=\"button\" class=\"close\" data-dismiss=\"modal\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <h4 class=\"modal-title\"><b>");t.b(t.v(t.f("label",c,p,0)));t.b("</b> Properties</h4>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"modal-body\">");t.b("\n");t.b("\n");t.b("\n" + i);t.b(" <script>");t.b("\n" + i);t.b(" $(document).ready(function() {");t.b("\n");t.b("\n" + i);if(t.s(t.f("paramList",c,p,1),c,p,0,561,636,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" $(\"#");t.b(t.v(t.f("paramID",c,p,0)));t.b("_text\").val('");t.b(t.t(t.f("paramValue",c,p,0)));t.b("'); ");t.b("\n" + i);});c.pop();}t.b("\n" + i);t.b(" });");t.b("\n");t.b("\n");t.b("\n" + i);t.b(" function byChanged() {");t.b("\n");t.b("\n" + i);t.b(" var val = $('#");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_text').val();");t.b("\n" + i);t.b(" if (val !== undefined && val !== null && val.trim().length > 0) {");t.b("\n" + i);t.b(" app.updateFigureParameter(\"by\", val);");t.b("\n" + i);t.b(" }");t.b("\n");t.b("\n" + i);t.b(" }");t.b("\n");t.b("\n");t.b("\n" + i);t.b(" function commentChanged() {");t.b("\n");t.b("\n" + i);t.b(" var val = $('#");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_text').val();");t.b("\n" + i);t.b(" if (val !== undefined && val !== null && val.trim().length > 0) {");t.b("\n" + i);t.b(" val = val.replace(/\\n/g, '\\\\n');");t.b("\n" + i);t.b(" app.updateFigureParameter(\"comment\", val);");t.b("\n" + i);t.b(" }");t.b("\n" + i);t.b(" }");t.b("\n" + i);t.b(" </script>");t.b("\n" + i);t.b(" <form id=\"");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_form\" role='form'>");t.b("\n" + i);t.b(" <br>");t.b("\n");t.b("\n" + i);t.b(" <!-- 'by' parameter section -->");t.b("\n" + i);t.b(" <div id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_div' class='form-group'>");t.b("\n" + i);t.b(" <label for='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_label'>by</label>");t.b("\n" + i);t.b(" <input id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_text' class='form-control' name='by' type='text' value='' onchange=\"byChanged()\" placeholder=\"You can directly enter all values here...\" />");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <br>");t.b("\n");t.b("\n" + i);t.b(" <!-- 'comment' parameter section -->");t.b("\n" + i);t.b(" <div id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_div' class='form-group'>");t.b("\n" + i);t.b(" <label for='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_label'>comment</label>");t.b("\n" + i);t.b(" <textarea id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_text' class='form-control' name='comment' value='' onchange=\"commentChanged()\" placeholder=\"Comment goes here...\" rows=\"3\"></textarea>");t.b("\n" + i);t.b(" </div>");t.b("\n");t.b("\n" + i);t.b(" <br />");t.b("\n");t.b("\n" + i);t.b(" </form>");t.b("\n");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"modal-footer\">");t.b("\n" + i);t.b(" <button type=\"button\" class=\"btn btn-default\" data-dismiss=\"modal\">Close</button>");t.b("\n" + i);t.b(" <button type=\"button\" class=\"btn btn-primary\">OK</button>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div><!-- /.modal-content -->");t.b("\n" + i);t.b(" </div><!-- /.modal-dialog -->");t.b("\n" + i);t.b("</div><!-- /.modal -->");return t.fl(); },partials: {}, subs: { }});
templates["FilterProps"] = new Hogan.Template({code: function (c,p,i) { var t=this;t.b(i=i||"");t.b("<div id=\"propertiesModal\" class=\"modal fade\">");t.b("\n" + i);t.b(" <div class=\"modal-lg\">");t.b("\n" + i);t.b(" <div class=\"modal-content\">");t.b("\n" + i);t.b(" <div class=\"modal-header\">");t.b("\n" + i);t.b(" <button type=\"button\" class=\"close\" data-dismiss=\"modal\"><span aria-hidden=\"true\">&times;</span><span class=\"sr-only\">Close</span>");t.b("\n" + i);t.b(" </button>");t.b("\n" + i);t.b(" <h4 class=\"modal-title\"><b>");t.b(t.v(t.f("label",c,p,0)));t.b("</b> Properties</h4>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"modal-body\">");t.b("\n");t.b("\n");t.b("\n" + i);t.b(" <script>");t.b("\n" + i);t.b(" $(document).ready(function() {");t.b("\n");t.b("\n" + i);if(t.s(t.f("paramList",c,p,1),c,p,0,561,636,"{{ }}")){t.rs(c,p,function(c,p,t){t.b(" $(\"#");t.b(t.v(t.f("paramID",c,p,0)));t.b("_text\").val('");t.b(t.t(t.f("paramValue",c,p,0)));t.b("'); ");t.b("\n" + i);});c.pop();}t.b("\n" + i);t.b(" });");t.b("\n");t.b("\n");t.b("\n" + i);t.b(" function byChanged() {");t.b("\n");t.b("\n" + i);t.b(" var val = $('#");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_text').val();");t.b("\n" + i);t.b(" if (val !== undefined && val !== null && val.trim().length > 0) {");t.b("\n" + i);t.b(" app.updateFigureParameter(\"by\", val);");t.b("\n" + i);t.b(" }");t.b("\n");t.b("\n" + i);t.b(" }");t.b("\n");t.b("\n");t.b("\n" + i);t.b(" function commentChanged() {");t.b("\n");t.b("\n" + i);t.b(" var val = $('#");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_text').val();");t.b("\n" + i);t.b(" if (val !== undefined && val !== null && val.trim().length > 0) {");t.b("\n" + i);t.b(" val = val.replace(/\\n/g, '\\\\n');");t.b("\n" + i);t.b(" app.updateFigureParameter(\"comment\", val);");t.b("\n" + i);t.b(" }");t.b("\n" + i);t.b(" }");t.b("\n" + i);t.b(" </script>");t.b("\n" + i);t.b(" <form id=\"");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_form\" role='form'>");t.b("\n" + i);t.b(" <br>");t.b("\n");t.b("\n" + i);t.b(" <!-- 'by' parameter section -->");t.b("\n" + i);t.b(" <div id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_div' class='form-group'>");t.b("\n" + i);t.b(" <label for='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_label'>by</label>");t.b("\n" + i);t.b(" <input id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_by_text' class='form-control' name='by' type='text' value='' onchange=\"byChanged()\" placeholder=\"You can directly enter all values here...\" />");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <br>");t.b("\n");t.b("\n" + i);t.b(" <!-- 'comment' parameter section -->");t.b("\n" + i);t.b(" <div id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_div' class='form-group'>");t.b("\n" + i);t.b(" <label for='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_label'>comment</label>");t.b("\n" + i);t.b(" <textarea id='");t.b(t.v(t.f("shapeID",c,p,0)));t.b("_comment_text' class='form-control' name='comment' value='' onchange=\"commentChanged()\" placeholder=\"Comment goes here...\" rows=\"3\"></textarea>");t.b("\n" + i);t.b(" </div>");t.b("\n");t.b("\n" + i);t.b(" <br />");t.b("\n");t.b("\n" + i);t.b(" </form>");t.b("\n");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" <div class=\"modal-footer\">");t.b("\n" + i);t.b(" <button type=\"button\" class=\"btn btn-primary\" data-dismiss=\"modal\">Close</button>");t.b("\n" + i);t.b(" </div>");t.b("\n" + i);t.b(" </div><!-- /.modal-content -->");t.b("\n" + i);t.b(" </div><!-- /.modal-dialog -->");t.b("\n" + i);t.b("</div><!-- /.modal -->");return t.fl(); },partials: {}, subs: { }});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment