2021-02-24 11:05:23 +01:00
|
|
|
<?php
|
|
|
|
if (!empty($updateAvailables)) {
|
|
|
|
$alertHtml = sprintf(
|
|
|
|
'<h5 class="alert-heading">%s</h5>%s<div>%s</div>',
|
|
|
|
__n('A new update is available!', 'New updates are available!', count($updateAvailables)),
|
|
|
|
__('Updating to the latest version is highly recommanded.'),
|
|
|
|
$this->Bootstrap->button([
|
|
|
|
'variant' => 'success',
|
|
|
|
'icon' => 'arrow-alt-circle-up',
|
|
|
|
'class' => 'mt-1',
|
|
|
|
'text' => __n('Run update', 'Run all updates', count($updateAvailables)),
|
|
|
|
'params' => [
|
|
|
|
'onclick' => 'runAllUpdate()'
|
|
|
|
]
|
|
|
|
])
|
|
|
|
);
|
|
|
|
echo $this->Bootstrap->alert([
|
|
|
|
'variant' => 'warning',
|
|
|
|
'html' => $alertHtml,
|
|
|
|
'dismissible' => false,
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
|
|
|
|
foreach ($status as $i => &$update) {
|
|
|
|
if ($update['status'] == 'up') {
|
|
|
|
$update['_rowVariant'] = 'success';
|
|
|
|
} else if ($update['status'] == 'down') {
|
|
|
|
$update['_rowVariant'] = 'danger';
|
|
|
|
}
|
2021-09-03 09:47:13 +02:00
|
|
|
|
|
|
|
if (!empty($update['plugin'])) {
|
|
|
|
$update['name'] = "{$update['plugin']}.{$update['name']}";
|
|
|
|
}
|
2021-02-24 11:05:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
echo $this->Bootstrap->table([], [
|
|
|
|
'fields' => [
|
|
|
|
['key' => 'id', 'label' => __('ID')],
|
|
|
|
['key' => 'name', 'label' => __('Name')],
|
|
|
|
['key' => 'end_time', 'label' => __('End Time')],
|
|
|
|
['key' => 'time_taken_formated', 'label' => __('Time Taken')],
|
|
|
|
['key' => 'status', 'label' => __('Status')]
|
|
|
|
],
|
|
|
|
'items' => $status,
|
|
|
|
]);
|
|
|
|
?>
|
|
|
|
|
|
|
|
<script>
|
|
|
|
function runAllUpdate() {
|
|
|
|
const url = '/instance/migrate'
|
|
|
|
const reloadUrl = '/instance/migrate-index'
|
|
|
|
const modalOptions = {
|
|
|
|
title: '<?= __n('Run database update?', 'Run all database updates?', count($updateAvailables)) ?>',
|
|
|
|
body: '<?= __('The process might take some time.') ?>',
|
|
|
|
type: 'confirm-success',
|
|
|
|
confirmText: '<?= __n('Run update', 'Run all updates', count($updateAvailables)) ?>',
|
|
|
|
APIConfirm: (tmpApi) => {
|
2021-03-15 22:47:13 +01:00
|
|
|
return tmpApi.fetchAndPostForm(url, {}).then(() => {
|
2021-02-24 11:05:23 +01:00
|
|
|
location.reload()
|
|
|
|
})
|
|
|
|
},
|
|
|
|
}
|
|
|
|
UI.modal(modalOptions)
|
|
|
|
}
|
|
|
|
</script>
|