-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(#117): refactor task list item, fix not be able to stop JFR reco…
…rding
- Loading branch information
1 parent
e2b34fb
commit c3a27e9
Showing
15 changed files
with
465 additions
and
256 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
<script setup lang="ts"> | ||
import { computed, ref } from 'vue' | ||
import { TaskTrait } from '@/modules/connection/model/task/TaskTrait' | ||
import { TaskStatus } from '@/modules/connection/model/task/TaskStatus' | ||
import { TaskViewerService, useTaskViewerService } from '@/modules/task-viewer/services/TaskViewerService' | ||
import { Toaster, useToaster } from '@/modules/notification/service/Toaster' | ||
import { useI18n } from 'vue-i18n' | ||
import { Connection } from '@/modules/connection/model/Connection' | ||
const taskViewerService: TaskViewerService = useTaskViewerService() | ||
const toaster: Toaster = useToaster() | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
connection: Connection | ||
task: TaskStatus | ||
}>() | ||
const cancelling = ref<boolean>(false) | ||
const canBeCancelled = computed<boolean>(() => { | ||
return ( | ||
props.task.traits.contains(TaskTrait.CanBeCancelled) || | ||
props.task.traits.contains(TaskTrait.NeedsToBeStopped) | ||
) && | ||
!props.task.isCancelRequested | ||
}) | ||
async function cancelTask(): Promise<void> { | ||
cancelling.value = true | ||
try { | ||
const cancelled = await taskViewerService.cancelTask(props.connection, props.task.taskId) | ||
if (cancelled) { | ||
toaster.success(t( | ||
'taskViewer.tasksVisualizer.notification.taskCancelled', | ||
{ taskName: props.task.taskName } | ||
)) | ||
} else { | ||
toaster.info(t( | ||
'taskViewer.tasksVisualizer.notification.taskNotCancelled', | ||
{ taskName: props.task.taskName } | ||
)) | ||
} | ||
// visualize the cancel until the next full reload | ||
props.task.cancelRequested() | ||
} catch (e: any) { | ||
toaster.error(t( | ||
'taskViewer.tasksVisualizer.notification.couldNotCancelTask', | ||
{ | ||
taskName: props.task.taskName, | ||
reason: e.message | ||
} | ||
)) | ||
} | ||
cancelling.value = false | ||
} | ||
</script> | ||
|
||
<template> | ||
<VBtn | ||
v-if="canBeCancelled" | ||
icon | ||
:loading="cancelling" | ||
@click="cancelTask" | ||
> | ||
<VIcon>mdi-close</VIcon> | ||
|
||
<VTooltip activator="parent"> | ||
{{ t('taskViewer.tasksVisualizer.task.button.cancel') }} | ||
</VTooltip> | ||
</VBtn> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
</style> |
42 changes: 42 additions & 0 deletions
42
src/modules/task-viewer/components/DownloadTaskFileResultButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script setup lang="ts"> | ||
import { FileTaskResult } from '@/modules/connection/model/task/FileTaskResult' | ||
import VDownloadServerFileButton from '@/modules/connection/component/VDownloadServerFileButton.vue' | ||
import { TaskStatus } from '@/modules/connection/model/task/TaskStatus' | ||
import { Toaster, useToaster } from '@/modules/notification/service/Toaster' | ||
import { useI18n } from 'vue-i18n' | ||
import { Connection } from '@/modules/connection/model/Connection' | ||
const toaster: Toaster = useToaster() | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
connection: Connection | ||
task: TaskStatus | ||
}>() | ||
function onCouldNotDownloadResultFile(e: Error): void { | ||
toaster.error(t( | ||
'taskViewer.tasksVisualizer.task.notification.couldNotDownloadResultFile', | ||
{ | ||
taskName: props.task.taskName, | ||
reason: e.message | ||
} | ||
)) | ||
} | ||
</script> | ||
|
||
<template> | ||
<VDownloadServerFileButton | ||
|
||
:connection="connection" | ||
:file="(task.result as FileTaskResult).value" | ||
@error="onCouldNotDownloadResultFile($event)" | ||
> | ||
{{ t('taskViewer.tasksVisualizer.task.button.downloadFileResult') }} | ||
</VDownloadServerFileButton> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
</style> |
41 changes: 41 additions & 0 deletions
41
src/modules/task-viewer/components/ShowTaskDetailButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script setup lang="ts"> | ||
import TaskDetailDialog from '@/modules/task-viewer/components/TaskDetailDialog.vue' | ||
import { ref } from 'vue' | ||
import { TaskStatus } from '@/modules/connection/model/task/TaskStatus' | ||
import { useI18n } from 'vue-i18n' | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
task: TaskStatus | ||
}>() | ||
const showDetailsDialog = ref<boolean>(false) | ||
</script> | ||
|
||
<template> | ||
<TaskDetailDialog | ||
v-model="showDetailsDialog" | ||
:task="task" | ||
> | ||
<template #activator="{ props }"> | ||
<VBtn | ||
icon | ||
v-bind="props" | ||
@click="showDetailsDialog = true" | ||
> | ||
<VIcon>mdi-information-outline</VIcon> | ||
|
||
<VTooltip activator="parent"> | ||
{{ t('taskViewer.tasksVisualizer.task.button.details') }} | ||
</VTooltip> | ||
</VBtn> | ||
</template> | ||
</TaskDetailDialog> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
</style> |
42 changes: 42 additions & 0 deletions
42
src/modules/task-viewer/components/ShowTaskExceptionButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<script setup lang="ts"> | ||
import TaskExceptionDialog from '@/modules/task-viewer/components/TaskExceptionDialog.vue' | ||
import { ref } from 'vue' | ||
import { TaskStatus } from '@/modules/connection/model/task/TaskStatus' | ||
import { useI18n } from 'vue-i18n' | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
task: TaskStatus | ||
}>() | ||
const showExceptionDialog = ref<boolean>(false) | ||
</script> | ||
|
||
<template> | ||
<TaskExceptionDialog | ||
v-model="showExceptionDialog" | ||
:exception="task.exception || ''" | ||
> | ||
<template #activator="{ props }"> | ||
<VBtn | ||
icon | ||
variant="text" | ||
color="warning" | ||
v-bind="props" | ||
@click="showExceptionDialog = true" | ||
> | ||
<VIcon>mdi-alert-outline</VIcon> | ||
|
||
<VTooltip activator="parent"> | ||
{{ t('taskViewer.tasksVisualizer.task.button.exception') }} | ||
</VTooltip> | ||
</VBtn> | ||
</template> | ||
</TaskExceptionDialog> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
</style> |
41 changes: 41 additions & 0 deletions
41
src/modules/task-viewer/components/ShowTaskTextResultButton.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<script setup lang="ts"> | ||
import { TextTaskResult } from '@/modules/connection/model/task/TextTaskResult' | ||
import TaskTextResultDialog from '@/modules/task-viewer/components/TaskTextResultDialog.vue' | ||
import { ref } from 'vue' | ||
import { TaskStatus } from '@/modules/connection/model/task/TaskStatus' | ||
import { useI18n } from 'vue-i18n' | ||
const { t } = useI18n() | ||
const props = defineProps<{ | ||
task: TaskStatus | ||
}>() | ||
const showResultTextDialog = ref<boolean>(false) | ||
</script> | ||
|
||
<template> | ||
<TaskTextResultDialog | ||
v-model="showResultTextDialog" | ||
:result="task.result as TextTaskResult" | ||
> | ||
<template #activator="{ props }"> | ||
<VBtn | ||
icon | ||
v-bind="props" | ||
@click="showResultTextDialog = true" | ||
> | ||
<VIcon>mdi-file-document-outline</VIcon> | ||
|
||
<VTooltip activator="parent"> | ||
{{ t('taskViewer.tasksVisualizer.task.button.textResult') }} | ||
</VTooltip> | ||
</VBtn> | ||
</template> | ||
</TaskTextResultDialog> | ||
</template> | ||
|
||
<style lang="scss" scoped> | ||
</style> |
Oops, something went wrong.