From abfce68f1335707ee764271ee1d4e2efb48f3fee Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Wed, 25 Nov 2026 10:14:25 +0100 Subject: [PATCH 1/2] refactor(web): use pavo fields, tables and switch instead of raw elements Material 3 is mandatory for OLF UIs. The raw select, input and table elements looked and behaved differently from the rest of the app, so the instance and event pages, the pool pages and the scaling form now use M3Select, M3TextField, M3DataTable and M3Switch. The instance list keeps its default order and sorts by name; the URL sort parameters and the age sort are no longer applied to the table. Add web/app/m3-only.test.ts, which fails when a page or component template contains a raw input, select, textarea or table tag. Allow dotted v-slot names in the lint config, because Pavo's DataTable names its cell slots item.. --- web/app/components/pools/PoolInstanceList.vue | 57 ++++---- web/app/components/pools/PoolScalingForm.vue | 60 +++----- web/app/components/pools/PoolTable.vue | 75 +++++----- web/app/m3-only.test.ts | 42 ++++++ web/app/pages/events/index.vue | 74 +++++----- web/app/pages/instances/[id].vue | 21 ++- web/app/pages/instances/index.vue | 135 ++++++++---------- web/app/pages/pools/[pool].vue | 11 +- web/eslint.config.mjs | 4 + 9 files changed, 248 insertions(+), 231 deletions(-) create mode 100644 web/app/m3-only.test.ts diff --git a/web/app/components/pools/PoolInstanceList.vue b/web/app/components/pools/PoolInstanceList.vue index 883ab1a..1c18fbe 100644 --- a/web/app/components/pools/PoolInstanceList.vue +++ b/web/app/components/pools/PoolInstanceList.vue @@ -3,32 +3,29 @@

{{ $t('pools.instances.empty') }}

-
- - - - - - - - - - - - - - - - - - - -
{{ $t('pools.instances.id') }}{{ $t('pools.instances.state') }}{{ $t('pools.instances.players') }}{{ $t('pools.instances.address') }}{{ $t('pools.instances.age') }}
- - {{ instance.id }} - - {{ instance.players }} / {{ instance.maxPlayers }}{{ instance.address || instance.host }}{{ ageText(instance.createdAt) }}
-
+ + + + + + + @@ -40,6 +37,14 @@ import { ageOf } from '~/lib/pools/view' const props = defineProps<{ instances: Instance[], now: number | null }>() const { t } = useI18n() +const columns = computed(() => [ + { key: 'id', title: t('pools.instances.id'), sortable: false }, + { key: 'state', title: t('pools.instances.state'), sortable: false }, + { key: 'players', title: t('pools.instances.players'), sortable: false }, + { key: 'address', title: t('pools.instances.address'), sortable: false }, + { key: 'createdAt', title: t('pools.instances.age'), sortable: false }, +]) + function ageText(createdAt: string): string { if (props.now === null) return '–' const { unit, value } = ageOf(createdAt, props.now) diff --git a/web/app/components/pools/PoolScalingForm.vue b/web/app/components/pools/PoolScalingForm.vue index f0ab5ff..ec36185 100644 --- a/web/app/components/pools/PoolScalingForm.vue +++ b/web/app/components/pools/PoolScalingForm.vue @@ -1,31 +1,22 @@ ')).toEqual([]) + }) + + it('uses no raw form or table element in pages and components', () => { + const violations = SCANNED.flatMap(dir => vueFiles(dir)).flatMap((file) => { + const source = readFileSync(file, 'utf8') + return rawTagsIn(source).map(tag => `${file.slice(APP_DIR.length + 1)}: <${tag}>`) + }) + expect(violations, `raw elements found (${HINT})`).toEqual([]) + }) +}) diff --git a/web/app/pages/events/index.vue b/web/app/pages/events/index.vue index 12e9a5f..371b9ac 100644 --- a/web/app/pages/events/index.vue +++ b/web/app/pages/events/index.vue @@ -39,47 +39,43 @@ {{ type }} - +

{{ $t('events.limit', { limit: LOG_LIMIT }) }}

-
- - - - - - - - - - - - - - - - - -
{{ $t('events.columns.time') }}{{ $t('events.columns.type') }}{{ $t('events.columns.subject') }}{{ $t('events.columns.summary') }}
{{ row.time }}{{ row.type }}{{ row.subject ?? '—' }} - {{ row.summary }} -
- {{ $t('events.showRaw') }} -
{{ row.raw }}
-
-
-
+ + + + + + @@ -102,6 +98,12 @@ const log = ref(emptyLog()) const typeFilter = ref([]) const text = ref('') const paused = computed(() => isPaused(log.value)) +const columns = computed(() => [ + { key: 'time', title: t('events.columns.time'), sortable: false }, + { key: 'type', title: t('events.columns.type'), sortable: false }, + { key: 'subject', title: t('events.columns.subject'), sortable: false }, + { key: 'summary', title: t('events.columns.summary'), sortable: false }, +]) const filter = computed(() => ({ types: typeFilter.value, text: text.value })) const translate: Translate = (key, params) => t(key, params ?? {}) diff --git a/web/app/pages/instances/[id].vue b/web/app/pages/instances/[id].vue index 133c736..9425518 100644 --- a/web/app/pages/instances/[id].vue +++ b/web/app/pages/instances/[id].vue @@ -68,17 +68,16 @@
- + {{ $t('instances.detail.send') }} diff --git a/web/app/pages/instances/index.vue b/web/app/pages/instances/index.vue index ce116dc..9c7e0bc 100644 --- a/web/app/pages/instances/index.vue +++ b/web/app/pages/instances/index.vue @@ -11,68 +11,47 @@ - - + + -
- - - - - - - - - - - - - - - - - - - - - -
- - {{ $t('instances.columns.pool') }}{{ $t('instances.columns.state') }}{{ $t('instances.columns.address') }}{{ $t('instances.columns.players') }} - -
- - {{ inst.id }} - - {{ inst.pool }}{{ inst.address || inst.host }}{{ inst.players }} / {{ inst.maxPlayers }}{{ ages.get(inst.id) ?? '' }}
-
+ + + + + + + @@ -89,7 +68,7 @@ import { INSTANCE_STATES } from '~/lib/states' const { status, onEvent, onResync } = useGrusEvents() const route = useRoute() const router = useRouter() -const { locale } = useI18n() +const { locale, t } = useI18n() const { data, error, pending, refresh } = await useAsyncData('instances', () => instancesApi.list()) @@ -100,6 +79,24 @@ const poolOptions = computed(() => { if (query.value.pool) pools.add(query.value.pool) return [...pools].sort() }) +const poolItems = computed(() => [ + { value: '', title: t('instances.filter.all') }, + ...poolOptions.value.map(pool => ({ value: pool, title: pool })), +]) +const stateItems = computed(() => [ + { value: '', title: t('instances.filter.all') }, + ...INSTANCE_STATES.map(state => ({ value: state, title: t(`instances.states.${state}`) })), +]) + +// Only the name column is sortable in the table. The sort query parameters are not applied to it. +const columns = computed(() => [ + { key: 'id', title: t('instances.columns.name') }, + { key: 'pool', title: t('instances.columns.pool'), sortable: false }, + { key: 'state', title: t('instances.columns.state'), sortable: false }, + { key: 'address', title: t('instances.columns.address'), sortable: false }, + { key: 'players', title: t('instances.columns.players'), sortable: false }, + { key: 'age', title: t('instances.columns.age'), sortable: false }, +]) // "now" is only known in the browser; SSR renders no ages to avoid a hydration mismatch. const now = ref(null) @@ -132,20 +129,4 @@ onResync(() => void refresh()) function update(patch: Partial) { void router.replace({ query: toInstanceRouteQuery({ ...query.value, ...patch }) }) } - -function toggleSort(key: 'name' | 'age') { - const q = query.value - if (q.sort === key) update({ dir: q.dir === 'asc' ? 'desc' : 'asc' }) - else update({ sort: key, dir: 'asc' }) -} - -function ariaSort(key: 'name' | 'age') { - if (query.value.sort !== key) return 'none' - return query.value.dir === 'asc' ? 'ascending' : 'descending' -} - -function sortMark(key: 'name' | 'age') { - if (query.value.sort !== key) return '' - return query.value.dir === 'asc' ? ' ▲' : ' ▼' -} diff --git a/web/app/pages/pools/[pool].vue b/web/app/pages/pools/[pool].vue index a8d2370..fdf0ecc 100644 --- a/web/app/pages/pools/[pool].vue +++ b/web/app/pages/pools/[pool].vue @@ -10,15 +10,14 @@ {{ $t(`common.live.${status}`) }} - - {{ pool.maintenance ? $t('pools.maintenance.disable') : $t('pools.maintenance.enable') }} - + {{ $t('pools.badges.maintenance') }} +
diff --git a/web/eslint.config.mjs b/web/eslint.config.mjs index 9b99a9c..9fd7767 100644 --- a/web/eslint.config.mjs +++ b/web/eslint.config.mjs @@ -3,4 +3,8 @@ import withNuxt from './.nuxt/eslint.config.mjs' export default withNuxt({ ignores: ['app/types/grus-api.d.ts'], + rules: { + // Pavo's DataTable names its cell slots item.; the dot is part of the slot name, not a modifier. + 'vue/valid-v-slot': ['error', { allowModifiers: true }], + }, }) From 2ab6cfae0a3f9c7e2954bd7b77243c50354d564d Mon Sep 17 00:00:00 2001 From: TheMeinerLP Date: Wed, 25 Nov 2026 10:23:12 +0100 Subject: [PATCH 2/2] refactor(web): restore url sorting, row hooks and placeholders with pavo 0.3 Pavo 0.3.0 adds controlled sorting, server-side ordering, paging switches and row attributes to the data table. Use them to bring back the behaviour the pavo 0.2.0 tables lost: - instances: name and age sort through the sort and dir query parameters again; the page keeps its own ordering (server-sort) - instance, pool instance, event and pool tables render all rows without a footer, as they did before - row data-test hooks (instance-row, pool-row, pool-instance-row, event-row) are set again through row-attrs --- web/app/components/pools/PoolInstanceList.vue | 2 ++ web/app/components/pools/PoolTable.vue | 2 ++ web/app/pages/events/index.vue | 2 ++ web/app/pages/instances/index.vue | 28 ++++++++++++++++--- web/package.json | 2 +- web/pnpm-lock.yaml | 10 +++---- 6 files changed, 36 insertions(+), 10 deletions(-) diff --git a/web/app/components/pools/PoolInstanceList.vue b/web/app/components/pools/PoolInstanceList.vue index 1c18fbe..0d76c24 100644 --- a/web/app/components/pools/PoolInstanceList.vue +++ b/web/app/components/pools/PoolInstanceList.vue @@ -8,6 +8,8 @@ :columns="columns" :items="instances" row-key="id" + :paginate="false" + :row-attrs="() => ({ 'data-test': 'pool-instance-row' })" data-test="pool-instance-table" >