Remove action centre if nothing is in there
This commit is contained in:
parent
af701a37f8
commit
7fa56b9c08
Binary file not shown.
|
@ -748,9 +748,17 @@ $(function(){
|
|||
}
|
||||
});
|
||||
}
|
||||
|
||||
// set up action centre - run in background without tying anything up
|
||||
/* $.post("/plugins/<?=$plugin?>/include/exec.php",{action:'getPortsInUse'},function(data) {
|
||||
var ret = JSON.parse(data); */
|
||||
$.post("/plugins/<?=$plugin?>/include/exec.php",{action:'enableActionCentre'},function(data) {
|
||||
console.log("Action Centre");
|
||||
console.log(data);
|
||||
var ret = JSON.parse(data);
|
||||
if ( ret.status == "action" )
|
||||
$(".actionCentre").show();
|
||||
else
|
||||
$(".actionCentre").hide();
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
b352e0154d3c7e77a8ba35a93a6463cb ./Apps.page
|
||||
92c67b595d6e4a553d0bdd26195ac4e8 ./Apps.page
|
||||
4e55f7483b661af21a25b677179baffe ./CA_notices.page
|
||||
42a1658a916a3a3eed2a9f2af80603c4 ./ca_settings.page
|
||||
e718d7825dbdc96a17a915079222b098 ./default.cfg
|
||||
11cc3efbeb502ffd5079ae68b55f417d ./include/exec.php
|
||||
924d3111123a9ca9d3d7590070f2a8ec ./include/exec.php
|
||||
d5ba81dbd93c7b149dec96def31107e9 ./include/helpers.php
|
||||
fc87642746ba4f324537bc381b78e982 ./include/paths.php
|
||||
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
|
||||
|
@ -20,5 +20,5 @@ da3b4f9b73c5c3bf65be6c42d68b51f9 ./scripts/showStatistics.php
|
|||
4425f8fd4ef662a7dc65cee01de3e419 ./scripts/updatePLG.sh
|
||||
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
|
||||
c7ba8f5e37c5943bdc2c8c90fd580276 ./skins/Narrow/css.php
|
||||
0bdefa4e915c02ed3310c39eb5a1cef5 ./skins/Narrow/skin.html
|
||||
c3653e326529337846904be15698bc71 ./skins/Narrow/skin.html
|
||||
444485f96e18f42d42612efd4ba5066e ./skins/Narrow/skin.php
|
||||
|
|
|
@ -188,6 +188,9 @@ switch ($_POST['action']) {
|
|||
case 'changeMaxPerPage':
|
||||
changeMaxPerPage();
|
||||
break;
|
||||
case 'enableActionCentre':
|
||||
enableActionCentre();
|
||||
break;
|
||||
case 'var_dump':
|
||||
break;
|
||||
###############################################
|
||||
|
@ -1205,7 +1208,11 @@ function previous_apps() {
|
|||
}
|
||||
$displayedApplications['community'] = $displayed;
|
||||
writeJsonFile($caPaths['community-templates-displayed'],$displayedApplications);
|
||||
postReturn(['status'=>"ok"]);
|
||||
if ( $installed == "action" && empty($displayed) ) {
|
||||
postReturn(['status'=>"ok",'script'=>'$(".actionCentre").hide();']);
|
||||
} else {
|
||||
postReturn(['status'=>"ok"]);
|
||||
}
|
||||
}
|
||||
|
||||
####################################################################################
|
||||
|
@ -2189,6 +2196,9 @@ function getLastUpdate($ID) {
|
|||
return $lastUpdated;
|
||||
}
|
||||
|
||||
######################################
|
||||
# Changes the max per page displayed #
|
||||
######################################
|
||||
function changeMaxPerPage() {
|
||||
global $caPaths, $caSettings;
|
||||
|
||||
|
@ -2202,6 +2212,169 @@ function changeMaxPerPage() {
|
|||
}
|
||||
}
|
||||
|
||||
################################################################
|
||||
# Enables if necessary the action centre #
|
||||
# Basically a duplicate of action centre code in previous apps #
|
||||
################################################################
|
||||
function enableActionCentre() {
|
||||
global $caPaths, $caSettings, $DockerClient;
|
||||
|
||||
# wait til check for updates is finished
|
||||
for ( ;; ) {
|
||||
if ( is_file($caPaths['updateRunning']) && file_exists("/proc/".@file_get_contents($caPaths['updateRunning'])) ) {
|
||||
debug("sleeping -> update running");
|
||||
sleep(5);
|
||||
}
|
||||
else break;
|
||||
}
|
||||
|
||||
# wait til templates are downloaded
|
||||
for ( ;; ) {
|
||||
$file = readJsonFile($caPaths['community-templates-info']);
|
||||
if ( ! $file ) {
|
||||
debug("sleeping - no templates");
|
||||
sleep(5);
|
||||
} else {
|
||||
debug("action centre: have templates");
|
||||
break;
|
||||
}
|
||||
}
|
||||
$extraBlacklist = readJsonFile($caPaths['extraBlacklist']);
|
||||
$extraDeprecated = readJsonFile($caPaths['extraDeprecated']);
|
||||
|
||||
if ( is_file("/var/run/dockerd.pid") && is_dir("/proc/".@file_get_contents("/var/run/dockerd.pid")) ) {
|
||||
$dockerUpdateStatus = readJsonFile($caPaths['dockerUpdateStatus']);
|
||||
} else {
|
||||
$dockerUpdateStatus = array();
|
||||
}
|
||||
$info = getAllInfo();
|
||||
|
||||
# $info contains all installed containers
|
||||
# now correlate that to a template;
|
||||
# this section handles containers that have not been renamed from the appfeed
|
||||
if ( $caSettings['dockerRunning'] ) {
|
||||
$all_files = glob("{$caPaths['dockerManTemplates']}/*.xml");
|
||||
$all_files = $all_files ?: array();
|
||||
foreach ($all_files as $xmlfile) {
|
||||
$o = readXmlFile($xmlfile);
|
||||
$o['Overview'] = fixDescription($o['Overview']);
|
||||
$o['Description'] = $o['Overview'];
|
||||
$o['CardDescription'] = $o['Overview'];
|
||||
$o['InstallPath'] = $xmlfile;
|
||||
$o['UnknownCompatible'] = true;
|
||||
$containerID = false;
|
||||
|
||||
$runningflag = false;
|
||||
foreach ($info as $installedDocker) {
|
||||
$installedImage = str_replace("library/","",$installedDocker['Image']);
|
||||
$installedName = $installedDocker['Name'];
|
||||
if ( $installedName == $o['Name'] ) {
|
||||
if ( startsWith($installedImage, $o['Repository']) ) {
|
||||
$runningflag = true;
|
||||
$searchResult = searchArray($file,'Repository',$o['Repository']);
|
||||
if ( $searchResult === false) {
|
||||
$searchResult = searchArray($file,'Repository',explode(":",$o['Repository'])[0]);
|
||||
}
|
||||
if ( $searchResult === false ) {
|
||||
$tempPath = $o['InstallPath'];
|
||||
$containerID = $file[$searchResult]['ID'];
|
||||
$tmpOvr = $o['Overview'];
|
||||
$o = $file[$searchResult];
|
||||
$o['Name'] = $installedName;
|
||||
$o['Overview'] = $tmpOvr;
|
||||
$o['CardDescription'] = $tmpOvr;
|
||||
$o['InstallPath'] = $tempPath;
|
||||
$o['SortName'] = str_replace("-"," ",$installedName);
|
||||
if ( $installedName !== $file[$searchResult]['Name'] )
|
||||
$o['NoPin'] = true; # This is renamed and effectively outside of CA's control
|
||||
} else {
|
||||
$runningFlag = true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ( $runningflag ) {
|
||||
$o['Uninstall'] = true;
|
||||
$o['ID'] = $containerID;
|
||||
|
||||
$tmpRepo = strpos($o['Repository'],":") ? $o['Repository'] : $o['Repository'].":latest";
|
||||
|
||||
if ( $dockerUpdateStatus[$tmpRepo]['status'] == "false" )
|
||||
$o['actionCenter'] = true;
|
||||
|
||||
if ( ! $o['Blacklist'] && ! $o['Deprecated'] ) {
|
||||
if ( $extraBlacklist[$o['Repository']] ) {
|
||||
$o['Blacklist'] = true;
|
||||
$o['ModeratorComment'] = $extraBlacklist[$o['Repository']];
|
||||
}
|
||||
if ( $extraDeprecated[$o['Repository']] ) {
|
||||
$o['Deprecated'] = true;
|
||||
$o['ModeratorComment'] = $extraDeprecated[$o['Deprecated']];
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$o['Blacklist'] && !$o['Deprecated'] && !$o['actionCenter'] )
|
||||
continue;
|
||||
|
||||
$displayed[] = $o;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
# Now work on plugins
|
||||
foreach ($file as $template) {
|
||||
if ( ! $template['Plugin'] ) continue;
|
||||
|
||||
$filename = pathinfo($template['Repository'],PATHINFO_BASENAME);
|
||||
|
||||
if ( checkInstalledPlugin($template) ) {
|
||||
$template['InstallPath'] = "/var/log/plugins/$filename";
|
||||
$template['Uninstall'] = true;
|
||||
|
||||
if ( $template['PluginURL'] ) {
|
||||
if ( ( strcmp(plugin("version","/var/log/plugins/$filename"),$template['pluginVersion']) < 0 || $template['UpdateAvailable']) && $template['Name'] !== "Community Applications") {
|
||||
$template['actionCenter'] = true;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !$template['Blacklist'] && !$template['Deprecated'] && !$template['actionCenter'] )
|
||||
continue;
|
||||
$displayed[] = $template;
|
||||
}
|
||||
}
|
||||
$installedLanguages = array_diff(scandir($caPaths['languageInstalled']),array(".","..","en_US"));
|
||||
foreach ($installedLanguages as $language) {
|
||||
$index = searchArray($file,"LanguagePack",$language);
|
||||
if ( $index !== false ) {
|
||||
$tmpL = $file[$index];
|
||||
$tmpL['Uninstall'] = true;
|
||||
|
||||
if ( !languageCheck($tmpL) )
|
||||
continue;
|
||||
|
||||
$displayed[] = $tmpL;
|
||||
}
|
||||
}
|
||||
|
||||
file_put_contents("/tmp/blah",print_r($displayed,true));
|
||||
if ( isset($displayed) ) {
|
||||
debug("action center enabled");
|
||||
postReturn(['status'=>"action"]);
|
||||
} else {
|
||||
debug("action centre disabled");
|
||||
postReturn(['status'=>"noaction"]);
|
||||
}
|
||||
|
||||
/* if ( is_array($displayed) ) {
|
||||
usort($displayed,"mySort");
|
||||
}
|
||||
$displayedApplications['community'] = $displayed;
|
||||
writeJsonFile($caPaths['community-templates-displayed'],$displayedApplications); */
|
||||
}
|
||||
|
||||
|
||||
|
||||
#######################################
|
||||
# Logs Javascript errors being caught #
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
</ul>
|
||||
<li class='caMenuItem sectionMenu caPinnedMenu onlyShowWithFeed' data-category='pinned_apps'><?tr("Pinned Apps");?></li>
|
||||
<li class='caMenuItem favouriteRepo onlyShowWithFeed'><?tr("Favourite Repo");?></li>
|
||||
<li class='caMenuItem sectionMenu actionCentre onlyShowWithFeed' data-category='action_centre'><?tr("Action Centre");?></li>
|
||||
<li class='caMenuItem sectionMenu actionCentre onlyShowWithFeed' style='display:none;' data-category='action_centre'><?tr("Action Centre");?></li>
|
||||
<hr class='onlyShowWithFeed'>
|
||||
|
||||
<ul class='caMenu'>
|
||||
|
|
Loading…
Reference in New Issue
Block a user