This commit is contained in:
iamBadgers
2026-04-03 23:38:40 -07:00
parent 25e0e11a8e
commit e550e5da5d
3 changed files with 55 additions and 26 deletions

View File

@@ -1,31 +1,56 @@
<template> <template>
<Form v-slot="$form"> <Form v-slot="$form" class="flex flex-row">
<Card> <Card class="detailCard flex">
<template #title> <template #title>
{{ table.table_name }} {{ table.table_name }}
<Chip class="active" icon="pi pi-apple" :label="table.active ? 'active' : 'inactive'" />
</template> </template>
<template #content> <template #subtitle>
<InputText name="tableName" type="text" placeholder="Table Name" v-model="tableName" /> Status:
<InputText name="tableLink" type="text" placeholder="Table Link" v-model="tableLink" /> <Chip :class="table.active ? 'active' : 'inactive'" :label="table.active ? 'active' : 'inactive'" />
</template> </template>
<template #footer> <template #footer>
<Button label="Save" /> <Button class="button-box" label="Start" />
<Button label="Clear" /> <Button class="button-box" label="Stop" />
<Button class="button-box" label="Delete" />
</template> </template>
</Card> </Card>
<Card class="detailCard flex">
<template #title>
Edit Details
</template>
<template #content>
<div class="flex flex-column">
<InputText class="button-box" name="tableName" type="text" placeholder="Table Name" v-model="tableName" />
<InputText class="button-box" name="tableLink" type="text" placeholder="Table Link" v-model="tableLink" />
</div>
</template>
<template #footer>
<Button class="button-box" label="Save" />
<Button class="button-box" label="Clear" />
</template>
</Card>
</Form> </Form>
</template> </template>
<style> <style>
@import "primeicons/primeicons.css";
.active { .active {
color: green; --p-chip-color: green;
background-color: green;
font-weight: 10;
} }
.inactive { .inactive {
color: red; --p-chip-color: red;
}
.detailCard {
margin: 25px;
}
.button-box {
margin: 5px;
} }
</style> </style>
@@ -49,8 +74,6 @@ const table = reactive({
const tableName = ref() const tableName = ref()
const tableLink = ref() const tableLink = ref()
console.log('asdf')
onMounted(() => { onMounted(() => {
axios.get(`http://localhost/api/tables/${route.params.id}`).then((resp) => { axios.get(`http://localhost/api/tables/${route.params.id}`).then((resp) => {
table.table_name = resp.data.table_name table.table_name = resp.data.table_name

View File

@@ -1,5 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { ref, onMounted } from 'vue' import { ref, onMounted } from 'vue'
import { useRouter } from 'vue-router'
import axios from 'axios' import axios from 'axios'
import Button from 'primevue/button' import Button from 'primevue/button'
@@ -8,6 +9,7 @@ import Column from 'primevue/column'
import Card from 'primevue/card' import Card from 'primevue/card'
import SplitButton from 'primevue/splitbutton' import SplitButton from 'primevue/splitbutton'
const route = useRouter()
const allTables = ref() const allTables = ref()
const activeTables = ref() const activeTables = ref()
@@ -43,13 +45,19 @@ function stopTable(tableId: number) {
.then((resp) => (activeTables.value = resp.data)) .then((resp) => (activeTables.value = resp.data))
} }
const saveButtonSubmenu = [ function buildButtonModel(id: number) {
{ label: 'Edit' }, return [{
label: 'Edit', command: () => {
route.push({ name: 'edit', params: { id: id } })
}
},
{ label: 'Restart' }, { label: 'Restart' },
{ label: 'Force Stop' }, { label: 'Force Stop' },
{ separator: true }, { separator: true },
{ label: 'Delete' }, { label: 'Delete' }
] ]
}
</script> </script>
<style> <style>
@@ -113,15 +121,13 @@ const saveButtonSubmenu = [
<template #content> <template #content>
<DataTable class="Tables" :value="allTables"> <DataTable class="Tables" :value="allTables">
<Column field="table_name" header="Table Name" /> <Column field="table_name" header="Table Name">
</Column>
<Column field="table_link" header="Table Link" /> <Column field="table_link" header="Table Link" />
<Column header="Close"> <Column header="Close">
<template #body="slotProps"> <template #body="slotProps">
<SplitButton <SplitButton label="Start" @click="startTable(slotProps.data.id)"
label="Start" :model="buildButtonModel(slotProps.data.id)" />
@click="startTable(slotProps.data.id)"
:model="saveButtonSubmenu"
/>
</template> </template>
</Column> </Column>
</DataTable> </DataTable>

View File

@@ -8,8 +8,8 @@ import TableEditor from './TableEditor.vue'
import 'primeflex/primeflex.css' import 'primeflex/primeflex.css'
const routes = [ const routes = [
{ path: '/', component: TableManager }, { name: "home", path: '/', component: TableManager },
{ path: '/edit/:id', component: TableEditor }, { name: "edit", path: '/edit/:id', component: TableEditor },
] ]
const router = createRouter({ const router = createRouter({