X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;ds=sidebyside;f=dgbuilder%2Fpublic%2Fred%2Fmain.js;h=cf7bb287c7faaf6f6978105963f11da80bf4cece;hb=8f6a6c445eaeb7356e1db9d10d10b7d3fa42f27e;hp=27032a2654bfe2a9f6ff3d89f7198109b0ebedad;hpb=6741df81b766bb1dc271c214b923b18f52c20892;p=ccsdk%2Fdistribution.git
diff --git a/dgbuilder/public/red/main.js b/dgbuilder/public/red/main.js
index 27032a26..cf7bb287 100644
--- a/dgbuilder/public/red/main.js
+++ b/dgbuilder/public/red/main.js
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
**/
+
var RED = (function() {
function hideDropTarget() {
@@ -392,7 +393,8 @@ var RED = (function() {
.always(function() {
});
}
- /*
+
+ /*
function listYangFiles(){
yangFilesList=[];
var divStyle="";
@@ -1216,10 +1218,239 @@ Added this logic because , when the configuration item is choosen in the menu th
$("#list-yang-browser-dialog").dialog("close");
$("#request-input-dialog").dialog();
$("#request-input-dialog").dialog("close");
+ $("#test-dg-dialog").dialog();
+ $("#test-dg-dialog").dialog("close");
+ $("#ctx-values-dialog").dialog();
+ $("#ctx-values-dialog").dialog("close");
+ $("#list-input-browser-dialog").dialog();
+ $("#list-input-browser-dialog").dialog("close");
+ $("#diff-browser-dialog").dialog();
+ $("#diff-browser-dialog").dialog("close");
//var msecs2= Date.now();
//console.log("Time taken for dialog boxes:" + (msecs2 - msecs1));
})();
+
+ //start functions to support Test DG
+ function testDG(){
+ getSliParametersFromDG();
+ /*
+ for (var property in callNodes) {
+ if (callNodes.hasOwnProperty(property)) {
+ console.log(property);
+ var moduleRpc = property.split("_");
+ var mName = moduleRpc[0];
+ var rName = moduleRpc[1];
+ }
+ }
+ */
+ showTestDGDialog();
+ }
+
+
+ function showInputFiles(files){
+ var divStyle="";
+
+ var header="
";
+ var html= divStyle + header + "";
+ var htmlStr = "
URL Method GET
POST
PUT
DELETE
Input ";
+ htmlStr +="
Response "
+ //background: "#c3e8d1",
+ $("#test-dg-dialog").dialog({
+ dialogClass :"no-close",
+ modal:true,
+ autoOpen :false,
+ title: "Test DG Module:" + moduleName + " RPC:" + rpcName,
+ width: 800,
+ height: "auto",
+ buttons :[
+ {
+ text: "$Variables",
+ click: function() {
+ $("#test-dg-response").val("");
+ showCtxVariables(moduleName,rpcName);
+ //console.dir(dgParsedParameters);
+ }
+ },
+ {
+ text: "Load",
+ click: function() {
+ var inputData = {
+ "moduleName" : moduleName,
+ "rpcName" : rpcName
+ };
+
+ $.post( "/getInputFiles",inputData )
+ .done(function( data ) {
+ //console.dir(data);
+ if(data != undefined && data != null){
+ showInputFiles(data.files);
+ }
+ })
+ .fail(function(err) {
+ console.log( "failed to save input. " + err );
+ })
+ .always(function() {
+ });
+ }
+ },
+ {
+ text: "Send",
+ click: function() {
+ $("#test-dg-response").val("");
+ var methodType =$("input[name=methodType]:checked").val();
+ var urlValue = $("#test-dg-url").val();
+ var reqData = {};
+ try{
+ reqData = JSON.parse($("#test-dg-request").val());
+ }catch(er){
+ $("#test-dg-response").val(er);
+ return false;
+ }
+ //console.log("urlValue:" + urlValue);
+ //console.dir(reqData);
+ var inputStr = $("#test-dg-request").val();
+ //headers: { 'Authorization': 'Basic ' + btoa(data.restConfUser + ":" + data.restConfPassword)},
+ var inputData = {
+ "moduleName" : moduleName,
+ "rpcName" : rpcName,
+ "inputStr" : inputStr
+ };
+
+ $.post( "/saveTestDGInput",inputData )
+ .done(function( data ) {
+
+ })
+ .fail(function(err) {
+ console.log( "failed to save input. " + err );
+ })
+ .always(function() {
+ $.ajax({
+ xhrFields: { withCredentials: true },
+ type: methodType,
+ url: urlValue,
+ data: JSON.stringify(reqData),
+ contentType: "application/json; charset=utf-8",
+ username : data.restConfUser,
+ password : data.restConfPassword,
+ success: function(data) {
+ if(data != null){
+ $("#test-dg-response").val(JSON.stringify(data,null,4));
+ }else{
+ $("#test-dg-response").val("No Content returned");
+ }
+ },
+ error: function(err) {
+ if(err != null){
+ $("#test-dg-response").val(JSON.stringify(err,null,4));
+ }else{
+ $("#test-dg-response").val("error Occured");
+ }
+ }
+ });
+ });
+ }
+ },
+ {
+ text: "Reset",
+ click: function() {
+ $("#test-dg-request").val(sliApiInputStr);
+ $("#test-dg-response").val("");
+ }
+ },
+ {
+ text: "Close",
+ click: function() {
+ $("#test-dg-dialog").dialog("close");
+ }
+ }
+ ],
+ open:function(){
+ $('#test-dg-dialog').css('overflow', 'hidden');
+ }
+ }).dialog("open").html(htmlStr).css("background","aliceblue");
+ });
+ }
+ //end functions to support Test DG
+
+
function updateConfiguration(){
//console.log("in updateConfiguration");
$.get("/getCurrentSettings",function (data){
@@ -1228,9 +1459,16 @@ Added this logic because , when the configuration item is choosen in the menu th
var dbName = data.dbName;
var dbUser = data.dbUser;
var dbPassword = data.dbPassword;
+ var formatXML = data.formatXML;
+ var formatJSON = data.formatJSON;
var gitLocalRepository = data.gitLocalRepository;
var performGitPull = data.performGitPull;
+ var restConfUrl = data.restConfUrl;
+ var restConfUser = data.restConfUser;
+ var restConfPassword = data.restConfPassword;
+ var emailAddress = data.emailAddress;
+
if(dbHost == undefined) dbHost="";
if(dbPort == undefined) dbPort="";
if(dbName == undefined) dbName="";
@@ -1238,13 +1476,19 @@ Added this logic because , when the configuration item is choosen in the menu th
if(dbPassword == undefined) dbPassword="";
if(gitLocalRepository == undefined) gitLocalRepository="";
if(performGitPull == undefined || performGitPull == null) performGitPull="N";
+ if(restConfUrl == undefined) restConfUrl="";
+ if(restConfUser == undefined) restConfUser="";
+ if(restConfPassword == undefined) restConfPassword="";
+ if(emailAddress == undefined) emailAddress="";
+ if(formatXML == undefined) formatXML="Y";
+ if(formatJSON == undefined) formatJSON="Y";
- var divStyle="border: 1px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 500px; border-radius: 25px;";
+ var divStyle="border: 1px solid #a1a1a1; padding: 10px 40px; background: #dddddd; width: 600px; border-radius: 25px;";
//var divStyle="border: 2px solid #a1a1a1; padding: 10px 40px; background: #99CCFF; width: 400px; border-radius: 25px;";
var html = "
";
- html += "";
+ html += "";
html += "
";
html += "
";
html += "";
@@ -1272,12 +1516,31 @@ Added this logic because , when the configuration item is choosen in the menu th
html += "
";
html += "
";
html += "
";
-
html += "
";
html += "
";
+ html += "
";
+ html += "
";
+
+ html += "
";
+ html += "
";
+ html += "";
html += "Git Local Repository Path ";
- html += " ";
+ html += " ";
html += " ";
html += "
";
html += "
";
@@ -1290,14 +1553,36 @@ Added this logic because , when the configuration item is choosen in the menu th
html += "";
html += "
";
html += "
";
+ html += "
";
+
+ html += "
";
+ html += "
";
+ html += "
";
html += "
";
//console.log("html:" + html);
$( "#update-configuration-dialog" ).dialog({
title: "Configuration",
modal: true,
autoOpen: true,
- width: 630,
- height: 630,
+ width: 730,
+ height: 930,
buttons: [
{
text: "Save",
@@ -1308,11 +1593,29 @@ Added this logic because , when the configuration item is choosen in the menu th
var newDBUser = $("#dbuser").val().trim();
var newDBPassword = $("#dbpassword").val().trim();
var newGitLocalRepository = $("#gitLocalRepository").val().trim();
+
+ var isFormatXML = $('#formatXML').is(':checked');
+ var isFormatJSON = $('#formatJSON').is(':checked');
var isPerformGitPullChecked = $('#performGitPull').is(':checked');
+ var newRestConfUrl = $("#restconfurl").val().trim();
+ var newRestConfUser = $("#restconfuser").val().trim();
+ var newRestConfPassword = $("#restconfpassword").val().trim();
var newPerformGitPull = "N";
+ var newEmailAddress = $("#emailaddress").val().trim();
+ //console.log("newEmailAddress:" + newEmailAddress);
if(isPerformGitPullChecked){
newPerformGitPull = "Y";
}
+ if(isFormatXML){
+ newFormatXML = "Y";
+ }else{
+ newFormatXML = "N";
+ }
+ if(isFormatJSON){
+ newFormatJSON = "Y";
+ }else{
+ newFormatJSON = "N";
+ }
if(newDBHost == ""){
RED.notify("Error: DB Host is required.");
$("#dbhost").focus();
@@ -1333,18 +1636,31 @@ Added this logic because , when the configuration item is choosen in the menu th
RED.notify("Error: DB Password is required.");
$("#dbpassword").focus();
return;
+ }else if(newEmailAddress == ""){
+ RED.notify("Error: Email Address is required.");
+ $("#emailaddress").focus();
+ return;
}else{
- console.log("newGitLocalRepository:" + newGitLocalRepository);
+ //console.log("newGitLocalRepository:" + newGitLocalRepository);
var reqData= {"dbHost":newDBHost,
"dbPort" : newDBPort,
"dbName" : newDBName,
"dbUser" : newDBUser,
"dbPassword" : newDBPassword,
"gitLocalRepository" : newGitLocalRepository,
- "performGitPull" : newPerformGitPull
+ "performGitPull" : newPerformGitPull ,
+ "formatXML": newFormatXML,
+ "formatJSON": newFormatJSON,
+ "restConfUrl" : newRestConfUrl,
+ "restConfUser" : newRestConfUser,
+ "restConfPassword" : newRestConfPassword,
+ "emailAddress" : newEmailAddress
};
$.post( "/updateConfiguration",reqData )
.done(function( data ) {
+ RED.settings.emailAddress = newEmailAddress;
+ format_xml = newFormatXML;
+ format_json = newFormatJSON;
RED.notify("Configuration updated successfully");
//loadSettings();
//RED.comms.connect();
@@ -1552,16 +1868,25 @@ Added this logic because , when the configuration item is choosen in the menu th
{id:"btn-list-yang-files",icon:"fa fa-clipboard",label:"List Yang Files",onselect:listYangFiles},
]},
null,
+ /* {id:"btn-dg-diff-menu",icon:"fa fa-sign-in",label:"DG diff",options:[
+ {id:"btn-diff-json",icon:"fa fa-clipboard",label:"Json diff since import",onselect:RED.view.diffJsonSinceImportDialog},
+ {id:"btn-diff-xml",icon:"fa fa-clipboard",label:"XML diff since import",onselect:RED.view.diffXmlSinceImportDialog},
+ ]},
+ null,*/
{id:"btn-configure-upload",icon:"fa fa-book",label:"Configuration",toggle:false,onselect:updateConfiguration},
null,
{id:"btn-manage-tabs",icon:"fa fa-info",label:"Manage Tabs",toggle:false,onselect:showSelectedTabs},
null,
- {id:"btn-search-text",icon:"fa fa-info",label:"Search Text (Ctrl+[)",toggle:false,onselect:RED.view.showSearchTextDialog},
+ {id:"btn-test-dg",icon:"fa fa-book",label:"Test DG",toggle:false,onselect:testDG},
+ null,
+ {id:"btn-find-dgnumber",icon:"fa fa-info",label:"Search Text (Ctrl+[)",toggle:false,onselect:RED.view.showSearchTextDialog},
null,
{id:"btn-find-dgnumber",icon:"fa fa-info",label:"Find Node (Ctrl+B)",toggle:false,onselect:RED.view.showDgNumberDialog},
null,
- {id:"btn-request-input",icon:"fa fa-info",label:"RPC Input (Ctrl+O)",toggle:false,onselect:RED.view.showRequestTemplateDialog},
+ {id:"btn-request-input",icon:"fa fa-info",label:"RPC Input (Ctrl+O)",toggle:false,onselect:RED.view.showRequestTemplateDialog},
null,
+ /*{id:"btn-loop-detection",icon:"fa fa-info",label:"Loop Detection",toggle:true,onselect:performLoopDetection},
+ null ,*/
{id:"btn-node-status",icon:"fa fa-info",label:"Node Status",toggle:true,onselect:toggleStatus},
null,
{id:"btn-node-dgnumber",icon:"fa fa-info",label:"Show Node Numbers",toggle:true,onselect:toggleDgNumberDisplay},
@@ -1610,7 +1935,7 @@ Added this logic because , when the configuration item is choosen in the menu th
//Making default loop detection on and display check mark in the menu
//$("#btn-loop-detection").addClass("active");
- RED.keyboard.add(/* ? */ 191,{shift:true},function(){showHelp();d3.event.preventDefault();});
+ RED.keyboard.add(/* ? */ 191,{shift:true,ctrl:true},function(){showHelp();d3.event.preventDefault();});
loadSettings();
RED.comms.connect();
});