This commit is contained in:
Douglas Barone 2023-07-04 08:20:08 -04:00
parent d818c8b935
commit 997d74069d
3 changed files with 12 additions and 6 deletions

View File

@ -62,13 +62,13 @@ class PrinterController {
} }
static async show(req: Request, res: Response) { static async show(req: Request, res: Response) {
const { id } = req.params const { serialNumber } = req.params
const { take = 32, days = 60 } = req.query const { take = 32, days = 60 } = req.query
const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days)) const gte = new Date(Date.now() - 1000 * 60 * 60 * 24 * Number(days))
const printer = await prisma.printer.findUnique({ const printer = await prisma.printer.findUnique({
where: { id: Number(id) }, where: { serialNumber: serialNumber },
include: { include: {
status: { status: {
where: { where: {

View File

@ -2,7 +2,7 @@
<v-card <v-card
variant="outlined" variant="outlined"
class="printer-card" class="printer-card"
:to="{ name: 'Printer', params: { id: printer.id } }" :to="{ name: 'Printer', params: { serialNumber: printer.serialNumber } }"
> >
<v-row no-gutters wrap> <v-row no-gutters wrap>
<v-col cols="2" align-self="center"> <v-col cols="2" align-self="center">
@ -18,7 +18,13 @@
<v-col cols="4"> <v-col cols="4">
<v-list density="compact"> <v-list density="compact">
<v-list-item> <v-list-item>
<v-list-item-title>{{ printer.serialNumber }}</v-list-item-title> <v-list-item-title v-if="printer.friendlyName">
{{ printer.friendlyName }} ({{ printer.serialNumber }})
</v-list-item-title>
<v-list-item-title v-else>
{{ printer.serialNumber }}
</v-list-item-title>
<v-list-item-subtitle>{{ printer.model }}</v-list-item-subtitle> <v-list-item-subtitle>{{ printer.model }}</v-list-item-subtitle>
</v-list-item> </v-list-item>
<v-list-item> <v-list-item>
@ -194,7 +200,7 @@ const printerAlert = computed(() => {
<style scoped> <style scoped>
.printer-card { .printer-card {
border-color: #555; border-color: #7a7a7a;
} }
.alert { .alert {

View File

@ -28,7 +28,7 @@ const routes = [
import(/* webpackChunkName: "home" */ '@/views/Home.vue') import(/* webpackChunkName: "home" */ '@/views/Home.vue')
}, },
{ {
path: ':id', path: ':serialNumber',
name: 'Printer', name: 'Printer',
// route level code-splitting // route level code-splitting
// this generates a separate chunk (about.[hash].js) for this route // this generates a separate chunk (about.[hash].js) for this route