Minor code cleanup

This commit is contained in:
bergware
2018-03-06 09:58:44 +01:00
parent 99a09254ad
commit 1ab5d925c1
5 changed files with 26 additions and 26 deletions
@@ -31,7 +31,7 @@ $DockerTemplates = new DockerTemplates();
# ██║ ╚██████╔╝██║ ╚████║╚██████╗ ██║ ██║╚██████╔╝██║ ╚████║███████║
# ╚═╝ ╚═════╝ ╚═╝ ╚═══╝ ╚═════╝ ╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═══╝╚══════╝
$echo = function($m){ echo "<pre>".print_r($m, true)."</pre>"; };
$echo = function($m){echo "<pre>".print_r($m, true)."</pre>";};
unset($custom);
exec("docker network ls --filter driver='macvlan' --format='{{.Name}}'", $custom);
@@ -781,7 +781,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
$('#tab'+this_tab).bind({click:function(){$('#'+elementId).show();}});
for (var x=1; x<=last; x++) if(x != this_tab) $('#tab'+x).bind({click:function(){$('#'+elementId).hide();}});
<?endif;?>
$('.advanced-switch').switchButton({ labels_placement: "left", on_label: 'Advanced View', off_label: 'Basic View'});
$('.advanced-switch').switchButton({labels_placement: "left", on_label: 'Advanced View', off_label: 'Basic View'});
$('.advanced-switch').change(function () {
var status = $(this).is(':checked');
toggleRows('advanced', status, 'basic');
@@ -918,7 +918,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
Opts.Name = makeName(Opts.Type);
}
if (! Opts.Description ) {
Opts.Description = "Container " + Opts.Type + ": " + Opts.Target;
Opts.Description = "Container "+Opts.Type+": "+Opts.Target;
}
if (Opts.Required == "true") {
Opts.Buttons = "<span class='advanced'><button type='button' onclick='editConfigPopup("+confNum+",false)'> Edit</button> ";
@@ -953,7 +953,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
popup.html($("#templatePopupConfig").html());
// Load existing config info
var config = $("#ConfigNum" + num);
var config = $("#ConfigNum"+num);
config.find("input").each(function(){
var name = $(this).attr("name").replace("conf", "").replace("[]", "");
popup.find("*[name='"+name+"']").val($(this).val());
@@ -1000,7 +1000,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
Opts.Name = makeName(Opts.Type);
}
if (! Opts.Description ) {
Opts.Description = "Container " + Opts.Type + ": " + Opts.Target;
Opts.Description = "Container "+Opts.Type+": "+Opts.Target;
}
Opts.Number = num;
newConf = makeConfig(Opts);
@@ -1031,7 +1031,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
}
function removeConfig(num) {
$('#ConfigNum' + num).fadeOut("fast", function() { $(this).remove(); });
$('#ConfigNum'+num).fadeOut("fast", function() {$(this).remove();});
$('input[name="contName"]').trigger('change'); // signal change
}
@@ -1046,8 +1046,8 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
}
function makeName(type) {
i = $("#configLocation input[name^='confType'][value='"+type+"']").length + 1;
return "Host " + type.replace('Variable','Key') + " "+i;
i = $("#configLocation input[name^='confType'][value='"+type+"']").length+1;
return "Host "+type.replace('Variable','Key')+" "+i;
}
function toggleMode(el,disabled) {
@@ -1143,7 +1143,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
function(folder){if(on_folders){p.val(folder);p.trigger('change');if(close_on_select){$(ft).slideUp('fast',function (){$(ft).remove();});}}}
);
// Format fileTree according to parent position, height and width
ft.css({'left':p.position().left,'top':( p.position().top + p.outerHeight() ),'width':(p.width()) });
ft.css({'left':p.position().left,'top':(p.position().top+p.outerHeight()),'width':(p.width())});
// close if click elsewhere
$(document).mouseup(function(e){if(!ft.is(e.target) && ft.has(e.target).length === 0){ft.slideUp('fast',function (){$(ft).remove();});}});
// close if parent changed
@@ -1208,7 +1208,7 @@ optgroup.title{background-color:#625D5D;color:#FFFFFF;text-align:center;margin-t
//$value['name'] = str_replace("my-", '', $value['name']);
$selected = (isset($xmlTemplate) && $value['path'] == $xmlTemplate) ? ' selected ' : '';
if ($selected && ($key == "default")) $showAdditionalInfo = 'class="advanced"';
if (strlen($selected) && $key == 'user' ){ $rmadd = $value['path']; }
if (strlen($selected) && $key == 'user' ){$rmadd = $value['path'];}
printf("\t\t\t\t\t\t<option class=\"list\" value=\"%s:%s\" {$selected} >%s</option>\n", htmlspecialchars($key), htmlspecialchars($value['path']), htmlspecialchars($value['name']));
}
printf("\t\t\t\t\t</optgroup>\n");
@@ -42,8 +42,8 @@ function addDockerImageContext(image, imageTag) {
}
function execUpContainer(container) {
var title = "Updating the container: " + container;
var address = "/plugins/dynamix.docker.manager/include/CreateDocker.php?updateContainer=true&ct[]=" + encodeURIComponent(container);
var title = "Updating the container: "+container;
var address = "/plugins/dynamix.docker.manager/include/CreateDocker.php?updateContainer=true&ct[]="+encodeURIComponent(container);
popupWithIframe(title, address, true);
}
@@ -81,9 +81,9 @@ function popupWithIframe(title, cmd, reload) {
function addContainer() {
var path = location.pathname;
var x = path.indexOf("?");
if (x!=-1) path = path.substring(0, x);
if (x!=-1) path = path.substring(0,x);
location = path + "/AddContainer";
location = path+"/AddContainer";
}
function editContainer(container, template) {
@@ -91,7 +91,7 @@ function editContainer(container, template) {
var x = path.indexOf("?");
if (x!=-1) path = path.substring(0, x);
location = path + "/UpdateContainer?xmlTemplate=edit:" + template;
location = path+"/UpdateContainer?xmlTemplate=edit:"+template;
}
function updateContainer(container) {
@@ -176,7 +176,7 @@ function autoStart(container, event) {
function containerLogs(container, id) {
var height = 600;
var width = 900;
var run = eventURL + "?action=log&container=" + id + "&title=Log for:" + container;
var run = eventURL+"?action=log&container="+id+"&title=Log for:"+container;
var top = (screen.height-height) / 2;
var left = (screen.width-width) / 2;
var options = 'resizeable=yes,scrollbars=yes,height='+height+',width='+width+',top='+top+',left='+left;
+5 -5
View File
@@ -55,8 +55,8 @@ if ($_GET['refresh']) {
if ($subaction) {
$vm = $lv->domain_get_name_by_uuid($uuid);
if ($subaction == 'disk-resize') {
$capacity = str_replace(["KB","MB","GB","TB","PB", " ", ","], ["K","M","G","T","P", "", ""], strtoupper($_POST['cap']));
$oldcap = str_replace(["KB","MB","GB","TB","PB", " ", ","], ["K","M","G","T","P", "", ""], strtoupper($_GET['oldcap']));
$capacity = str_replace(["KB","MB","GB","TB","PB"," ",","], ["K","M","G","T","P","",""], strtoupper($_POST['cap']));
$oldcap = str_replace(["KB","MB","GB","TB","PB"," ",","], ["K","M","G","T","P","",""], strtoupper($_GET['oldcap']));
if (substr($oldcap,0,-1) < substr($capacity,0,-1)){
shell_exec("qemu-img resize -q ".escapeshellarg($_GET['disk'])." ".escapeshellarg($capacity));
$msg = $vm." disk capacity has been changed to $capacity";
@@ -149,8 +149,8 @@ function hideInput(){
function addVM() {
var path = location.pathname;
var x = path.indexOf("?");
if (x!=-1) path = path.substring(0, x);
location = path + "/VMTemplates";
if (x!=-1) path = path.substring(0,x);
location = path+"/VMTemplates";
}
<?if ($display['resize']):?>
function resize(bind) {
@@ -196,7 +196,7 @@ foreach ($vms as $vm) {
$(this).prop('checked', data.autostart);
},'json');
});
context.init({preventDoubleContext:false });
context.init({preventDoubleContext:false});
});
}
$(function() {
@@ -987,19 +987,19 @@
}
foreach ($arrHostDevs as $arrHostDev) {
$arrFoundGPUDevices = array_filter($arrValidGPUDevices, function($arrDev) use ($arrHostDev) { return ($arrDev['id'] == $arrHostDev['id']); });
$arrFoundGPUDevices = array_filter($arrValidGPUDevices, function($arrDev) use ($arrHostDev) {return ($arrDev['id'] == $arrHostDev['id']);});
if (!empty($arrFoundGPUDevices)) {
$arrGPUDevices[] = ['id' => $arrHostDev['id']];
continue;
}
$arrFoundAudioDevices = array_filter($arrValidAudioDevices, function($arrDev) use ($arrHostDev) { return ($arrDev['id'] == $arrHostDev['id']); });
$arrFoundAudioDevices = array_filter($arrValidAudioDevices, function($arrDev) use ($arrHostDev) {return ($arrDev['id'] == $arrHostDev['id']);});
if (!empty($arrFoundAudioDevices)) {
$arrAudioDevices[] = ['id' => $arrHostDev['id']];
continue;
}
$arrFoundOtherDevices = array_filter($arrValidOtherDevices, function($arrDev) use ($arrHostDev) { return ($arrDev['id'] == $arrHostDev['id']); });
$arrFoundOtherDevices = array_filter($arrValidOtherDevices, function($arrDev) use ($arrHostDev) {return ($arrDev['id'] == $arrHostDev['id']);});
if (!empty($arrFoundOtherDevices)) {
$arrOtherDevices[] = ['id' => $arrHostDev['id']];
continue;
@@ -70,7 +70,7 @@ function addVMContext(name, uuid, template, state, vncurl, log){
}
opts.push({divider:true});
if (log !== "") {
opts.push({text:"Logs", icon:"fa-navicon", action:function(e){e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1=' + log, 'Log for:' + name, 600, 900);}});
opts.push({text:"Logs", icon:"fa-navicon", action:function(e){e.preventDefault(); openWindow('/webGui/scripts/tail_log&arg1='+log, 'Log for:'+name, 600, 900);}});
}
if (state == "shutoff") {
opts.push({text:"Edit", icon:"fa-pencil", href:path+'/UpdateVM?uuid='+uuid});
@@ -81,7 +81,7 @@ function addVMContext(name, uuid, template, state, vncurl, log){
swal({title:"Are you sure?",text:"Remove definition:"+name,type:"warning",showCancelButton:true},function(){ajaxVMDispatch({action:"domain-undefine",uuid:uuid});});
}});
if (template != 'OpenELEC') {
opts.push({text:"Remove VM + Disks", icon:"fa-trash", action:function(e) {
opts.push({text:"Remove VM & Disks", icon:"fa-trash", action:function(e) {
e.preventDefault();
swal({title:"Are you sure?",text:"Completely REMOVE "+name+" disk image and definition",type:"warning",showCancelButton:true},function(){ajaxVMDispatch({action:"domain-delete",uuid:uuid});});
}});