Date: Fri, 3 Apr 2020 14:58:39 -0400
Subject: [PATCH 3/6] Display default image in case of docker icon corrupted
download
---
.../include/DockerContainers.php | 51 ++++++++-----------
plugins/dynamix/include/DashboardApps.php | 24 ++++-----
2 files changed, 30 insertions(+), 45 deletions(-)
diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php
index aeb4bddbf..07252325e 100644
--- a/plugins/dynamix.docker.manager/include/DockerContainers.php
+++ b/plugins/dynamix.docker.manager/include/DockerContainers.php
@@ -13,10 +13,6 @@
?>
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
-// add translations
-$_SERVER['REQUEST_URI'] = 'docker';
-require_once "$docroot/webGui/include/Translations.php";
-
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/webGui/include/Helpers.php";
@@ -28,7 +24,7 @@ $user_prefs = $dockerManPaths['user-prefs'];
$autostart_file = $dockerManPaths['autostart-file'];
if (!$containers && !$images) {
- echo "| "._('No Docker containers installed')." |
";
+ echo "| No Docker containers installed |
";
return;
}
@@ -48,13 +44,6 @@ $menu = [];
$autostart = @file($autostart_file, FILE_IGNORE_NEW_LINES) ?: [];
$names = array_map('var_split', $autostart);
-function my_lang_log($text) {
- global $language;
- if (isset($language['healthy'])) $text = str_replace('healthy',$language['healthy'],$text);
- if (isset($language['Exited'])) $text = str_replace('Exited',$language['Exited'],$text);
- return my_lang(my_lang(_($text),2));
-}
-
foreach ($containers as $ct) {
$name = $ct['Name'];
$id = $ct['Id'];
@@ -76,7 +65,7 @@ foreach ($containers as $ct) {
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
$update = $updateStatus==1 ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
- $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
+ $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
$wait = var_split($autostart[array_search($name,$names)],1);
$ports = [];
foreach ($ct['Ports'] as $port) {
@@ -96,12 +85,12 @@ foreach ($containers as $ct) {
} else {
$appname = htmlspecialchars($name);
}
- echo "$image$appname
"._($status)."";
- echo ""._('Container ID').": $id
";
+ echo "$image$appname
$status";
+ echo "Container ID: $id
";
if ($ct['BaseImage']) echo "".htmlspecialchars(${ct['BaseImage']})."
";
- echo _('By').": ";
+ echo "By: ";
$registry = $info['registry'];
- [$author,$version] = explode(':',$ct['Image']);
+ list($author,$version) = explode(':',$ct['Image']);
if ($registry) {
echo "".htmlspecialchars($author)."";
} else {
@@ -110,42 +99,42 @@ foreach ($containers as $ct) {
echo "";
switch ($updateStatus) {
case 0:
- echo " "._('up-to-date')."";
- echo "";
+ echo " up-to-date";
+ echo "";
break;
case 1:
- echo " "._('update ready')." ";
- echo " "._('apply update')."";
+ echo " update ready ";
+ echo " apply update";
break;
case 2:
- echo " ".('rebuild ready')." ";
- echo " "._('rebuilding')."";
+ echo " rebuild ready ";
+ echo " rebuilding";
break;
default:
- echo " "._('not available')."";
- echo "";
+ echo " not available";
+ echo "";
break;
}
- echo " "._($version)." | ";
+ echo " $version
";
echo "{$ct['NetworkMode']} | ";
echo "".implode(' ',$ports)." | ";
echo "".implode(' ',$paths)." | ";
echo "0% ";
echo " 0 / 0 | ";
echo "";
- echo ""._('wait')." | ";
+ echo "wait";
echo " ";
- echo htmlspecialchars(str_replace('Up',_('Uptime'),my_lang_log($ct['Status'])))." "._('Created')." ".htmlspecialchars(my_lang($ct['Created']))." | ";
+ echo htmlspecialchars(str_replace('Up','Uptime',$ct['Status']))."Created ".htmlspecialchars($ct['Created'])."
";
}
foreach ($images as $image) {
if (count($image['usedBy'])) continue;
$id = $image['Id'];
$menu[] = sprintf("addDockerImageContext('%s','%s');", $id, implode(',',$image['Tags']));
echo "";
- echo " ("._('orphan image').") "._('stopped')."";
- echo " | "._('Image ID').": $id ";
+ echo " (orphan image) stopped";
+ echo " | Image ID: $id ";
echo implode(', ',array_map('htmlspecialchars',$image['Tags']));
- echo " | "._('Created')." ".htmlspecialchars(my_lang($image['Created']))." |
";
+ echo "Created ".htmlspecialchars($image['Created'])." | ";
}
echo "\0".implode($menu).implode($docker)."\0".(pgrep('rc.docker')!==false ? 1:0);
?>
diff --git a/plugins/dynamix/include/DashboardApps.php b/plugins/dynamix/include/DashboardApps.php
index 3411f02a2..10153c5cd 100644
--- a/plugins/dynamix/include/DashboardApps.php
+++ b/plugins/dynamix/include/DashboardApps.php
@@ -1,7 +1,7 @@
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
-// add translations
-$_SERVER['REQUEST_URI'] = 'dashboard';
-require_once "$docroot/webGui/include/Translations.php";
-
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
@@ -42,7 +38,7 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$running = $info['running'] ? 1:0;
$paused = $info['paused'] ? 1:0;
$is_autostart = $info['autostart'] ? 'true':'false';
- $updateStatus = substr($ct['NetworkMode'],-4)==':???' ? 2 : ($info['updated']=='true' ? 0 : ($info['updated']=='false' ? 1 : 3));
+ $updateStatus = $info['updated']=='true'||$info['updated']=='undef' ? 'true':'false';
$template = $info['template'];
$shell = $info['shell'];
$webGui = html_entity_decode($info['url']);
@@ -53,12 +49,12 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$shape = $running ? ($paused ? 'pause' : 'play') : 'square';
$status = $running ? ($paused ? 'paused' : 'started') : 'stopped';
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
- $update = $updateStatus==1 ? 'blue-text' : '';
+ $update = $updateStatus=='false' ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
- $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
- echo "$image$name
"._($status)."";
+ $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
+ echo "$image$name
$status";
}
- $none = count($containers) ? _('No running docker containers') : _('No docker containers defined');
+ $none = count($containers) ? "No running docker containers" : "No docker containers defined";
echo "$none
";
echo " | ";
}
@@ -112,9 +108,9 @@ if ($_POST['vms'] && ($display=='icons' || $display=='vms')) {
break;
}
$image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
- echo "$image$vm
"._($status)."";
+ echo "$image$vm
$status";
}
- $none = count($vms) ? _('No running virtual machines') : _('No virtual machines defined');
+ $none = count($vms) ? "No running virtual machines" : "No virtual machines defined";
echo "$none
";
echo " | ";
}
From 7cdea2d9f08d0e4080ed24b2908f78dbc8851d3e Mon Sep 17 00:00:00 2001
From: Squidly271
Date: Fri, 3 Apr 2020 15:19:25 -0400
Subject: [PATCH 4/6] Revert "Display default image in case of docker icon
corrupted download"
This reverts commit 03131a9409bbfb1c250433aee5a6bd6ffcec574b.
---
.../include/DockerContainers.php | 51 +++++++++++--------
plugins/dynamix/include/DashboardApps.php | 24 +++++----
2 files changed, 45 insertions(+), 30 deletions(-)
diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php
index 07252325e..aeb4bddbf 100644
--- a/plugins/dynamix.docker.manager/include/DockerContainers.php
+++ b/plugins/dynamix.docker.manager/include/DockerContainers.php
@@ -13,6 +13,10 @@
?>
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+// add translations
+$_SERVER['REQUEST_URI'] = 'docker';
+require_once "$docroot/webGui/include/Translations.php";
+
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/webGui/include/Helpers.php";
@@ -24,7 +28,7 @@ $user_prefs = $dockerManPaths['user-prefs'];
$autostart_file = $dockerManPaths['autostart-file'];
if (!$containers && !$images) {
- echo "| No Docker containers installed |
";
+ echo "| "._('No Docker containers installed')." |
";
return;
}
@@ -44,6 +48,13 @@ $menu = [];
$autostart = @file($autostart_file, FILE_IGNORE_NEW_LINES) ?: [];
$names = array_map('var_split', $autostart);
+function my_lang_log($text) {
+ global $language;
+ if (isset($language['healthy'])) $text = str_replace('healthy',$language['healthy'],$text);
+ if (isset($language['Exited'])) $text = str_replace('Exited',$language['Exited'],$text);
+ return my_lang(my_lang(_($text),2));
+}
+
foreach ($containers as $ct) {
$name = $ct['Name'];
$id = $ct['Id'];
@@ -65,7 +76,7 @@ foreach ($containers as $ct) {
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
$update = $updateStatus==1 ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
- $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
+ $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
$wait = var_split($autostart[array_search($name,$names)],1);
$ports = [];
foreach ($ct['Ports'] as $port) {
@@ -85,12 +96,12 @@ foreach ($containers as $ct) {
} else {
$appname = htmlspecialchars($name);
}
- echo "$image$appname
$status";
- echo "Container ID: $id
";
+ echo "$image$appname
"._($status)."";
+ echo ""._('Container ID').": $id
";
if ($ct['BaseImage']) echo "".htmlspecialchars(${ct['BaseImage']})."
";
- echo "By: ";
+ echo _('By').": ";
$registry = $info['registry'];
- list($author,$version) = explode(':',$ct['Image']);
+ [$author,$version] = explode(':',$ct['Image']);
if ($registry) {
echo "".htmlspecialchars($author)."";
} else {
@@ -99,42 +110,42 @@ foreach ($containers as $ct) {
echo "";
switch ($updateStatus) {
case 0:
- echo " up-to-date";
- echo "";
+ echo " "._('up-to-date')."";
+ echo "";
break;
case 1:
- echo " update ready ";
- echo " apply update";
+ echo " "._('update ready')." ";
+ echo " "._('apply update')."";
break;
case 2:
- echo " rebuild ready ";
- echo " rebuilding";
+ echo " ".('rebuild ready')." ";
+ echo " "._('rebuilding')."";
break;
default:
- echo " not available";
- echo "";
+ echo " "._('not available')."";
+ echo "";
break;
}
- echo " $version | ";
+ echo " "._($version)."
";
echo "{$ct['NetworkMode']} | ";
echo "".implode(' ',$ports)." | ";
echo "".implode(' ',$paths)." | ";
echo "0% ";
echo " 0 / 0 | ";
echo "";
- echo "wait | ";
+ echo ""._('wait')."";
echo " ";
- echo htmlspecialchars(str_replace('Up','Uptime',$ct['Status']))." Created ".htmlspecialchars($ct['Created'])." | ";
+ echo htmlspecialchars(str_replace('Up',_('Uptime'),my_lang_log($ct['Status']))).""._('Created')." ".htmlspecialchars(my_lang($ct['Created']))."
";
}
foreach ($images as $image) {
if (count($image['usedBy'])) continue;
$id = $image['Id'];
$menu[] = sprintf("addDockerImageContext('%s','%s');", $id, implode(',',$image['Tags']));
echo "";
- echo " (orphan image) stopped";
- echo " | Image ID: $id ";
+ echo " ("._('orphan image').") "._('stopped')."";
+ echo " | "._('Image ID').": $id ";
echo implode(', ',array_map('htmlspecialchars',$image['Tags']));
- echo " | Created ".htmlspecialchars($image['Created'])." |
";
+ echo ""._('Created')." ".htmlspecialchars(my_lang($image['Created']))." | ";
}
echo "\0".implode($menu).implode($docker)."\0".(pgrep('rc.docker')!==false ? 1:0);
?>
diff --git a/plugins/dynamix/include/DashboardApps.php b/plugins/dynamix/include/DashboardApps.php
index 10153c5cd..3411f02a2 100644
--- a/plugins/dynamix/include/DashboardApps.php
+++ b/plugins/dynamix/include/DashboardApps.php
@@ -1,7 +1,7 @@
$docroot = $docroot ?? $_SERVER['DOCUMENT_ROOT'] ?: '/usr/local/emhttp';
+// add translations
+$_SERVER['REQUEST_URI'] = 'dashboard';
+require_once "$docroot/webGui/include/Translations.php";
+
require_once "$docroot/plugins/dynamix.docker.manager/include/DockerClient.php";
require_once "$docroot/plugins/dynamix.vm.manager/include/libvirt_helpers.php";
@@ -38,7 +42,7 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$running = $info['running'] ? 1:0;
$paused = $info['paused'] ? 1:0;
$is_autostart = $info['autostart'] ? 'true':'false';
- $updateStatus = $info['updated']=='true'||$info['updated']=='undef' ? 'true':'false';
+ $updateStatus = substr($ct['NetworkMode'],-4)==':???' ? 2 : ($info['updated']=='true' ? 0 : ($info['updated']=='false' ? 1 : 3));
$template = $info['template'];
$shell = $info['shell'];
$webGui = html_entity_decode($info['url']);
@@ -49,12 +53,12 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$shape = $running ? ($paused ? 'pause' : 'play') : 'square';
$status = $running ? ($paused ? 'paused' : 'started') : 'stopped';
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
- $update = $updateStatus=='false' ? 'blue-text' : '';
+ $update = $updateStatus==1 ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
- $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
- echo "$image$name
$status";
+ $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
+ echo "$image$name
"._($status)."";
}
- $none = count($containers) ? "No running docker containers" : "No docker containers defined";
+ $none = count($containers) ? _('No running docker containers') : _('No docker containers defined');
echo "$none
";
echo " | ";
}
@@ -108,9 +112,9 @@ if ($_POST['vms'] && ($display=='icons' || $display=='vms')) {
break;
}
$image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
- echo "$image$vm
$status";
+ echo "$image$vm
"._($status)."";
}
- $none = count($vms) ? "No running virtual machines" : "No virtual machines defined";
+ $none = count($vms) ? _('No running virtual machines') : _('No virtual machines defined');
echo "$none
";
echo " | ";
}
From cadba1e54ccddd78ed52b47d1c95808bc0f1de61 Mon Sep 17 00:00:00 2001
From: Andrew Z
Date: Fri, 3 Apr 2020 15:25:56 -0400
Subject: [PATCH 5/6] Display default docker icon if download corrupted
---
plugins/dynamix.docker.manager/include/DockerContainers.php | 2 +-
plugins/dynamix/include/DashboardApps.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/plugins/dynamix.docker.manager/include/DockerContainers.php b/plugins/dynamix.docker.manager/include/DockerContainers.php
index aeb4bddbf..e52a984b9 100644
--- a/plugins/dynamix.docker.manager/include/DockerContainers.php
+++ b/plugins/dynamix.docker.manager/include/DockerContainers.php
@@ -76,7 +76,7 @@ foreach ($containers as $ct) {
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
$update = $updateStatus==1 ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
- $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
+ $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
$wait = var_split($autostart[array_search($name,$names)],1);
$ports = [];
foreach ($ct['Ports'] as $port) {
diff --git a/plugins/dynamix/include/DashboardApps.php b/plugins/dynamix/include/DashboardApps.php
index 3411f02a2..bf8f15426 100644
--- a/plugins/dynamix/include/DashboardApps.php
+++ b/plugins/dynamix/include/DashboardApps.php
@@ -55,7 +55,7 @@ if ($_POST['docker'] && ($display=='icons' || $display=='docker')) {
$color = $status=='started' ? 'green-text' : ($status=='paused' ? 'orange-text' : 'red-text');
$update = $updateStatus==1 ? 'blue-text' : '';
$icon = $info['icon'] ?: '/plugins/dynamix.docker.manager/images/question.png';
- $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
+ $image = substr($icon,-4)=='.png' ? "
" : (substr($icon,0,5)=='icon-' ? "" : "");
echo "$image$name
"._($status)."";
}
$none = count($containers) ? _('No running docker containers') : _('No docker containers defined');
From ec6009dd2ff0bae719b6c81a024956f679204018 Mon Sep 17 00:00:00 2001
From: Squidly271
Date: Sat, 4 Apr 2020 01:22:52 -0400
Subject: [PATCH 6/6] LT Catchup
---
plugins/dynamix/ArrayOperation.page | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/plugins/dynamix/ArrayOperation.page b/plugins/dynamix/ArrayOperation.page
index 21aa92d89..ba81255f2 100644
--- a/plugins/dynamix/ArrayOperation.page
+++ b/plugins/dynamix/ArrayOperation.page
@@ -306,7 +306,7 @@ function formatWarning(val) {
| | **_(Clear)_** _(will start **Clearing** new data disk(s))_. |
else:
if ($var['mdResyncAction']=="check"):?>
- | | **_(Check)_** _ (will start **Read-Check** of all array disks)_. |
+ | | **_(Check)_** _(will start **Read-Check** of all array disks)_. |
elseif (strstr($var['mdResyncAction'],"check")):?>
| _(Parity is valid)_. | | **_(Check)_** _(will start **Parity-Check**)_. onclick="$.cookie('one','tab1',{path:'/'})">(_(Schedule)_)
_(Write corrections to parity)_ |
@@ -488,7 +488,7 @@ function formatWarning(val) {
_(Too many wrong and/or missing disks)_! |
break;
case "ERROR:NO_DATA_DISKS":?>
- | **_(Stopped)_**. _ (No data disks)_. | |
+
| **_(Stopped)_**. _(No data disks)_. | |
_(No array data disks have been assigned)_! |
break;
endswitch;
@@ -545,7 +545,7 @@ function formatWarning(val) {
| |
-
+'.parse_file($display['sleep']))?>