diff --git a/dashboard/src/components/SystemUpdate.vue b/dashboard/src/components/SystemUpdate.vue index d3fc47992..3a839a124 100644 --- a/dashboard/src/components/SystemUpdate.vue +++ b/dashboard/src/components/SystemUpdate.vue @@ -4,10 +4,14 @@ const API_ORIGIN = import.meta.env.VITE_API_ORIGIN ? import.meta.env.VITE_API_OR import { ref, onMounted, useTemplateRef } from 'vue'; import { Button, Dialog, ProgressBar, Radiobutton, MultiSelect } from 'pankow'; +import { prettyLongDate } from 'pankow/utils'; +import { TASK_TYPES } from '../constants.js'; import Section from '../components/Section.vue'; import UpdaterModel from '../models/UpdaterModel.js'; +import TasksModel from '../models/TasksModel.js'; import DashboardModel from '../models/DashboardModel.js'; +const tasksModel = TasksModel.create(API_ORIGIN, localStorage.token); const updaterModel = UpdaterModel.create(API_ORIGIN, localStorage.token); const dashboardModel = DashboardModel.create(API_ORIGIN, localStorage.token); @@ -139,6 +143,19 @@ async function onCheck() { checkingBusy.value = false; } +async function refreshTasks() { + const [error, result] = await tasksModel.getByType(TASK_TYPES.TASK_UPDATE); + if (error) return console.error(error); + + taskLogsMenu.value = result.map(t => { + return { + icon: 'fa-solid ' + ((!t.active && t.success) ? 'status-active fa-check-circle' : (t.active ? 'fa-circle-notch fa-spin' : 'status-error fa-times-circle')), + label: prettyLongDate(t.ts), + action: () => { window.open(`/logs.html?taskId=${t.id}`); } + }; + }); +} + onMounted(async () => { const [error, result] = await dashboardModel.getConfig(); if (error) return console.error(error); @@ -148,6 +165,7 @@ onMounted(async () => { await refreshInfo(); await refreshAutoupdatePattern(); + await refreshTasks(); }); @@ -173,7 +191,7 @@ onMounted(async () => {
{{ $t('settings.updateScheduleDialog.days') }}:
{{ $t('settings.updateScheduleDialog.hours') }}:
- +
@@ -194,7 +212,7 @@ onMounted(async () => {
{{ prettyAutoUpdateSchedule(currentPattern) }} {{ $t('settings.updates.disabled') }} - +
@@ -204,7 +222,6 @@ onMounted(async () => { -
diff --git a/dashboard/src/views/SettingsView.vue b/dashboard/src/views/SettingsView.vue index 27fcc3e49..daa0c845b 100644 --- a/dashboard/src/views/SettingsView.vue +++ b/dashboard/src/views/SettingsView.vue @@ -85,7 +85,7 @@ onMounted(async () => {