LSP: added connector option type flag

This commit is contained in:
Cat 2017-10-23 10:11:03 +02:00 committed by Thulinma
parent a162ffbd84
commit 816896b7b9
2 changed files with 24 additions and 19 deletions

View file

@ -207,7 +207,7 @@ UI.elements.connection.user_and_host.text(mist.user.name+" @ "+mist.user.host);U
b.totals[q])}a&&a(b,d);break;case "CHALL":if(b.authorize.challenge==mist.user.authstring){mist.user.password!=""&&UI.elements.connection.msg.text("The credentials you provided are incorrect.").addClass("red");UI.navto("Login")}else if(mist.user.password=="")UI.navto("Login");else{mist.user.authstring=b.authorize.challenge;mist.send(a,c,d);sessionStorage.setItem("mistLogin",JSON.stringify({host:mist.user.host,name:mist.user.name,password:mist.user.password}))}break;case "NOACC":UI.navto("Create a new account");
break;case "ACC_MADE":delete c.authorize;mist.send(a,c,d);break;default:UI.navto("Login")}}};d.hide||UI.elements.connection.msg.removeClass("red").text("Data sent, waiting for a reply..").append($("<br>")).append($("<a>").text("Cancel request").click(function(){e.abort()}));var e=$.ajax(b)},inputMatch:function(a,c){if(typeof a=="undefined")return false;typeof a=="string"&&(a=[a]);for(var d in a){var b=a[d].replace(/[^\w\s]/g,"\\$&"),b=b.replace(/\\\*/g,".*");if(RegExp("^(?:[a-zA-Z]:)?"+b+"(?:\\?[^\\?]*)?$",
"i").test(c))return true}return false},convertBuildOptions:function(a,c){var d=[],b=["required","optional"];"desc"in a&&d.push({type:"help",help:a.desc});for(var e in b)if(a[b[e]]){d.push($("<h4>").text(UI.format.capital(b[e])+" parameters"));for(var f in a[b[e]]){var m=a[b[e]][f],h={label:UI.format.capital(m.name),pointer:{main:c,index:f},validate:[]};b[e]=="required"&&(!("default"in m)||m["default"]=="")&&h.validate.push("required");if("default"in m)h.placeholder=m["default"];if("help"in m)h.help=
m.help;if("unit"in m)h.unit=m.unit;switch(m.type){case "int":h.type="int";break;case "uint":h.type="int";h.min=0;break;case "debug":h.type="debug";break;case "select":h.type="select";h.select=m.select;break;default:h.type="str"}d.push(h)}}return d},stored:{get:function(){return mist.data.ui_settings||{}},set:function(a,c){var d=this.get();d[a]=c;mist.send(function(){},{ui_settings:d})},del:function(a){delete mist.data.ui_settings[a];mist.send(function(){},{ui_settings:mist.data.ui_settings})}}};
m.help;if("unit"in m)h.unit=m.unit;if("type"in m)switch(m.type){case "int":h.type="int";break;case "uint":h.type="int";h.min=0;break;case "debug":h.type="debug";break;case "select":h.type="select";h.select=m.select;break;default:h.type="str"}else h.type="checkbox";d.push(h)}}return d},stored:{get:function(){return mist.data.ui_settings||{}},set:function(a,c){var d=this.get();d[a]=c;mist.send(function(){},{ui_settings:d})},del:function(a){delete mist.data.ui_settings[a];mist.send(function(){},{ui_settings:mist.data.ui_settings})}}};
function log(){try{UI.debug&&[].push.call(arguments,Error().stack);[].unshift.call(arguments,"["+UI.format.time((new Date).getTime()/1E3)+"]");console.log.apply(console,arguments)}catch(a){}}
$.fn.getval=function(){var a=$(this).data("opts"),c=$(this).val();if(a&&"type"in a)switch(a.type){case "span":c=$(this).html();break;case "checkbox":c=$(this).prop("checked");break;case "radioselect":a=$(this).find("label > input[type=radio]:checked").parent();if(a.length){c=[];c.push(a.children("input[type=radio]").val());a=a.children("select");a.length&&c.push(a.val())}else c="";break;case "checklist":c=[];$(this).find(".checklist input[type=checkbox]:checked").each(function(){c.push($(this).attr("name"))});
break;case "unix":c!=""&&(c=Math.round(new Date($(this).val())/1E3))}return c};

View file

@ -5938,6 +5938,7 @@ var mist = {
if ('unit' in ele) {
obj.unit = ele.unit;
}
if ("type" in ele) {
switch (ele.type) {
case 'int':
obj.type = 'int';
@ -5957,6 +5958,10 @@ var mist = {
default:
obj.type = 'str';
}
}
else {
obj.type = "checkbox";
}
build.push(obj);
}
}