Skip to content

Commit

Permalink
3.5.2
Browse files Browse the repository at this point in the history
  • Loading branch information
lbr38 committed May 31, 2023
1 parent e6e0ba3 commit c35bac6
Show file tree
Hide file tree
Showing 16 changed files with 963 additions and 964 deletions.
2 changes: 1 addition & 1 deletion docker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ ARG max_upload_size

# Install dependencies
RUN apt-get update -y
RUN apt-get install findutils git gnupg2 rpm librpmsign9 createrepo-c reprepro apt-utils curl ca-certificates apt-transport-https dnsutils -y
RUN apt-get install findutils git gnupg2 rpm librpmsign9 createrepo-c reprepro apt-utils curl ca-certificates apt-transport-https dnsutils xz-utils -y

# Install postfix
RUN apt-get install postfix -y
Expand Down
2 changes: 1 addition & 1 deletion docker/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
WWW_DIR="/var/www/repomanager"
DATA_DIR="/var/lib/repomanager"

$WWW_DIR/bin/repomanager --www-user www-data -p
$WWW_DIR/bin/repomanager --www-user www-data -p &

# Start services
service php8.1-fpm start
Expand Down
26 changes: 18 additions & 8 deletions www/controllers/Layout/Container/vars/operations/log.vars.inc.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
* Get the log file to display from the cookie set by JS
*/
if (!empty($_COOKIE['view-logfile'])) {
if (file_exists(MAIN_LOGS_DIR . '/' . $_COOKIE['view-logfile'])) {
$logfile = $_COOKIE['view-logfile'];
$logfileCookie = \Controllers\Common::validateData($_COOKIE['view-logfile']);

if (file_exists(MAIN_LOGS_DIR . '/' . $logfileCookie)) {
$logfile = $logfileCookie;
}
}

Expand All @@ -16,12 +18,20 @@
* It's the case for some links from planification mails or planification tab
*/
if (!empty($_GET['view-logfile'])) {
if (file_exists(MAIN_LOGS_DIR . '/' . $_GET['view-logfile'])) {
$logfile = $_GET['view-logfile'];
/**
* Rewrite cookie
*/
setcookie('view-logfile', $_GET['logfile'], time() + 3600 * 24 * 30, '/');
$logfileGet = \Controllers\Common::validateData($_GET['view-logfile']);

/**
* Logfile name must match the pattern
*/
if (preg_match('/^(?:[0-9]{2})?[0-9]{2}-[0-3]?[0-9]-[0-3]?[0-9].*_(plan|repomanager)_.*.log$/', $logfileGet)) {
if (file_exists(MAIN_LOGS_DIR . '/' . $logfileGet)) {
$logfile = $logfileGet;

/**
* Rewrite cookie
*/
setcookie('view-logfile', $logfile, time() + 3600 * 24 * 30, '/');
}
}
}

Expand Down
21 changes: 21 additions & 0 deletions www/controllers/Layout/Container/vars/plans/form.vars.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
$myrepo = new \Controllers\Repo();
$mygroup = new \Controllers\Group('repo');
$mylogin = new \Controllers\Login();

/**
* Get list of repos with at least DEFAULT_ENV
*/
$reposList = $myrepo->listForPlan();

/**
* Get repos groups list
*/
$groupsList = $mygroup->listAll();

/**
* Getting users email
*/
$usersEmail = $mylogin->getEmails();

unset($myrepo, $mygroup, $mylogin);
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
$myrepo = new \Controllers\Repo();
$myplan = new \Controllers\Planification();
$mygroup = new \Controllers\Group('repo');

$plansDone = $myplan->listDone();

unset($myplan);
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,13 @@
$myrepo = new \Controllers\Repo();
$myplan = new \Controllers\Planification();
$mygroup = new \Controllers\Group('repo');
$mylogin = new \Controllers\Login();

/**
* Get repos groups list
*/
$repoGroupsList = $mygroup->listAllName();

/**
* Getting users email
*/
$usersEmail = $mylogin->getEmails();

/**
* Récupération de la liste des planifications en liste d'attente ou en cours d'exécution
* Get planifications list
*/
$planQueueList = $myplan->listQueue();
$planRunningList = $myplan->listRunning();
$planDisabledList = $myplan->listDisabled();

$planList = array_merge($planRunningList, $planQueueList, $planDisabledList);
array_multisort(array_column($planList, 'Date'), SORT_ASC, array_column($planList, 'Time'), SORT_ASC, $planList);

unset($mylogin);
2 changes: 1 addition & 1 deletion www/controllers/Layout/Tab/Plans.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Plans
public static function render()
{
\Controllers\Layout\Container\Render::render('repos/list');
\Controllers\Layout\Container\Render::render('plans/list');
\Controllers\Layout\Container\Render::render('plans/all');

if (IS_ADMIN) {
\Controllers\Layout\Panel\RepoGroup::render();
Expand Down
5 changes: 3 additions & 2 deletions www/controllers/Operation.php
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,7 @@ public function startOperation(array $variables = [])
*/
$this->layoutContainerStateController->update('header/menu');
$this->layoutContainerStateController->update('repos/list');
$this->layoutContainerStateController->update('plans/list');
$this->layoutContainerStateController->update('plans/planned');
$this->layoutContainerStateController->update('operations/list');

unset($variables);
Expand Down Expand Up @@ -604,7 +604,8 @@ public function closeOperation()
$this->layoutContainerStateController->update('header/menu');
$this->layoutContainerStateController->update('repos/list');
$this->layoutContainerStateController->update('repos/properties');
$this->layoutContainerStateController->update('plans/list');
$this->layoutContainerStateController->update('plans/planned');
$this->layoutContainerStateController->update('plans/history');
$this->layoutContainerStateController->update('operations/list');

/**
Expand Down
98 changes: 75 additions & 23 deletions www/public/resources/js/plan.js
Original file line number Diff line number Diff line change
@@ -1,28 +1,82 @@
$(document).ready(function () {
idToSelect2('#planActionSelect', 'Select action...', true);
idToSelect2('#planReminderSelect', 'Select reminder...', true);
idToSelect2('#planDayOfWeekSelect', 'Select day(s)...', true);
idToSelect2('#addPlanMailRecipient', 'Select recipients...', true);
});

/**
* Rechargement de la div des planifications
* Recharge les menus select2 en même temps
* Functions
*/
function reloadPlanDiv()
function printDate()
{
$("#planDiv").load(" #planDiv > *",function () {
idToSelect2('#planActionSelect', 'Select action...', true);
idToSelect2('#planReminderSelect', 'Select...', true);
idToSelect2('#planDayOfWeekSelect', 'Select...', true);
idToSelect2('#addPlanMailRecipient', 'Select recipients...', true);
});
/**
* Récupération de la date sélectionnée dans la liste
*/
var selectValue = $('#addPlanDate').val();

/**
* Si aucune date n'a été selectionnée par l'utilisateur alors on n'affiche rien
*/
if (selectValue == "") {
$("#update-preview").hide();

/**
* Sinon on affiche l'environnement qui pointe vers le nouveau snapshot qui sera créé
*/
} else {
$("#update-preview").css('display', 'table-row');
$('#update-preview-date').html(selectValue);
}
}

function printEnv()
{
var envSpan = '#update-preview-target-env';

/**
* Nom du dernier environnement de la chaine
*/
var lastEnv = '<?=LAST_ENV?>';

/**
* Récupération de l'environnement sélectionné dans la liste
*/
var selectValue = $('#addPlanTargetEnv').val();

/**
* Si l'environnement correspond au dernier environnement de la chaine alors il sera affiché en rouge
*/
if (selectValue == lastEnv) {
var envSpanClass = 'last-env';
} else {
var envSpanClass = 'env';
}

/**
* Si aucun environnement n'a été selectionné par l'utilisateur alors on n'affiche rien
*/
if (selectValue == "") {
$(envSpan).html('');

/**
* Sinon on affiche l'environnement qui pointe vers le nouveau snapshot qui sera créé
*/
} else {
$(envSpan).html('⟵<span class="'+envSpanClass+'">'+selectValue+'</span>');
}
}

printDate();
printEnv();


/**
* Events listeners
*/

/**
* Event: On date or env change, update the preview
*/
$(document).on('change', '#addPlanDate, #addPlanTargetEnv', function () {
printDate();
printEnv();

}).trigger('change');

/**
* Event : affichage des détails d'une planification
*/
Expand All @@ -34,7 +88,7 @@ $(document).on('click','.planDetailsBtn',function () {
/**
* Affichage du div portant cet Id
*/
$('.detailsDiv[plan-id=' + planId + ']').slideToggle(100);
$('.planInfo[plan-id=' + planId + ']').slideToggle(100);
});

/**
Expand Down Expand Up @@ -96,7 +150,6 @@ $(document).on('change','#planFrequencySelect',function () {
}
}).trigger('change');


/**
* Event : Afficher des boutons radio supplémentaires si l'option du select sélectionnée est '#updateRepoSelect' afin de choisir si on souhaite activer gpg check et resigner les paquets
*/
Expand Down Expand Up @@ -164,7 +217,6 @@ $(document).on('submit','#newPlanForm',function () {
return false;
});


/**
* Event : Suppression d'une planification
*/
Expand Down Expand Up @@ -236,7 +288,7 @@ function newPlan(type, day, date, time, frequency, planAction, snapId, groupId,
success: function (data, textStatus, jqXHR) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
printAlert(jsonValue.message, 'success');
reloadPlanDiv();
reloadContainer('plans/planned');
},
error : function (jqXHR, textStatus, thrownError) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
Expand All @@ -263,7 +315,7 @@ function deletePlan(id)
success: function (data, textStatus, jqXHR) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
printAlert(jsonValue.message, 'success');
reloadPlanDiv();
reloadContainer('plans/planned');
},
error : function (jqXHR, ajaxOptions, thrownError) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
Expand All @@ -290,7 +342,7 @@ function disablePlan(id)
success: function (data, textStatus, jqXHR) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
printAlert(jsonValue.message, 'success');
reloadPlanDiv();
reloadContainer('plans/planned');
},
error : function (jqXHR, ajaxOptions, thrownError) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
Expand All @@ -317,7 +369,7 @@ function enablePlan(id)
success: function (data, textStatus, jqXHR) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
printAlert(jsonValue.message, 'success');
reloadPlanDiv();
reloadContainer('plans/planned');
},
error : function (jqXHR, ajaxOptions, thrownError) {
jsonValue = jQuery.parseJSON(jqXHR.responseText);
Expand Down
6 changes: 3 additions & 3 deletions www/public/resources/styles/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -784,7 +784,7 @@ footer #github img { width: 25px; }
height: 100px;
}

.detailsDiv {
.detailsDiv, .planInfo {
padding: 10px;
background-color: #182b3e;
border-left: 1px solid #24405c;
Expand All @@ -794,11 +794,11 @@ footer #github img { width: 25px; }
border-radius: 4px;
}

#planDiv .detailsDiv div {
.planInfo div {
display: table-row;
}

#planDiv .detailsDiv div span {
.planInfo div span {
display: table-cell;
width: 60%;
padding: 5px;
Expand Down
2 changes: 1 addition & 1 deletion www/version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.5.1
3.5.2
6 changes: 6 additions & 0 deletions www/views/includes/containers/plans/all.inc.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<section class="section-right reloadable-container" container="plans/all">
<?php
\Controllers\Layout\Container\Render::render('plans/planned');
\Controllers\Layout\Container\Render::render('plans/form');
\Controllers\Layout\Container\Render::render('plans/history'); ?>
</section>
Loading

0 comments on commit c35bac6

Please sign in to comment.