mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 02:48:21 +00:00
fix edit addresses id
This commit is contained in:
parent
83b800ea05
commit
eec845ee76
1 changed files with 10 additions and 4 deletions
|
@ -1,5 +1,7 @@
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { apiCall } from "../../api";
|
import { apiCall } from "../../api";
|
||||||
|
import getPlugins from '../../plugins';
|
||||||
|
const p = getPlugins();
|
||||||
|
|
||||||
let addresses = $ref([]);
|
let addresses = $ref([]);
|
||||||
let loading = $ref(false);
|
let loading = $ref(false);
|
||||||
|
@ -13,7 +15,7 @@ const columns = [
|
||||||
];
|
];
|
||||||
|
|
||||||
async function load(){
|
async function load(){
|
||||||
loading = true
|
loading = true;
|
||||||
let res = await apiCall("Object.GetAddresses", {});
|
let res = await apiCall("Object.GetAddresses", {});
|
||||||
if (res.Error === null) {
|
if (res.Error === null) {
|
||||||
addresses = res.Data.Addresses;
|
addresses = res.Data.Addresses;
|
||||||
|
@ -21,7 +23,7 @@ async function load(){
|
||||||
} else {
|
} else {
|
||||||
console.debug("error", res);
|
console.debug("error", res);
|
||||||
}
|
}
|
||||||
loading = false
|
loading = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const displayData = $computed(() => {
|
const displayData = $computed(() => {
|
||||||
|
@ -69,6 +71,10 @@ async function deleteAddress(){
|
||||||
load();
|
load();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function editInterface() {
|
||||||
|
p.router.push("/object/addresses/edit/" + displayData[selection[0]].name);
|
||||||
|
}
|
||||||
|
|
||||||
onMounted(async() => {
|
onMounted(async() => {
|
||||||
load();
|
load();
|
||||||
});
|
});
|
||||||
|
@ -79,7 +85,7 @@ onMounted(async() => {
|
||||||
<TableView title="Addresses" :columns="columns" :loading="loading" v-model:selection="selection" v-model:data="displayData" :table-props="{sort:true, sortSelf: true}">
|
<TableView title="Addresses" :columns="columns" :loading="loading" v-model:selection="selection" v-model:data="displayData" :table-props="{sort:true, sortSelf: true}">
|
||||||
<button @click="load">Refresh</button>
|
<button @click="load">Refresh</button>
|
||||||
<router-link class="button" to="/object/addresses/edit">Create</router-link>
|
<router-link class="button" to="/object/addresses/edit">Create</router-link>
|
||||||
<router-link class="button" :class="{ disabled: selection.length != 1 }" :to="'/object/addresses/edit/' + selection[0]">Edit</router-link>
|
<button @click="editInterface" :disabled="selection.length != 1">Edit</button>
|
||||||
<button @click="deleteAddress" :disabled="selection.length != 1">Delete</button>
|
<button @click="deleteAddress" :disabled="selection.length != 1">Delete</button>
|
||||||
</TableView>
|
</TableView>
|
||||||
</template>
|
</template>
|
Loading…
Add table
Reference in a new issue