From 3847a89594dcd0047559b52ce6bb1003a105adc5 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Sun, 12 Mar 2023 20:27:36 +0100 Subject: [PATCH 1/3] add table selection, rework column definitions --- client/src/components/NiceTable.vue | 83 ++++++++++++++++++++++++++--- client/src/pages/firewall/Rules.vue | 11 +++- 2 files changed, 85 insertions(+), 9 deletions(-) diff --git a/client/src/components/NiceTable.vue b/client/src/components/NiceTable.vue index 08a57e0..d7b8baa 100644 --- a/client/src/components/NiceTable.vue +++ b/client/src/components/NiceTable.vue @@ -1,15 +1,33 @@ \ No newline at end of file diff --git a/client/src/pages/firewall/Rules.vue b/client/src/pages/firewall/Rules.vue index 876efbb..d0d9369 100644 --- a/client/src/pages/firewall/Rules.vue +++ b/client/src/pages/firewall/Rules.vue @@ -2,6 +2,15 @@ import { apiCall } from "../../api"; let rules = $ref([]); +const columns = [ + {heading: 'Name', path: 'name'}, + {heading: 'Source', path: 'match.source_addresses'}, + {heading: 'Destination', path: 'match.destination_addresses'}, + {heading: 'Service', path: 'match.services'}, + {heading: 'Verdict', path: 'verdict'}, + {heading: 'Counter', path: 'counter'}, + {heading: 'Comment', path: 'comment'}, +]; async function loadRules(){ let res = await apiCall("Firewall.GetForwardRules", {}); @@ -24,6 +33,6 @@ onMounted(async() => { - + \ No newline at end of file From d97f7a4e935a359f55ab1b4887b4c1e17578f420 Mon Sep 17 00:00:00 2001 From: adroslice Date: Sun, 12 Mar 2023 21:16:01 +0100 Subject: [PATCH 2/3] Added Drag&Drop to NiceTable --- client/src/components/NiceTable.vue | 37 ++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/client/src/components/NiceTable.vue b/client/src/components/NiceTable.vue index d7b8baa..f936233 100644 --- a/client/src/components/NiceTable.vue +++ b/client/src/components/NiceTable.vue @@ -84,6 +84,22 @@ function atPath(value: any, path: string): any { } return value; } + +let draggedRow = $ref(-1); +let draggedOverRow = $ref(-1); +function dragDropRow() { + if (data) { + const row = data[draggedRow]; + data.splice(draggedRow, 1); + data.splice(draggedOverRow, 0, row); + data = data; + } + // Reset drag data + draggedRow = 0; + draggedOverRow = 0; + // Kill selection + selection = []; +}