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";
|
||||
|
||||
let interfaces = $ref({});
|
||||
let loading = $ref(false);
|
||||
let selection = $ref([] as number[]);
|
||||
|
||||
const columns = [
|
||||
{heading: 'Name', path: 'name'},
|
||||
{heading: 'Type', path: 'type'},
|
||||
|
@ -25,14 +28,8 @@ const displayData = $computed(() => {
|
|||
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(){
|
||||
loading = true
|
||||
let res = await apiCall("Network.GetInterfaces", {});
|
||||
if (res.Error === null) {
|
||||
console.debug("interfaces", res.Data.Interfaces);
|
||||
|
@ -40,6 +37,7 @@ async function load(){
|
|||
} else {
|
||||
console.debug("error", res);
|
||||
}
|
||||
loading = false
|
||||
}
|
||||
|
||||
onMounted(async() => {
|
||||
|
@ -49,5 +47,11 @@ onMounted(async() => {
|
|||
</script>
|
||||
|
||||
<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>
|
Loading…
Add table
Reference in a new issue