fixes and improvements
This commit is contained in:
@@ -36,6 +36,7 @@ import { HoverEditButton } from "../components/HoverEditButton";
|
||||
import { SectionCard } from "../components/SectionCard";
|
||||
import { SelectionRailCard } from "../components/SelectionRailCard";
|
||||
import { TabbedCard } from "../components/TabbedCard";
|
||||
import { ConfirmDialog } from "../components/ConfirmDialog";
|
||||
const SERVICE_OPTIONS = [
|
||||
{ value: "monitoring", label: "Monitoring" },
|
||||
{ value: "files", label: "Files" },
|
||||
@@ -996,6 +997,7 @@ export function Settings() {
|
||||
const deleteMachine = useDeleteMonitoringMachine();
|
||||
const testMachineSSH = useTestMonitoringMachineSSH();
|
||||
const [tab, setTab] = useState<SettingsTab>("machines");
|
||||
const [deleteMachineId, setDeleteMachineId] = useState<string | null>(null);
|
||||
const [sshValidationMessage, setSSHValidationMessage] = useState("");
|
||||
const [sshValidationError, setSSHValidationError] = useState("");
|
||||
const [sshValidationStatus, setSSHValidationStatus] = useState("");
|
||||
@@ -1384,7 +1386,7 @@ export function Settings() {
|
||||
variant="outlined"
|
||||
color="error"
|
||||
onClick={() =>
|
||||
deleteMachine.mutate(selectedMachine.id)
|
||||
setDeleteMachineId(selectedMachine.id)
|
||||
}
|
||||
>
|
||||
Delete
|
||||
@@ -1448,8 +1450,8 @@ export function Settings() {
|
||||
variant="outlined"
|
||||
color="error"
|
||||
onClick={() => {
|
||||
deleteMachine.mutate(machineDraft.id as string);
|
||||
closeMachineDialog();
|
||||
setDeleteMachineId(machineDraft.id as string);
|
||||
|
||||
}}
|
||||
>
|
||||
Delete
|
||||
@@ -1457,6 +1459,20 @@ export function Settings() {
|
||||
) : undefined
|
||||
}
|
||||
/>
|
||||
|
||||
<ConfirmDialog
|
||||
open={Boolean(deleteMachineId)}
|
||||
title="Delete machine?"
|
||||
message="The machine will be removed. Action history will be deleted."
|
||||
onCancel={() => setDeleteMachineId(null)}
|
||||
onConfirm={() => {
|
||||
if (deleteMachineId) {
|
||||
deleteMachine.mutate(deleteMachineId);
|
||||
closeMachineDialog();
|
||||
}
|
||||
setDeleteMachineId(null);
|
||||
}}
|
||||
/>
|
||||
</Dialog>
|
||||
</Stack>
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user