LSP: added 3 new fields on overview page for load balancer location
This commit is contained in:
parent
45b5ea30ac
commit
5d04450202
2 changed files with 51 additions and 22 deletions
|
@ -27,7 +27,7 @@ a)},findOutput:function(a){return this.findInOutput("connectors",a)},findInOutpu
|
||||||
b.append(e);if("classes"in d)for(var l in d.classes)e.addClass(d.classes[l])}else if("text"==d.type)b.append($("<span>").addClass("text_container").append($("<span>").addClass("text").append(d.text)));else if("custom"==d.type)b.append(d.custom);else if("buttons"==d.type)for(l in e=$("<span>").addClass("button_container").on("keydown",function(a){a.stopPropagation()}),"css"in d&&e.css(d.css),b.append(e),d.buttons){var m=d.buttons[l],f=$("<button>").text(m.label).data("opts",m);"css"in m&&f.css(m.css);
|
b.append(e);if("classes"in d)for(var l in d.classes)e.addClass(d.classes[l])}else if("text"==d.type)b.append($("<span>").addClass("text_container").append($("<span>").addClass("text").append(d.text)));else if("custom"==d.type)b.append(d.custom);else if("buttons"==d.type)for(l in e=$("<span>").addClass("button_container").on("keydown",function(a){a.stopPropagation()}),"css"in d&&e.css(d.css),b.append(e),d.buttons){var m=d.buttons[l],f=$("<button>").text(m.label).data("opts",m);"css"in m&&f.css(m.css);
|
||||||
if("classes"in m)for(var q in m.classes)f.addClass(m.classes[q]);e.append(f);switch(m.type){case "cancel":f.addClass("cancel").click(m["function"]);break;case "save":f.addClass("save").click(function(){var a=$(this).data("opts").preSave;a&&a.call(this);var b=$(this).closest(".input_container"),c=!1;b.find('.hasValidate:visible, input[type="hidden"].hasValidate').each(function(){if(c=$(this).data("validate")(this,!0))return!1});(a=$(this).data("opts").failedValidate)&&a.call(this);c||(b.find('.isSetting:visible, input[type="hidden"].isSetting').each(function(){var a=
|
if("classes"in m)for(var q in m.classes)f.addClass(m.classes[q]);e.append(f);switch(m.type){case "cancel":f.addClass("cancel").click(m["function"]);break;case "save":f.addClass("save").click(function(){var a=$(this).data("opts").preSave;a&&a.call(this);var b=$(this).closest(".input_container"),c=!1;b.find('.hasValidate:visible, input[type="hidden"].hasValidate').each(function(){if(c=$(this).data("validate")(this,!0))return!1});(a=$(this).data("opts").failedValidate)&&a.call(this);c||(b.find('.isSetting:visible, input[type="hidden"].isSetting').each(function(){var a=
|
||||||
$(this).getval(),b=$(this).data("pointer");if(""===a)if("default"in $(this).data("opts"))a=$(this).data("opts")["default"];else return b.main[b.index]=null,!0;b.main[b.index]=a}),(a=$(this).data("opts")["function"])&&a(this))});break;default:f.click(m["function"])}}else{m=$("<label>").addClass("UIelement");b.append(m);"css"in d&&m.css(d.css);m.append($("<span>").addClass("label").html("label"in d?d.label+":":""));if("classes"in d)for(q in d.classes)m.addClass(d.classes[q]);f=$("<span>").addClass("field_container");
|
$(this).getval(),b=$(this).data("pointer");if(""===a)if("default"in $(this).data("opts"))a=$(this).data("opts")["default"];else return b.main[b.index]=null,!0;b.main[b.index]=a}),(a=$(this).data("opts")["function"])&&a(this))});break;default:f.click(m["function"])}}else{m=$("<label>").addClass("UIelement");b.append(m);"css"in d&&m.css(d.css);m.append($("<span>").addClass("label").html("label"in d?d.label+":":""));if("classes"in d)for(q in d.classes)m.addClass(d.classes[q]);f=$("<span>").addClass("field_container");
|
||||||
m.append(f);switch(d.type){case "password":e=$("<input>").attr("type","password");break;case "int":e=$("<input>").attr("type","number");"min"in d&&e.attr("min",d.min);"max"in d&&e.attr("max",d.max);"validate"in d?d.validate.push("int"):d.validate=["int"];break;case "span":e=$("<span>");break;case "debug":d.select=[["","Default"],[0,"0 - All debugging messages disabled"],[1,"1 - Messages about failed operations"],[2,"2 - Previous level, and error messages"],[3,"3 - Previous level, and warning messages"],
|
m.append(f);switch(d.type){case "password":e=$("<input>").attr("type","password");break;case "int":e=$("<input>").attr("type","number");"min"in d&&e.attr("min",d.min);"max"in d&&e.attr("max",d.max);"step"in d&&e.attr("step",d.step);"validate"in d?d.validate.push("int"):d.validate=["int"];break;case "span":e=$("<span>");break;case "debug":d.select=[["","Default"],[0,"0 - All debugging messages disabled"],[1,"1 - Messages about failed operations"],[2,"2 - Previous level, and error messages"],[3,"3 - Previous level, and warning messages"],
|
||||||
[4,"4 - Previous level, and status messages for development"],[5,"5 - Previous level, and more status messages for development"],[6,"6 - Previous level, and verbose debugging messages"],[7,"7 - Previous level, and very verbose debugging messages"],[8,"8 - Report everything in extreme detail"],[9,"9 - Report everything in insane detail"],[10,"10 - All messages enabled"]];case "select":e=$("<select>");for(l in d.select){var n=$("<option>");"string"==typeof d.select[l]?n.text(d.select[l]):n.val(d.select[l][0]).text(d.select[l][1]);
|
[4,"4 - Previous level, and status messages for development"],[5,"5 - Previous level, and more status messages for development"],[6,"6 - Previous level, and verbose debugging messages"],[7,"7 - Previous level, and very verbose debugging messages"],[8,"8 - Report everything in extreme detail"],[9,"9 - Report everything in insane detail"],[10,"10 - All messages enabled"]];case "select":e=$("<select>");for(l in d.select){var n=$("<option>");"string"==typeof d.select[l]?n.text(d.select[l]):n.val(d.select[l][0]).text(d.select[l][1]);
|
||||||
e.append(n)}break;case "textarea":e=$("<textarea>").on("keydown",function(a){a.stopPropagation()});break;case "checkbox":e=$("<input>").attr("type","checkbox");break;case "hidden":e=$("<input>").attr("type","hidden");m.hide();break;case "email":e=$("<input>").attr("type","email").attr("autocomplete","on").attr("required","");break;case "browse":e=$("<input>").attr("type","text");"filetypes"in d&&e.data("filetypes",d.filetypes);break;case "geolimited":case "hostlimited":e=$("<input>").attr("type",
|
e.append(n)}break;case "textarea":e=$("<textarea>").on("keydown",function(a){a.stopPropagation()});break;case "checkbox":e=$("<input>").attr("type","checkbox");break;case "hidden":e=$("<input>").attr("type","hidden");m.hide();break;case "email":e=$("<input>").attr("type","email").attr("autocomplete","on").attr("required","");break;case "browse":e=$("<input>").attr("type","text");"filetypes"in d&&e.data("filetypes",d.filetypes);break;case "geolimited":case "hostlimited":e=$("<input>").attr("type",
|
||||||
"hidden");break;case "radioselect":e=$("<div>").addClass("radioselect");for(c in d.radioselect){var k=$("<input>").attr("type","radio").val(d.radioselect[c][0]).attr("name",d.label);("LTSonly"in d&&!mist.data.LTS||d.readonly)&&k.prop("disabled",!0);n=$("<label>").append(k).append($("<span>").html(d.radioselect[c][1]));e.append(n);if(2<d.radioselect[c].length)for(l in k=$("<select>").change(function(){$(this).parent().find("input[type=radio]:enabled").prop("checked","true")}),n.append(k),("LTSonly"in
|
"hidden");break;case "radioselect":e=$("<div>").addClass("radioselect");for(c in d.radioselect){var k=$("<input>").attr("type","radio").val(d.radioselect[c][0]).attr("name",d.label);("LTSonly"in d&&!mist.data.LTS||d.readonly)&&k.prop("disabled",!0);n=$("<label>").append(k).append($("<span>").html(d.radioselect[c][1]));e.append(n);if(2<d.radioselect[c].length)for(l in k=$("<select>").change(function(){$(this).parent().find("input[type=radio]:enabled").prop("checked","true")}),n.append(k),("LTSonly"in
|
||||||
|
@ -49,13 +49,13 @@ b=d.getval();h=b.split("://");h.length>1&&(b=h[0]=="file"?h[1]:"");b=b.split(i);
|
||||||
break;case "hostlimited":k.prototype=$("<input>").attr("type","text").attr("placeholder","type a host")}k.prototype.on("change keyup",function(){$(this).closest(".field_container").data("subUI").blackwhite.trigger("change")});k.blackwhite.change(function(){var a=$(this).closest(".field_container").data("subUI"),b=[],c=false;a.values.children().each(function(){c=$(this).val();c!=""?b.push(c):$(this).remove()});a.values.append(a.prototype.clone(true));b.length>0?a.field.val($(this).val()+b.join(" ")):
|
break;case "hostlimited":k.prototype=$("<input>").attr("type","text").attr("placeholder","type a host")}k.prototype.on("change keyup",function(){$(this).closest(".field_container").data("subUI").blackwhite.trigger("change")});k.blackwhite.change(function(){var a=$(this).closest(".field_container").data("subUI"),b=[],c=false;a.values.children().each(function(){c=$(this).val();c!=""?b.push(c):$(this).remove()});a.values.append(a.prototype.clone(true));b.length>0?a.field.val($(this).val()+b.join(" ")):
|
||||||
a.field.val("");a.field.trigger("change")});"LTSonly"in d&&!mist.data.LTS&&(k.blackwhite.prop("disabled",!0),k.prototype.prop("disabled",!0));k.values.append(k.prototype.clone(!0));f.data("subUI",k).addClass("limit_list").append(k.blackwhite).append(k.values)}"pointer"in d&&(e.data("pointer",d.pointer).addClass("isSetting"),d.pointer.main&&(k=d.pointer.main[d.pointer.index],"undefined"!=k&&e.setval(k)));(""==e.getval()||null==e.getval())&&"value"in d&&e.setval(d.value);if("datalist"in d)for(c in k=
|
a.field.val("");a.field.trigger("change")});"LTSonly"in d&&!mist.data.LTS&&(k.blackwhite.prop("disabled",!0),k.prototype.prop("disabled",!0));k.values.append(k.prototype.clone(!0));f.data("subUI",k).addClass("limit_list").append(k.blackwhite).append(k.values)}"pointer"in d&&(e.data("pointer",d.pointer).addClass("isSetting"),d.pointer.main&&(k=d.pointer.main[d.pointer.index],"undefined"!=k&&e.setval(k)));(""==e.getval()||null==e.getval())&&"value"in d&&e.setval(d.value);if("datalist"in d)for(c in k=
|
||||||
"datalist_"+c+MD5(e[0].outerHTML),e.attr("list",k),k=$("<datalist>").attr("id",k),f.append(k),d.datalist)k.append($("<option>").val(d.datalist[c]));f=$("<span>").addClass("help_container");m.append(f);"help"in d&&(f.append($("<span>").addClass("ih_balloon").html(d.help)),e.on("focus mouseover",function(){$(this).closest("label").addClass("active")}).on("blur mouseout",function(){$(this).closest("label").removeClass("active")}));if("validate"in d){m=[];for(l in d.validate){k=d.validate[l];if("function"!=
|
"datalist_"+c+MD5(e[0].outerHTML),e.attr("list",k),k=$("<datalist>").attr("id",k),f.append(k),d.datalist)k.append($("<option>").val(d.datalist[c]));f=$("<span>").addClass("help_container");m.append(f);"help"in d&&(f.append($("<span>").addClass("ih_balloon").html(d.help)),e.on("focus mouseover",function(){$(this).closest("label").addClass("active")}).on("blur mouseout",function(){$(this).closest("label").removeClass("active")}));if("validate"in d){m=[];for(l in d.validate){k=d.validate[l];if("function"!=
|
||||||
typeof k)switch(k){case "required":k=function(a){return a==""||a==null?{msg:"This is a required field.",classes:["red"]}:false};break;case "int":k=function(a,b){var c=$(b).data("opts");if(!$(b)[0].validity.valid){var d=[];"min"in c&&d.push(" greater than or equal to "+c.min);"max"in c&&d.push(" smaller than or equal to "+c.max);return{msg:"Please enter an integer"+d.join(" and")+".",classes:["red"]}}if(parseInt(Number(a))!=a)return{msg:"Please enter an integer.",classes:["red"]}};break;case "streamname":k=
|
typeof k)switch(k){case "required":k=function(a){return a==""||a==null?{msg:"This is a required field.",classes:["red"]}:false};break;case "int":k=function(a,b){var c=$(b).data("opts");if(!$(b)[0].validity.valid){var d=[];"min"in c&&d.push(" greater than or equal to "+c.min);"max"in c&&d.push(" smaller than or equal to "+c.max);return{msg:"Please enter an integer"+d.join(" and")+".",classes:["red"]}}};break;case "streamname":k=function(a,b){if(a!=""){if(!isNaN(a.charAt(0)))return{msg:"The first character may not be a number.",
|
||||||
function(a,b){if(a!=""){if(!isNaN(a.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(a.toLowerCase()!=a)return{msg:"Uppercase letters are not allowed.",classes:["red"]};if(a.replace(/[^\da-z_]/g,"")!=a)return{msg:"Special characters (except for underscores) are not allowed.",classes:["red"]};if("streams"in mist.data&&a in mist.data.streams&&$(b).data("pointer").main.name!=a)return{msg:"This streamname already exists.<br>If you want to edit an existing stream, please click edit on the the streams tab.",
|
classes:["red"]};if(a.toLowerCase()!=a)return{msg:"Uppercase letters are not allowed.",classes:["red"]};if(a.replace(/[^\da-z_]/g,"")!=a)return{msg:"Special characters (except for underscores) are not allowed.",classes:["red"]};if("streams"in mist.data&&a in mist.data.streams&&$(b).data("pointer").main.name!=a)return{msg:"This streamname already exists.<br>If you want to edit an existing stream, please click edit on the the streams tab.",classes:["red"]}}};break;case "streamname_with_wildcard":k=
|
||||||
classes:["red"]}}};break;case "streamname_with_wildcard":k=function(a){if(a!=""){streampart=a.split("+");var b=streampart.slice(1).join("+");streampart=streampart[0];if(!isNaN(streampart.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(streampart.toLowerCase()!=streampart)return{msg:"Uppercase letters are not allowed in a stream name.",classes:["red"]};if(streampart.replace(/[^\da-z_]/g,"")!=streampart)return{msg:"Special characters (except for underscores) are not allowed in a stream name.",
|
function(a){if(a!=""){streampart=a.split("+");var b=streampart.slice(1).join("+");streampart=streampart[0];if(!isNaN(streampart.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(streampart.toLowerCase()!=streampart)return{msg:"Uppercase letters are not allowed in a stream name.",classes:["red"]};if(streampart.replace(/[^\da-z_]/g,"")!=streampart)return{msg:"Special characters (except for underscores) are not allowed in a stream name.",classes:["red"]};if(streampart!=
|
||||||
classes:["red"]};if(streampart!=a&&b.replace(/[\00|\0|\/]/g,"")!=b)return{msg:"Slashes or null bytes are not allowed in wildcards.",classes:["red"]}}};break;case "streamname_with_wildcard_and_variables":k=function(a){if(a!=""){streampart=a.split("+");var b=streampart.slice(1).join("+");streampart=streampart[0];if(!isNaN(streampart.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(streampart.toLowerCase()!=streampart)return{msg:"Uppercase letters are not allowed in a stream name.",
|
a&&b.replace(/[\00|\0|\/]/g,"")!=b)return{msg:"Slashes or null bytes are not allowed in wildcards.",classes:["red"]}}};break;case "streamname_with_wildcard_and_variables":k=function(a){if(a!=""){streampart=a.split("+");var b=streampart.slice(1).join("+");streampart=streampart[0];if(!isNaN(streampart.charAt(0)))return{msg:"The first character may not be a number.",classes:["red"]};if(streampart.toLowerCase()!=streampart)return{msg:"Uppercase letters are not allowed in a stream name.",classes:["red"]};
|
||||||
classes:["red"]};if(streampart.replace(/[^\da-z_$]/g,"")!=streampart)return{msg:"Special characters (except for underscores) are not allowed in a stream name.",classes:["red"]};if(streampart!=a&&b.replace(/[\00|\0|\/]/g,"")!=b)return{msg:"Slashes or null bytes are not allowed in wildcards.",classes:["red"]}}};break;default:k=function(){}}m.push(k)}e.data("validate_functions",m).data("help_container",f).data("validate",function(a,b){if($(a).is(":visible")||$(a).is('input[type="hidden"]')){var c=$(a).getval(),
|
if(streampart.replace(/[^\da-z_$]/g,"")!=streampart)return{msg:"Special characters (except for underscores) are not allowed in a stream name.",classes:["red"]};if(streampart!=a&&b.replace(/[\00|\0|\/]/g,"")!=b)return{msg:"Slashes or null bytes are not allowed in wildcards.",classes:["red"]}}};break;default:k=function(){}}m.push(k)}e.data("validate_functions",m).data("help_container",f).data("validate",function(a,b){if($(a).is(":visible")||$(a).is('input[type="hidden"]')){var c=$(a).getval(),d=$(a).data("validate_functions"),
|
||||||
d=$(a).data("validate_functions"),h=$(a).data("help_container");h.find(".err_balloon").remove();for(var g in d){var f=d[g](c,a);if(f){$err=$("<span>").addClass("err_balloon").html(f.msg);for(var e in f.classes)$err.addClass(f.classes[e]);h.prepend($err);b&&$(a).focus();return typeof f=="object"&&"break"in f?f["break"]:true}}return false}}).addClass("hasValidate").on("change keyup",function(){$(this).data("validate")($(this))});""!=e.getval()&&e.trigger("change")}"function"in d&&(e.on("change keyup",
|
h=$(a).data("help_container");h.find(".err_balloon").remove();for(var g in d){var f=d[g](c,a);if(f){$err=$("<span>").addClass("err_balloon").html(f.msg);for(var e in f.classes)$err.addClass(f.classes[e]);h.prepend($err);b&&$(a).focus();return typeof f=="object"&&"break"in f?f["break"]:true}}return false}}).addClass("hasValidate").on("change keyup",function(){$(this).data("validate")($(this))});""!=e.getval()&&e.trigger("change")}"function"in d&&(e.on("change keyup",d["function"]),e.trigger("change"))}}b.on("keydown",
|
||||||
d["function"]),e.trigger("change"))}}b.on("keydown",function(a){var b=!1;switch(a.which){case 13:b=$(this).find("button.save").first();break;case 27:b=$(this).find("button.cancel").first()}b&&b.length&&(b.trigger("click"),a.stopPropagation())});return b},buildVheaderTable:function(a){var b=$("<table>").css("margin","0.2em"),c=$("<tr>").addClass("header").append($("<td>").addClass("vheader").attr("rowspan",a.labels.length+1).append($("<span>").text(a.vheader))),d=[];c.append($("<td>"));for(var e in a.labels)d.push($("<tr>").append($("<td>").html(""==
|
function(a){var b=!1;switch(a.which){case 13:b=$(this).find("button.save").first();break;case 27:b=$(this).find("button.cancel").first()}b&&b.length&&(b.trigger("click"),a.stopPropagation())});return b},buildVheaderTable:function(a){var b=$("<table>").css("margin","0.2em"),c=$("<tr>").addClass("header").append($("<td>").addClass("vheader").attr("rowspan",a.labels.length+1).append($("<span>").text(a.vheader))),d=[];c.append($("<td>"));for(var e in a.labels)d.push($("<tr>").append($("<td>").html(""==
|
||||||
a.labels[e]?" ":a.labels[e]+":")));for(var l in a.content)for(e in c.append($("<td>").html(a.content[l].header)),a.content[l].body)d[e].append($("<td>").html(a.content[l].body[e]));b.append($("<tbody>").append(c).append(d));return b},plot:{addGraph:function(a,b){var c={id:a.id,xaxis:a.xaxis,datasets:[],elements:{cont:$("<div>").addClass("graph"),plot:$("<div>").addClass("plot"),legend:$("<div>").addClass("legend").attr("draggable","true")}};UI.draggable(c.elements.legend);c.elements.cont.append(c.elements.plot).append(c.elements.legend);
|
a.labels[e]?" ":a.labels[e]+":")));for(var l in a.content)for(e in c.append($("<td>").html(a.content[l].header)),a.content[l].body)d[e].append($("<td>").html(a.content[l].body[e]));b.append($("<tbody>").append(c).append(d));return b},plot:{addGraph:function(a,b){var c={id:a.id,xaxis:a.xaxis,datasets:[],elements:{cont:$("<div>").addClass("graph"),plot:$("<div>").addClass("plot"),legend:$("<div>").addClass("legend").attr("draggable","true")}};UI.draggable(c.elements.legend);c.elements.cont.append(c.elements.plot).append(c.elements.legend);
|
||||||
b.append(c.elements.cont);return c},go:function(a){if(!(1>Object.keys(a).length)){var b={totals:[],clients:[]},c;for(c in a)for(var d in a[c].datasets){var e=a[c].datasets[d];switch(e.datatype){case "clients":case "upbps":case "downbps":case "perc_lost":case "perc_retrans":switch(e.origin[0]){case "total":b.totals.push({fields:[e.datatype],end:-15});break;case "stream":b.totals.push({fields:[e.datatype],streams:[e.origin[1]],end:-15});break;case "protocol":b.totals.push({fields:[e.datatype],protocols:[e.origin[1]],
|
b.append(c.elements.cont);return c},go:function(a){if(!(1>Object.keys(a).length)){var b={totals:[],clients:[]},c;for(c in a)for(var d in a[c].datasets){var e=a[c].datasets[d];switch(e.datatype){case "clients":case "upbps":case "downbps":case "perc_lost":case "perc_retrans":switch(e.origin[0]){case "total":b.totals.push({fields:[e.datatype],end:-15});break;case "stream":b.totals.push({fields:[e.datatype],streams:[e.origin[1]],end:-15});break;case "protocol":b.totals.push({fields:[e.datatype],protocols:[e.origin[1]],
|
||||||
end:-15})}break;case "cpuload":case "memload":b.capabilities={}}}0==b.totals.length&&delete b.totals;0==b.clients.length&&delete b.clients;mist.send(function(){for(var b in a){var c=a[b];if(1>c.datasets.length){c.elements.plot.html("");c.elements.legend.html("");break}switch(c.xaxis){case "time":var d=[];c.yaxes={};var e=[],n;for(n in c.datasets){var k=c.datasets[n];k.display&&(k.getdata(),k.yaxistype in c.yaxes||(d.push(UI.plot.yaxes[k.yaxistype]),c.yaxes[k.yaxistype]=d.length),k.yaxis=c.yaxes[k.yaxistype],
|
end:-15})}break;case "cpuload":case "memload":b.capabilities={}}}0==b.totals.length&&delete b.totals;0==b.clients.length&&delete b.clients;mist.send(function(){for(var b in a){var c=a[b];if(1>c.datasets.length){c.elements.plot.html("");c.elements.legend.html("");break}switch(c.xaxis){case "time":var d=[];c.yaxes={};var e=[],n;for(n in c.datasets){var k=c.datasets[n];k.display&&(k.getdata(),k.yaxistype in c.yaxes||(d.push(UI.plot.yaxes[k.yaxistype]),c.yaxes[k.yaxistype]=d.length),k.yaxis=c.yaxes[k.yaxistype],
|
||||||
|
@ -86,13 +86,15 @@ pointer:{main:mist.user,index:"name"}},{label:"Desired password",type:"password"
|
||||||
classes:["red"]}:false}],help:"Repeat your desired password.",classes:["match_password"]},{type:"buttons",buttons:[{type:"save",label:"Create new account","function":function(){mist.send(function(){UI.navto("Account created")},{authorize:{new_username:mist.user.name,new_password:mist.user.rawpassword}});mist.user.password=MD5(mist.user.rawpassword);delete mist.user.rawpassword}}]}]));break;case "Account created":UI.elements.menu.addClass("hide");c.append($("<p>").text("Your account has been created succesfully.")).append(UI.buildUI([{type:"text",
|
classes:["red"]}:false}],help:"Repeat your desired password.",classes:["match_password"]},{type:"buttons",buttons:[{type:"save",label:"Create new account","function":function(){mist.send(function(){UI.navto("Account created")},{authorize:{new_username:mist.user.name,new_password:mist.user.rawpassword}});mist.user.password=MD5(mist.user.rawpassword);delete mist.user.rawpassword}}]}]));break;case "Account created":UI.elements.menu.addClass("hide");c.append($("<p>").text("Your account has been created succesfully.")).append(UI.buildUI([{type:"text",
|
||||||
text:"Would you like to enable all (currently) available protocols with their default settings?"},{type:"buttons",buttons:[{label:"Enable protocols",type:"save","function":function(){if(mist.data.config.protocols)c.append("Unable to enable all protocols as protocol settings already exist.<br>");else{c.append("Retrieving available protocols..<br>");mist.send(function(a){var b=[],d;for(d in a.capabilities.connectors)if(a.capabilities.connectors[d].required)c.append('Could not enable protocol "'+d+'" because it has required settings.<br>');
|
text:"Would you like to enable all (currently) available protocols with their default settings?"},{type:"buttons",buttons:[{label:"Enable protocols",type:"save","function":function(){if(mist.data.config.protocols)c.append("Unable to enable all protocols as protocol settings already exist.<br>");else{c.append("Retrieving available protocols..<br>");mist.send(function(a){var b=[],d;for(d in a.capabilities.connectors)if(a.capabilities.connectors[d].required)c.append('Could not enable protocol "'+d+'" because it has required settings.<br>');
|
||||||
else{b.push({connector:d});c.append('Enabled protocol "'+d+'".<br>')}c.append("Saving protocol settings..<br>");mist.send(function(){c.append("Protocols enabled. Redirecting..");setTimeout(function(){UI.navto("Overview")},5E3)},{config:{protocols:b}})},{capabilities:true})}}},{label:"Skip",type:"cancel","function":function(){UI.navto("Overview")}}]}]));break;case "Overview":if("undefined"==typeof mist.data.bandwidth){mist.send(function(){UI.navto(a)},{bandwidth:!0});c.append("Loading..");return}var e=
|
else{b.push({connector:d});c.append('Enabled protocol "'+d+'".<br>')}c.append("Saving protocol settings..<br>");mist.send(function(){c.append("Protocols enabled. Redirecting..");setTimeout(function(){UI.navto("Overview")},5E3)},{config:{protocols:b}})},{capabilities:true})}}},{label:"Skip",type:"cancel","function":function(){UI.navto("Overview")}}]}]));break;case "Overview":if("undefined"==typeof mist.data.bandwidth){mist.send(function(){UI.navto(a)},{bandwidth:!0});c.append("Loading..");return}var e=
|
||||||
$("<span>").text("Loading.."),l=$("<span>"),m=$("<span>").addClass("logs"),f=$("<span>"),q=$("<span>"),n=$("<span>").text("Unknown"),k=$("<span>"),w=$("<span>"),g={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus,defaultStream:mist.data.config.defaultStream,trustedproxy:mist.data.config.trustedproxy},h={};"bandwidth"in mist.data&&(h=mist.data.bandwidth,null==h&&(h={}),h.limit||(h.limit=""));var j=$("<select>").html($("<option>").val(1).text("bytes/s")).append($("<option>").val(1024).text("KiB/s")).append($("<option>").val(1048576).text("MiB/s")).append($("<option>").val(1073741824).text("GiB/s")),
|
$("<span>").text("Loading.."),l=$("<span>"),m=$("<span>").addClass("logs"),f=$("<span>"),q=$("<span>"),n=$("<span>").text("Unknown"),k=$("<span>"),w=$("<span>"),g={serverid:mist.data.config.serverid,debug:mist.data.config.debug,accesslog:mist.data.config.accesslog,prometheus:mist.data.config.prometheus,defaultStream:mist.data.config.defaultStream,trustedproxy:mist.data.config.trustedproxy,location:"location"in mist.data.config?mist.data.config.location:{}},h={};"bandwidth"in mist.data&&(h=mist.data.bandwidth,
|
||||||
i=parseURL(mist.user.host),i=i.protocol+i.host+i.port;c.append(UI.buildUI([{type:"help",help:"You can find most basic information about your MistServer here.<br>You can also set the debug level and force a save to the config.json file that MistServer uses to save your settings. "},{type:"span",label:"Version",pointer:{main:mist.data.config,index:"version"}},{type:"span",label:"Version check",value:e,LTSonly:!0},{type:"span",label:"Server time",value:q},{type:"span",label:"Licensed to",value:"license"in
|
null==h&&(h={}),h.limit||(h.limit=""));var j=$("<select>").html($("<option>").val(1).text("bytes/s")).append($("<option>").val(1024).text("KiB/s")).append($("<option>").val(1048576).text("MiB/s")).append($("<option>").val(1073741824).text("GiB/s")),i=parseURL(mist.user.host),i=i.protocol+i.host+i.port;c.append(UI.buildUI([{type:"help",help:"You can find most basic information about your MistServer here.<br>You can also set the debug level and force a save to the config.json file that MistServer uses to save your settings. "},
|
||||||
mist.data.config?mist.data.config.license.user:"",LTSonly:!0},{type:"span",label:"Active licenses",value:n,LTSonly:!0},{type:"span",label:"Configured streams",value:mist.data.streams?Object.keys(mist.data.streams).length:0},{type:"span",label:"Active streams",value:l},{type:"span",label:"Current connections",value:f},{type:"span",label:"Enabled protocols",value:k},{type:"span",label:"Disabled protocols",value:w},{type:"span",label:"Recent problems",value:m},$("<br>"),{type:"str",label:"Human readable name",
|
{type:"span",label:"Version",pointer:{main:mist.data.config,index:"version"}},{type:"span",label:"Version check",value:e,LTSonly:!0},{type:"span",label:"Server time",value:q},{type:"span",label:"Licensed to",value:"license"in mist.data.config?mist.data.config.license.user:"",LTSonly:!0},{type:"span",label:"Active licenses",value:n,LTSonly:!0},{type:"span",label:"Configured streams",value:mist.data.streams?Object.keys(mist.data.streams).length:0},{type:"span",label:"Active streams",value:l},{type:"span",
|
||||||
pointer:{main:g,index:"serverid"},help:"You can name your MistServer here for personal use. You'll still need to set host name within your network yourself."},{type:"debug",label:"Debug level",pointer:{main:g,index:"debug"},help:"You can set the amount of debug information MistServer saves in the log. A full reboot of MistServer is required before some components of MistServer can post debug information."},{type:"selectinput",label:"Access log",selectinput:[["","Do not track"],["LOG","Log to MistServer log"],
|
label:"Current connections",value:f},{type:"span",label:"Enabled protocols",value:k},{type:"span",label:"Disabled protocols",value:w},{type:"span",label:"Recent problems",value:m},$("<br>"),{type:"str",label:"Human readable name",pointer:{main:g,index:"serverid"},help:"You can name your MistServer here for personal use. You'll still need to set host name within your network yourself."},{type:"debug",label:"Debug level",pointer:{main:g,index:"debug"},help:"You can set the amount of debug information MistServer saves in the log. A full reboot of MistServer is required before some components of MistServer can post debug information."},
|
||||||
[{type:"str",label:"Path",LTSonly:!0},"Log to file"]],pointer:{main:g,index:"accesslog"},help:"Enable access logs.",LTSonly:!0},{type:"selectinput",label:"Prometheus stats output",selectinput:[["","Disabled"],[{type:"str",label:"Passphrase",LTSonly:!0},"Enabled"]],pointer:{main:g,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+i+"/PASSPHRASE or "+i+"/PASSPHRASE.json.",LTSonly:!0},{type:"inputlist",label:"Trusted proxies",help:"List of proxy server addresses that are allowed to override the viewer IP address to arbitrary values.<br>You may use a hostname or IP address.",
|
{type:"selectinput",label:"Access log",selectinput:[["","Do not track"],["LOG","Log to MistServer log"],[{type:"str",label:"Path",LTSonly:!0},"Log to file"]],pointer:{main:g,index:"accesslog"},help:"Enable access logs.",LTSonly:!0},{type:"selectinput",label:"Prometheus stats output",selectinput:[["","Disabled"],[{type:"str",label:"Passphrase",LTSonly:!0},"Enabled"]],pointer:{main:g,index:"prometheus"},help:"Make stats available in Prometheus format. These can be accessed via "+i+"/PASSPHRASE or "+
|
||||||
LTSonly:!0,pointer:{main:g,index:"trustedproxy"}},{type:"selectinput",label:"Load balancer bandwidth limit",selectinput:[["","Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:j},"Custom"]],pointer:{main:h,index:"limit"},help:"This setting only applies when MistServer is combined with a load balancer. This is the amount of traffic this server is willing to handle.",LTSonly:!0},{type:"inputlist",label:"Load balancer bandwidth exceptions",pointer:{main:h,index:"exceptions"},help:"This setting only applies when MistServer is combined with a load balancer. Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>",
|
i+"/PASSPHRASE.json.",LTSonly:!0},{type:"inputlist",label:"Trusted proxies",help:"List of proxy server addresses that are allowed to override the viewer IP address to arbitrary values.<br>You may use a hostname or IP address.",LTSonly:!0,pointer:{main:g,index:"trustedproxy"}},{type:"selectinput",label:"Load balancer bandwidth limit",selectinput:[["","Default (1 gbps)"],[{label:"Custom",type:"int",min:0,unit:j},"Custom"]],pointer:{main:h,index:"limit"},help:"This setting only applies when MistServer is combined with a load balancer. This is the amount of traffic this server is willing to handle.",
|
||||||
LTSonly:!0},{type:"str",validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:g,index:"defaultStream"},help:"When this is set, if someone attempts to view a stream that does not exist, or is offline, they will be redirected to this stream instead. $stream may be used to refer to the original stream name.",LTSonly:!0},{type:"checkbox",label:"Force configurations save",pointer:{main:g,index:"save"},help:"Tick the box in order to force an immediate save to the config.json MistServer uses to save your settings. Saving will otherwise happen upon closing MistServer. Don't forget to press save after ticking the box."},
|
LTSonly:!0},{type:"inputlist",label:"Load balancer bandwidth exceptions",pointer:{main:h,index:"exceptions"},help:"This setting only applies when MistServer is combined with a load balancer. Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>",LTSonly:!0},{type:"int",step:1E-8,label:"Server latitude",pointer:{main:g.location,index:"lat"},help:"This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them.",
|
||||||
|
LTSonly:!0},{type:"int",step:1E-8,label:"Server longitude",pointer:{main:g.location,index:"lon"},help:"This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them.",LTSonly:!0},{type:"str",label:"Server location name",pointer:{main:g.location,index:"name"},help:"This setting is only useful when MistServer is combined with a load balancer. This will be displayed as the server's location.",LTSonly:!0},{type:"str",
|
||||||
|
validate:["streamname_with_wildcard_and_variables"],label:"Fallback stream",pointer:{main:g,index:"defaultStream"},help:"When this is set, if someone attempts to view a stream that does not exist, or is offline, they will be redirected to this stream instead. $stream may be used to refer to the original stream name.",LTSonly:!0},{type:"checkbox",label:"Force configurations save",pointer:{main:g,index:"save"},help:"Tick the box in order to force an immediate save to the config.json MistServer uses to save your settings. Saving will otherwise happen upon closing MistServer. Don't forget to press save after ticking the box."},
|
||||||
{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={config:g},b={};b.limit=h.limit?j.val()*h.limit:0;b.exceptions=h.exceptions;if(b.exceptions===null)b.exceptions=[];a.bandwidth=b;if(g.save)a.save=g.save;delete g.save;mist.send(function(){UI.navto("Overview")},a)}}]}]));if(mist.data.LTS){var P=function(a){function b(a){if(a.update){var d="";"progress"in a.update&&(d=" ("+a.update.progress+"%)");e.text("Updating.."+d);c(a.log);setTimeout(function(){mist.send(function(a){b(a)},
|
{type:"buttons",buttons:[{type:"save",label:"Save","function":function(){var a={config:g},b={};b.limit=h.limit?j.val()*h.limit:0;b.exceptions=h.exceptions;if(b.exceptions===null)b.exceptions=[];a.bandwidth=b;if(g.save)a.save=g.save;delete g.save;mist.send(function(){UI.navto("Overview")},a)}}]}]));if(mist.data.LTS){var P=function(a){function b(a){if(a.update){var d="";"progress"in a.update&&(d=" ("+a.update.progress+"%)");e.text("Updating.."+d);c(a.log);setTimeout(function(){mist.send(function(a){b(a)},
|
||||||
{update:true})},1E3)}else UI.showTab("Overview")}function c(a){a=a.filter(function(a){return a[1]=="UPDR"});if(a.length){var b=$("<div>");e.append(b);for(var d in a)b.append($("<div>").text(a[d][2]))}}if(!a.update||!("uptodate"in a.update)){e.text("Unknown, checking..");setTimeout(function(){mist.send(function(a){"update"in a&&P(a)},{checkupdate:true})},5E3)}else if(a.update.error)e.addClass("red").text(a.update.error);else if(a.update.uptodate)e.text("Your version is up to date.").addClass("green");
|
{update:true})},1E3)}else UI.showTab("Overview")}function c(a){a=a.filter(function(a){return a[1]=="UPDR"});if(a.length){var b=$("<div>");e.append(b);for(var d in a)b.append($("<div>").text(a[d][2]))}}if(!a.update||!("uptodate"in a.update)){e.text("Unknown, checking..");setTimeout(function(){mist.send(function(a){"update"in a&&P(a)},{checkupdate:true})},5E3)}else if(a.update.error)e.addClass("red").text(a.update.error);else if(a.update.uptodate)e.text("Your version is up to date.").addClass("green");
|
||||||
else{if(a.update.progress){e.addClass("orange").removeClass("red").text("Updating..");b(a)}else{e.text("");e.append($("<span>").addClass("red").text("On "+(new Date(a.update.date)).toLocaleDateString()+" version "+a.update.version+" became available."));(!a.update.url||a.update.url.slice(-4)!=".zip")&&e.append($("<button>").text("Rolling update").css({"font-size":"1em","margin-left":"1em"}).click(function(){if(confirm("Are you sure you want to execute a rolling update?")){e.addClass("orange").removeClass("red").text("Rolling update command sent..");
|
else{if(a.update.progress){e.addClass("orange").removeClass("red").text("Updating..");b(a)}else{e.text("");e.append($("<span>").addClass("red").text("On "+(new Date(a.update.date)).toLocaleDateString()+" version "+a.update.version+" became available."));(!a.update.url||a.update.url.slice(-4)!=".zip")&&e.append($("<button>").text("Rolling update").css({"font-size":"1em","margin-left":"1em"}).click(function(){if(confirm("Are you sure you want to execute a rolling update?")){e.addClass("orange").removeClass("red").text("Rolling update command sent..");
|
||||||
|
|
41
lsp/mist.js
41
lsp/mist.js
|
@ -527,6 +527,9 @@ var UI = {
|
||||||
if ('max' in e) {
|
if ('max' in e) {
|
||||||
$field.attr('max',e.max);
|
$field.attr('max',e.max);
|
||||||
}
|
}
|
||||||
|
if ('step' in e) {
|
||||||
|
$field.attr('step',e.step);
|
||||||
|
}
|
||||||
if ('validate' in e) {
|
if ('validate' in e) {
|
||||||
e.validate.push('int');
|
e.validate.push('int');
|
||||||
}
|
}
|
||||||
|
@ -1212,12 +1215,6 @@ var UI = {
|
||||||
classes: ['red']
|
classes: ['red']
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (parseInt(Number(val)) != val) {
|
|
||||||
return {
|
|
||||||
msg: 'Please enter an integer.',
|
|
||||||
classes: ['red']
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'streamname': {
|
case 'streamname': {
|
||||||
|
@ -2402,7 +2399,8 @@ var UI = {
|
||||||
accesslog: mist.data.config.accesslog,
|
accesslog: mist.data.config.accesslog,
|
||||||
prometheus: mist.data.config.prometheus,
|
prometheus: mist.data.config.prometheus,
|
||||||
defaultStream: mist.data.config.defaultStream,
|
defaultStream: mist.data.config.defaultStream,
|
||||||
trustedproxy: mist.data.config.trustedproxy
|
trustedproxy: mist.data.config.trustedproxy,
|
||||||
|
location: "location" in mist.data.config ? mist.data.config.location : {}
|
||||||
};
|
};
|
||||||
var b = {};
|
var b = {};
|
||||||
if ("bandwidth" in mist.data) {
|
if ("bandwidth" in mist.data) {
|
||||||
|
@ -2565,6 +2563,35 @@ var UI = {
|
||||||
},
|
},
|
||||||
help: "This setting only applies when MistServer is combined with a load balancer. Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>",
|
help: "This setting only applies when MistServer is combined with a load balancer. Data sent to the hosts and subnets listed here will not count towards reported bandwidth usage.<br>Examples:<ul><li>192.168.0.0/16</li><li>localhost</li><li>10.0.0.0/8</li><li>fe80::/16</li></ul>",
|
||||||
LTSonly: true
|
LTSonly: true
|
||||||
|
},{
|
||||||
|
type: "int",
|
||||||
|
step: 0.00000001,
|
||||||
|
label: "Server latitude",
|
||||||
|
pointer: {
|
||||||
|
main: s.location,
|
||||||
|
index: "lat"
|
||||||
|
},
|
||||||
|
help: "This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them.",
|
||||||
|
LTSonly: true
|
||||||
|
},{
|
||||||
|
type: "int",
|
||||||
|
step: 0.00000001,
|
||||||
|
label: "Server longitude",
|
||||||
|
pointer: {
|
||||||
|
main: s.location,
|
||||||
|
index: "lon"
|
||||||
|
},
|
||||||
|
help: "This setting is only useful when MistServer is combined with a load balancer. When this is set, the balancer can send users to a server close to them.",
|
||||||
|
LTSonly: true
|
||||||
|
},{
|
||||||
|
type: "str",
|
||||||
|
label: "Server location name",
|
||||||
|
pointer: {
|
||||||
|
main: s.location,
|
||||||
|
index: "name"
|
||||||
|
},
|
||||||
|
help: "This setting is only useful when MistServer is combined with a load balancer. This will be displayed as the server's location.",
|
||||||
|
LTSonly: true
|
||||||
},{
|
},{
|
||||||
type: "str",
|
type: "str",
|
||||||
validate: ['streamname_with_wildcard_and_variables'],
|
validate: ['streamname_with_wildcard_and_variables'],
|
||||||
|
|
Loading…
Add table
Reference in a new issue