Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobimicroweber committed Mar 19, 2024
1 parent ccd6eaf commit bf50a17
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
2 changes: 1 addition & 1 deletion htdocs/js/versions.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ $j(document).ready(function() {
appDownloadStatus = 'running';
}
}
if (data.app_installed && showTemplateUpToDate) {
if (data.running_tasks_count == 0) {
$j('.js-templates-up-to-date').show();
$j('.js-check-for-update').removeAttr('disabled');
$j('.js-check-for-update').html('Check for updates');
Expand Down
12 changes: 11 additions & 1 deletion plib/controllers/TaskController.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,16 @@ public function taskstatusesAction()
{
$taskStatuses = [];
$taskManager = new pm_LongTask_Manager();

$runningTasksCount = 0;
$tasks = $taskManager->getTasks(['task_templatesdownload']);
if (isset($tasks[0])) {
$taskStatuses['templates_download'] = [
'status' => $tasks[0]->getStatus(),
'progress' => $tasks[0]->getProgress(),
];
if ($tasks[0]->getStatus() == pm_LongTask_Task::STATUS_RUNNING) {
$runningTasksCount++;
}
}

$tasks = $taskManager->getTasks(['task_appdownload']);
Expand All @@ -21,6 +24,9 @@ public function taskstatusesAction()
'status' => $tasks[0]->getStatus(),
'progress' => $tasks[0]->getProgress(),
];
if ($tasks[0]->getStatus() == pm_LongTask_Task::STATUS_RUNNING) {
$runningTasksCount++;
}
}

$tasks = $taskManager->getTasks(['task_domainreinstall']);
Expand All @@ -29,6 +35,9 @@ public function taskstatusesAction()
'status' => $tasks[0]->getStatus(),
'progress' => $tasks[0]->getProgress(),
];
if ($tasks[0]->getStatus() == pm_LongTask_Task::STATUS_RUNNING) {
$runningTasksCount++;
}
}

$appInstalled = false;
Expand All @@ -41,6 +50,7 @@ public function taskstatusesAction()
'tasks' => $taskStatuses,
'current_version' => $currentVersionOfApp,
'app_installed' => $appInstalled,
'running_tasks_count' => $runningTasksCount,
]);

}
Expand Down

0 comments on commit bf50a17

Please sign in to comment.