mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
MAke Create Page not crash
This commit is contained in:
parent
f0edca127f
commit
f91132f200
1 changed files with 37 additions and 7 deletions
|
@ -1,6 +1,34 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
const props = $defineProps<{entity: string}>();
|
import PillBar from "../../../../components/inputs/PillBar.vue";
|
||||||
const { entity } = $(props);
|
import TextBox from "../../../../components/inputs/TextBox.vue";
|
||||||
|
import MultilineTextBox from "../../../../components/inputs/MultilineTextBox.vue";
|
||||||
|
import CheckBox from "../../../../components/inputs/CheckBox.vue";
|
||||||
|
|
||||||
|
const props = $defineProps<{subsystem: string, entity: string}>();
|
||||||
|
const { subsystem, entity } = $(props);
|
||||||
|
|
||||||
|
const createTypes: { [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 },
|
||||||
|
],
|
||||||
|
}
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
async function create() {
|
async function create() {
|
||||||
|
|
||||||
|
@ -8,13 +36,15 @@ async function create() {
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div v-if="createTypes[subsystem][entity]">
|
||||||
<PageHeader title="Create TODO">
|
<PageHeader :title="'Edit ' + createTypes[subsystem][entity].title">
|
||||||
<button @click="create">Create</button>
|
<button @click="create">Create</button>
|
||||||
<button @click="$router.go(-1)">Discard</button>
|
<button @click="$router.go(-1)">Discard</button>
|
||||||
</PageHeader>
|
</PageHeader>
|
||||||
|
{{ subsystem }} {{ entity }}
|
||||||
|
<NiceForm class="scroll cl-secondary" title="Test" :fields="createTypes[subsystem][entity].fields"/>
|
||||||
|
</div>
|
||||||
|
<div v-else>
|
||||||
|
No create for this Entity
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<style scoped>
|
|
||||||
</style>
|
|
Loading…
Add table
Reference in a new issue