Skip to content

Commit

Permalink
teepod: Comfirm on removal
Browse files Browse the repository at this point in the history
  • Loading branch information
kvinwang committed Dec 23, 2024
1 parent 43de41b commit ce6f34b
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions teepod/src/console.html
Original file line number Diff line number Diff line change
Expand Up @@ -653,10 +653,10 @@ <h2>VM List</h2>
@click="shutdownVm(vm.id)" title="Shutdown VM">
<i class="fas fa-stop"></i> Shutdown
</button>
<button class="action-btn danger" @click="stopVm(vm.id)" title="Stop VM">
<button class="action-btn danger" @click="stopVm(vm)" title="Stop VM">
<i class="fas fa-kill"></i> Kill
</button>
<button class="action-btn warning" @click="removeVm(vm.id)" title="Remove VM">
<button class="action-btn warning" @click="removeVm(vm)" title="Remove VM">
<i class="fas fa-trash"></i> Remove
</button>
<button class="action-btn" @click="showLog(vm.id)" title="View Logs">
Expand Down Expand Up @@ -1131,10 +1131,13 @@ <h3>Derive VM</h3>
}
};

const stopVm = async (id) => {
const stopVm = async (vm) => {
if (!confirm(`You are killing "${vm.name}". This might cause data corruption.`)) {
return;
}
try {
const _response = await rpcCall('StopVm', {
id
id: vm.id
});
loadVMList();
} catch (error) {
Expand Down Expand Up @@ -1167,10 +1170,13 @@ <h3>Derive VM</h3>
}
};

const removeVm = async (id) => {
const removeVm = async (vm) => {
if (!confirm(`You are removing "${vm.name}". This action cannot be undone.`)) {
return;
}
try {
const _response = await rpcCall('RemoveVm', {
id
id: vm.id
});
loadVMList();
} catch (error) {
Expand Down

0 comments on commit ce6f34b

Please sign in to comment.