mirror of
https://github.com/Squidly271/community.applications.git
synced 2025-06-03 14:52:13 +08:00
Fixed: show comments etc when installing via card on templates that have branches
This commit is contained in:
parent
a0aee26e3f
commit
e7e6ff4e3a
BIN
archive/community.applications-2022.01.02-x86_64-1.txz
Normal file
BIN
archive/community.applications-2022.01.02-x86_64-1.txz
Normal file
Binary file not shown.
@ -1224,26 +1224,78 @@ function pinnedApps() {
|
||||
});
|
||||
}
|
||||
|
||||
function displayTags(leadTemplate,rename=false) {
|
||||
function displayTags(leadTemplate,rename=false,comment="",ports="") {
|
||||
event.stopPropagation();
|
||||
closeSidebar();
|
||||
post({action:'displayTags',leadTemplate:leadTemplate,noSpinner:true,rename:rename},function(result) {
|
||||
disableSearch();
|
||||
var flag = false;
|
||||
|
||||
if ( ports ) {
|
||||
ports = JSON.parse(ports);
|
||||
if ( ports ) {
|
||||
ports.forEach(function(port){
|
||||
portsInUse.forEach(function(used) {
|
||||
if (port == used)
|
||||
flag = true;
|
||||
});
|
||||
});
|
||||
}
|
||||
if (flag) {
|
||||
comment = comment.concat("<br><?tr("One or more ports used by this application are already in use by another service or app running on your server. You will need to adjust the host ports accordingly on the template")?>");
|
||||
}
|
||||
}
|
||||
if (comment) {
|
||||
swal({
|
||||
title: "<?tr("Choose A Branch To Install")?>",
|
||||
text: result.tags,
|
||||
html: true,
|
||||
type: "warning",
|
||||
title: "<?tr("Attention")?>",
|
||||
text: comment,
|
||||
allowOutsideClick: true,
|
||||
showConfirmButton: true,
|
||||
showCancelButton: true,
|
||||
showConfirmButton: false,
|
||||
confirmButtonText: "<?tr("OK")?>",
|
||||
cancelButtonText: "<?tr("Cancel")?>",
|
||||
allowOutsideClick: true
|
||||
}, function(isConfirm) {
|
||||
if ( ! isConfirm ) {
|
||||
enableSearch();
|
||||
animation: false,
|
||||
type: "warning",
|
||||
html: true,
|
||||
closeOnConfirm: false
|
||||
},function(isConfirm) {
|
||||
if (isConfirm) {
|
||||
post({action:'displayTags',leadTemplate:leadTemplate,noSpinner:true,rename:rename},function(result) {
|
||||
disableSearch();
|
||||
swal({
|
||||
title: "<?tr("Choose A Branch To Install")?>",
|
||||
text: result.tags,
|
||||
html: true,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
showConfirmButton: false,
|
||||
cancelButtonText: "<?tr("Cancel")?>",
|
||||
allowOutsideClick: true
|
||||
}, function(isConfirm) {
|
||||
if ( ! isConfirm ) {
|
||||
enableSearch();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
} else {
|
||||
post({action:'displayTags',leadTemplate:leadTemplate,noSpinner:true,rename:rename},function(result) {
|
||||
disableSearch();
|
||||
swal({
|
||||
title: "<?tr("Choose A Branch To Install")?>",
|
||||
text: result.tags,
|
||||
html: true,
|
||||
type: "warning",
|
||||
showCancelButton: true,
|
||||
showConfirmButton: false,
|
||||
cancelButtonText: "<?tr("Cancel")?>",
|
||||
allowOutsideClick: true
|
||||
}, function(isConfirm) {
|
||||
if ( ! isConfirm ) {
|
||||
enableSearch();
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function makePlural(string,count) {
|
||||
|
@ -1,9 +1,9 @@
|
||||
93430cdb88eb296df5d5753f6c575ea8 ./Apps.page
|
||||
8c0556f3cbebc296709cd3ef7622fae3 ./Apps.page
|
||||
4e55f7483b661af21a25b677179baffe ./CA_notices.page
|
||||
c7c6da0a4a4a7ac33f387ea178319bae ./ca_settings.page
|
||||
ed2883d6c44c19304c431079596a1731 ./default.cfg
|
||||
afe60a2b41646f7904be1db8c836f851 ./include/exec.php
|
||||
192f3642aba7260d90e723d86a1fe257 ./include/helpers.php
|
||||
fb3835932cb817d530eb0fde0c788dc5 ./include/helpers.php
|
||||
d827ebdf8c29aa6a9818df043a37721e ./include/paths.php
|
||||
532fffdf939594c143e679da02bd841e ./javascript/libraries.js
|
||||
b398273cf7daa62ab00d2de2336ca25f ./README.md
|
||||
@ -21,4 +21,4 @@ a1401a0bed89c182b69f0c7508282c1f ./scripts/pluginInstall.php
|
||||
34554a56611dfe625889c82afd5138de ./scripts/updatePluginSupport.php
|
||||
dec0ef21fb5bd704cd319e0a059a11ba ./skins/Narrow/css.php
|
||||
7d827147dc8ede3d518b2cacae1d385b ./skins/Narrow/skin.html
|
||||
b31866f877bd4cd0a9be91b15ed9d0b8 ./skins/Narrow/skin.php
|
||||
1a27517d5081d2ef2191775e41303a5a ./skins/Narrow/skin.php
|
||||
|
@ -662,18 +662,17 @@ function debug($str) {
|
||||
# Gets the default ports in a template #
|
||||
########################################
|
||||
function portsUsed($template) {
|
||||
if ( $template['Network'] !== "bridge" || ! is_array($template['Config']) )
|
||||
if ( $template['Network'] !== "bridge")
|
||||
return;
|
||||
|
||||
$portsUsed = [];
|
||||
if ( $template['Config']['@attributes'] )
|
||||
$template['Config'] = ['@attributes'=>$template['Config']];
|
||||
|
||||
foreach ($template['Config'] as $config) {
|
||||
if ( $config['@attributes']['Type'] !== "Port" ) continue;
|
||||
$portsUsed[] = $config['value'] ?: $config['@attributes']['Default'];
|
||||
}
|
||||
|
||||
if ( is_array($template['Config']) ) {
|
||||
foreach ($template['Config'] as $config) {
|
||||
if ( $config['@attributes']['Type'] !== "Port" ) continue;
|
||||
$portsUsed[] = $config['value'] ?: $config['@attributes']['Default'];
|
||||
}
|
||||
}
|
||||
return json_encode($portsUsed);
|
||||
}
|
||||
|
||||
|
@ -95,6 +95,11 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
||||
} else {
|
||||
$actionsContext = [];
|
||||
$selected = false;
|
||||
$installComment = $template['CAComment'];
|
||||
|
||||
if ( ! $installComment && $template['Requires'] )
|
||||
$installComment = tr("This application has additional requirements")."<br>".markdown($template['Requires']);
|
||||
|
||||
if ( ! $template['Language'] ) {
|
||||
if ( ! $template['NoInstall'] && ! $caSettings['NoInstalls']) {
|
||||
if ( ! $template['Plugin'] ) {
|
||||
@ -120,9 +125,9 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
||||
}
|
||||
if ( $caSettings['defaultReinstall'] == "true" ) {
|
||||
if ( $template['BranchID'] )
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true);");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true,'".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');");
|
||||
else
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second','','".portsUsed($template)."');");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second','".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');");
|
||||
}
|
||||
$actionsContext[] = array("icon"=>"ca_fa-edit","text"=>tr("Edit"),"action"=>"popupInstallXML('".addslashes($info[$ind]['template'])."','edit');");
|
||||
$actionsContext[] = array("divider"=>true);
|
||||
@ -138,9 +143,6 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
||||
$actionsContext[] = array("divider"=>true);
|
||||
$actionsContext[] = array("icon"=>"ca_fa-delete","text"=>tr("Remove from Previous Apps"),"action"=>"removeApp('{$template['InstallPath']}','{$template['Name']}');");
|
||||
} else {
|
||||
$installComment = $template['CAComment'];
|
||||
if ( ! $installComment && $template['Requires'] )
|
||||
$installComment = tr("This application has additional requirements")."<br>".markdown($template['Requires']);
|
||||
if ( ! $template['BranchID'] ) {
|
||||
if ( is_file("{$caPaths['dockerManTemplates']}/my-{$template['Name']}.xml") ) {
|
||||
$test = readXmlFile("{$caPaths['dockerManTemplates']}/my-{$template['Name']}.xml",true);
|
||||
@ -152,8 +154,7 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
|
||||
}
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>"Install","action"=>"popupInstallXML('".addslashes($template['Path'])."','default','".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');");
|
||||
} else {
|
||||
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>"Install","action"=>"displayTags('{$template['ID']}',false,'".str_replace(" "," ",htmlspecialchars($installComment))."','','".portsUsed($userTemplate)."');");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>"Install","action"=>"displayTags('{$template['ID']}',false,'".str_replace(" "," ",htmlspecialchars($installComment))."','".portsUsed($template)."');");
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -520,7 +521,7 @@ function getPopupDescriptionSkin($appNumber) {
|
||||
}
|
||||
if ( $caSettings['defaultReinstall'] == "true" ) {
|
||||
if ( $template['BranchID'] )
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true);");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"displayTags('{$template['ID']}',true,'','".portsUsed($template)."');");
|
||||
else
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install second instance"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','second','','".portsUsed($template)."');");
|
||||
}
|
||||
@ -538,9 +539,9 @@ function getPopupDescriptionSkin($appNumber) {
|
||||
if ( ( $template['Compatible'] || $caSettings['hideIncompatible'] !== "true" ) ) {
|
||||
if ( !$template['Deprecated'] || $caSettings['hideDeprecated'] !== "true" ) {
|
||||
if ( ! $template['BranchID'] ) {
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','default','','".portsUsed($userTemplate)."');");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"popupInstallXML('".addslashes($template['Path'])."','default','','".portsUsed($template)."');");
|
||||
} else {
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"displayTags('{$template['ID']}');");
|
||||
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>tr("Install"),"action"=>"displayTags('{$template['ID']}',false,'','".portsUsed($template)."');");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user