mirror of
https://github.com/speatzle/nfsense.git
synced 2025-05-11 19:08:20 +00:00
Use new Table View
This commit is contained in:
parent
8976d32caf
commit
25684438e9
1 changed files with 13 additions and 9 deletions
|
@ -2,6 +2,9 @@
|
||||||
import { apiCall } from "../../api";
|
import { apiCall } from "../../api";
|
||||||
|
|
||||||
let interfaces = $ref({});
|
let interfaces = $ref({});
|
||||||
|
let loading = $ref(false);
|
||||||
|
let selection = $ref([] as number[]);
|
||||||
|
|
||||||
const columns = [
|
const columns = [
|
||||||
{heading: 'Name', path: 'name'},
|
{heading: 'Name', path: 'name'},
|
||||||
{heading: 'Type', path: 'type'},
|
{heading: 'Type', path: 'type'},
|
||||||
|
@ -23,16 +26,10 @@ const displayData = $computed(() => {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
});
|
});
|
||||||
|
|
||||||
function getServicePortRange(s:any): string {
|
|
||||||
if (s.dport_end) {
|
|
||||||
return s.dport_start + "-" + s.dport_end;
|
|
||||||
}
|
|
||||||
return s.dport_start;
|
|
||||||
}
|
|
||||||
|
|
||||||
async function load(){
|
async function load(){
|
||||||
|
loading = true
|
||||||
let res = await apiCall("Network.GetInterfaces", {});
|
let res = await apiCall("Network.GetInterfaces", {});
|
||||||
if (res.Error === null) {
|
if (res.Error === null) {
|
||||||
console.debug("interfaces", res.Data.Interfaces);
|
console.debug("interfaces", res.Data.Interfaces);
|
||||||
|
@ -40,6 +37,7 @@ async function load(){
|
||||||
} else {
|
} else {
|
||||||
console.debug("error", res);
|
console.debug("error", res);
|
||||||
}
|
}
|
||||||
|
loading = false
|
||||||
}
|
}
|
||||||
|
|
||||||
onMounted(async() => {
|
onMounted(async() => {
|
||||||
|
@ -49,5 +47,11 @@ onMounted(async() => {
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<TableView title="Interfaces" :columns="columns" :load-data="load" v-model:data="displayData" :table-props="{sort:true, sortSelf: true}"/>
|
<TableView title="Interfaces" :columns="columns" :loading="loading" v-model:selection="selection" v-model:data="displayData" :table-props="{sort:true, sortSelf: true}">
|
||||||
|
<button @click="load">Apply</button>
|
||||||
|
<button @click="load">Refresh</button>
|
||||||
|
<button @click="load">Create</button>
|
||||||
|
<button @click="load" :disabled="selection.length != 1">Edit</button>
|
||||||
|
<button @click="load" :disabled="selection.length == 0">Delete</button>
|
||||||
|
</TableView>
|
||||||
</template>
|
</template>
|
Loading…
Add table
Reference in a new issue