Compare commits

...

1 commit

Author SHA1 Message Date
b773a0dde1 Add loading server configs 2023-05-03 20:31:42 +02:00

View file

@ -1,8 +1,10 @@
<script setup lang="ts"> <script setup lang="ts">
import TableComponent from '@/components/TableComponent.vue'; import TableComponent from '@/components/TableComponent.vue';
import {getConfigs} from '@/services/ServerConfigs'
const tableHeader = ["ID", "Server ID", "System Message", "Rate limit"] const serverConfigs = await getConfigs()
const tableRows = [["1", "name", "comment", "1"]] const tableHeader = ["ID", "Server ID", "System Message", "Rate limit", "Created"]
const tableRows = serverConfigs.map(config => [config.id, config.serverId, config.systemMessage.slice(0, 47) + "...", config.rateLimit, config.time])
const actions = [{ class: "btn btn-sm btn-info m-1", content: "Edit", event: (_: number) => { } }, { class: "btn btn-sm btn-error m-1", content: "Delete", event: (_: number) => { } }] const actions = [{ class: "btn btn-sm btn-info m-1", content: "Edit", event: (_: number) => { } }, { class: "btn btn-sm btn-error m-1", content: "Delete", event: (_: number) => { } }]
</script> </script>
<template> <template>
@ -10,5 +12,6 @@ const actions = [{ class: "btn btn-sm btn-info m-1", content: "Edit", event: (_:
<h1 class="text-xl normal-case">Server Configs</h1> <h1 class="text-xl normal-case">Server Configs</h1>
<button class="btn btn-circle btn-success">Add</button> <button class="btn btn-circle btn-success">Add</button>
</div> </div>
<TableComponent :tableHeader="tableHeader" :tableRows="tableRows" :actions="actions" /> <TableComponent v-if="serverConfigs.length" :tableHeader="tableHeader" :tableRows="tableRows" :actions="actions" />
<p v-else class="m-5">No server configs</p>
</template> </template>