feat: confirm kill process

This commit is contained in:
Pavel
2025-08-14 22:55:36 +02:00
parent e4bf2b4c9b
commit ab924f6b48

View File

@@ -6,6 +6,8 @@
import { apiCall } from '../utility/api';
import { onMount } from 'svelte';
import { showSnackbarError, showSnackbarSuccess } from '../utility/snackbar';
import { showModal } from '../modals/modalTools';
import ConfirmModal from '../modals/ConfirmModal.svelte';
export let conid;
export let isSummaryOpened: boolean = false;
@@ -45,6 +47,18 @@
refreshProcesses();
}
async function killProcessWithConfirm(processId: number) {
showModal(ConfirmModal, {
message: _t('summaryProcesses.killConfirm', {
defaultMessage: 'Are you sure you want to kill process {processId}?',
values: { processId },
}),
onConfirm: async () => {
await killProcess(processId);
},
});
}
function formatRunningTime(seconds: number): string {
if (!seconds) return '-';
if (seconds < 60) return `${seconds.toFixed(3)}s`;
@@ -91,7 +105,7 @@
]}
>
<svelte:fragment slot="0" let:row>
<CtaButton on:click={() => killProcess(row.processId)}>
<CtaButton on:click={() => killProcessWithConfirm(row.processId)}>
{_t('common.kill', { defaultMessage: 'Kill' })}
</CtaButton>
</svelte:fragment>