diff --git a/kadmos/vistoms/static/lib/vistoms.css b/kadmos/vistoms/static/lib/vistoms.css index e7217f42ce1ee13a2272fc2641544a86ff07a0b5..5acab2b8e43d5525b035e0184af91b3fb319cff4 100644 --- a/kadmos/vistoms/static/lib/vistoms.css +++ b/kadmos/vistoms/static/lib/vistoms.css @@ -1,3 +1,59 @@ +.graph_menu { + font-family:Arial; + font-size:16pt; +} +.graph_menu *{margin: 0; padding: 0;} +.graph_menu {margin-left: 0px} +.graph_menu nav{margin-left: 0px; margin-top: 10} +.graph_menu ul{list-style: none;} + +.graph_menu ul li{ width: 250px; background: #555555; float: left; height: 45px; line-height: 45px; text-align: left; margin-right: 2px; position: relative;} +.graph_menu ul li:hover{ background: #888;} +.graph_menu ul li a{color: #fff; text-decoration: none; padding-left: 6px; font-family: sans-serif; display: block;} +.graph_menu ul li ul li{ border-top: 1px solid #fff;} +.graph_menu ul li ul{display: none;} +.graph_menu ul li:hover ul{ display: block;} + +.graph_menu ul li ul .data_model_view{position: absolute; left: 248px; top: 0; display: none;} +.graph_menu ul li ul .data_model_view li{width: 120px} +.graph_menu ul li ul li:hover .data_model_view{display: block;} + +.graph_menu ul li ul li ul .view_options{position: absolute; left: 118px; top: 0; display: none;} +.graph_menu ul li ul li ul .view_options li{width: 220px} +.graph_menu ul li ul li ul li:hover .view_options{display: block;} + +.graph_menu ul li ul .check_graph{position: absolute; left: 248px; top: 0; display: none;} +.graph_menu ul li ul .check_graph li{width: 300px} +.graph_menu ul li ul li:hover .check_graph{display: block;} + +.graph_menu ul li ul .fpg_manipulations{position: absolute; left: 248px; top: 0; display: none;} +.graph_menu ul li ul .fpg_manipulations li{width: 420px} +.graph_menu ul li ul li:hover .fpg_manipulations{display: block;} + +.graph_menu ul li ul li ul .merge{position: absolute; left: 418px; top: 0; display: none;} +.graph_menu ul li ul li ul .merge li{width: 300px} +.graph_menu ul li ul li ul li:hover .merge{display: block;} + +.graph_menu ul li ul li ul .remove{position: absolute; left: 418px; top: 0; display: none;} +.graph_menu ul li ul li ul .remove li{width: 220px} +.graph_menu ul li ul li ul li:hover .remove{display: block;} + +.graph_menu ul li ul li ul .assign{position: absolute; left: 418px; top: 0; display: none;} +.graph_menu ul li ul li ul .assign li{width: 230px} +.graph_menu ul li ul li ul li:hover .assign{display: block;} + +.graph_menu ul li ul .mdpg_manipulations{position: absolute; left: 248px; top: 0; display: none;} +.graph_menu ul li ul .mdpg_manipulations li{width: 460px} +.graph_menu ul li ul li:hover .mdpg_manipulations{display: block;} + +.graph_menu ul li ul li ul .set{position: absolute; left: 458px; top: 0; display: none;} +.graph_menu ul li ul li ul .set li{width: 250px} +.graph_menu ul li ul li ul li:hover .set{display: block;} + + + + + #myInput { font-family:Arial; font-size:12pt; @@ -408,7 +464,7 @@ stroke-width: 1.5px; border-radius: 4px; font-family: Arial; font-size: 16pt; - width: 300px; + width: 350px; border: 1px solid #d4d4d4; z-index:1200; } diff --git a/kadmos/vistoms/templates/VISTOMS.html b/kadmos/vistoms/templates/VISTOMS.html index 535836523c9b18d26f6407de7459f417fd9f48a1..27404cc748c21c3d465cfe93bb6585f0d83dce26 100644 --- a/kadmos/vistoms/templates/VISTOMS.html +++ b/kadmos/vistoms/templates/VISTOMS.html @@ -828,6 +828,7 @@ } }); kadmosHavePatience(xhr, bootboxContent) + d3.selectAll(".form-content").remove(); } } ] @@ -19048,6 +19049,11 @@ function preMarkVariable(variableData) { markedVariables.push(variableData) + bootbox.hideAll(); + var bootboxContent = {title: 'Pre-assign parameter role', message: "<p><b>Successfully pre-assigned parameter.</b></p>" + +"<p>To actually assign the parameter role you have to press the <b>'Assign parameter roles'</b> button from the <b>'FPG Manipulations'</b> menu." + +"<p>Note: You can first premark all parameters and the assign them altogether to save time</p>"}; + kadmosSuccessMessage(bootboxContent) } function markVariable(variableData_arr) @@ -19380,14 +19386,14 @@ childrenItems: [] }, { - title: 'Mark variable', + title: 'Pre-assign parameter', onMouseDown: function(elm, d, i) {}, onMouseUp: function(elm, d, i) {}, onMouseOver: function(elm, d, i) {}, childrenItems: markingOptions }, { - title: 'Unmark variable', + title: 'Un-assign parameter role', onMouseDown: function(elm, d, i) { bootbox.hideAll(); bootbox.confirm("Are you sure you want to do this?", function(sure) @@ -20116,77 +20122,116 @@ { if (fileType) { - if (fileType.includes("VISTOMS")) { - bootbox.prompt( - { - title: "<p>The graph will be saved as new VISTOMS graph</p>" - +"<p>Please type in the name of the new graph!</p>", - value: currentGraph.name, - callback: function(newGraphName) - { - if (newGraphName!=null) - { - var bootboxContent = {title: "Save as new VISTOMS graph", message: '<p>Please be patient...</p>'}; - var newGraphID = "" - if (data.graphs.length<100){newGraphID="0"+String(data.graphs.length+1)} - else {newGraphID=String(data.graphs.length+1)} - - var newGraphID = '01'; - data.graphs.forEach(function(graph) - { - id_int = parseInt(graph.id) - if (data.graphs.length < 100){newGraphID = "0" + String(id_int+1);} - else{newGraphID = String(id_int+1);} - }) - - var xhr = $.ajax( - { - type: 'POST', - data: {'graphID': graphID, 'newGraphID': newGraphID, 'newGraphName': newGraphName, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - url: '/kadmos_save_vistoms_graph', - success: function(result) + bootbox.hideAll(); + var html = d3.select("html") + var form_content = html.append("div").attr("class","form-content").attr("style","display:none") + var form = form_content.append("form").attr("class","form").attr("role","form") + var form_group, input; + + //Tool information + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Name") + input = form_group.append("input") + .attr("id","graph_name") + .attr("class","form-control") + .attr("name","graph_name") + .attr("placeholder","Add a graph name here...") + //Tool information + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Description") + input = form_group.append("input") + .attr("id","graph_description") + .attr("class","form-control") + .attr("name","graph_description") + .attr("placeholder","Add a graph description here...") + + bootbox.dialog({ + message: $(".form-content").html(), + title: "<p>The graph will be saved as new VISTOMS graph" + +"<p>Please type in a new name and description for the graph</p>", + size: "large", + buttons: [ + { + label: "Cancel", + className: "btn btn-default pull-left", + callback: function() { + d3.selectAll(".form-content").remove(); + } + }, + { + label: "OK", + className: "btn btn-primary pull-left", + callback: function() { + + //get form data + var graph_name = $('form #graph_name').val(); + var graph_description = $('form #graph_description').val(); + + + var bootboxContent = {title: "Save as new VISTOMS graph", message: '<p>Please be patient...</p>'}; + var newGraphID = "" + if (data.graphs.length<100){newGraphID="0"+String(data.graphs.length+1)} + else {newGraphID=String(data.graphs.length+1)} + + var newGraphID = '01'; + data.graphs.forEach(function(graph) { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else + id_int = parseInt(graph.id) + if (data.graphs.length < 100){newGraphID = "0" + String(id_int+1);} + else{newGraphID = String(id_int+1);} + }) + + var xhr = $.ajax( + { + type: 'POST', + data: {'graphID': graphID, 'newGraphID': newGraphID, 'newGraphName': graph_name, 'newGraphDesc': graph_description, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + url: '/kadmos_save_vistoms_graph', + success: function(result) { - var updatedData = jQuery.extend(true, {}, data); - var graphData = JSON.parse(result); - - for (var i = 0; i < data.graphs.length; i++) + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else { - if (graphID == data.graphs[i].id) + var updatedData = jQuery.extend(true, {}, data); + var graphData = JSON.parse(result); + + for (var i = 0; i < data.graphs.length; i++) { - //Insert copied graph behind the original one - updatedData.graphs.splice(i+1, 0, graphData.graphs[0]) + if (graphID == data.graphs[i].id) + { + //Insert copied graph behind the original one + updatedData.graphs.splice(i+1, 0, graphData.graphs[0]) + } } + + + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,newGraphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) } - - - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,newGraphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - } - }) + }); + kadmosHavePatience(xhr, bootboxContent) + d3.selectAll(".form-content").remove(); + } + } + ] + }); + } else { @@ -20478,22 +20523,108 @@ }); } + //aigner: Function adds or edits a competence's metadata function editDCMetadata(theData, theCurrentGraph, aNode=null) { bootbox.hideAll(); + //aigner: Initialize the metadata element and it's sub components var metadata; if (aNode != null) { - metadata = aNode.metadata; - } - + metadata = JSON.parse(JSON.stringify(aNode.metadata)); + } + console.log(aNode.metadata) + + //aigner: Initialize sub component "general_info" + if (typeof metadata.general_info == "undefined" + || metadata.general_info == null) + { + metadata.general_info = {owner:{},creator:{},operator:{}}; + if (typeof metadata.general_info.description == "undefined"){metadata.general_info.description = ""} + if (typeof metadata.general_info.status == "undefined"){metadata.general_info.status = ""} + if (typeof metadata.general_info.owner.contactUID == "undefined"){metadata.general_info.owner.contactUID = ""} + if (typeof metadata.general_info.creator.contactUID == "undefined"){metadata.general_info.creator.contactUID = ""} + if (typeof metadata.general_info.operator.contactUID == "undefined"){metadata.general_info.operator.contactUID = ""} + + } + //aigner: Initialize sub component "performance_info" + if (typeof metadata.performance_info == "undefined" + || metadata.performance_info == null) + { + metadata.performance_info = {}; + if (typeof metadata.performance_info.precision == "undefined"){metadata.performance_info.precision = ""} + if (typeof metadata.performance_info.fidelity_level == "undefined"){metadata.performance_info.fidelity_level = "-"} + if (typeof metadata.performance_info.run_time == "undefined"){metadata.performance_info.run_time = ""} + if (typeof metadata.performance_info.verification == "undefined"){metadata.performance_info.verification = ""} + } + //aigner: Initialize sub component "execution_info" + //This is somewhat more complicated, since it can be either a "local_component" or a "remote_component" + var local_component_info = [[[],[]]] + local_component_info[0][1] = { + command: "", + description: "", + hardware_requirements: "", + software_requirements: "", + integration_platform: ""} + var remote_component_info = { + data_exchange_settings: {folder:"", urlsite:""}, + job_settings: { + job_name:"", + notification_message:"", + remote_engineer:{contact_u_i_d:""}, + single_or_multi_execution:"" + } + } + if (typeof metadata.execution_info == "undefined" + || metadata.execution_info == null) + { + metadata.execution_info = {} + } + //aigner: Set type of component to "none" initially + metadata.execution_info.component_type = "none"; + if (typeof metadata.execution_info.remote_component_info == "undefined") + { + metadata.execution_info.remote_component_info = remote_component_info + } + else + { + metadata.execution_info.component_type = "remote"; + } + if (typeof metadata.execution_info.local_component_info == "undefined") + { + metadata.execution_info.local_component_info = local_component_info + } + else + { + metadata.execution_info.component_type = "local"; + } + //aigner: Initialize sub component "licensing" + if (typeof metadata.general_info.licensing == "undefined" + || metadata.general_info.licensing == null) + { + metadata.general_info.licensing = {}; + if (typeof metadata.general_info.licensing.license_type == "undefined"){metadata.general_info.licensing.license_type = ""} + if (typeof metadata.general_info.licensing.license_specification == "undefined"){metadata.general_info.licensing.license_specification = ""} + if (typeof metadata.general_info.licensing.license_info == "undefined"){metadata.general_info.licensing.license_info = ""} + } + //aigner: Initialize sub component "sources" + if (typeof metadata.general_info.sources == "undefined" + || metadata.general_info.sources == null) + { + metadata.general_info.sources = {}; + if (typeof metadata.general_info.sources.repository_link == "undefined"){metadata.general_info.sources.repository_link = ""} + if (typeof metadata.general_info.sources.download_link == "undefined"){metadata.general_info.sources.download_link = ""} + if (typeof metadata.general_info.sources.references == "undefined"){metadata.general_info.sources.references = ""} + } + + //aigner. Now make the previously initialized infos visible in the html page with the help of a bootbox pop-up var html = d3.select("html") var form_content = html.append("div").attr("class","form-content").attr("style","display:none") var form = form_content.append("form").attr("class","form").attr("role","form") var form_group, input; - //General information + //aigner: Visualize sub component "general_info" form_group = form.append("div").attr("class","form-group") form_group.append("label").text("General information") form_group = form.append("div").attr("class","form-group") @@ -20503,36 +20634,33 @@ .attr("class","form-control") .attr("name","description") .attr("placeholder","Add a description for the DC here") - if (typeof metadata.general_info != "undefined" && metadata.general_info !=null && typeof metadata.general_info.description!="undefined") - { - description.attr("value",metadata.general_info.description) - } - - form_group = form.append("div").attr("class","form-group") - form_group.append("text").text("Mode") - var mode = form_group.append("input") - .attr("id","mode") - .attr("class","form-control") - .attr("name","mode") - .attr("placeholder","Mode (e.g. main)") - if (metadata.mode) - { - mode.attr("value",metadata.mode) - } - - form_group = form.append("div").attr("class","form-group") - form_group.append("text").text("Version") - var version = form_group.append("input") - .attr("id","version") - .attr("class","form-control") - .attr("name","version") - .attr("placeholder","Version (e.g. 1.0)") - if (metadata.version) - { - version.attr("value",metadata.version) - } - - + description.text(metadata.general_info.description) + <!-- form_group = form.append("div").attr("class","form-group") --> + <!-- form_group.append("text").text("Mode") --> + <!-- var mode = form_group.append("input") --> + <!-- .attr("id","mode") --> + <!-- .attr("class","form-control") --> + <!-- .attr("name","mode") --> + <!-- .attr("placeholder","Mode (e.g. main)") --> + <!-- if (typeof metadata.general_info != "undefined" --> + <!-- && metadata.general_info !=null --> + <!-- && typeof metadata.general_info.mode!="undefined") --> + <!-- { --> + <!-- mode.attr("value",metadata.general_info.mode) --> + <!-- } --> + <!-- form_group = form.append("div").attr("class","form-group") --> + <!-- form_group.append("text").text("Version") --> + <!-- var version = form_group.append("input") --> + <!-- .attr("id","version") --> + <!-- .attr("class","form-control") --> + <!-- .attr("name","version") --> + <!-- .attr("placeholder","Version (e.g. 1.0)") --> + <!-- if (typeof metadata.general_info != "undefined" --> + <!-- && metadata.general_info !=null --> + <!-- && typeof metadata.general_info.version!="undefined") --> + <!-- { --> + <!-- version.attr("value",metadata.general_info.version) --> + <!-- } --> form_group = form.append("div").attr("class","form-group") form_group.append("text").text("Status") var input = form_group.append("select").attr("id","status").style("margin-left","5px") @@ -20540,16 +20668,10 @@ status.attr("type","select").attr("value","-").text("Please select...") status = input.append("option") status.attr("type","select").attr("value","Available").text("Available") - if (typeof metadata.general_info != "undefined" - && metadata.general_info !=null - && typeof metadata.general_info.status!="undefined" - && metadata.general_info.status=="Available"){status.attr("selected","true")} + if(metadata.general_info.status=="Available"){status.attr("selected","true")} status = input.append("option") status.attr("type","select").attr("value","N/A").text("N/A") - if (typeof metadata.general_info != "undefined" - && metadata.general_info !=null - && typeof metadata.general_info.status!="undefined" - && metadata.general_info.status=="N/A"){status.attr("selected","true")}{status.attr("selected","true")} + if(metadata.general_info.status=="N/A"){status.attr("selected","true")} var contacts = [] if (theCurrentGraph.organization.contacts){contacts=theCurrentGraph.organization.contacts}; form_group = form.append("div").attr("class","form-group") @@ -20559,11 +20681,7 @@ contacts.forEach(function(contact){ var owner = input.append("option") owner.attr("type","select").attr("value",contact.attrib.uID).text(contact.name + " (" + contact.company + ")") - if (typeof metadata.general_info != "undefined" - && metadata.general_info !=null - && typeof metadata.general_info.owner!="undefined" - && typeof metadata.general_info.owner!=null - && contact.attrib.uID==metadata.general_info.owner.contactUID){owner.attr("selected","true")} + if (contact.attrib.uID==metadata.general_info.owner.contactUID){owner.attr("selected","true")} }) form_group = form.append("div").attr("class","form-group") form_group.append("text").text("Creator") @@ -20572,11 +20690,7 @@ contacts.forEach(function(contact){ var creator = input.append("option") creator.attr("type","select").attr("value",contact.attrib.uID).text(contact.name + " (" + contact.company + ")") - if (typeof metadata.general_info != "undefined" - && metadata.general_info !=null - && typeof metadata.general_info.creator!="undefined" - && typeof metadata.general_info.creator!=null - && contact.attrib.uID==metadata.general_info.creator.contactUID){creator.attr("selected","true")} + if (contact.attrib.uID==metadata.general_info.creator.contactUID){creator.attr("selected","true")} }) form_group = form.append("div").attr("class","form-group") form_group.append("text").text("Operator") @@ -20585,101 +20699,286 @@ contacts.forEach(function(contact){ var operator = input.append("option") operator.attr("type","select").attr("value",contact.attrib.uID).text(contact.name + " (" + contact.company + ")") - if (typeof metadata.general_info != "undefined" - && metadata.general_info !=null - && typeof metadata.general_info.operator!="undefined" - && typeof metadata.general_info.operator!=null - && contact.attrib.uID==metadata.general_info.operator.contactUID){operator.attr("selected","true")} + if (contact.attrib.uID==metadata.general_info.operator.contactUID){operator.attr("selected","true")} }) - - //Information on tool execution + //aigner: Visualize sub component "performance_info" form_group = form.append("div").attr("class","form-group").style("margin-top","40px") - form_group.append("label").text("Execution information") - form_group = form.append("div").attr("class","form-group") - form_group.append("text").text("Operating System") - input = form_group.append("select").attr("id","operating_system").style("margin-left","5px") - input.append("option").attr("type","select").attr("value","-").text("Please select...") - input.append("option").attr("type","select").attr("value","windows").text("Windows") - input.append("option").attr("type","select").attr("value","linux").text("Linux") - input.append("option").attr("type","select").attr("value","mac").text("Mac OS") - input.append("option").attr("type","select").attr("value","other").text("Other") + form_group.append("label").text("Performance information") form_group = form.append("div").attr("class","form-group") - form_group.append("text").text("Integration platform") + form_group.append("text").text("Precision") input = form_group.append("input") - .attr("id","integration_platform") - .attr("class","form-control") - .attr("name","integration_platform") - .attr("placeholder","Integration platform (e.g. RCE, Optimus)") - form_group = form.append("div").attr("class","form-group") - form_group.append("text").text("Execution command") - input = form_group.append("textarea") - .attr("id","command") + .attr("id","precision") .attr("class","form-control") - .attr("cols","40") - .attr("rows","5") - .attr("name","command") - .attr("placeholder","Execution command") + .attr("name","precision") + .attr("placeholder","Precision (range 0 - 1)") + .attr("value",metadata.performance_info.precision) form_group = form.append("div").attr("class","form-group") - input = form_group.append("input") - .attr("id","description_cmd") - .attr("class","form-control") - .attr("name","description_cmd") - .attr("placeholder","Details on the exectuion command (optional)") + form_group.append("text").text("Fidelity level") + input = form_group.append("select").attr("id","fidelity_level").style("margin-left","5px") + input.append("option").attr("type","select").attr("value","-").text("Please select...").attr("selected","true") + for (var count=0; count <= 3; count ++) + { + var fidelity = input.append("option") + fidelity.attr("type","select").attr("value",count).text(String(count)) + if (count==metadata.performance_info.fidelity_level){fidelity.attr("selected","true")} + } form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Run time") input = form_group.append("input") - .attr("id","software_requirements") + .attr("id","run_time") .attr("class","form-control") - .attr("name","software_requirements") - .attr("placeholder","Software requirements") + .attr("name","run_time") + .attr("placeholder","Run time in sec") + .attr("value",metadata.performance_info.run_time) form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Verification") input = form_group.append("input") - .attr("id","hardware_requirements") + .attr("id","verification") .attr("class","form-control") - .attr("name","hardware_requirements") - .attr("placeholder","Hardware requirements") - + .attr("name","verification") + .attr("placeholder","Verification (optional)") + .attr("value",metadata.performance_info.verification) + //Information on tool licensing form_group = form.append("div").attr("class","form-group").style("margin-top","40px") form_group.append("label").text("License information (optional)") + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("License type") input = form_group.append("input") .attr("id","license_type") .attr("class","form-control") .attr("name","license_type") .attr("placeholder","License type (e.g. open-source, commercial)") + .attr("value",metadata.general_info.licensing.license_type) form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("License specification") input = form_group.append("input") .attr("id","license_specification") .attr("class","form-control") .attr("name","license_specification") .attr("placeholder","License specification (e.g. Apache License 2.0)") + .attr("value",metadata.general_info.licensing.license_specification) form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("License information") input = form_group.append("input") .attr("id","license_info") .attr("class","form-control") .attr("name","license_info") .attr("placeholder","License information (e.g. https://www.apache.org/licenses/LICENSE-2.0)") + .attr("value",metadata.general_info.licensing.license_info) //Information on tool sources form_group = form.append("div").attr("class","form-group").style("margin-top","40px") form_group.append("label").text("Source information (optional)") + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Repository link") input = form_group.append("input") .attr("id","repository_link") .attr("class","form-control") .attr("name","repository_link") .attr("placeholder","Repository link") + .attr("value",metadata.general_info.sources.repository_link) form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Download link") input = form_group.append("input") .attr("id","download_link") .attr("class","form-control") .attr("name","download_link") .attr("placeholder","Download link") + .attr("value",metadata.general_info.sources.download_link) form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("References") input = form_group.append("input") .attr("id","references") .attr("class","form-control") .attr("name","references") .attr("placeholder","References") + .attr("value",metadata.general_info.sources.references) + + //aigner: Visualize sub component "execution_info" + //Again, this is more complicated... + form_group = form.append("div").attr("class","form-group").style("margin-top","40px") + form_group.append("label").text("Execution information") + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Execution type") + input = form_group.append("select") + .attr("id","execution_type") + .attr("class","execution_type") + .style("margin-left","5px") + var option = input.append("option").attr("value","-").text("Please select...").attr("selected","true") + var option_loc = input.append("option").attr("value","local_component").text("Local component") + var option_rem = input.append("option").attr("value","remote_component").text("Remote component") + if(metadata.execution_info.component_type=="local"){option_loc.attr("selected","true")} + else if(metadata.execution_info.component_type=="remote"){option_rem.attr("selected","true")} + + //Use a jquery function to toggle between local_component, remote_component, and none + //depending on the user's dropdown selection of the "execution_type" element + $(function() { + var form = d3.selectAll(".form"); + + //Information on remote component + var local_component_info = metadata.execution_info.local_component_info[metadata.execution_info.local_component_info.length-1][1]; + form_group = form.append("div").attr("class","form-group_lc") + form_group.append("text").text("Operating System") + input = form_group.append("select").attr("id","operating_system").style("margin-left","5px") + var input_list = [{text:"Windows",value:"windows"}, + {text:"Linux",value:"linux"}, + {text:"Mac OS",value:"mac"}, + {text:"Other",value:"other"}]; + input.append("option").attr("type","select").attr("value","-").text("Please select...") + input_list.forEach(function(theInput){ + var operatingSystem = input.append("option") + operatingSystem.attr("type","select").attr("value",theInput.value).text(theInput.text) + if (theInput.value==local_component_info.operating_system) + { + operatingSystem.attr("selected","true") + } + }) + form_group = form.append("div").attr("class","form-group_lc") + form_group.append("text").text("Integration platform") + input = form_group.append("input") + .attr("id","integration_platform") + .attr("class","form-control") + .attr("name","integration_platform") + .attr("placeholder","Integration platform (e.g. RCE, Optimus)") + .attr("value",local_component_info.integration_platform) + form_group = form.append("div").attr("class","form-group_lc") + form_group.append("text").text("Execution command") + input = form_group.append("textarea") + .attr("id","command") + .attr("class","form-control") + .attr("cols","40") + .attr("rows","5") + .attr("name","command") + .attr("placeholder","Execution command") + .text(local_component_info.command) + form_group = form.append("div").attr("class","form-group_lc") + form_group.append("text").text("Details") + input = form_group.append("textarea") + .attr("id","description_cmd") + .attr("class","form-control") + .attr("cols","40") + .attr("rows","1") + .attr("name","description_cmd") + .attr("placeholder","Details on the exectuion command (optional)") + .text(local_component_info.description) + form_group = form.append("div").attr("class","form-group_lc") + form_group.append("text").text("Software requirements") + input = form_group.append("textarea") + .attr("id","software_requirements") + .attr("class","form-control") + .attr("cols","40") + .attr("rows","1") + .attr("name","software_requirements") + .attr("placeholder","Software requirements") + .text(local_component_info.software_requirements) + form_group = form.append("div").attr("class","form-group_lc") + form_group.append("text").text("Hardware requirements") + input = form_group.append("textarea") + .attr("id","hardware_requirements") + .attr("class","form-control") + .attr("cols","40") + .attr("rows","1") + .attr("name","hardware_requirements") + .attr("placeholder","Hardware requirements") + .text(local_component_info.hardware_requirements) + + //Information on remote component + var remote_component_info = metadata.execution_info.remote_component_info; + form_group = form.append("div").attr("class","form-group_rc").style("margin-top","40px") + form_group.append("label").text("Remote component information") + form_group = form.append("div").attr("class","form-group_rc") + form_group.append("text").text("Remote engineer") + input = form_group.append("select").attr("id","remote_engineer_uid").style("margin-left","5px") + input.append("option").attr("type","select").attr("value","-").text("Please select...") + contacts.forEach(function(contact){ + var owner = input.append("option") + owner.attr("type","select").attr("value",contact.attrib.uID).text(contact.name + " (" + contact.company + ")") + if (contact.attrib.uID==remote_component_info.job_settings.remote_engineer.contact_u_i_d){owner.attr("selected","true")} + }) + form_group = form.append("div").attr("class","form-group_rc") + form_group.append("text").text("URL site") + input = form_group.append("input") + .attr("id","urlsite") + .attr("class","form-control") + .attr("name","urlsite") + .attr("placeholder","URL site") + .attr("value",remote_component_info.data_exchange_settings.urlsite) + form_group = form.append("div").attr("class","form-group_rc") + form_group.append("text").text("Folder") + input = form_group.append("input") + .attr("id","folder") + .attr("class","form-control") + .attr("name","folder") + .attr("placeholder","Folder") + .attr("value",remote_component_info.data_exchange_settings.folder) + form_group = form.append("div").attr("class","form-group_rc") + form_group.append("text").text("Job name") + input = form_group.append("input") + .attr("id","job_name") + .attr("class","form-control") + .attr("name","job_name") + .attr("placeholder","Job name") + .attr("value",remote_component_info.job_settings.job_name) + form_group = form.append("div").attr("class","form-group_rc") + form_group.append("text").text("Single or multi execution") + input = form_group.append("select").attr("id","single_or_multi_execution").style("margin-left","5px") + input.append("option").attr("type","select").attr("value","-").text("Please select...").attr("selected","true") + var single_type = input.append("option").attr("type","select").attr("value","single").text("Single") + var multi_type = input.append("option").attr("type","select").attr("value","multi").text("Multi") + if (metadata.execution_info.remote_component_info.job_settings.single_or_multi_execution=="single") + { + single_type.attr("selected","true") + } + else if (metadata.execution_info.remote_component_info.job_settings.single_or_multi_execution=="multi") + { + multi_type.attr("selected","true") + } + form_group = form.append("div").attr("class","form-group_rc") + form_group.append("text").text("Notification message") + input = form_group.append("textarea") + .attr("id","notification_message") + .attr("class","form-control") + .attr("cols","40") + .attr("rows","1") + .attr("name","notification_message") + .attr("placeholder","Notification message") + .text(remote_component_info.job_settings.notification_message) + + //Which of the above visualized block should actually be shown? + //--> The one that the component actually is, namely either a "local_component" or a "remote" + d3.selectAll(".form-group_rc").attr("style","display:none") + d3.selectAll(".form-group_lc").attr("style","display:none") + if (metadata.execution_info.component_type=="local"){d3.selectAll(".form-group_lc").attr("style","display:block")} + else if (metadata.execution_info.component_type=="remote"){d3.selectAll(".form-group_rc").attr("style","display:block")} + + //aigner: Function switches between remote and local component depending on user input + $('.execution_type').on('change', function(e) + { + var execution_type = $('form #execution_type').val(); + if (execution_type == "local_component") + { + metadata.execution_info.component_type = "local"; + d3.selectAll(".form-group_rc").attr("style","display:none") + d3.selectAll(".form-group_lc").attr("style","display:block") + } + else if (execution_type == "remote_component") + { + metadata.execution_info.component_type = "remote"; + d3.selectAll(".form-group_rc").attr("style","display:block") + d3.selectAll(".form-group_lc").attr("style","display:none") + } + else + { + metadata.execution_info.component_type = "none"; + d3.selectAll(".form-group_rc").attr("style","display:none") + d3.selectAll(".form-group_lc").attr("style","display:none") + } + }); + }); + + var modal = bootbox.dialog({ @@ -20698,22 +20997,85 @@ { label: "OK", className: "btn btn-primary", - callback: function() { - var metadata = { - uID: aNode.uID, - description: $('form #description').val(), - status: $('form #status').val(), - owner_uid: $('form #owner_uid').val(), - creator_uid: $('form #creator_uid').val(), - operator_uid: $('form #operator_uid').val() + callback: function() { + + var metadata_to_kadmos = { + general_info: { + description: $('form #description').val(), + mode: $('form #mode').val(), + version: $('form #version').val(), + status: $('form #status').val(), + owner_uid: $('form #owner_uid').val(), + creator_uid: $('form #creator_uid').val(), + operator_uid: $('form #operator_uid').val() + }, + performance_info: { + precision: $('form #precision').val(), + fidelity_level: $('form #fidelity_level').val(), + run_time: $('form #run_time').val(), + verification: $('form #verification').val() + }, + execution_details: { + local_component:false, + operating_system:"", + integration_platform: "", + command: "", + description: "", + software_requirements: "", + hardware_requirements: "" + }, + remote_component_info: { + remote_component: false, + remote_engineer_uid: "", + single_or_multi_execution: "", + job_name: "", + urlsite: "", + folder: "" + }, + licensing: { + license_type: $('form #license_type').val(), + license_specification: $('form #license_specification').val(), + license_info: $('form #license_info').val() + }, + sources: { + repository_link: $('form #repository_link').val(), + download_link: $('form #download_link').val(), + references: $('form #references').val() + } + } + + if (metadata.execution_info.component_type=="local") + { + metadata_to_kadmos.execution_details = { + local_component: true, + operating_system: $('form #operating_system').val(), + integration_platform: $('form #integration_platform').val(), + command: $('form #command').val(), + description: $('form #description_cmd').val(), + software_requirements: $('form #software_requirements').val(), + hardware_requirements: $('form #hardware_requirements').val() + } + } + else if (metadata.execution_info.component_type=="remote") + { + metadata_to_kadmos.remote_component_info = { + remote_component: true, + remote_engineer_uid: $('form #remote_engineer_uid').val(), + single_or_multi_execution: $('form #single_or_multi_execution').val(), + job_name: $('form #job_name').val(), + urlsite: $('form #urlsite').val(), + folder: $('form #folder').val(), + notification_message: $('form #notification_message').val() + } } - var metadata_str = JSON.stringify(metadata) + + var metadata_str = JSON.stringify(metadata_to_kadmos) var bootboxContent = {title: "Get graph elements", message: '<p>Please be patient...</p>'}; var xhr = $.ajax( { type: 'POST', url: '/kadmos_add_DC_metadata', - data: {'graphID':graphID, 'currentOrder':nodeOrder, 'nodeName':metadata.uID, 'metadata_str':metadata_str, 'sessionId': sessionId}, + data: {'graphID':graphID, 'currentOrder':nodeOrder, 'nodeName':aNode.uID, 'metadata_str':metadata_str, 'sessionId': sessionId}, success: function(result) { if (result.includes("ERROR:")) @@ -21115,6 +21477,80 @@ //#################################################################################################################### + + + + var graph_menu = " <nav>" + +" <ul>" + +" <li><a href='#'>Graph inspection <span>▾</span></a>" + +" <ul>" + +" <li class='search_element'><a href='#'>Find graph elements</a></li>" + +" <li><a href='#'>Inspect data model<span>▸</span></a>" + +" <ul class='data_model_view'>" + +" <li class='tree_view'><a href='#'>Tree view<span>▸</span></a></li>" + +" <li class='list_view'><a href='#'>List view<span>▸</span></a></li>" + +" </ul>" + +" </li>" + +" <li><a href='#'>Check<span>▸</span></a>" + +" <ul class='check_graph'>" + +" <li class='l1_check'><a href='#'>L1 check: graph</a></li>" + +" <li class='l2_check'><a href='#'>L2 check: problem formulation</a></li>" + +" <li class='l3_check'><a href='#'>L3 check: graph & problem formulation</a></li>" + +" </ul>" + +" </li>" + +" </ul>" + +" </li>" + +" <li><a href='#'>Graph manipulation <span>▾</span></a>" + +" <ul>" + +" <li><a href='#'>FPG manipulation <span>▸</span></a>" + +" <ul class='fpg_manipulations'>" + +" <li class='start_MDO_problem'><a href='#'>Copy graph for MDAO problem definition</a></li>" + +" <li class='get_function_order'><a href='#'>Get possible function order</a></li>" + +" <li class='make_variables_valid'><a href='#'>Make all variables valid</a></li>" + +" <li><a href='#'>Remove...<span>▸</span></a>" + +" <ul class='remove'>" + +" <li class='remove_dcs'><a href='#'>design competences</a></li>" + +" <li class='remove_collision_parameters'><a href='#'>collision parameters</a></li>" + +" <li class='remove_unused_outputs'><a href='#'>unused outputs</a></li>" + +" </ul>" + +" </li>" + +" <li><a href='#'>Merge...<span>▸</span></a>" + +" <ul class='merge'>" + +" <li class='merge_seq_competences'><a href='#'>sequential competences</a></li>" + +" <li class='merge_par_competences'><a href='#'>parallel competences</a></li>" + +" <li class='merge_funcMod_competences'><a href='#'>function modes competences</a></li>" + +" </ul>" + +" </li>" + +" <li><a href='#'>Assign...<span>▸</span></a>" + +" <ul class='assign'>" + +" <li class='assign_probFunc_roles'><a href='#'>problem function roles</a></li>" + +" <li class='assign_parameter_roles'><a href='#'>parameter roles</a></li>" + +" </ul>" + +" </li>" + +" </ul>" + +" </li>" + +" <li><a href='#'>MDPG manipulation <span>▸</span></a>" + +" <ul class='mdpg_manipulations'>" + +" <li class='start_MDO_architecture'><a href='#'>Copy graph for MDAO architecture definition</a></li>" + +" <li><a href='#'>Set...<span>▸</span></a>" + +" <ul class='set'>" + +" <li class='set_MDAO_architecture'><a href='#'>MDAO architecture</a></li>" + +" <li class='set_coupling_decomposition'><a href='#'>Coupling decomposition</a></li>" + +" <li class='set_DOE_method'><a href='#'>DOE method</a></li>" + +" </ul>" + +" </li>" + +" <li class='impose_MDAO_architecture'><a href='#'>Impose MDAO architecture</a></li>" + +" </ul>" + +" </li>" + +" <li class='upload_script'><a href='#'>Upload custom script</a></li>" + +" </ul>" + +" </li>" + +" </ul>" + +" </nav>" + + d3.select(".xdsmDiv").append('div').attr("class","graph_menu").style("margin-left","20px").html(graph_menu); + + var inspectionsDiv = d3.select(".xdsmDiv").append("div").attr("class","dataModelDiv").style("top","-10px") @@ -21158,22 +21594,15 @@ {text:"all problematic functions",value:"all problematic functions"}] var operators = [ - {text:"",value:""}, + {text:"Operator (please select)",value:"-"}, {text:"<",value:"<"}, {text:"<=",value:"<="}, {text:"==",value:"=="}, {text:">=",value:">="}, {text:">",value:">"}] - - var inspectGraph_ul = inspectionsDiv.append("ul") - var inspectGraph_li = inspectGraph_ul.append("li") - .on("mouseover", function(){ - d3.select(this) - .style("cursor", "pointer") - }) - inspectGraph_li.append("a").text("Search") - inspectGraph_li.style("left", "0px") - inspectGraph_li.on("mousedown", function() + + var search_element_dom = d3.select(".search_element") + search_element_dom.on("mousedown", function() { bootbox.hideAll(); @@ -21201,9 +21630,10 @@ var maxNumOfAttributes = 3; - var form_group3 = form.append("div").attr("class","form-group") + for (var i=0; i<maxNumOfAttributes; i++) { + var form_group3 = form.append("div").attr("class","form-group") var input = form_group3.append("div").attr("class","attribute") if (i==0){input.append("label").attr("for","attribute"+String(i)).text("Attribute conditions (max. "+String(maxNumOfAttributes)+")")} input.append("input") @@ -21211,11 +21641,13 @@ .attr("class","form-control") .attr("name","attribute") .attr("placeholder","attribute "+String(i+1)) - input.append("input") - .attr("id","operator"+String(i)) - .attr("class","form-control") - .attr("name","operator "+String(i+1)) - .attr("placeholder","operator "+String(i+1)+" (<,<=,==,>=,>)") + input = form_group3.append("select").attr("id","operator"+String(i)) + operators.forEach(function(operator) + { + input.append("option").attr("type","select").attr("value",operator.value).text(operator.text) + }) + + input = form_group3.append("div").attr("class","attribute") input.append("input") .attr("id","value"+String(i)) .attr("class","form-control") @@ -21477,207 +21909,209 @@ //aigner: Kadmos functions --> Check graph //#################################################################################################################### - var checkGraph_ul = inspectionsDiv.append("ul") - var checkGraph_li = checkGraph_ul.append("li") - .on("mouseover", function(){ - d3.select(this) - .style("cursor", "default") - }) - checkGraph_li.append("a").text("Check") - var checkGraph = checkGraph_li.append("ul"); - var xOffset_ul = checkGraph_li._groups[0][0].offsetLeft+checkGraph_li._groups[0][0].offsetWidth-40; - checkGraph.style("left", String(xOffset_ul)+"px") - - //aigner: Kadmos function --> graph checks - checkGraph.append("li").append("a") - .text("L1 check: graph") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - var bootboxContent = {title: "L1 check: graph", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - data: {'graphID': graphID, 'sessionId': sessionId}, - url: '/kadmos_L1_check', - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - bootboxContent.message = result - kadmosSuccessMessage(bootboxContent); - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - }) + var l1_check_dom = d3.select(".l1_check") + l1_check_dom.on("mousedown", function() + { + var bootboxContent = {title: "L1 check: graph", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + data: {'graphID': graphID, 'sessionId': sessionId}, + url: '/kadmos_L1_check', + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + bootboxContent.message = result + kadmosSuccessMessage(bootboxContent); + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + }) - checkGraph.append("li").append("a") - .text("L2 check: problem formulation") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - var bootboxContent = {title: "L2 check: problem formulation", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - data: {'graphID': graphID, 'sessionId': sessionId}, - url: '/kadmos_L2_check', - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - bootboxContent.message = result - kadmosSuccessMessage(bootboxContent); - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - }) + var l2_check_dom = d3.select(".l2_check") + l2_check_dom.on("mousedown", function() + { + var bootboxContent = {title: "L2 check: problem formulation", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + data: {'graphID': graphID, 'sessionId': sessionId}, + url: '/kadmos_L2_check', + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + bootboxContent.message = result + kadmosSuccessMessage(bootboxContent); + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + }) - checkGraph.append("li").append("a") - .text("L3 check: graph & problem formulation") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - var bootboxContent = {title: "L3 check: graph & problem formulation", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - data: {'graphID': graphID, 'sessionId': sessionId}, - url: '/kadmos_L3_check', - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - bootboxContent.message = result - kadmosSuccessMessage(bootboxContent); - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - }) + var l3_check_dom = d3.select(".l3_check") + l3_check_dom.on("mousedown", function() + { + var bootboxContent = {title: "L3 check: graph & problem formulation", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + data: {'graphID': graphID, 'sessionId': sessionId}, + url: '/kadmos_L3_check', + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + bootboxContent.message = result + kadmosSuccessMessage(bootboxContent); + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + }) //#################################################################################################################### //aigner: Kadmos functions --> Graph manipulation //#################################################################################################################### - var optionsDiv = d3.select(".xdsmDiv").append("div").attr("class","dataModelDiv").style("top","-10px") - var fpgManipulations_ul = optionsDiv.append("ul") - var fpgManipulations_li = fpgManipulations_ul.append("li") - .on("mouseover", function(){ - d3.select(this) - .style("cursor", "default") - }) - fpgManipulations_li.append("a").text("1. FPG Manipulations") - var fpgManipulations = fpgManipulations_li.append("ul"); - var xOffset_ul = fpgManipulations_li._groups[0][0].offsetLeft+fpgManipulations_li._groups[0][0].offsetWidth-40; - fpgManipulations.style("left", String(xOffset_ul)+"px") - - //aigner: Kadmos function --> Start defining MDO problem - fpgManipulations.append("li").append("a") - .text("1.1. Start defining MDO problem") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "<p>This will create an initial FPG for your MDO problem. After clicking this button, you can go through the \"<b>FPG manipulation</b>\" steps." - +"<p>Please type in a new name for the graph</p>", - value: currentGraph.name, - callback: function(newGraphName) - { - if (newGraphName) - { - var newGraphID = '01'; - data.graphs.forEach(function(graph) - { - id_int = parseInt(graph.id) - if (data.graphs.length < 100){newGraphID = "0" + String(id_int+1);} - else{newGraphID = String(id_int+1);} - }) - var bootboxContent = {title: "Start defining MDO problem", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_start_defining_MDO_problem', - data: {'graphID':graphID, 'currentOrder': nodeOrder, 'newGraphName':newGraphName, 'newGraphID':newGraphID, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = jQuery.extend(true, {}, data); - var graphData = JSON.parse(result); - - for (var i = 0; i < data.graphs.length; i++) - { - if (graphID == data.graphs[i].id) - { - - //Insert copied graph behind the original one - updatedData.graphs.splice(i+1, 0, graphData.graphs[0]) - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,newGraphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - } - }) - }) - + var start_MDO_problem_DOM = d3.select(".start_MDO_problem") + start_MDO_problem_DOM.on("mousedown", function() + { + bootbox.hideAll(); + var html = d3.select("html") + var form_content = html.append("div").attr("class","form-content").attr("style","display:none") + var form = form_content.append("form").attr("class","form").attr("role","form") + var form_group, input; + + //Tool information + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Name") + input = form_group.append("input") + .attr("id","graph_name") + .attr("class","form-control") + .attr("name","graph_name") + .attr("placeholder","Add a graph name here...") + //Tool information + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Description") + input = form_group.append("input") + .attr("id","graph_description") + .attr("class","form-control") + .attr("name","graph_description") + .attr("placeholder","Add a graph description here...") + + bootbox.dialog({ + message: $(".form-content").html(), + title: "<p>This will create an initial FPG for your MDO problem. After clicking this button, you can go through the \"<b>FPG manipulation</b>\" steps." + +"<p>Please type in a new name and description for the graph</p>", + size: "large", + buttons: [ + { + label: "Cancel", + className: "btn btn-default pull-left", + callback: function() { + d3.selectAll(".form-content").remove(); + } + }, + { + label: "OK", + className: "btn btn-primary pull-left", + callback: function() { + + //get form data + var graph_name = $('form #graph_name').val(); + var graph_description = $('form #graph_description').val(); + + + var newGraphID = '01'; + data.graphs.forEach(function(graph) + { + id_int = parseInt(graph.id) + if (data.graphs.length < 100){newGraphID = "0" + String(id_int+1);} + else{newGraphID = String(id_int+1);} + }) + var bootboxContent = {title: "Copy graph for defining MDO problem", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_start_defining_MDO_problem', + data: {'graphID':graphID, 'currentOrder': nodeOrder, 'newGraphName':graph_name, 'newGraphDesc':graph_description, 'newGraphID':newGraphID, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = jQuery.extend(true, {}, data); + var graphData = JSON.parse(result); + + for (var i = 0; i < data.graphs.length; i++) + { + if (graphID == data.graphs[i].id) + { + + //Insert copied graph behind the original one + updatedData.graphs.splice(i+1, 0, graphData.graphs[0]) + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,newGraphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + d3.selectAll(".form-content").remove(); + } + } + ] + }); + }) - fpgManipulations.append("li").append("a") - .text("1.2. Exclude Design Competences") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() + var remove_dcs_DOM = d3.select(".remove_dcs") + remove_dcs_DOM.on("mousedown", function() { bootbox.hideAll(); bootbox.prompt( @@ -21747,720 +22181,721 @@ } }); }) - - fpgManipulations.append("li").append("a") - .text("1.3. Merge sequential competences") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "Please select the sequential design competences you would like to merge.", - inputType: 'checkbox', - inputOptions: theInputOptions, - callback: function (nodeList) - { - if (nodeList) - { - var nodeStr = ''; - for (var i=0; i< nodeList.length; i++) - { - if (i==0){nodeStr += nodeList[i]} - else{nodeStr += ',' + nodeList[i]} - } - - bootbox.hideAll(); - bootbox.confirm("Are you sure you want to do this", function(sure) - { - if (sure) - { - var bootboxContent = {title: "Merge sequential design competences", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_merge_seq_DCs', - data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }) - - } - } - }); - }) - fpgManipulations.append("li").append("a") - .text("1.4. Merge parallel competences") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "Please select the parallel design competences you would like to merge.", - inputType: 'checkbox', - inputOptions: theInputOptions, - callback: function (nodeList) - { - if (nodeList) - { - var nodeStr = ''; - for (var i=0; i< nodeList.length; i++) - { - if (i==0){nodeStr += nodeList[i]} - else{nodeStr += ',' + nodeList[i]} - } - - bootbox.hideAll(); - bootbox.confirm("Are you sure you want to do this", function(sure) - { - if (sure) - { - var bootboxContent = {title: "Merge parallel design competences", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_merge_parallel_DCs', - data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }) - - } - } - }); - }) + var merge_seq_competences_DOM = d3.select(".merge_seq_competences") + merge_seq_competences_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.prompt( + { + title: "Please select the sequential design competences you would like to merge.", + inputType: 'checkbox', + inputOptions: theInputOptions, + callback: function (nodeList) + { + if (nodeList) + { + var nodeStr = ''; + for (var i=0; i< nodeList.length; i++) + { + if (i==0){nodeStr += nodeList[i]} + else{nodeStr += ',' + nodeList[i]} + } + + bootbox.hideAll(); + bootbox.confirm("Are you sure you want to do this", function(sure) + { + if (sure) + { + var bootboxContent = {title: "Merge sequential design competences", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_merge_seq_DCs', + data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }) + + } + } + }); + }) + + var merge_par_competences_DOM = d3.select(".merge_par_competences") + merge_par_competences_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.prompt( + { + title: "Please select the parallel design competences you would like to merge.", + inputType: 'checkbox', + inputOptions: theInputOptions, + callback: function (nodeList) + { + if (nodeList) + { + var nodeStr = ''; + for (var i=0; i< nodeList.length; i++) + { + if (i==0){nodeStr += nodeList[i]} + else{nodeStr += ',' + nodeList[i]} + } + + bootbox.hideAll(); + bootbox.confirm("Are you sure you want to do this", function(sure) + { + if (sure) + { + var bootboxContent = {title: "Merge parallel design competences", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_merge_parallel_DCs', + data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }) + + } + } + }); + }) - fpgManipulations.append("li").append("a") - .text("1.5. Merge function modes competences") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "Please select the design competences you would like to merge.", - inputType: 'checkbox', - inputOptions: theInputOptions, - callback: function (nodeList) - { - if (nodeList) - { - var nodeStr = ''; - for (var i=0; i< nodeList.length; i++) - { - if (i==0){nodeStr += nodeList[i]} - else{nodeStr += ',' + nodeList[i]} - } - - bootbox.hideAll(); - bootbox.confirm("Are you sure you want to do this", function(sure) - { - if (sure) - { - var bootboxContent = {title: "Merge function mode design competences", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_merge_func_mod_DCs', - data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }) - - } - } - }); - }) + var merge_funcMod_competences_DOM = d3.select(".merge_funcMod_competences") + merge_funcMod_competences_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.prompt( + { + title: "Please select the design competences you would like to merge.", + inputType: 'checkbox', + inputOptions: theInputOptions, + callback: function (nodeList) + { + if (nodeList) + { + var nodeStr = ''; + for (var i=0; i< nodeList.length; i++) + { + if (i==0){nodeStr += nodeList[i]} + else{nodeStr += ',' + nodeList[i]} + } + + bootbox.hideAll(); + bootbox.confirm("Are you sure you want to do this", function(sure) + { + if (sure) + { + var bootboxContent = {title: "Merge function mode design competences", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_merge_func_mod_DCs', + data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }) + + } + } + }); + }) - fpgManipulations.append("li").append("a") - .text("1.6. Remove collision parameters") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "Please select the design competences for which you would like to remove collisions.", - inputType: 'checkbox', - inputOptions: theInputOptions, - callback: function (nodeList) - { - if (nodeList) - { - var nodeStr = ''; - for (var i=0; i< nodeList.length; i++) - { - if (i==0){nodeStr += nodeList[i]} - else{nodeStr += ',' + nodeList[i]} - } - - bootbox.hideAll(); - bootbox.confirm("Are you sure you want to do this", function(sure) - { - if (sure) - { - var bootboxContent = {title: "Remove collisions", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_remove_collision', - data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }) - - } - } - }); - }) + var remove_collision_parameters_DOM = d3.select(".remove_collision_parameters") + remove_collision_parameters_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.prompt( + { + title: "Please select the design competences for which you would like to remove collisions.", + inputType: 'checkbox', + inputOptions: theInputOptions, + callback: function (nodeList) + { + if (nodeList) + { + var nodeStr = ''; + for (var i=0; i< nodeList.length; i++) + { + if (i==0){nodeStr += nodeList[i]} + else{nodeStr += ',' + nodeList[i]} + } + + bootbox.hideAll(); + bootbox.confirm("Are you sure you want to do this", function(sure) + { + if (sure) + { + var bootboxContent = {title: "Remove collisions", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_remove_collision', + data: {'graphID':graphID, 'nodeList':nodeStr, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }) + + } + } + }); + }) - fpgManipulations.append("li").append("a") - .text("1.7. Make all variables valid") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.confirm("<p>This will automatically remove all collisions from the graph by creating multiple variable instances.</p>" - +"<p>Are you sure you want to do this?</p>", function(sure) - { - if (sure) - { - var bootboxContent = {title: "Create FPG", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_make_all_variables_valid', - data: {'graphID':graphID, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }); - }) + var make_variables_valid_DOM = d3.select(".make_variables_valid") + make_variables_valid_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.confirm("<p>This will automatically remove all collisions from the graph by creating multiple variable instances.</p>" + +"<p>Are you sure you want to do this?</p>", function(sure) + { + if (sure) + { + var bootboxContent = {title: "Create FPG", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_make_all_variables_valid', + data: {'graphID':graphID, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }); + }) - fpgManipulations.append("li").append("a") - .text("1.8. Add problem function roles") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.confirm("Are you sure you want to do this?", function(sure) - { - if (sure) - { - var bootboxContent = {title: "Create FPG", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_add_function_problem_roles', - data: {'graphID':graphID, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }); - }) + var assign_probFunc_roles_DOM = d3.select(".assign_probFunc_roles") + assign_probFunc_roles_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.confirm("Are you sure you want to do this?", function(sure) + { + if (sure) + { + var bootboxContent = {title: "Create FPG", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_add_function_problem_roles', + data: {'graphID':graphID, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }); + }) - fpgManipulations.append("li").append("a") - .text("1.9. Assign parameter roles") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - if (markedVariables.length<1) - { - bootbox.hideAll(); - bootbox.alert({ - title: "Assign parameter roles", - message: "<p>Please mark all parameters, which are of special interest. The options are:</p>" - +"<ul><li><b>Design Variable</b></li>" - +"<li><b>Objective</b></li>" - +"<li><b>Constraint</b></li>" - +"<li><b>State Variable</b> (also \"quantity of interest\")</li></ul><br/>" - +"<p>To \"pre-mark\" special parameters open the <b>Data Model Tree</b> or <b>Data Model List</b>, select the parameters via right-mouse click and use one if the \"Mark Variable\" options.</p>" - +"<p><b>IMPORTANT: After all parameters are \"pre-marked\", klick this button again to assign the parameter roles!</b></p>" - }) - } - else - { - markVariable(markedVariables) - } - - }) - - fpgManipulations.append("li").append("a") - .text("1.10. Get Possible Function Order") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "Select a sorting method", - inputType: 'select', - value: 'single-swap', - inputOptions: [ - { - text: 'single-swap', - value: 'single-swap', - }, - { - text: 'two-swap', - value: 'two-swap', - }, - { - text: 'hybrid-swap', - value: 'hybrid-swap', - }, - { - text: 'brute-force', - value: 'brute-force', - }, - { - text: 'branch-and-bound', - value: 'branch-and-bound', - } - ], - callback: function (result) { - if (result) - { - var method = result; - var bootboxContent = {title: "Get Possible Function Order", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_get_possible_function_order', - data: {'graphID':graphID, 'sortingMethod':method, 'currentOrder':nodeOrder, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - } - }); - }) + var assign_parameter_roles_DOM = d3.select(".assign_parameter_roles") + assign_parameter_roles_DOM.on("mousedown", function() + { + if (markedVariables.length<1) + { + bootbox.hideAll(); + bootbox.alert({ + title: "Assign parameter roles", + message: "<p>Please mark all parameters, which are of special interest. The options are:</p>" + +"<ul><li><b>Design Variable</b></li>" + +"<li><b>Objective</b></li>" + +"<li><b>Constraint</b></li>" + +"<li><b>State Variable</b> (also \"quantity of interest\")</li></ul><br/>" + +"<p>To \"pre-mark\" special parameters open the <b>Data Model Tree</b> or <b>Data Model List</b>, select the parameters via right-mouse click and use one of the \"Pre-assign parameter\" options.</p>" + +"<p><b>IMPORTANT: After all parameters are \"pre-assigned\", klick this button again to assign the parameter roles!</b></p>" + }) + } + else + { + markVariable(markedVariables) + } + + }) - fpgManipulations.append("li").append("a") - .text("1.11. Remove unused outputs") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "<p><b>Remove unused outputs</b></p>" - +"<p>Do you want to clean up the graph afterwards?</p>" - +"<b>CAUTION:</b> This will remove all unused competences automatically as well!", - inputType: 'select', - value: "True", - inputOptions: [{text:'yes', value:'True'}, {text:'no', value:'False'}], - callback: function (selection) - { - if (selection) - { - var bootboxContent = {title: "Enrich FPG", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_remove_unused_outputs', - data: {'graphID':graphID, 'currentOrder':nodeOrder, 'cleanUp':selection, - 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - - } - }) - }) + var get_function_order_DOM = d3.select(".get_function_order") + get_function_order_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.prompt( + { + title: "Select a sorting method", + inputType: 'select', + value: 'single-swap', + inputOptions: [ + { + text: 'single-swap', + value: 'single-swap', + }, + { + text: 'two-swap', + value: 'two-swap', + }, + { + text: 'hybrid-swap', + value: 'hybrid-swap', + }, + { + text: 'brute-force', + value: 'brute-force', + }, + { + text: 'branch-and-bound', + value: 'branch-and-bound', + } + ], + callback: function (result) { + if (result) + { + var method = result; + var bootboxContent = {title: "Get Possible Function Order", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_get_possible_function_order', + data: {'graphID':graphID, 'sortingMethod':method, 'currentOrder':nodeOrder, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + } + }); + }) + + var remove_unused_outputs_DOM = d3.select(".remove_unused_outputs") + remove_unused_outputs_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.prompt( + { + title: "<p><b>Remove unused outputs</b></p>" + +"<p>Do you want to clean up the graph afterwards?</p>" + +"<b>CAUTION:</b> This will remove all unused competences automatically as well!", + inputType: 'select', + value: "True", + inputOptions: [{text:'yes', value:'True'}, {text:'no', value:'False'}], + callback: function (selection) + { + if (selection) + { + var bootboxContent = {title: "Enrich FPG", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_remove_unused_outputs', + data: {'graphID':graphID, 'currentOrder':nodeOrder, 'cleanUp':selection, + 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + + } + }) + }) //#################################################################################################################### //aigner: MDPG manipulations //#################################################################################################################### - var mpgManipulations_ul = optionsDiv.append("ul") - var mpgManipulations_li = mpgManipulations_ul.append("li") - .on("mouseover", function(){ - d3.select(this) - .style("cursor", "default") - }) - mpgManipulations_li.append("a").text("2. MDPG Manipulations") - var mpgManipulations = mpgManipulations_li.append("ul"); - var xOffset_ul = mpgManipulations_li._groups[0][0].offsetLeft+mpgManipulations_li._groups[0][0].offsetWidth-40; - mpgManipulations.style("left", String(xOffset_ul)+"px") - - - //aigner: Kadmos function --> Start defining MDO problem - mpgManipulations.append("li").append("a") - .text("2.1. Start defining MDAO architecture") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - bootbox.hideAll(); - bootbox.prompt( - { - title: "<p>This will create an initial MDPG for your MDO problem. After clicking this button, you can go through the \"<b>MDPG manipulation</b>\" steps." - +"<p>Please type in a new name for the graph</p>", - value: currentGraph.name, - callback: function(newGraphName) - { - if (newGraphName) - { - var newGraphID = '01'; - data.graphs.forEach(function(graph) - { - id_int = parseInt(graph.id) - if (data.graphs.length < 100){newGraphID = "0" + String(id_int+1);} - else{newGraphID = String(id_int+1);} - }) - var bootboxContent = {title: "Start defining MDAO architecture", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_start_defining_MDAO_architecture', - data: {'graphID':graphID, 'currentOrder': nodeOrder, 'newGraphName':newGraphName, 'newGraphID':newGraphID, 'sessionId': sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = jQuery.extend(true, {}, data); - var graphData = JSON.parse(result); - - for (var i = 0; i < data.graphs.length; i++) - { - if (graphID == data.graphs[i].id) - { - - //Insert copied graph behind the original one - updatedData.graphs.splice(i+1, 0, graphData.graphs[0]) - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,newGraphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - } - }) - }) - + //aigner: Kadmos function Start defining MDO problem + var start_MDO_architecture_DOM = d3.select(".start_MDO_architecture") + start_MDO_architecture_DOM.on("mousedown", function() + { + bootbox.hideAll(); + bootbox.hideAll(); + var html = d3.select("html") + var form_content = html.append("div").attr("class","form-content").attr("style","display:none") + var form = form_content.append("form").attr("class","form").attr("role","form") + var form_group, input; + + //Tool information + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Name") + input = form_group.append("input") + .attr("id","graph_name") + .attr("class","form-control") + .attr("name","graph_name") + .attr("placeholder","Add a graph name here...") + //Tool information + form_group = form.append("div").attr("class","form-group") + form_group.append("text").text("Description") + input = form_group.append("input") + .attr("id","graph_description") + .attr("class","form-control") + .attr("name","graph_description") + .attr("placeholder","Add a graph description here...") + + bootbox.dialog({ + message: $(".form-content").html(), + title: "<p>This will create an initial MDPG for your MDO problem. After clicking this button, you can go through the \"<b>MDPG manipulation</b>\" steps." + +"<p>Please type in a new name and description for the graph</p>", + size: "large", + buttons: [ + { + label: "Cancel", + className: "btn btn-default pull-left", + callback: function() { + d3.selectAll(".form-content").remove(); + } + }, + { + label: "OK", + className: "btn btn-primary pull-left", + callback: function() { + + //get form data + var graph_name = $('form #graph_name').val(); + var graph_description = $('form #graph_description').val(); + + + var newGraphID = '01'; + data.graphs.forEach(function(graph) + { + id_int = parseInt(graph.id) + if (data.graphs.length < 100){newGraphID = "0" + String(id_int+1);} + else{newGraphID = String(id_int+1);} + }) + var bootboxContent = {title: "Copy graph for defining MDAO architecture", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_start_defining_MDAO_architecture', + data: {'graphID':graphID, 'currentOrder': nodeOrder, 'newGraphName':graph_name, 'newGraphDesc':graph_description, 'newGraphID':newGraphID, 'sessionId': sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = jQuery.extend(true, {}, data); + var graphData = JSON.parse(result); + + for (var i = 0; i < data.graphs.length; i++) + { + if (graphID == data.graphs[i].id) + { + + //Insert copied graph behind the original one + updatedData.graphs.splice(i+1, 0, graphData.graphs[0]) + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,newGraphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + d3.selectAll(".form-content").remove(); + } + } + ] + }); + }) - var MDAO_architecture = '-'; + + var MDAO_architecture = '-'; var coupling_decomposition = '-'; var DOE_method = '-'; - mpgManipulations.append("li").append("a") - .text("2.2. Select MDAO Architecture") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - var theOptions = [] - for (var i = 0; i<MDAO_architectures.length; i++){theOptions.push({text:MDAO_architectures[i], value:MDAO_architectures[i]})} - bootbox.hideAll(); - bootbox.prompt( - { - title: "Select MDAO Architecture", - inputType: 'select', - value: MDAO_architecture, - inputOptions: theOptions, - callback: function (result) {if (result){MDAO_architecture = result;}} - }) - }) + var set_MDAO_architecture_DOM = d3.select(".set_MDAO_architecture") + set_MDAO_architecture_DOM.on("mousedown", function() + { + var theOptions = [] + for (var i = 0; i<MDAO_architectures.length; i++){theOptions.push({text:MDAO_architectures[i], value:MDAO_architectures[i]})} + bootbox.hideAll(); + bootbox.prompt( + { + title: "Set MDAO Architecture", + inputType: 'select', + value: MDAO_architecture, + inputOptions: theOptions, + callback: function (result) {if (result){MDAO_architecture = result;}} + }) + }) - mpgManipulations.append("li").append("a") - .text("2.3. Select Coupling Decomposition") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - var theOptions = [] - for (var i = 0; i<coupling_decompositions.length; i++){theOptions.push({text:coupling_decompositions[i], value:coupling_decompositions[i]})} - bootbox.hideAll(); - bootbox.prompt( - { - title: "Select Coupling Decomposition", - value: coupling_decomposition, - inputType: 'select', - inputOptions: theOptions, - callback: function (result) {if (result){coupling_decomposition = result;}} - }) - }) + var set_coupling_decomposition_DOM = d3.select(".set_coupling_decomposition") + set_coupling_decomposition_DOM.on("mousedown", function() + { + var theOptions = [] + for (var i = 0; i<coupling_decompositions.length; i++){theOptions.push({text:coupling_decompositions[i], value:coupling_decompositions[i]})} + bootbox.hideAll(); + bootbox.prompt( + { + title: "Select Coupling Decomposition", + value: coupling_decomposition, + inputType: 'select', + inputOptions: theOptions, + callback: function (result) {if (result){coupling_decomposition = result;}} + }) + }) - mpgManipulations.append("li").append("a") - .text("2.4. Select DOE Method") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() + var set_DOE_method_DOM = d3.select(".set_DOE_method") + set_DOE_method_DOM.on("mousedown", function() { var theOptions = [] for (var i = 0; i<DOE_methods.length; i++){theOptions.push({text:DOE_methods[i], value:DOE_methods[i]})} @@ -22475,215 +22910,193 @@ }) }) - mpgManipulations.append("li").append("a") - .text("2.5. Impose MDAO Architecture") - .on("mouseover", function(){d3.select(this).style("cursor", "pointer")}) - .on("mousedown", function() - { - var theOptions = [{text:"yes",value:"True"},{text:"no",value:"False"}] - bootbox.hideAll(); - bootbox.prompt( - { - title: "Allow Unconverged Couplings?", - value: "True", - inputType: 'select', - inputOptions: theOptions, - callback: function (result) - { - if (result) - { - var allow_unconverged_couplings = result; - var bootboxContent = {title: "Impose MDAO Architecture", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax( - { - type: 'POST', - url: '/kadmos_impose_MDAO_architecture', - data: {'graphID':graphID, - 'currentOrder':nodeOrder, - 'mdao_architecture':MDAO_architecture, - 'doe_method':DOE_method, - 'coupling_decomposition':coupling_decomposition, - 'allow_unconverged_couplings':allow_unconverged_couplings, - 'sessionId':sessionId}, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - - } - - } - }) - }) + var impose_MDAO_architecture_DOM = d3.select(".impose_MDAO_architecture") + impose_MDAO_architecture_DOM.on("mousedown", function() + { + var theOptions = [{text:"yes",value:"True"},{text:"no",value:"False"}] + bootbox.hideAll(); + bootbox.prompt( + { + title: "Allow Unconverged Couplings?", + value: "True", + inputType: 'select', + inputOptions: theOptions, + callback: function (result) + { + if (result) + { + var allow_unconverged_couplings = result; + var bootboxContent = {title: "Impose MDAO Architecture", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax( + { + type: 'POST', + url: '/kadmos_impose_MDAO_architecture', + data: {'graphID':graphID, + 'currentOrder':nodeOrder, + 'mdao_architecture':MDAO_architecture, + 'doe_method':DOE_method, + 'coupling_decomposition':coupling_decomposition, + 'allow_unconverged_couplings':allow_unconverged_couplings, + 'sessionId':sessionId}, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + + } + + } + }) + }) //#################################################################################################################### //aigner: Upload custom KADMOS script //#################################################################################################################### - var uploadCustomScript_ul = optionsDiv.append("ul") - var uploadCustomScript_li = uploadCustomScript_ul.append("li") - .on("mouseover", function(){ - d3.select(this) - .style("cursor", "pointer") - }) - .on("mousedown", function(){ - bootbox.dialog({ - title: "Upload custom script", - message: "<button id='downloadBtn' class='btn btn-primary'><i class='glyphicon glyphicon-download-alt '></i> Download template script</button>" - +"<form style='margin-top:20px;' id='scriptForm' method='post' enctype='multipart/form-data'>" - +"<label>" - +"<text>Upload script file:</text>" - +"<input type='file' name='file[]' />" - +"<input type='submit' value='Submit'/>" - +"</label></form>", - buttons : - { - cancel: { - label: "Cancel", - className: 'btn-danger' - } - } - }); - - //aigner: template for custom script that user can download - $('#downloadBtn').on("mousedown", function(){ - var script_template = "import sys\n\n" - +"from kadmos.graph import *\n\n\n" - +"def script(graph, mpg):\n" - +" \"\"\"\n" - +" Script to include manual operations in the KADMOS integration in VISTOMS\n\n" - +" :param graph: Any kadmos graph\n" - +" :param mpg: A corresponding MDO process graph\n" - +" :return: graph, mpg\n" - +" \"\"\"\n" - +" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n" - +" # ADD YOUR SCRIPT BELOW THIS LINE #\n" - +" # Example script:\n" - +" # graph.remove_node('node_ID')\n" - +" # graph.remove_edge('node_ID1', 'node_ID2')\n" - +" # END SCRIPT ABOVE THIS LINE #\n" - +" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n" - +" return graph, mpg\n" - - download('script_template.py', script_template); - }) - //upload of custom script - $('#scriptForm').on('submit',function(event){ - event.preventDefault(); - var formData = new FormData($('#scriptForm')[0]); - formData.append('graphID', graphID); - formData.append('sessionId', sessionId); - - if (typeof currentGraph.xdsm.workflow !== 'undefined' && currentGraph.xdsm.workflow.length > 0) - { - // the array is defined and has at least one element - upload_custom_script() - } - else - { - upload_custom_script() - } - - function upload_custom_script() - { - var bootboxContent = {title: "Upload custom KADMOS script", message: '<p>Please be patient...</p>'}; - var xhr = $.ajax({ - type: 'POST', - url: '/kadmos_run_custom_script', - data: formData, - processData: false, - contentType: false, - success: function(result) - { - if (result.includes("ERROR:")) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - else - { - var updatedData = {}; - updatedData = data; - var graphData = JSON.parse(result); - for (var i = 0; i < updatedData.graphs.length; i++) - { - if (graphID == updatedData.graphs[i].id) - { - updatedData.graphs[i] = graphData.graphs[0]; - } - } - - clearView(); - makeKadmosMenu(updatedData); - xdsm_script(updatedData,graphID); - - bootboxContent.message = "Success!" - kadmosSuccessMessage(bootboxContent) - } - }, - error: function(result) - { - bootboxContent.message = result - kadmosErrorMessage(bootboxContent); - } - }); - kadmosHavePatience(xhr, bootboxContent) - } - }); - }) - - uploadCustomScript_li.append("a").text("Upload Custom Script") - //#################################################################################################################### + var upload_script_DOM = d3.select(".upload_script") + upload_script_DOM.on("mousedown", function(){ + bootbox.dialog({ + title: "Upload custom script", + message: "<button id='downloadBtn' class='btn btn-primary'><i class='glyphicon glyphicon-download-alt '></i> Download template script</button>" + +"<form style='margin-top:20px;' id='scriptForm' method='post' enctype='multipart/form-data'>" + +"<label>" + +"<text>Upload script file:</text>" + +"<input type='file' name='file[]' />" + +"<input type='submit' value='Submit'/>" + +"</label></form>", + buttons : + { + cancel: { + label: "Cancel", + className: 'btn-danger' + } + } + }); + + //aigner: template for custom script that user can download + $('#downloadBtn').on("mousedown", function(){ + var script_template = "import sys\n\n" + +"from kadmos.graph import *\n\n\n" + +"def script(graph, mpg):\n" + +" \"\"\"\n" + +" Script to include manual operations in the KADMOS integration in VISTOMS\n\n" + +" :param graph: Any kadmos graph\n" + +" :param mpg: A corresponding MDO process graph\n" + +" :return: graph, mpg\n" + +" \"\"\"\n" + +" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n" + +" # ADD YOUR SCRIPT BELOW THIS LINE #\n" + +" # Example script:\n" + +" # graph.remove_node('node_ID')\n" + +" # graph.remove_edge('node_ID1', 'node_ID2')\n" + +" # END SCRIPT ABOVE THIS LINE #\n" + +" # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # #\n" + +" return graph, mpg\n" + + download('script_template.py', script_template); + }) + //upload of custom script + $('#scriptForm').on('submit',function(event){ + event.preventDefault(); + var formData = new FormData($('#scriptForm')[0]); + formData.append('graphID', graphID); + formData.append('sessionId', sessionId); + + if (typeof currentGraph.xdsm.workflow !== 'undefined' && currentGraph.xdsm.workflow.length > 0) + { + // the array is defined and has at least one element + upload_custom_script() + } + else + { + upload_custom_script() + } + + function upload_custom_script() + { + var bootboxContent = {title: "Upload custom KADMOS script", message: '<p>Please be patient...</p>'}; + var xhr = $.ajax({ + type: 'POST', + url: '/kadmos_run_custom_script', + data: formData, + processData: false, + contentType: false, + success: function(result) + { + if (result.includes("ERROR:")) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + else + { + var updatedData = {}; + updatedData = data; + var graphData = JSON.parse(result); + for (var i = 0; i < updatedData.graphs.length; i++) + { + if (graphID == updatedData.graphs[i].id) + { + updatedData.graphs[i] = graphData.graphs[0]; + } + } + + clearView(); + makeKadmosMenu(updatedData); + xdsm_script(updatedData,graphID); + + bootboxContent.message = "Success!" + kadmosSuccessMessage(bootboxContent) + } + }, + error: function(result) + { + bootboxContent.message = result + kadmosErrorMessage(bootboxContent); + } + }); + kadmosHavePatience(xhr, bootboxContent) + } + }); + }) + //#################################################################################################################### //aigner: Data Model Tree View Button //#################################################################################################################### - var dataModelDiv = d3.select(".xdsmDiv").append("div").attr("class","dataModelDiv").attr("transform","translate(10,0)") - var ul = dataModelDiv.append("ul") - var dropdown1 = ul.append("li").on("mouseover", function(){d3.select(this).style("cursor", "default")}) - dropdown1.append("img").attr("src",fileReference.AGILE_Icon) - .attr("align","left") - .style("margin-left","6px") - .style("margin-right","-10px") - .style("margin-top","10px") - .style("margin-bottom","0px") - .attr("height","20") - .attr("width","20") - dropdown1.append("a").text("Data Model Tree") - var links = dropdown1.append("ul"); - var xOffset_ul = dropdown1._groups[0][0].offsetLeft+dropdown1._groups[0][0].offsetWidth-40; - links.style("left", String(xOffset_ul)+"px") + var dropdown1 = d3.select(".tree_view") + var links = dropdown1.append("ul").attr("class","view_options"); for (var j=0; j< varCategories.length; j++) { //console.log(varCategories[j]) @@ -22746,20 +23159,8 @@ } } - var ul_list = dataModelDiv.append("ul") - var dropdownList = ul_list.append("li").on("mouseover", function(){d3.select(this).style("cursor", "default")}) - dropdownList.append("img").attr("src",fileReference.AGILE_Icon) - .attr("align","left") - .style("margin-left","6px") - .style("margin-right","-10px") - .style("margin-top","10px") - .style("margin-bottom","0px") - .attr("height","20") - .attr("width","20") - dropdownList.append("a").text("Data Model List") - var linksList = dropdownList.append("ul"); - var xOffset_ul = dropdownList._groups[0][0].offsetLeft+dropdownList._groups[0][0].offsetWidth-40; - linksList.style("left", String(xOffset_ul)+"px") + var dropdownList = d3.select(".list_view") + var linksList = dropdownList.append("ul").attr("class","view_options"); for (var j=0; j< varCategories.length; j++) { //console.log(varCategories[j]) diff --git a/kadmos/vistoms/vistoms.py b/kadmos/vistoms/vistoms.py index 7acface84e50db35304dbc357353f56293592c8e..8a4ac84a78a17f99f51c913afc1d6681b87772b4 100644 --- a/kadmos/vistoms/vistoms.py +++ b/kadmos/vistoms/vistoms.py @@ -464,6 +464,7 @@ def interface(debug=True, tempdir=None): # get request form graphID = request.form['graphID'] newGraphName = request.form['newGraphName'] + newGraphDesc = request.form['newGraphDesc'] newGraphID = request.form['newGraphID'] session_id = request.form['sessionId'] session_folder = retrieve_session_folder(SESSIONS_CATALOG_FOLDER, session_id) @@ -484,6 +485,7 @@ def interface(debug=True, tempdir=None): newFileName = TEMP_FILE + '_' + newGraphID + '.kdms' graph.graph['name'] = newGraphName + graph.graph['description'] = newGraphDesc graph.graph['id'] = newGraphID graph.save(os.path.join(session_folder, newFileName), file_type="kdms", graph_check_critical=False, mpg=mpg) @@ -929,6 +931,7 @@ def interface(debug=True, tempdir=None): functionOrder = request.form['currentOrder'].split(',') newGraphID = request.form['newGraphID'] newGraphName = request.form['newGraphName'] + newGraphDesc = request.form['newGraphDesc'] # First determine session folder session_id = request.form['sessionId'] @@ -951,8 +954,7 @@ def interface(debug=True, tempdir=None): fpg_initial = graph.deepcopy_as(FundamentalProblemGraph) fpg_initial.graph['name'] = newGraphName - fpg_initial.graph['description'] = 'Fundamental problem graph to solve the "' + graph.graph['name'] \ - + '".' + fpg_initial.graph['description'] = newGraphDesc fpg_initial.graph['problem_formulation'] = dict() fpg_initial.graph['problem_formulation']['function_order'] = functionOrder fpg_initial.graph['problem_formulation']['mdao_architecture'] = "None" @@ -998,45 +1000,54 @@ def interface(debug=True, tempdir=None): graphFileName = TEMP_FILE+'_'+graphID+'.kdms' mpgFileName = TEMP_FILE+'_'+graphID+'_mpg.kdms' if os.path.exists(os.path.join(path, mpgFileName)): - return "ERROR: You cannot add metadata to a design competence in an MPG! Please go back to the RCG " \ - "to do so." + graph = load(os.path.join(path, graphFileName), file_check_critical=False) + mpg = load(os.path.join(path, mpgFileName), file_check_critical=False) else: graph = load(os.path.join(path, graphFileName), file_check_critical=False) mpg = None - graph.add_dc_general_info(nodeName, description=metadata_py['general_info']['description'], - status=metadata_py['general_info']['status'], - owner_uid=metadata_py['general_info']['owner_uid'], - creator_uid=metadata_py['general_info']['creator_uid'], - operator_uid=metadata_py['general_info']['operator_uid']) - graph.add_dc_performance_info(nodeName, precision=metadata_py['performance_info']['precision'], - fidelity_level=metadata_py['performance_info']['fidelity_level'], - run_time=metadata_py['performance_info']['run_time'], - verification=metadata_py['performance_info']['verification']) - graph.add_dc_licensing(nodeName, license_type=metadata_py['licensing']['license_type'], - license_specification=metadata_py['licensing']['license_specification'], - license_info=metadata_py['licensing']['license_info']) - graph.add_dc_sources(nodeName, repository_link=metadata_py['sources']['repository_link'], - download_link=metadata_py['sources']['download_link'], - references=metadata_py['sources']['references']) - graph.add_dc_execution_details(nodeName, operating_system="", integration_platform="", command="", - description="", software_requirements="", hardware_requirements="") - remote_component = metadata_py['remote_component_info']['remote_component'] - if remote_component: - graph.add_dc_remote_component_info(nodeName, single_or_multi_execution="", job_name="", - remote_engineer=metadata_py['remote_component_info']['remote_engineer_uid'], - notification_message="", data_exchange_dict= {'urlsite': metadata_py['remote_component_info']['urlsite'], - 'folder': metadata_py['remote_component_info']['folder']}) + graph.add_dc_general_info(nodeName, description=metadata_py['general_info']['description'], + status=metadata_py['general_info']['status'], + owner_uid=metadata_py['general_info']['owner_uid'], + creator_uid=metadata_py['general_info']['creator_uid'], + operator_uid=metadata_py['general_info']['operator_uid']) + graph.add_dc_performance_info(nodeName, precision=metadata_py['performance_info']['precision'], + fidelity_level=metadata_py['performance_info']['fidelity_level'], + run_time=metadata_py['performance_info']['run_time'], + verification=metadata_py['performance_info']['verification']) + graph.add_dc_licensing(nodeName, license_type=metadata_py['licensing']['license_type'], + license_specification=metadata_py['licensing']['license_specification'], + license_info=metadata_py['licensing']['license_info']) + graph.add_dc_sources(nodeName, repository_link=metadata_py['sources']['repository_link'], + download_link=metadata_py['sources']['download_link'], + references=metadata_py['sources']['references']) + + local_component = metadata_py['execution_details']['local_component'] + if local_component: + graph.add_dc_execution_details(nodeName, operating_system=metadata_py['execution_details']['operating_system'], + integration_platform=metadata_py['execution_details']['integration_platform'], + command=metadata_py['execution_details']['command'], + description=metadata_py['execution_details']['description'], + software_requirements=metadata_py['execution_details']['software_requirements'], + hardware_requirements=metadata_py['execution_details']['hardware_requirements']) + + remote_component = metadata_py['remote_component_info']['remote_component'] + if remote_component: + graph.add_dc_remote_component_info(nodeName, single_or_multi_execution=metadata_py['remote_component_info']['single_or_multi_execution'], + job_name=metadata_py['remote_component_info']['job_name'], + remote_engineer=metadata_py['remote_component_info']['remote_engineer_uid'], + notification_message=metadata_py['remote_component_info']['notification_message'], + data_exchange_dict= {'urlsite': metadata_py['remote_component_info']['urlsite'],'folder': metadata_py['remote_component_info']['folder']}) - # Add the graph with the updated function order to VISTOMS - newVistomsData = graph.vistoms_add_json(function_order=function_order, graph_id=graphID, mpg=mpg) - # Use function order for VISTOMS if it is available in the graph information - if graph.graph_has_nested_attributes('problem_formulation', 'function_order') and mpg is None: - graph.graph['problem_formulation']['function_order'] = function_order - # Save the graph in temp/tmp.kdms - graph.save(os.path.join(session_folder, TEMP_FILE + '_' + graphID + '.kdms'), file_type='kdms', - graph_check_critical=False, mpg=mpg) + # Add the graph with the updated function order to VISTOMS + newVistomsData = graph.vistoms_add_json(function_order=function_order, graph_id=graphID, mpg=mpg) + # Use function order for VISTOMS if it is available in the graph information + if graph.graph_has_nested_attributes('problem_formulation', 'function_order') and mpg is None: + graph.graph['problem_formulation']['function_order'] = function_order + # Save the graph in temp/tmp.kdms + graph.save(os.path.join(session_folder, TEMP_FILE + '_' + graphID + '.kdms'), file_type='kdms', + graph_check_critical=False, mpg=mpg) - return newVistomsData + return newVistomsData except Exception as e: return "ERROR: " + e.message @@ -1223,22 +1234,23 @@ def interface(debug=True, tempdir=None): graphFileName = TEMP_FILE+'_'+graphID+'.kdms' mpgFileName = TEMP_FILE+'_'+graphID+'_mpg.kdms' if os.path.exists(os.path.join(path, mpgFileName)): - return "ERROR: You cannot change organizational info on an MPG! Please go back to the RCG to do so." + graph = load(os.path.join(path, graphFileName), file_check_critical=False) + mpg = load(os.path.join(path, mpgFileName), file_check_critical=False) else: graph = load(os.path.join(path, graphFileName), file_check_critical=False) mpg = None - # Set the new organization from VISTOMS request - graph.graph['organization'] = organization + # Set the new organization from VISTOMS request + graph.graph['organization'] = organization - # Add the graph with the updated function order to VISTOMS - newVistomsData = graph.vistoms_add_json(graph_id=graphID, mpg=mpg, function_order=function_order) + # Add the graph with the updated function order to VISTOMS + newVistomsData = graph.vistoms_add_json(graph_id=graphID, mpg=mpg, function_order=function_order) - # Save the graph in temp/tmp.kdms - graph.save(os.path.join(session_folder, TEMP_FILE + '_' + graphID + '.kdms'), file_type='kdms', - graph_check_critical=False, mpg=mpg) + # Save the graph in temp/tmp.kdms + graph.save(os.path.join(session_folder, TEMP_FILE + '_' + graphID + '.kdms'), file_type='kdms', + graph_check_critical=False, mpg=mpg) - return newVistomsData + return newVistomsData except Exception as e: return "ERROR: " + e.message @@ -2048,6 +2060,7 @@ def interface(debug=True, tempdir=None): functionOrder = request.form['currentOrder'].split(',') newGraphID = request.form['newGraphID'] newGraphName = request.form['newGraphName'] + newGraphDesc = request.form['newGraphDesc'] # First determine session folder session_id = request.form['sessionId'] @@ -2079,7 +2092,7 @@ def interface(debug=True, tempdir=None): mdg = deepcopy(graph) mdg.graph['name'] = newGraphName - mdg.graph['description'] = 'MDAO data and process graph to solve the "' + graph.graph['name'] + '".' + mdg.graph['description'] = newGraphDesc mdg.graph['problem_formulation'] = dict() mdg.graph['problem_formulation']['function_order'] = functionOrder mdg.graph['problem_formulation']['mdao_architecture'] = "None" @@ -2241,7 +2254,7 @@ if __name__ == '__main__': folder = os.path.join(args[args.index('-folder') + 1],'') assert isinstance(folder, basestring), 'Folder should be a string.' else: - folder = None + folder = "C:/Users/aigne/Desktop/VISTOMS/vistoms_tmp" # Check if open_vistoms is given in args if '-open' in args: open_vistoms = args[args.index('-open') + 1]