Add docker / plugins sub menu to installed / previous

This commit is contained in:
Squidly271 2021-04-28 09:55:34 -04:00
parent d77cb121f3
commit 51b99c4bf5
5 changed files with 163 additions and 134 deletions

Binary file not shown.

View File

@ -339,9 +339,21 @@ $(function(){
case "installed_apps":
previousApps(true);
break;
case "inst_docker":
previousApps(true,false,"docker");
break;
case "inst_plugins":
previousApps(true,false,"plugins");
break;
case "previous_apps":
previousApps(false);
break;
case "prev_docker":
previousApps(false,false,"docker");
break;
case "prev_plugins":
previousApps(false,false,"plugins");
break;
case "pinned_apps":
pinnedApps();
break;
@ -950,7 +962,7 @@ function showModeration(script,title) {
showDesc_openBox("/plugins/<?=$plugin?>/scripts/showStatistics.php?arg1="+script,title,550,900,true,false);
}
function previousApps(installed,dontClear=false) {
function previousApps(installed,dontClear=false,filter="") {
hideSortIcons();
clearCategory();
setPageOne();
@ -960,7 +972,7 @@ function previousApps(installed,dontClear=false) {
$(".dockerSearch").hide();
enableIcon("#sortIcon",true);
post({action:'previous_apps',installed:installed},function(result) {
post({action:'previous_apps',installed:installed,filter:filter},function(result) {
if ( installed ) {
$(".multi_installDiv").hide();
} else {

View File

@ -1,6 +1,6 @@
767d6f2203fed9541daeb57bbf7b58b3 ./Apps.page
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
5cdbd6e3fd10ca4e156cacb7b26dae1e ./CommunityApps.page
6b47f59ebd426b33c9c9b4e739d1f47a ./CommunityApps.page
6db73582f22dab13d329e862067ee84e ./PluginAPI.page
b398273cf7daa62ab00d2de2336ca25f ./README.md
1a908064914041c48be7bf0dab77515a ./ca_settings.page
@ -11,12 +11,12 @@ b398273cf7daa62ab00d2de2336ca25f ./README.md
6e48a62b91bdd066f023f46c6b491afd ./images/discord-gray.svg
8e7dc33512b8a78f28d7179a972c7c34 ./images/discord-hover.svg
54e46db492ddb033dfeb2827c5efd4a8 ./images/discord-white.svg
9c186878dde3a06d4a3e9f8f5769b553 ./include/exec.php
1743a5f99c606008ec90b6302cb2d280 ./include/exec.php
46a523633a4737378b64192db97fca27 ./include/helpers.php
8f1129e0cdb994c6d1900192252433d8 ./include/paths.php
9ba7ea3ef8bad60cb8335da9c0daea4f ./javascript/libraries.js
3a632db992fd18e3f5cfeca203bcff2c ./skins/Narrow/css.php
81e36a845dd30426806a0d0c04a8b786 ./skins/Narrow/skin.html
58a140a38ceb6836a5b7c5b9bca85b6c ./skins/Narrow/skin.html
7bebedcb67df7ed7c3933a79a3757d9b ./skins/Narrow/skin.php
38d1f40cbc64eed32cdb3292e1ec1f6e ./scripts/PluginAPI.php
bbd9dec6c5df486d75c46388c14f09ce ./scripts/installMulti.php

View File

@ -979,6 +979,7 @@ function previous_apps() {
global $caPaths, $caSettings, $DockerClient;
$installed = getPost("installed","");
$filter = getPost("filter","");
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
$info = $caSettings['dockerRunning'] ? $DockerClient->getDockerContainers() : array();
@ -996,6 +997,7 @@ if ( $caSettings['dockerRunning'] ) {
$all_files = glob("{$caPaths['dockerManTemplates']}/*.xml");
$all_files = $all_files ?: array();
if ( $installed == "true" ) {
if ( !$filter || $filter == "docker" ) {
foreach ($info as $installedDocker) {
$installedName = $installedDocker['Name'];
if ( startsWith($installedImage,"library/") ) # official images are in DockerClient as library/mysql eg but template just shows mysql
@ -1018,7 +1020,7 @@ if ( $caSettings['dockerRunning'] ) {
}
}
}
# handle renamed containers
# handle renamed containers
foreach ($all_files as $xmlfile) {
$o = readXmlFile($xmlfile);
$o['Description'] = fixDescription($o['Description']);
@ -1029,7 +1031,7 @@ if ( $caSettings['dockerRunning'] ) {
$flag = false;
$containerID = false;
foreach ($file as $templateDocker) {
# use startsWith to eliminate any version tags (:latest)
# use startsWith to eliminate any version tags (:latest)
if ( startsWith($templateDocker['Repository'], $testRepo) ) {
if ( $templateDocker['Name'] == $o['Name'] ) {
$flag = true;
@ -1078,8 +1080,10 @@ if ( $caSettings['dockerRunning'] ) {
}
}
}
}
} else {
# now get the old not installed docker apps
if ( ! $filter || $filter == "docker" ) {
# now get the old not installed docker apps
foreach ($all_files as $xmlfile) {
$o = readXmlFile($xmlfile);
if ( ! $o ) continue;
@ -1088,7 +1092,7 @@ if ( $caSettings['dockerRunning'] ) {
$o['InstallPath'] = $xmlfile;
$o['UnknownCompatible'] = true;
$o['Removable'] = true;
# is the container running?
# is the container running?
$flag = false;
foreach ($info as $installedDocker) {
@ -1103,7 +1107,7 @@ if ( $caSettings['dockerRunning'] ) {
}
if ( ! $flag ) {
$testRepo = explode(":",$o['Repository'])[0];
# now associate the template back to a template in the appfeed
# now associate the template back to a template in the appfeed
foreach ($file as $appTemplate) {
if (startsWith($appTemplate['Repository'],$testRepo)) {
$tempPath = $o['InstallPath'];
@ -1122,9 +1126,11 @@ if ( $caSettings['dockerRunning'] ) {
}
}
}
}
}
# Now work on plugins
if ( $installed == "true" ) {
if ( ! $filter || $filter == "plugins" ) {
foreach ($file as $template) {
if ( ! $template['Plugin'] ) continue;
@ -1138,7 +1144,9 @@ if ( $caSettings['dockerRunning'] ) {
$displayed[] = $template;
}
}
}
} else {
if ( ! $filter || $filter == "plugins" ) {
$all_plugs = array_merge(glob("/boot/config/plugins-error/*.plg"),glob("/boot/config/plugins-removed/*.plg"));
foreach ($all_plugs as $oldplug) {
foreach ($file as $template) {
@ -1161,6 +1169,7 @@ if ( $caSettings['dockerRunning'] ) {
}
}
}
}
if ( is_array($displayed) ) {
usort($displayed,"mySort");
}

View File

@ -2,7 +2,15 @@
<div class='menuItems'>
<ul class='caMenu'>
<li class='caMenuItem sectionMenu' data-category='installed_apps'><?tr("Installed Apps");?></li>
<ul class='subCategory'>
<li class='caMenuItem sectionMenu' data-category='inst_docker'><?tr("Docker");?></li>
<li class='caMenuItem sectionMenu' data-category='inst_plugins'><?tr("Plugins");?></li>
</ul>
<li class='caMenuItem sectionMenu' data-category='previous_apps'><?tr("Previous Apps");?></li>
<ul class='subCategory'>
<li class='caMenuItem sectionMenu' data-category='prev_docker'><?tr("Docker");?></li>
<li class='caMenuItem sectionMenu' data-category='prev_plugins'><?tr("Plugins");?></li>
</ul>
<li class='caMenuItem sectionMenu caPinnedMenu' data-category='pinned_apps'><?tr("Pinned Apps");?></li>
<li class='caMenuItem favouriteRepo'><?tr("Favourite Repo");?></li>
<hr>