messing with status reads

This commit is contained in:
iamBadgers
2026-04-23 18:56:23 -07:00
parent cd26e658ad
commit 685055a955
4 changed files with 68 additions and 33 deletions

View File

@@ -22,26 +22,23 @@ onMounted(() => {
})
async function loadTables(): Promise<void> {
return axios.get('/api/tables/all')
return axios
.get('/api/tables/all')
.then((resp) => (allTables.value = resp.data))
.then(() => axios.get('/api/tables/active'))
.then((resp) => (activeTables.value = resp.data))
}
function startTable(tableId: number) {
axios.post(`/api/tables/${tableId}:start`, { "hard": "False" })
.then(() => loadTables())
axios.post(`/api/tables/${tableId}:start`, { hard: 'False' }).then(() => loadTables())
}
function stopTable(tableId: number) {
axios.post(`/api/tables/${tableId}:stop`)
.then(() => loadTables())
axios.post(`/api/tables/${tableId}:stop`).then(() => loadTables())
}
function deleteTable(tableId: number) {
axios
.delete(`/api/tables/${tableId}`)
.then(() => loadTables())
axios.delete(`/api/tables/${tableId}`).then(() => loadTables())
}
function buildButtonModel(table: any) {
@@ -56,8 +53,8 @@ function buildButtonModel(table: any) {
{
label: 'Hard Start',
command: () => {
axios.post(`/api/tables/${table.id}:start`, { "hard": "True" }).then(() => loadTables())
}
axios.post(`/api/tables/${table.id}:start`, { hard: 'True' }).then(() => loadTables())
},
},
{ separator: true },
{
@@ -66,13 +63,14 @@ function buildButtonModel(table: any) {
confirm.require({
header: `Delete ${table.table_name}?`,
message: "This will delete the table and all of it's data",
accept: () => { deleteTable(table.id) },
accept: () => {
deleteTable(table.id)
},
})
},
},
]
}
</script>
<style>
@@ -157,15 +155,18 @@ function buildButtonModel(table: any) {
<template #body="slotProps">
<div class="flex flex-row">
<span class="flex"></span>
<SplitButton label="Start" @click="startTable(slotProps.data.id)"
:model="buildButtonModel(slotProps.data)" />
<SplitButton
label="Start"
@click="startTable(slotProps.data.id)"
:model="buildButtonModel(slotProps.data)"
/>
</div>
</template>
</Column>
</DataTable>
<div class="button-box flex justify-content-end">
<router-link to="/new">
<Button label="New Table"" />
<Button label="New Table" />
</router-link>
</div>
</template>