Fix Edit Button

This commit is contained in:
Samuel Lorch 2023-05-13 22:09:50 +02:00
parent f5ea65010a
commit 7bff4c5de1

View file

@ -1,5 +1,7 @@
<script setup lang="ts">
import { apiCall } from "../../api";
import getPlugins from '../../plugins';
const p = getPlugins();
let services = $ref({});
let loading = $ref(false);
@ -53,7 +55,7 @@ function getServicePortRange(s:any): string {
}
async function load(){
loading = true
loading = true;
let res = await apiCall("Object.GetServices", {});
if (res.Error === null) {
console.debug("services", res.Data.Services);
@ -61,7 +63,7 @@ async function load(){
} else {
console.debug("error", res);
}
loading = false
loading = false;
}
async function deleteService(){
@ -74,6 +76,10 @@ async function deleteService(){
load();
}
async function editService() {
p.router.push("/object/services/edit/" + displayData[selection[0]].name);
}
onMounted(async() => {
load();
});
@ -84,7 +90,7 @@ onMounted(async() => {
<TableView title="Services" :columns="columns" :loading="loading" v-model:selection="selection" v-model:data="displayData" :table-props="{sort:true, sortSelf: true}">
<button @click="load">Refresh</button>
<router-link class="button" to="/object/services/edit">Create</router-link>
<router-link class="button" :class="{ disabled: selection.length != 1 }" :to="'/object/services/edit/' + selection[0]">Edit</router-link>
<button @click="editService" :disabled="selection.length != 1">Edit</button>
<button @click="deleteService" :disabled="selection.length != 1">Delete</button>
</TableView>
</template>