feat: add policy deletion, improve dry run handling, and enhance policy designer UX
Add DELETE /policies/{policy_id} endpoint with audit logging, improve firewall apply to handle dry run mode without calling provider and track operation success separately from applied status, update Proxmox provider error message to clarify rule-to-VM mapping requirement, add dry run explanation text to FirewallPreview with conditional button labels, enhance Policies page with expanded DataTable columns showing source
This commit is contained in:
@@ -19,7 +19,7 @@ export function PolicyDesigner() {
|
||||
const services = useQuery({ queryKey: ["service-catalog"], queryFn: () => api<ServiceCatalogItem[]>("/service-catalog") });
|
||||
const [preview, setPreview] = useState<Record<string, unknown> | null>(null);
|
||||
const [form, setForm] = useState({
|
||||
name: "Designed Policy",
|
||||
name: "",
|
||||
source: "any",
|
||||
destination: "any",
|
||||
service_id: "",
|
||||
@@ -45,7 +45,7 @@ export function PolicyDesigner() {
|
||||
const service = services.data?.find((item) => item.id === form.service_id);
|
||||
return {
|
||||
project_id: null,
|
||||
name: form.name,
|
||||
name: form.name.trim(),
|
||||
enabled: true,
|
||||
definition: {
|
||||
source: form.source,
|
||||
@@ -95,6 +95,16 @@ export function PolicyDesigner() {
|
||||
<div className="grid gap-4 lg:grid-cols-[1fr_420px]">
|
||||
<form onSubmit={submit} className="rounded-md border border-border bg-panel p-4">
|
||||
<div className="grid gap-4 md:grid-cols-2">
|
||||
<Field label="Policy Name">
|
||||
<input
|
||||
className={inputClass}
|
||||
value={form.name}
|
||||
onChange={(event) => setForm({ ...form, name: event.target.value })}
|
||||
placeholder="DNS from VMs to resolver"
|
||||
required
|
||||
/>
|
||||
</Field>
|
||||
<div />
|
||||
<Field label="Source">
|
||||
<select className={selectClass} value={form.source} onChange={(event) => setForm({ ...form, source: event.target.value })}>
|
||||
{targets.map((target) => <option key={target.value} value={target.value}>{target.label}</option>)}
|
||||
@@ -145,7 +155,7 @@ export function PolicyDesigner() {
|
||||
<Wand2 size={18} />
|
||||
Dry Run
|
||||
</button>
|
||||
<button className={buttonClass}>
|
||||
<button className={buttonClass} disabled={!form.name.trim() || save.isPending}>
|
||||
<Save size={18} />
|
||||
Save
|
||||
</button>
|
||||
|
||||
Reference in New Issue
Block a user