Rework Definitions for new Form

This commit is contained in:
Samuel Lorch 2023-04-03 22:45:49 +02:00
parent bf1193cd73
commit b96d4f4955

View file

@ -1,35 +1,42 @@
import PillBar from "./components/inputs/PillBar.vue"; export const editTypes: { [key: string]: { [key: string]: any } } = {
import TextBox from "./components/inputs/TextBox.vue"; "firewall": {
import NumberBox from "./components/inputs/NumberBox.vue"; "forwardrules": {
import MultilineTextBox from "./components/inputs/MultilineTextBox.vue"; title: "Forward Rule",
import CheckBox from "./components/inputs/CheckBox.vue"; sections: [
{
export const editTypes: { [key: string]: {[key: string]: any} } = { fields: [
"firewall": { { key: "name", label: "Name", as: "TextBox" },
"forwardrules": { { key: "verdict", label: "Verdict", as: "PillBar", props: { options: [{ name: 'Accept' }, { name: 'Drop' }, { name: 'Continue' }] } },
title: "Forward Rule", { key: "counter", label: "Counter", as: "CheckBox", },
fields: [ { key: "comment", label: "Comment", as: "MultilineTextBox", },
{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": { "network": {
title: "Interfaces", "interfaces": {
fields: [ title: "Interfaces",
{key: "name", label: "Name", component: () => TextBox, default: "placeholder"}, sections: [
{key: "type", label: "Type", component: () => PillBar, props: {options: [{name: 'Hardware', selected: true}, {name: 'VLAN'}, {name: 'Bond'}, {name: 'Brdige'}]}}, {
{key: "hardware_interface", label: "Hardware Interface", component: () => TextBox }, fields: [
{key: "vlan_id", label: "VLAN ID", component: () => NumberBox, props: {min: 1, max: 4094} }, { key: "name", label: "Name", as: "TextBox", default: "placeholder" },
{key: "bond_members", label: "Bond Members", component: () => TextBox, if: () => true }, { key: "type", label: "Type", as: "PillBar", props: { options: [{ name: 'Hardware' }, { name: 'VLAN' }, { name: 'Bond' }, { name: 'Bridge' }] } },
{key: "bridge_members", label: "Bridge Memebers", component: () => TextBox }, { key: "hardware_interface", label: "Hardware Interface", as: "TextBox", enabled: (values: any) => (values["type"] == 0) },
{key: "addressing_mode", label: "Addressing Mode", component: () => PillBar, props: {options: [{name: 'None', selected: true}, {name: 'Static'}, {name: 'DHCP'}]}}, { key: "vlan_id", label: "VLAN ID", as: "NumberBox", props: { min: 1, max: 4094 }, enabled: (values: any) => (values["type"] == 1) },
{key: "address", label: "Address", component: () => TextBox }, { key: "bond_members", label: "Bond Members", as: "TextBox", enabled: (values: any) => (values["type"] == 2) },
{key: "comment", label: "Comment", component: () => MultilineTextBox }, { key: "bridge_members", label: "Bridge Members", as: "TextBox", enabled: (values: any) => (values["type"] == 3) },
], ],
} },
{
title: "Addressing",
fields: [
{ key: "addressing_mode", label: "Addressing Mode", as: "PillBar", props: { options: [{ name: 'None', selected: true }, { name: 'Static' }, { name: 'DHCP' }] } },
{ key: "address", label: "Address", as: "TextBox", enabled: (values: any) => (values["addressing_mode"] == 1) },
{ key: "comment", label: "Comment", as: "MultilineTextBox" },
],
}
],
}, },
}; },
};