Fixed: On a search for a prev installed app you may not have been able to reinstall it from the card
Fixed: Prevent multiple searches from taking place if a search is still in progress
pull/11/head
Squidly271 2021-12-04 15:47:49 -05:00
parent ebc992a5d9
commit 01afdba90e
6 changed files with 46 additions and 9 deletions

View File

@ -153,6 +153,7 @@ data.currentpage = 1;
data.searchFlag = false;
data.searchActive = false; // Sets whether changepage re-sorts the displayed templates.
data.previousAppsSection = ""; // The section the user is on within previous apps
data.searchInProgress = false;
var dockerNotEnabled;
var postCount = 0;
var cookieWarning = false;
@ -226,7 +227,7 @@ $(function(){
closeSidebar();
});
$("#searchBox").keydown(function(e) { // Allow ESC key to exit from tooltipster popups
$("#searchBox").keydown(function(e) {
if (e.which === 13) {
searchBoxAwesomplete.close();
checkSortOrder();
@ -772,6 +773,12 @@ function myCloseAlert() {
}
function doSearch(button,newSearch) {
if ( data.searchInProgress )
return;
data.searchInProgress = true;
if ( ! newSearch === false ) {
$('#searchBox').val(newSearch);
}
@ -779,6 +786,7 @@ function doSearch(button,newSearch) {
filter = $.trim(filter);
if ( ! filter ) {
$("#searchBox").val(filter);
data.searchInProgress = false;
return;
}
@ -805,6 +813,7 @@ function doSearch(button,newSearch) {
} else {
updateContent();
data.searchFlag = false;
data.searchInProgress = false;
return;
}
data.searchActive = true;
@ -813,6 +822,8 @@ function doSearch(button,newSearch) {
} else {
$('.dockerSearch').hide();
}
data.searchInProgress = true;
post({action:'get_content',filter:filter},function(result) {
enableButtons();
updateDisplay(result.display);
@ -826,6 +837,7 @@ function doSearch(button,newSearch) {
var menuItem = $.find(".caMenuItem[data-category='"+category+"']");
$(menuItem).removeClass("caMenuDisabled").addClass("caMenuEnabled");
});
data.searchInProgress = false;
});
});
}
@ -1613,9 +1625,8 @@ function post(options,callback) {
alert("<?tr("You have been logged out")?>");
window.location.reload();
} else {
$("#templates_content").html(sprintf(tr("Something really wrong went on during %s"),options.action)+"<br><?tr("Post the ENTIRE contents of this message in the Community Applications Support Thread")?><br><br>OS: <?=$unRaidSettings['version']?> <?=$md5Error ? "<br>Modified CA" : ""?><br>Browser: <?=$_SERVER['HTTP_USER_AGENT']?><br>Language: <?=$_SESSION['locale']?><br><br>"+retval.escapeHTML());
throw new Error("Something went badly wrong!");
throw new Error("Something went badly wrong!"+options.action);
}
}
<? if ( $cfg['debugging'] == "yes" ):?>

View File

@ -1,9 +1,9 @@
e38e55c665414fdbaf56ec4f5182dad9 ./Apps.page
aab3481fc0356a16dbac7022781880f3 ./Apps.page
83b3f89cd42e8601c7c217d5b4889c81 ./CA_notices.page
7ee0b23dbd92ed55f611360a983f9565 ./ca_settings.page
1b49ec9797713ce869ea0c1066a109f2 ./default.cfg
153741a73e58d9ea5a001880626e3f81 ./include/exec.php
a29e895d79ef0d41695c6bed8534b522 ./include/helpers.php
fc99508b76773e7af9886e416145f7d9 ./include/exec.php
57b8df772ef356881156350d8d855c0f ./include/helpers.php
95709ae0ed53e2889a93849a69b37892 ./include/paths.php
410c0166bae560754e231486050621f6 ./javascript/libraries.js
8c24d585c7dd3ff9ef961bb2c2705711 ./PluginAPI.page
@ -22,4 +22,4 @@ e3dc9ed23036a09d69d5cd5c3111751e ./scripts/showStatistics.php
2bd671daecaf01549f8cc0202cb184b3 ./scripts/updatePluginSupport.php
a8900ea90ba3a4937a4648ae92f9e848 ./skins/Narrow/css.php
cfa1511913f794c8c5980460dfcdf049 ./skins/Narrow/skin.html
1b8ee27878d267006182231218d02f91 ./skins/Narrow/skin.php
e2290f61f2a45efd36d5efaa27528569 ./skins/Narrow/skin.php

View File

@ -5,6 +5,7 @@
# Licenced under GPLv2 #
# #
###############################################################
debug_backtrace();
$unRaidSettings = parse_ini_file("/etc/unraid-version");
### Translations section has to be first so that nothing else winds up caching the file(s)
@ -251,6 +252,9 @@ function DownloadApplicationFeed() {
$o['SortName'] = str_replace("-"," ",$o['Name']);
$o['SortName'] = preg_replace('/\s+/',' ',$o['SortName']);
$o['random'] = rand();
$tmpRepo = explode(":",$o['Repository']);
$o['Repository'] = implode(":",$tmpRepo);
if ( $o['CAComment'] ) $o['CAComment'] = tr($o['CAComment']);

View File

@ -41,11 +41,31 @@ function randomFile() {
# 7 Functions to avoid typing the same lines over and over again #
##################################################################
function readJsonFile($filename) {
global $caSettings, $caPaths;
if ( $caSettings['debugging'] == "yes" )
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Read JSON file $filename\n",FILE_APPEND);
$json = json_decode(@file_get_contents($filename),true);
if ($caSettings['debugging'] == "yes" && ! $json) {
if ( ! is_file($filename) )
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." $filename not found\n",FILE_APPEND);
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." JSON Read Error ($filename)\n",FILE_APPEND);
}
return is_array($json) ? $json : array();
}
function writeJsonFile($filename,$jsonArray) {
file_put_contents($filename,json_encode($jsonArray, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
global $caSettings, $caPaths;
if ($caSettings['debugging'] == "yes")
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Write JSON File $filename\n",FILE_APPEND);
$result = file_put_contents($filename,json_encode($jsonArray, JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT));
if ( $caSettings['debugging'] == "true" && ! $result )
file_put_contents($caPaths['logging'],date('Y-m-d H:i:s')." Write error $filename\n",FILE_APPEND);
}
function download_url($url, $path = "", $bg = false, $timeout = 45) {
global $caSettings, $caPaths;
@ -172,6 +192,7 @@ function favouriteSort($a,$b) {
# return value === false if not found #
###############################################
function searchArray($array,$key,$value,$startingIndex=0) {
$result = false;
if (count($array) ) {
for ($i = $startingIndex; $i <= max(array_keys($array)); $i++) {
if ( $array[$i][$key] == $value ) {

View File

@ -144,7 +144,8 @@ function my_display_apps($file,$pageNumber=1,$selectedApps=false,$startup=false)
if ( is_file("{$caPaths['dockerManTemplates']}/my-{$template['Name']}.xml") ) {
$test = readXmlFile("{$caPaths['dockerManTemplates']}/my-{$template['Name']}.xml",true);
if ( $template['Repository'] == $test['Repository'] ) {
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>"<span class='ca_red'>".tr("Reinstall From Previous Apps")."</span>","action"=>"popupInstallXML('".addslashes($template['InstallPath'])."','user');");
$actionsContext[] = array("icon"=>"ca_fa-install","text"=>"<span class='ca_red'>".tr("Reinstall From Previous Apps")."</span>","action"=>"popupInstallXML('".addslashes("{$caPaths['dockerManTemplates']}/my-{$template['Name']}").".xml','user');");
$actionsContext[] = array("divider"=>true);
}
}