From c3a27e9237aa5af511faca29d9df47af2ce68de1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luk=C3=A1=C5=A1=20Hornych?= Date: Mon, 7 Oct 2024 08:22:33 +0200 Subject: [PATCH] feat(#117): refactor task list item, fix not be able to stop JFR recording --- .../backup-viewer/components/BackupViewer.vue | 7 +- .../connection/model/task/TaskStatus.ts | 12 +- src/modules/i18n/en.json | 11 +- .../jfr-viewer/components/JfrViewer.vue | 24 +- .../components/CancelTaskButton.vue | 76 ++++++ .../DownloadTaskFileResultButton.vue | 42 +++ .../components/ShowTaskDetailButton.vue | 41 +++ .../components/ShowTaskExceptionButton.vue | 42 +++ .../components/ShowTaskTextResultButton.vue | 41 +++ .../components/TaskDetailDialog.vue | 21 +- .../task-viewer/components/TaskIcon.vue | 32 +++ .../task-viewer/components/TaskList.vue | 15 +- .../task-viewer/components/TaskListItem.vue | 242 ++---------------- .../components/TaskProgressBar.vue | 50 ++++ .../task-viewer/components/TaskTitle.vue | 65 +++++ 15 files changed, 465 insertions(+), 256 deletions(-) create mode 100644 src/modules/task-viewer/components/CancelTaskButton.vue create mode 100644 src/modules/task-viewer/components/DownloadTaskFileResultButton.vue create mode 100644 src/modules/task-viewer/components/ShowTaskDetailButton.vue create mode 100644 src/modules/task-viewer/components/ShowTaskExceptionButton.vue create mode 100644 src/modules/task-viewer/components/ShowTaskTextResultButton.vue create mode 100644 src/modules/task-viewer/components/TaskIcon.vue create mode 100644 src/modules/task-viewer/components/TaskProgressBar.vue create mode 100644 src/modules/task-viewer/components/TaskTitle.vue diff --git a/src/modules/backup-viewer/components/BackupViewer.vue b/src/modules/backup-viewer/components/BackupViewer.vue index 15e18b8..ba94504 100644 --- a/src/modules/backup-viewer/components/BackupViewer.vue +++ b/src/modules/backup-viewer/components/BackupViewer.vue @@ -86,6 +86,7 @@ loadBackupFiles().then(() => { }) let canReloadBackupFiles: boolean = true +let reloadBackupFilesTimeoutId: number | undefined = undefined async function reloadBackupFiles(manual: boolean = false): Promise { if (!canReloadBackupFiles && !manual) { return @@ -94,13 +95,13 @@ async function reloadBackupFiles(manual: boolean = false): Promise { const loaded: boolean = await loadBackupFiles() if (loaded) { canReloadBackupFiles = true - setTimeout(reloadBackupFiles, 2000) + reloadBackupFilesTimeoutId = setTimeout(reloadBackupFiles, 2000) } else { // we don't want to spam user server is down, user needs to refresh manually canReloadBackupFiles = false } } -setTimeout(reloadBackupFiles, 2000) +reloadBackupFilesTimeoutId = setTimeout(reloadBackupFiles, 2000) function reloadBackups(): void { reloadBackupFiles(true) @@ -138,6 +139,8 @@ async function downloadBackup(file: ServerFile){ )) } } + +onUnmounted(() => clearInterval(reloadBackupFilesTimeoutId))