diff --git a/php/public/index.php b/php/public/index.php index db9cf821..e2a1e641 100644 --- a/php/public/index.php +++ b/php/public/index.php @@ -74,13 +74,14 @@ $app->get('/containers', function ($request, $response, $args) use ($container) return $view->render($response, 'containers.twig', [ 'domain' => $configurationManager->GetDomain(), 'borg_backup_host_location' => $configurationManager->GetBorgBackupHostLocation(), - 'borg_backup_mode' => $configurationManager->GetBorgBackupMode(), 'nextcloud_password' => $configurationManager->GetSecret('NEXTCLOUD_PASSWORD'), 'containers' => (new \AIO\ContainerDefinitionFetcher($container->get(\AIO\Data\ConfigurationManager::class), $container))->FetchDefinition(), 'borgbackup_password' => $configurationManager->GetSecret('BORGBACKUP_PASSWORD'), 'is_mastercontainer_update_available' => $dockerActionManger->IsMastercontainerUpdateAvailable(), 'has_backup_run_once' => $configurationManager->hasBackupRunOnce(), + 'is_backup_container_running' => $dockerActionManger->isBackupContainerRunning(), 'backup_exit_code' => $dockerActionManger->GetBackupcontainerExitCode(), + 'borg_backup_mode' => $configurationManager->GetBorgBackupMode(), 'was_start_button_clicked' => $configurationManager->wasStartButtonClicked(), 'has_update_available' => $dockerActionManger->isAnyUpdateAvailable(), 'last_backup_time' => $configurationManager->GetLastBackupTime(), diff --git a/php/src/Docker/DockerActionManager.php b/php/src/Docker/DockerActionManager.php index 77da1206..70e65b48 100644 --- a/php/src/Docker/DockerActionManager.php +++ b/php/src/Docker/DockerActionManager.php @@ -600,4 +600,13 @@ class DockerActionManager } return true; } + + public function isBackupContainerRunning() : bool { + $id = 'nextcloud-aio-borgbackup'; + $backupContainer = $this->containerDefinitionFetcher->GetContainerById($id); + if ($this->GetContainerRunningState($backupContainer) instanceof RunningState) { + return true; + } + return false; + } } diff --git a/php/templates/containers.twig b/php/templates/containers.twig index 4d4a5fb2..36ddfb48 100644 --- a/php/templates/containers.twig +++ b/php/templates/containers.twig @@ -22,11 +22,19 @@ {% set isAnyRunning = false %} {% set isAnyRestarting = false %} {% set isWatchtowerRunning = false %} - {% set isBackupContainerRunning = false %} {% set isRestoreRunning = false %} {% set isBackupOrRestoreRunning = false %} {% set isApacheStarting = false %} + {% if is_backup_container_running == true %} + {% if borg_backup_mode == 'restore' %} + {% set isRestoreRunning = true %} + {% endif %} + {% if borg_backup_mode == 'backup' or borg_backup_mode == 'restore' %} + {% set isBackupOrRestoreRunning = true %} + {% endif %} + {% endif %} + {% for container in containers %} {% if container.GetIdentifier() not in ['nextcloud-aio-domaincheck', 'nextcloud-aio-borgbackup', 'nextcloud-aio-watchtower'] and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %} {% set isAnyRunning = true %} @@ -40,22 +48,13 @@ {% if container.GetIdentifier() == 'nextcloud-aio-apache' and class(container.GetStartingState()) == 'AIO\\Container\\State\\StartingState' %} {% set isApacheStarting = true %} {% endif %} - {% if container.GetIdentifier() == 'nextcloud-aio-borgbackup' and class(container.GetRunningState()) == 'AIO\\Container\\State\\RunningState' %} - {% set isBackupContainerRunning = true %} - {% if borg_backup_mode == 'restore' %} - {% set isRestoreRunning = true %} - {% endif %} - {% if borg_backup_mode == 'backup' or borg_backup_mode == 'restore' %} - {% set isBackupOrRestoreRunning = true %} - {% endif %} - {% endif %} {% endfor %} {% if isWatchtowerRunning == true %} Mastercontainer update currently running. It will restart the mastercontainer soon which will make it unavailable for a moment. Please wait until that's done. (Logs)

Reload ↻
{% else %} - {% if isBackupContainerRunning == false and domain == "" %} + {% if is_backup_container_running == false and domain == "" %} {% if is_mastercontainer_update_available == true %}

Mastercontainer update

⚠ A mastercontainer update is available. Please click on the button below to update it. Afterwards, you will be able to proceed with the setup.

@@ -145,7 +144,7 @@ {% endif %} {% endif %} {% endif %} - {% if isBackupContainerRunning == true %} + {% if is_backup_container_running == true %} Backup container is currently running. (Logs)

Reload ↻

{% endif %} @@ -264,7 +263,7 @@ {% if was_start_button_clicked == true %} - {% if isBackupContainerRunning == false and borg_backup_host_location == "" and isApacheStarting != true %} + {% if is_backup_container_running == false and borg_backup_host_location == "" and isApacheStarting != true %}

Backup and restore

Please type in the directory where backups will get created on the host system:

@@ -278,7 +277,7 @@ {% if borg_backup_host_location != "" %}

Backup and restore

- {% if isBackupContainerRunning == false %} + {% if is_backup_container_running == false %} {% if backup_exit_code > 0 %} Last {{ borg_backup_mode }} failed! (Logs)

{% elseif backup_exit_code == 0 %} @@ -290,7 +289,7 @@ {% endif %} {% endif %} - {% if isBackupContainerRunning == false %} + {% if is_backup_container_running == false %} {% if has_backup_run_once == true %}
Click here to reveal all backup options
@@ -343,7 +342,7 @@ {% endif %} {% endif %} - {% if isBackupContainerRunning == false %} + {% if is_backup_container_running == false %} {% if isApacheStarting == false %}

AIO password change

You can change your AIO password below:

@@ -358,7 +357,7 @@ {% endif %} {% endif %} {% endif %} - {% if isBackupContainerRunning == false %} + {% if is_backup_container_running == false %}

Optional addons

In this section, you can find optional addons.
You can enable or disaable them when your containers are stopped.

@@ -400,7 +399,7 @@ {% endif %} {% endif %} - {% if isApacheStarting == true or isBackupContainerRunning == true or isWatchtowerRunning == true %} + {% if isApacheStarting == true or is_backup_container_running == true or isWatchtowerRunning == true %} {% else %}