From ffe2bf188008696667a557264c6c6a855e84fa97 Mon Sep 17 00:00:00 2001 From: Samuel Lorch Date: Sun, 2 Apr 2023 18:57:30 +0200 Subject: [PATCH] Move types to definitions.ts, minor improvements --- client/src/definitions.ts | 27 +++++++++++++ .../pages/edit/[subsystem]/[entity]/[id].vue | 35 +++-------------- .../pages/edit/[subsystem]/[entity]/index.vue | 38 +++---------------- 3 files changed, 38 insertions(+), 62 deletions(-) create mode 100644 client/src/definitions.ts diff --git a/client/src/definitions.ts b/client/src/definitions.ts new file mode 100644 index 0000000..fce057b --- /dev/null +++ b/client/src/definitions.ts @@ -0,0 +1,27 @@ +import PillBar from "./components/inputs/PillBar.vue"; +import TextBox from "./components/inputs/TextBox.vue"; +import MultilineTextBox from "./components/inputs/MultilineTextBox.vue"; +import CheckBox from "./components/inputs/CheckBox.vue"; + +export const editTypes: { [key: string]: {[key: string]: any} } = { + "firewall": { + "forwardrules": { + title: "Forward Rule", + fields: [ + {key: "name", label: "Name", component: () => TextBox }, + {key: "verdict", label: "Verdict", component: () => PillBar, props: {options: [{name: 'Accept'}, {name: 'Drop'}, {name: 'Continue'}]}}, + {key: "counter", label: "Counter", component: () => CheckBox }, + {key: "comment", label: "Comment", component: () => MultilineTextBox }, + ], + } + }, + "network": { + "interfaces": { + title: "Interfaces", + fields: [ + {key: "name", label: "Name", component: () => TextBox }, + {key: "comment", label: "Comment", component: () => MultilineTextBox }, + ], + } + }, + }; \ No newline at end of file diff --git a/client/src/pages/edit/[subsystem]/[entity]/[id].vue b/client/src/pages/edit/[subsystem]/[entity]/[id].vue index cdae9c5..01b8f28 100644 --- a/client/src/pages/edit/[subsystem]/[entity]/[id].vue +++ b/client/src/pages/edit/[subsystem]/[entity]/[id].vue @@ -1,35 +1,10 @@