diff --git a/.github/workflows/test-api.yml b/.github/workflows/test-api.yml index adf796606..321d93099 100644 --- a/.github/workflows/test-api.yml +++ b/.github/workflows/test-api.yml @@ -20,11 +20,11 @@ jobs: run: sudo apt-get install curl jq wget -y # Wait for the API to be ready - # Generally after the 30 first minutes of the current hour (xx:30 to xx:59) + # Generally after the 45 first minutes of the current hour (xx:45 to xx:59) - name: Wait until API URL is ready run: | while (true); do - if $(date +%M | grep -q '^[3-5][0-9]$'); then + if $(date +%M | grep -q '^[4-5][5-9]$'); then break fi diff --git a/www/config/properties.php b/www/config/properties.php index a8fab4ed2..b586f57e8 100644 --- a/www/config/properties.php +++ b/www/config/properties.php @@ -2,7 +2,7 @@ $config = array( 'project_name' => 'Repomanager', 'project_dir_name' => 'repomanager', - 'project_logo' => 'https://github.com/lbr38/repomanager/raw/main/www/public/assets/images/repomanager.png', + 'project_logo' => 'https://raw.githubusercontent.com/lbr38/repomanager/main/www/public/assets/official-logo/repomanager-gray-256.png', 'project_git_repo' => 'https://github.com/lbr38/repomanager', 'project_git_repo_raw' => 'https://raw.githubusercontent.com/lbr38/repomanager/main', 'project_update_doc_url' => 'https://github.com/lbr38/repomanager/wiki/01.-Installation-and-update#update-repomanager', diff --git a/www/controllers/Repo/Environment.php b/www/controllers/Repo/Environment.php index 45cf0fb82..eafcc4f81 100644 --- a/www/controllers/Repo/Environment.php +++ b/www/controllers/Repo/Environment.php @@ -15,10 +15,31 @@ public function __construct() } /** - * Associate a new env to a snapshot + * Associate a new environment to a snapshot */ - public function add(string $env, string $description = null, int $snapId) + public function add(string $env, string $description = null, int $snapId) : void { $this->model->add($env, $description, $snapId); } + + /** + * Remove an environment from a snapshot + */ + public function remove(int $id) : void + { + $this->model->remove($id); + } + + /** + * Update environment description + */ + public function updateDescription(int $id, string $description) : void + { + // Description should not contain single quotes or backslashes + if (str_contains($description, "'") || str_contains($description, "\\") || str_contains($description, '')) { + throw new Exception('Description contains invalid characters'); + } + + $this->model->updateDescription($id, \Controllers\Common::validateData($description)); + } } diff --git a/www/controllers/Repo/Mirror/Deb.php b/www/controllers/Repo/Mirror/Deb.php index 840abb322..251f361b8 100644 --- a/www/controllers/Repo/Mirror/Deb.php +++ b/www/controllers/Repo/Mirror/Deb.php @@ -767,16 +767,15 @@ private function downloadDebPackages($url) } /** - * Deduplication * Check if package already exists in the previous snapshot - * If so, just create a hard link to the package */ - if (REPO_DEDUPLICATION) { - if (isset($this->previousSnapshotDirPath)) { - if (file_exists($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName)) { - /** - * Create hard link to the package - */ + if (isset($this->previousSnapshotDirPath)) { + if (file_exists($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName)) { + /** + * If deduplication is enabled + * Create a hard link to the package + */ + if (REPO_DEDUPLICATION) { if (!link($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName, $absoluteDir . '/' . $debPackageName)) { throw new Exception('Cannot create hard link to package: ' . $this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName); } @@ -785,6 +784,18 @@ private function downloadDebPackages($url) continue; } + + /** + * If deduplication is not enabled + * Copy package from the previous snapshot + */ + if (!copy($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName, $absoluteDir . '/' . $debPackageName)) { + throw new Exception('Cannot copy package from previous snapshot: ' . $this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $debPackageName); + } + + $this->taskLogSubStepController->completed('Copied from previous snapshot'); + + continue; } } diff --git a/www/controllers/Repo/Mirror/Rpm.php b/www/controllers/Repo/Mirror/Rpm.php index 47106f4d3..51dd94315 100644 --- a/www/controllers/Repo/Mirror/Rpm.php +++ b/www/controllers/Repo/Mirror/Rpm.php @@ -781,16 +781,15 @@ private function downloadRpmPackages(string $url) } /** - * Deduplication * Check if package already exists in the previous snapshot - * If so, just create a hard link to the package */ - if (REPO_DEDUPLICATION) { - if (isset($this->previousSnapshotDirPath)) { - if (file_exists($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $rpmPackageName)) { - /** - * Create hard link to the package - */ + if (isset($this->previousSnapshotDirPath)) { + if (file_exists($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $rpmPackageName)) { + /** + * If deduplication is enabled + * Create a hard link to the package + */ + if (REPO_DEDUPLICATION) { if (!link($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $rpmPackageName, $absoluteDir . '/' . $rpmPackageName)) { throw new Exception('Cannot create hard link to package: ' . $this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $rpmPackageName); } @@ -799,6 +798,18 @@ private function downloadRpmPackages(string $url) continue; } + + /** + * If deduplication is not enabled + * Copy package from the previous snapshot + */ + if (!copy($this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $rpmPackageName, $absoluteDir . '/' . $rpmPackageName)) { + throw new Exception('Cannot copy package from previous snapshot: ' . $this->previousSnapshotDirPath . '/' . $relativeDir . '/' . $rpmPackageName); + } + + $this->taskLogSubStepController->completed('Copied from previous snapshot'); + + continue; } } diff --git a/www/controllers/Repo/Repo.php b/www/controllers/Repo/Repo.php index 1cdbd921b..2a3215618 100644 --- a/www/controllers/Repo/Repo.php +++ b/www/controllers/Repo/Repo.php @@ -522,21 +522,6 @@ public function getEnvIdBySnapId(string $snapId) return $this->model->getEnvIdBySnapId($snapId); } - /** - * Set environment description - */ - public function envSetDescription(string $envId, string $description) : void - { - // Description cannot contain single quotes or backslashes - if (str_contains($description, "'") || str_contains($description, "\\")) { - throw new Exception('Description contains invalid characters'); - } - - $description = \Controllers\Common::validateData($description); - - $this->model->envSetDescription($envId, $description); - } - /** * Get repository environment description by the repo name */ @@ -627,22 +612,6 @@ public function snapSetPackagesExcluded(int $snapId, array $packages) $this->model->snapSetPackagesExcluded($snapId, implode(',', $packages)); } - /** - * Add a repo snapshot in database - */ - public function addSnap(string $date, string $time, string $gpgSignature, array $arch, array $includeTranslation, array $packagesIncluded, array $packagesExcluded, string $type, string $status, string $repoId) - { - $this->model->addSnap($date, $time, $gpgSignature, $arch, $includeTranslation, $packagesIncluded, $packagesExcluded, $type, $status, $repoId); - } - - /** - * Remove an env in database - */ - public function removeEnv(string $envId) - { - $this->model->removeEnv($envId); - } - /** * Return snapshot date from database, from its Id */ diff --git a/www/controllers/Repo/Snapshot.php b/www/controllers/Repo/Snapshot.php index 72240a447..dcbba1994 100644 --- a/www/controllers/Repo/Snapshot.php +++ b/www/controllers/Repo/Snapshot.php @@ -22,6 +22,22 @@ private function getUnused(string $repoId, string $retention) : array return $this->model->getUnused($repoId, $retention); } + /** + * Return the last insert row ID in database + */ + public function getLastInsertRowID() + { + return $this->model->getLastInsertRowID(); + } + + /** + * Add a snapshot in database + */ + public function add(string $date, string $time, string $gpgSignature, array $arch, array $includeTranslation, array $packagesIncluded, array $packagesExcluded, string $type, string $status, int $repoId) : void + { + $this->model->add($date, $time, $gpgSignature, $arch, $includeTranslation, $packagesIncluded, $packagesExcluded, $type, $status, $repoId); + } + /** * Update snapshot status in the database */ diff --git a/www/controllers/Task/Notify.php b/www/controllers/Task/Notify.php index 654bbf729..7e3a36709 100644 --- a/www/controllers/Task/Notify.php +++ b/www/controllers/Task/Notify.php @@ -152,7 +152,7 @@ public function error(array $task, string $error) $message .= '
'; $mailSubject = '[ ERROR ] Scheduled task #' . $task['Id'] . ' failed on ' . WWW_HOSTNAME; - $mymail = new \Controllers\Mail(implode(',', $taskRawParams['schedule']['schedule-recipient']), $mailSubject, $message, __SERVER_PROTOCOL__ . '://' . WWW_HOSTNAME . '/run/' . $task['Id'], 'View log file'); + $mymail = new \Controllers\Mail(implode(',', $taskRawParams['schedule']['schedule-recipient']), $mailSubject, $message, __SERVER_PROTOCOL__ . '://' . WWW_HOSTNAME . '/run/' . $task['Id'], 'View task log'); } /** @@ -168,6 +168,6 @@ public function success(array $task) $message .= '
'; $mailSubject = '[ SUCCESS ] Scheduled task #' . $task['Id'] . ' succeeded on ' . WWW_HOSTNAME; - $mymail = new \Controllers\Mail(implode(',', $taskRawParams['schedule']['schedule-recipient']), $mailSubject, $message, __SERVER_PROTOCOL__ . '://' . WWW_HOSTNAME . '/run/' . $task['Id'], 'View log file'); + $mymail = new \Controllers\Mail(implode(',', $taskRawParams['schedule']['schedule-recipient']), $mailSubject, $message, __SERVER_PROTOCOL__ . '://' . WWW_HOSTNAME . '/run/' . $task['Id'], 'View task log'); } } diff --git a/www/controllers/Task/Repo/Create.php b/www/controllers/Task/Repo/Create.php index af48ca61e..0738be7cd 100644 --- a/www/controllers/Task/Repo/Create.php +++ b/www/controllers/Task/Repo/Create.php @@ -335,12 +335,12 @@ private function local() /** * Add snapshot to database */ - $this->repo->addSnap($this->repo->getDate(), $this->repo->getTime(), 'false', $this->repo->getArch(), array(), array(), array(), $this->repo->getType(), 'active', $this->repo->getRepoId()); + $this->repoSnapshotController->add($this->repo->getDate(), $this->repo->getTime(), 'false', $this->repo->getArch(), array(), array(), array(), $this->repo->getType(), 'active', $this->repo->getRepoId()); /** * Retrieve snapshot Id from the last insert row */ - $this->repo->setSnapId($this->repo->getLastInsertRowID()); + $this->repo->setSnapId($this->repoSnapshotController->getLastInsertRowID()); /** * Add env to database if an env has been specified by the user diff --git a/www/controllers/Task/Repo/Duplicate.php b/www/controllers/Task/Repo/Duplicate.php index b639d260a..91e1ee76a 100644 --- a/www/controllers/Task/Repo/Duplicate.php +++ b/www/controllers/Task/Repo/Duplicate.php @@ -13,6 +13,7 @@ class Duplicate private $repo; private $rpmRepoController; private $debRepoController; + private $repoSnapshotController; private $repoEnvController; private $task; private $taskLogStepController; @@ -25,6 +26,7 @@ public function __construct(string $taskId) $this->rpmRepoController = new \Controllers\Repo\Rpm(); $this->debRepoController = new \Controllers\Repo\Deb(); $this->task = new \Controllers\Task\Task(); + $this->repoSnapshotController = new \Controllers\Repo\Snapshot(); $this->repoEnvController = new \Controllers\Repo\Environment(); $this->taskLogStepController = new \Controllers\Task\Log\Step($taskId); $this->taskLogSubStepController = new \Controllers\Task\Log\SubStep($taskId); @@ -324,12 +326,12 @@ public function execute() /** * Add the new repo snapshot in database */ - $this->repo->addSnap($this->repo->getDate(), $this->repo->getTime(), $this->repo->getSigned(), $this->repo->getArch(), array(), $this->repo->getPackagesToInclude(), $this->repo->getPackagesToExclude(), $this->repo->getType(), $this->repo->getStatus(), $targetRepoId); + $this->repoSnapshotController->add($this->repo->getDate(), $this->repo->getTime(), $this->repo->getSigned(), $this->repo->getArch(), array(), $this->repo->getPackagesToInclude(), $this->repo->getPackagesToExclude(), $this->repo->getType(), $this->repo->getStatus(), $targetRepoId); /** * Retrieve the Id of the new repo snapshot in database */ - $targetSnapId = $this->repo->getLastInsertRowID(); + $targetSnapId = $this->repoSnapshotController->getLastInsertRowID(); /** * Add the new repo environment in database, only if the user has specified an environment diff --git a/www/controllers/Task/Repo/Env.php b/www/controllers/Task/Repo/Env.php index 3af4db13e..a7c6ebafa 100644 --- a/www/controllers/Task/Repo/Env.php +++ b/www/controllers/Task/Repo/Env.php @@ -175,7 +175,7 @@ public function execute() */ if (!empty($actualEnvIds)) { foreach ($actualEnvIds as $actualEnvId) { - $this->repo->removeEnv($actualEnvId['Id']); + $this->repoEnvController->remove($actualEnvId['Id']); } } @@ -255,7 +255,7 @@ public function execute() */ if (!empty($actualEnvIds)) { foreach ($actualEnvIds as $actualEnvId) { - $this->repo->removeEnv($actualEnvId['Id']); + $this->repoEnvController->remove($actualEnvId['Id']); } } diff --git a/www/controllers/Task/Repo/Finalize.php b/www/controllers/Task/Repo/Finalize.php index 24ee828b6..c534db86f 100644 --- a/www/controllers/Task/Repo/Finalize.php +++ b/www/controllers/Task/Repo/Finalize.php @@ -63,12 +63,12 @@ protected function finalize() * Add snapshot in database * Empty array() for package translation because it's not used for the moment */ - $this->repo->addSnap($this->repo->getDate(), $this->repo->getTime(), $this->repo->getGpgSign(), $this->repo->getArch(), array(), $this->repo->getPackagesToInclude(), $this->repo->getPackagesToExclude(), $this->repo->getType(), 'active', $this->repo->getRepoId()); + $this->repoSnapshotController->add($this->repo->getDate(), $this->repo->getTime(), $this->repo->getGpgSign(), $this->repo->getArch(), array(), $this->repo->getPackagesToInclude(), $this->repo->getPackagesToExclude(), $this->repo->getType(), 'active', $this->repo->getRepoId()); /** * Retrieve the last insert row ID */ - $this->repo->setSnapId($this->repo->getLastInsertRowID()); + $this->repo->setSnapId($this->repoSnapshotController->getLastInsertRowID()); /** * Add env in database if an env has been specified by the user @@ -123,13 +123,13 @@ protected function finalize() /** * Add snapshot in database */ - $this->repo->addSnap($this->repo->getDate(), $this->repo->getTime(), $this->repo->getGpgSign(), $this->repo->getArch(), array(), $this->repo->getPackagesToInclude(), $this->repo->getPackagesToExclude(), $this->repo->getType(), 'active', $this->repo->getRepoId()); + $this->repoSnapshotController->add($this->repo->getDate(), $this->repo->getTime(), $this->repo->getGpgSign(), $this->repo->getArch(), array(), $this->repo->getPackagesToInclude(), $this->repo->getPackagesToExclude(), $this->repo->getType(), 'active', $this->repo->getRepoId()); /** * Retrieve the last insert row Id * And we can set snapId = this Id */ - $this->repo->setSnapId($this->repo->getLastInsertRowID()); + $this->repo->setSnapId($this->repoSnapshotController->getLastInsertRowID()); } } @@ -173,7 +173,7 @@ protected function finalize() */ if (!empty($actualEnvIds)) { foreach ($actualEnvIds as $actualEnvId) { - $this->repo->removeEnv($actualEnvId['Id']); + $this->repoEnvController->remove($actualEnvId['Id']); } } diff --git a/www/controllers/Task/Repo/RemoveEnv.php b/www/controllers/Task/Repo/RemoveEnv.php index 97c8f5688..a40397b1d 100644 --- a/www/controllers/Task/Repo/RemoveEnv.php +++ b/www/controllers/Task/Repo/RemoveEnv.php @@ -11,6 +11,7 @@ class RemoveEnv private $repo; private $task; private $repoSnapshotController; + private $repoEnvController; private $taskLogStepController; private $taskLogSubStepController; @@ -19,6 +20,7 @@ public function __construct(string $taskId) $this->repo = new \Controllers\Repo\Repo(); $this->task = new \Controllers\Task\Task(); $this->repoSnapshotController = new \Controllers\Repo\Snapshot(); + $this->repoEnvController = new \Controllers\Repo\Environment(); $this->taskLogStepController = new \Controllers\Task\Log\Step($taskId); $this->taskLogSubStepController = new \Controllers\Task\Log\SubStep($taskId); @@ -84,7 +86,7 @@ public function execute() /** * Delete environment from database */ - $this->repo->removeEnv($this->repo->getEnvId()); + $this->repoEnvController->remove($this->repo->getEnvId()); $this->taskLogStepController->completed(); diff --git a/www/controllers/ajax/repo.php b/www/controllers/ajax/repo.php index 05c3ac823..5cf9b6581 100644 --- a/www/controllers/ajax/repo.php +++ b/www/controllers/ajax/repo.php @@ -1,20 +1,4 @@ envSetDescription($_POST['envId'], $_POST['description']); - } catch (\Exception $e) { - response(HTTP_BAD_REQUEST, $e->getMessage()); - } - - response(HTTP_OK, "Description has been saved"); -} - /** * Get repo size */ diff --git a/www/controllers/ajax/repo/environment.php b/www/controllers/ajax/repo/environment.php new file mode 100644 index 000000000..fdcb503cf --- /dev/null +++ b/www/controllers/ajax/repo/environment.php @@ -0,0 +1,18 @@ +updateDescription($_POST['envId'], $_POST['description']); + } catch (\Exception $e) { + response(HTTP_BAD_REQUEST, $e->getMessage()); + } + + response(HTTP_OK, "Description has been saved"); +} + +response(HTTP_BAD_REQUEST, 'Invalid action'); diff --git a/www/models/Connection.php b/www/models/Connection.php index eec4b1ff0..5a5be0976 100644 --- a/www/models/Connection.php +++ b/www/models/Connection.php @@ -328,7 +328,9 @@ private function generateMainTables() /** * Create indexes */ + $this->exec("CREATE INDEX IF NOT EXISTS repos_snap_index ON repos_snap (Date, Time, Signed, Arch, Pkg_translation, Pkg_included, Pkg_excluded, Type, Reconstruct, Status, Id_repo)"); $this->exec("CREATE INDEX IF NOT EXISTS repos_snap_status_id_repo_index ON repos_snap (Status, Id_repo)"); + $this->exec("CREATE INDEX IF NOT EXISTS repos_snap_id_repo_index ON repos_snap (Id_repo)"); /** * repos_env table @@ -339,6 +341,11 @@ private function generateMainTables() Description VARCHAR(255), Id_snap INTEGER NOT NULL)"); + /** + * Create indexes + */ + $this->exec("CREATE INDEX IF NOT EXISTS repos_env_index ON repos_env (Env, Description, Id_snap)"); + /** * Create indexes */ @@ -486,6 +493,7 @@ private function generateMainTables() * Create indexes */ $this->exec("CREATE INDEX IF NOT EXISTS tasks_rawparams_status ON tasks (Raw_params, Status)"); + $this->exec("CREATE INDEX IF NOT EXISTS tasks_status ON tasks (Status)"); /** * profile_settings table diff --git a/www/models/Repo/Environment.php b/www/models/Repo/Environment.php index 6eaf38959..17647f8e4 100644 --- a/www/models/Repo/Environment.php +++ b/www/models/Repo/Environment.php @@ -14,7 +14,7 @@ public function __construct() /** * Associate a new env to a snapshot */ - public function add(string $env, string $description = null, int $snapId) + public function add(string $env, string $description = null, int $snapId) : void { try { $stmt = $this->db->prepare("INSERT INTO repos_env ('Env', 'Description', 'Id_snap') VALUES (:env, :description, :snapId)"); @@ -26,4 +26,33 @@ public function add(string $env, string $description = null, int $snapId) $this->db->logError($e); } } + + /** + * Remove an environment from a snapshot + */ + public function remove(int $id) : void + { + try { + $stmt = $this->db->prepare("DELETE FROM repos_env WHERE Id = :envId"); + $stmt->bindValue(':envId', $id); + $stmt->execute(); + } catch (Exception $e) { + $this->db->logError($e); + } + } + + /** + * Update environment description + */ + public function updateDescription(int $id, string $description) : void + { + try { + $stmt = $this->db->prepare("UPDATE repos_env SET Description = :description WHERE Id = :envId"); + $stmt->bindValue(':description', $description); + $stmt->bindValue(':envId', $id); + $stmt->execute(); + } catch (Exception $e) { + $this->db->logError($e); + } + } } diff --git a/www/models/Repo/Repo.php b/www/models/Repo/Repo.php index b8bc71e65..b2c65b2b2 100644 --- a/www/models/Repo/Repo.php +++ b/www/models/Repo/Repo.php @@ -418,21 +418,6 @@ public function getUnused() : array return $data; } - /** - * Set environment description - */ - public function envSetDescription(string $envId, string $description) : void - { - try { - $stmt = $this->db->prepare("UPDATE repos_env SET Description = :description WHERE Id = :envId"); - $stmt->bindValue(':description', $description); - $stmt->bindValue(':envId', $envId); - $stmt->execute(); - } catch (\Exception $e) { - $this->db->logError($e); - } - } - /** * Modification de l'état de signature GPG */ @@ -781,29 +766,6 @@ public function count() return $this->db->count($result); } - /** - * Add a repo snapshot in database - */ - public function addSnap(string $date, string $time, string $gpgSignature, array $arch, array $includeTranslation, array $packagesIncluded, array $packagesExcluded, string $type, string $status, string $repoId) - { - try { - $stmt = $this->db->prepare("INSERT INTO repos_snap ('Date', 'Time', 'Signed', 'Arch', 'Pkg_translation', 'Pkg_included', 'Pkg_excluded', 'Type', 'Status', 'Id_repo') VALUES (:date, :time, :signed, :arch, :includeTranslation, :packagesIncluded, :packagesExcluded, :type, :status, :repoId)"); - $stmt->bindValue(':date', $date); - $stmt->bindValue(':time', $time); - $stmt->bindValue(':signed', $gpgSignature); - $stmt->bindValue(':arch', implode(',', $arch)); - $stmt->bindValue(':includeTranslation', implode(',', $includeTranslation)); - $stmt->bindValue(':packagesIncluded', implode(',', $packagesIncluded)); - $stmt->bindValue(':packagesExcluded', implode(',', $packagesExcluded)); - $stmt->bindValue(':type', $type); - $stmt->bindValue(':status', $status); - $stmt->bindValue(':repoId', $repoId); - $stmt->execute(); - } catch (\Exception $e) { - $this->db->logError($e); - } - } - /** * Ajout du repo au groupe spécifié en base de données */ @@ -861,22 +823,6 @@ public function removeFromGroup(string $repoId, string $groupId = null) } } - /** - * Remove an env in database - */ - public function removeEnv(string $envId) - { - try { - $stmt = $this->db->prepare("DELETE FROM repos_env WHERE Id = :envId"); - $stmt->bindValue(':envId', $envId); - $stmt->execute(); - } catch (\Exception $e) { - $this->db->logError($e); - } - - unset($stmt); - } - /** * Update release version in database */ diff --git a/www/models/Repo/Snapshot.php b/www/models/Repo/Snapshot.php index 310aad4f5..afe9ef703 100644 --- a/www/models/Repo/Snapshot.php +++ b/www/models/Repo/Snapshot.php @@ -45,6 +45,29 @@ public function getUnused(string $repoId, string $retention) : array return $data; } + /** + * Add a snapshot in database + */ + public function add(string $date, string $time, string $gpgSignature, array $arch, array $includeTranslation, array $packagesIncluded, array $packagesExcluded, string $type, string $status, int $repoId) : void + { + try { + $stmt = $this->db->prepare("INSERT INTO repos_snap ('Date', 'Time', 'Signed', 'Arch', 'Pkg_translation', 'Pkg_included', 'Pkg_excluded', 'Type', 'Status', 'Id_repo') VALUES (:date, :time, :signed, :arch, :includeTranslation, :packagesIncluded, :packagesExcluded, :type, :status, :repoId)"); + $stmt->bindValue(':date', $date); + $stmt->bindValue(':time', $time); + $stmt->bindValue(':signed', $gpgSignature); + $stmt->bindValue(':arch', implode(',', $arch)); + $stmt->bindValue(':includeTranslation', implode(',', $includeTranslation)); + $stmt->bindValue(':packagesIncluded', implode(',', $packagesIncluded)); + $stmt->bindValue(':packagesExcluded', implode(',', $packagesExcluded)); + $stmt->bindValue(':type', $type); + $stmt->bindValue(':status', $status); + $stmt->bindValue(':repoId', $repoId); + $stmt->execute(); + } catch (Exception $e) { + $this->db->logError($e); + } + } + /** * Update snapshot status in the database */ diff --git a/www/public/assets/official-logo/repomanager-gray-128.png b/www/public/assets/official-logo/repomanager-gray-128.png new file mode 100644 index 000000000..c8a8e7b5b Binary files /dev/null and b/www/public/assets/official-logo/repomanager-gray-128.png differ diff --git a/www/public/assets/official-logo/repomanager-gray-256.png b/www/public/assets/official-logo/repomanager-gray-256.png new file mode 100644 index 000000000..658103f8c Binary files /dev/null and b/www/public/assets/official-logo/repomanager-gray-256.png differ diff --git a/www/public/assets/official-logo/repomanager-gray-512.png b/www/public/assets/official-logo/repomanager-gray-512.png new file mode 100644 index 000000000..b7e9e9186 Binary files /dev/null and b/www/public/assets/official-logo/repomanager-gray-512.png differ diff --git a/www/public/assets/official-logo/repomanager-gray.svg b/www/public/assets/official-logo/repomanager-gray.svg new file mode 100644 index 000000000..29afed978 --- /dev/null +++ b/www/public/assets/official-logo/repomanager-gray.svg @@ -0,0 +1,24 @@ + + + + + + + diff --git a/www/public/assets/official-logo/repomanager-white.svg b/www/public/assets/official-logo/repomanager-white.svg new file mode 100644 index 000000000..094ffdcc9 --- /dev/null +++ b/www/public/assets/official-logo/repomanager-white.svg @@ -0,0 +1,46 @@ + + + + + + + + diff --git a/www/public/resources/js/classes/Environment.js b/www/public/resources/js/classes/Environment.js new file mode 100644 index 000000000..ae2ba40ba --- /dev/null +++ b/www/public/resources/js/classes/Environment.js @@ -0,0 +1,26 @@ +class Environment +{ + /** + * Upodate environment description + * @param {*} id + * @param {*} description + */ + updateDescription(id, description) + { + ajaxRequest( + // Controller: + 'repo/environment', + // Action: + 'update-description', + // Data: + { + envId: id, + description: description + }, + // Print success alert: + true, + // Print error alert: + true + ); + } +} diff --git a/www/public/resources/js/events/repo/edit.js b/www/public/resources/js/events/repo/edit.js index 76feae4bb..76dd70339 100644 --- a/www/public/resources/js/events/repo/edit.js +++ b/www/public/resources/js/events/repo/edit.js @@ -1,5 +1,5 @@ /** - * Event: submit reposiroty edit form + * Event: submit repository edit form */ $(document).on('submit','#edit-form',function () { event.preventDefault(); @@ -99,3 +99,16 @@ $(document).on('submit','#edit-form',function () { return false; }); + +/** + * Event: edit repository description when pressing 'Enter' key + */ +$(document).on('keypress','input[type="text"].repo-description-input',function (e) { + e.stopPropagation(); + + const keycode = (event.keyCode ? event.keyCode : event.which); + + if (keycode == '13') { + myenvironment.updateDescription($(this).attr('env-id'), $(this).val()); + } +}); diff --git a/www/public/resources/js/repo.js b/www/public/resources/js/repo.js index 66cdda806..65b7c2ae8 100644 --- a/www/public/resources/js/repo.js +++ b/www/public/resources/js/repo.js @@ -242,47 +242,3 @@ $(document).on('mouseenter','.item-env, .item-env-info',function () { $(document).on('mouseleave','.item-env, .item-env-info',function () { $('#repos-list-container').find('.item-env-info').css('visibility', 'hidden'); }); - -/** - * Event : modification de la description d'un repo - */ -$(document).on('keypress','.repoDescriptionInput',function () { - var keycode = (event.keyCode ? event.keyCode : event.which); - if (keycode == '13') { - /** - * Récupération des valeurs suivantes : - * - L'Id du repo à modifier - * - Le status du repo - * - La description - */ - var envId = $(this).attr('env-id'); - var description = $(this).val(); - - setRepoDescription(envId, description); - } - event.stopPropagation(); -}); - -/** - * Ajax : Modifier la description d'un repo - * @param {string} repoId - * @param {string} repoDescription - */ -function setRepoDescription(envId, repoDescription) -{ - ajaxRequest( - // Controller: - 'repo', - // Action: - 'setRepoDescription', - // Data: - { - envId: envId, - description: repoDescription - }, - // Print success alert: - true, - // Print error alert: - true - ); -} diff --git a/www/public/resources/styles/components/layout.css b/www/public/resources/styles/components/layout.css index 2336ea1e0..739b50970 100644 --- a/www/public/resources/styles/components/layout.css +++ b/www/public/resources/styles/components/layout.css @@ -28,6 +28,33 @@ body { .details-div { padding: 10px; background-color: #182b3e; - border: 1px solid #24405c; + border: 3px solid #22384F; border-radius: 20px; } + +/* Full page loading veil */ +.body-veil { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + position: fixed; + row-gap: 20px; + top: 0; + left: 0; + width: 100%; + height: 100vh; + background-color: #0e1e2f; + border-radius: 20px; + z-index: 90; +} +.body-veil img:first-child { + width: 120px; + height: 120px; + opacity: 0.1; +} +.body-veil img:last-child { + width: 20px; + height: 20px; + opacity: 0.5; +} diff --git a/www/templates/mail/mail.template.html.php b/www/templates/mail/mail.template.html.php index 57c7d2562..62e25de41 100644 --- a/www/templates/mail/mail.template.html.php +++ b/www/templates/mail/mail.template.html.php @@ -148,8 +148,8 @@ - @@ -176,12 +176,12 @@
- + +
-
+ @@ -222,7 +222,7 @@ diff --git a/www/templates/mail/mail.template.mjml b/www/templates/mail/mail.template.mjml index a4bad5fcf..eac58c615 100644 --- a/www/templates/mail/mail.template.mjml +++ b/www/templates/mail/mail.template.mjml @@ -2,12 +2,12 @@ - + - + $content @@ -19,7 +19,7 @@ - Project description
Github link
+ Project - Github link
diff --git a/www/version b/www/version index 2c4686f5c..9cc7d2bfe 100644 --- a/www/version +++ b/www/version @@ -1 +1 @@ -4.24.0 \ No newline at end of file +4.24.1 \ No newline at end of file diff --git a/www/views/includes/footer.inc.php b/www/views/includes/footer.inc.php index eb368f40a..404054e05 100644 --- a/www/views/includes/footer.inc.php +++ b/www/views/includes/footer.inc.php @@ -44,7 +44,6 @@ - '; + } + } +} ?> + + + +">
-
NAME
+
NAME
HOSTS
diff --git a/www/views/includes/panels/hosts/profiles.inc.php b/www/views/includes/panels/hosts/profiles.inc.php index c7b6ce78e..e63cdfe28 100644 --- a/www/views/includes/panels/hosts/profiles.inc.php +++ b/www/views/includes/panels/hosts/profiles.inc.php @@ -61,7 +61,7 @@
-
NAME
+
NAME
REPOSITORIES
diff --git a/www/views/includes/panels/repos/groups/list.inc.php b/www/views/includes/panels/repos/groups/list.inc.php index 522b216da..899e5e808 100644 --- a/www/views/includes/panels/repos/groups/list.inc.php +++ b/www/views/includes/panels/repos/groups/list.inc.php @@ -35,7 +35,7 @@
-
NAME
+
NAME
REPOSITORIES
diff --git a/www/views/includes/repos-list.inc.php b/www/views/includes/repos-list.inc.php index 49d092e39..f5507314e 100644 --- a/www/views/includes/repos-list.inc.php +++ b/www/views/includes/repos-list.inc.php @@ -375,7 +375,7 @@ */ echo '
'; if (!empty($env)) { - echo ''; + echo ''; } echo '
'; diff --git a/www/views/includes/tables/repos/sources/list.inc.php b/www/views/includes/tables/repos/sources/list.inc.php index 7d7a7283f..8266bb975 100644 --- a/www/views/includes/tables/repos/sources/list.inc.php +++ b/www/views/includes/tables/repos/sources/list.inc.php @@ -83,7 +83,7 @@ -
NAME
+
NAME
URL
-
+
-
- release version
Github
+