From 36e1c3917e5115356aa10d220609055b59f3315f Mon Sep 17 00:00:00 2001 From: Ludovic <54670129+lbr38@users.noreply.github.com> Date: Mon, 27 Jan 2025 16:40:27 +0100 Subject: [PATCH] 4.16.4 --- docker/Dockerfile | 2 + docker/init | 4 + www/public/resources/js/host.js | 91 +++++++++---------- www/version | 2 +- .../containers/browse/actions.inc.php | 5 +- 5 files changed, 54 insertions(+), 50 deletions(-) diff --git a/docker/Dockerfile b/docker/Dockerfile index 92c7c1d6..fc27d694 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -14,6 +14,7 @@ ARG DEBIAN_FRONTEND=noninteractive ARG env ARG fqdn ARG max_upload_size +ARG php_memory_limit="256M" # PACKAGES INSTALL @@ -54,6 +55,7 @@ RUN cp /tmp/repomanager/docker/config/php/www.conf /etc/php/8.3/fpm/pool.d/www.c RUN cp /tmp/repomanager/docker/config/php/opcache.ini /etc/php/8.3/mods-available/opcache.ini RUN sed -i "s/^upload_max_filesize.*$/upload_max_filesize = $max_upload_size/g" /etc/php/8.3/fpm/php.ini RUN sed -i "s/^post_max_size.*$/post_max_size = $max_upload_size/g" /etc/php/8.3/fpm/php.ini +RUN sed -i "s/^memory_limit.*$/memory_limit = $php_memory_limit/g" /etc/php/8.3/fpm/php.ini # Configure SQLite RUN echo ".headers on" > /root/.sqliterc diff --git a/docker/init b/docker/init index ef5ce606..ac4cc633 100644 --- a/docker/init +++ b/docker/init @@ -27,6 +27,10 @@ if [ ! -z "$MAX_UPLOAD_SIZE" ];then sed -i "s/^post_max_size.*$/post_max_size = ${MAX_UPLOAD_SIZE}/g" /etc/php/8.3/fpm/php.ini fi +if [ ! -z "$PHP_MEMORY_LIMIT" ];then + sed -i "s/^memory_limit.*$/memory_limit = ${PHP_MEMORY_LIMIT}/g" /etc/php/8.3/fpm/php.ini +fi + # Start services if [ -f "/etc/init.d/syslog-ng" ];then /usr/sbin/service syslog-ng start diff --git a/www/public/resources/js/host.js b/www/public/resources/js/host.js index eaa77e63..a9605841 100644 --- a/www/public/resources/js/host.js +++ b/www/public/resources/js/host.js @@ -264,14 +264,14 @@ function searchHost() } /** - * Rechercher les hôtes possédant un paquet + * Research hosts with a package */ var getHostsWithPackage_locked = false; function getHostsWithPackage() { /** - * Si une recherche est déjà en cours, on sort + * If a search is already in progress, exit */ if (getHostsWithPackage_locked === true) { return; @@ -282,8 +282,7 @@ function getHostsWithPackage() printLoading(); /** - * A chaque saisie on (ré)-affiche tous les éléments masquées - * et on supprime les éventuelles infos dans le 'host-additionnal-info' + * On every input, (re)-display all hidden elements and remove any info in 'host-additionnal-info' */ $('.hosts-group-container').show(); $('.host-line').show(); @@ -291,25 +290,25 @@ function getHostsWithPackage() $('div.host-additionnal-info').hide(); /** - * On utilise un setTimeout pour laisser le temps à l'utilisateur de terminer sa saisie avant de rechercher + * Use a setTimeout to give the user time to finish typing before searching */ setTimeout(function () { /** - * Si l'input est vide, on quitte - */ + * If the input is empty, quit + */ if (!$("#getHostsWithPackageInput").val()) { getHostsWithPackage_locked = false; return; } /** - * Récupération du terme recherché dans l'input + * Retrieve the search term from the input */ var package = $("#getHostsWithPackageInput").val(); var hosts = []; /** - * Pour chaque id, on fait appel à la fonction getHostsWithPackage pour vérifier si le paquet existe sur l'hôte + * For each Id, call the getHostsWithPackageAjax function to check if the package exists on the host */ $('.hosts-table').find(".host-line").each(function () { var hostid = $(this).attr('hostid'); @@ -974,54 +973,52 @@ $(document).on('mouseleave', '.event-packages-details', function () { */ function getHostsWithPackageAjax(hosts, package) { - $.ajax({ - type: "POST", - url: "/ajax/controller.php", - data: { - controller: "host", - action: "getHostsWithPackage", + ajaxRequest( + // Controller: + 'host', + // Action: + 'getHostsWithPackage', + // Data: + { hostsIdArray: hosts, package: package }, - dataType: "json", - success: function (data, textStatus, jqXHR) { - jsonValue = jQuery.parseJSON(jqXHR.responseText); - const hostsArray = jQuery.parseJSON(jsonValue.message); + // Print success alert: + false, + // Print error alert: + true + ).then(() => { + const hostsArray = jQuery.parseJSON(jsonValue.message); - for (const [hostId, subArray] of Object.entries(hostsArray)) { - packagesFound = ''; + for (const [hostId, subArray] of Object.entries(hostsArray)) { + packagesFound = ''; - /** - * If package found - */ - if (Object.keys(subArray).length > 0) { - for (const [packageName, packageVersion] of Object.entries(subArray)) { - /** - * Build package list - */ - packagesFound += '
' + packageName + ' (' + packageVersion + ')
'; - } - - /** - * Show the host and print the package(s) found - */ - $('.host-line[hostid=' + hostId + ']').find('div.host-additionnal-info').html('
RESULTS
' + packagesFound); - $('.host-line[hostid=' + hostId + ']').find('div.host-additionnal-info').css('display', 'flex'); - $('.host-line[hostid=' + hostId + ']').show(); - } else { + /** + * If package found + */ + if (Object.keys(subArray).length > 0) { + for (const [packageName, packageVersion] of Object.entries(subArray)) { /** - * Else hide the host + * Build package list */ - $('.host-line[hostid=' + hostId + ']').hide(); + packagesFound += '
' + packageName + ' (' + packageVersion + ')
'; } + + /** + * Show the host and print the package(s) found + */ + $('.host-line[hostid=' + hostId + ']').find('div.host-additionnal-info').html('
RESULTS
' + packagesFound); + $('.host-line[hostid=' + hostId + ']').find('div.host-additionnal-info').css('display', 'flex'); + $('.host-line[hostid=' + hostId + ']').show(); + } else { + /** + * Else hide the host + */ + $('.host-line[hostid=' + hostId + ']').removeClass('flex').hide(); } + } - hideGroupDiv(); - }, - error: function (jqXHR, textStatus, thrownError) { - jsonValue = jQuery.parseJSON(jqXHR.responseText); - printAlert(jsonValue.message, 'error'); - }, + hideGroupDiv(); }); } diff --git a/www/version b/www/version index 5b33ac52..2bd63a3b 100644 --- a/www/version +++ b/www/version @@ -1 +1 @@ -4.16.3 \ No newline at end of file +4.16.4 \ No newline at end of file diff --git a/www/views/includes/containers/browse/actions.inc.php b/www/views/includes/containers/browse/actions.inc.php index f40b8d35..5a48bdcc 100644 --- a/www/views/includes/containers/browse/actions.inc.php +++ b/www/views/includes/containers/browse/actions.inc.php @@ -29,8 +29,9 @@
SELECT PACKAGES TO UPLOAD
-

Valid MIME types: application/x-rpm and application/vnd.debian.binary-package -

+

Max upload size:

+

Valid MIME types: application/x-rpm and application/vnd.debian.binary-package

+