diff --git a/web/app/components/pools/PoolInstanceList.vue b/web/app/components/pools/PoolInstanceList.vue index 883ab1a..0d76c24 100644 --- a/web/app/components/pools/PoolInstanceList.vue +++ b/web/app/components/pools/PoolInstanceList.vue @@ -3,32 +3,31 @@

{{ $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 +39,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..7e81361 100644 --- a/web/app/pages/events/index.vue +++ b/web/app/pages/events/index.vue @@ -39,47 +39,45 @@ {{ 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 +100,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..84fae22 100644 --- a/web/app/pages/instances/index.vue +++ b/web/app/pages/instances/index.vue @@ -11,68 +11,54 @@ - - + + -
- - - - - - - - - - - - - - - - - - - - - -
- - {{ $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) ?? '' }}
-
+ + + + + + + @@ -81,6 +67,7 @@ import { instancesApi } from '~/lib/api/instances' import type { Instance } from '~/lib/grus' import { applyInstanceEvent, filterInstances, formatAge, sortInstances } from '~/lib/instances/list' +import type { SortKey } from '~/lib/instances/list' import { parseInstanceQuery, toInstanceRouteQuery } from '~/lib/instances/query' import type { InstanceListQuery } from '~/lib/instances/query' import { INSTANCE_STATES } from '~/lib/states' @@ -89,7 +76,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 +87,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}`) })), +]) + +// Name and age sort through the URL (sort, dir); the page sorts the rows itself, so the table keeps their order. +const columns = computed(() => [ + { key: 'name', 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') }, +]) // "now" is only known in the browser; SSR renders no ages to avoid a hydration mismatch. const now = ref(null) @@ -133,19 +138,15 @@ 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' }) +// The table emits the column key and then the direction on every header click. The table cycles through +// "unsorted" as well; this page never shows that state, so an empty key keeps the current column (ascending). +let requestedSort: string | undefined +function onSortBy(key: string) { + requestedSort = key } - -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' ? ' ▲' : ' ▼' +function onSortDesc(desc: boolean) { + const sort = requestedSort || query.value.sort + requestedSort = undefined + update({ sort: sort as SortKey, dir: desc ? 'desc' : '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 }], + }, }) diff --git a/web/package.json b/web/package.json index 32ca4c1..cdf84e7 100644 --- a/web/package.json +++ b/web/package.json @@ -21,7 +21,7 @@ "dependencies": { "@mdi/js": "^7.4.47", "@nuxtjs/i18n": "^10.6.0", - "@onelitefeathernet/pavo": "^0.2.0", + "@onelitefeathernet/pavo": "^0.3.0", "nuxt": "^4.7.0", "vue": "^3.5.46" }, diff --git a/web/pnpm-lock.yaml b/web/pnpm-lock.yaml index f688cce..c98da29 100644 --- a/web/pnpm-lock.yaml +++ b/web/pnpm-lock.yaml @@ -15,8 +15,8 @@ importers: specifier: ^10.6.0 version: 10.6.0(@nuxt/schema@4.7.0)(@vue/compiler-dom@3.5.46)(db0@0.3.4)(dotenv@17.4.2)(esbuild@0.28.2)(giget@3.3.1)(jiti@2.7.0)(rolldown@1.2.19)(rollup@4.68.8)(typescript@5.9.3)(vite@8.3.8(@types/node@26.6.9)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.4)(yaml@2.9.1))(vue@3.5.46(typescript@5.9.3)) '@onelitefeathernet/pavo': - specifier: ^0.2.0 - version: 0.2.0(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.5)(mlly@1.8.2)(oxc-parser@0.141.0)(rolldown@1.2.19)(tailwindcss@4.3.5)(unplugin@3.7.0(esbuild@0.28.2)(rolldown@1.2.19)(rollup@4.68.8)(vite@8.3.8(@types/node@26.6.9)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.4)(yaml@2.9.1)))(vue@3.5.46(typescript@5.9.3)) + specifier: ^0.3.0 + version: 0.3.0(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.5)(mlly@1.8.2)(oxc-parser@0.141.0)(rolldown@1.2.19)(tailwindcss@4.3.5)(unplugin@3.7.0(esbuild@0.28.2)(rolldown@1.2.19)(rollup@4.68.8)(vite@8.3.8(@types/node@26.6.9)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.4)(yaml@2.9.1)))(vue@3.5.46(typescript@5.9.3)) nuxt: specifier: ^4.7.0 version: 4.7.0(@babel/plugin-syntax-jsx@7.29.7(@babel/core@7.29.13))(@babel/plugin-syntax-typescript@7.29.7(@babel/core@7.29.13))(@oxc-project/types@0.156.0)(@types/node@26.6.9)(@vue/compiler-sfc@3.5.46)(acorn@8.19.0)(bare-buffer@3.7.3)(confbox@0.2.4)(db0@0.3.4)(dotenv@17.4.2)(esbuild@0.28.2)(eslint@10.15.0(jiti@2.7.0))(giget@3.3.1)(lightningcss@1.33.0)(mlly@1.8.2)(optionator@0.9.4)(oxc-parser@0.141.0)(rolldown@1.2.19)(rollup-plugin-visualizer@7.3.0(rolldown@1.2.19)(rollup@4.68.8))(rollup@4.68.8)(srvx@1.0.8)(terser@5.51.4)(typescript@5.9.3)(vite@8.3.8(@types/node@26.6.9)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.4)(yaml@2.9.1))(vue-tsc@3.3.14(typescript@5.9.3))(yaml@2.9.1) @@ -1016,8 +1016,8 @@ packages: '@one-ini/wasm@0.2.1': resolution: {integrity: sha512-TUqERXGNTifZ9y2g3wPxQrw3HpHv/02DsW3D90T9x0hhonrL1ZqpSmNrU2XkoIq0fP1N6gZfVQzy2Fw1ZvGBNg==} - '@onelitefeathernet/pavo@0.2.0': - resolution: {integrity: sha512-nxM4iP7DypN+E5RtJ7LmyfTXZjTcKCtnH6RfgiecTWuhoppuEEKZ9ivKTjrEOzLK9OpXHZEC3oXcMAv03fD0Hw==, tarball: https://npm.pkg.github.com/download/@onelitefeathernet/pavo/0.2.0/fb8e97d327d1f174185837eec3cbe645f4fb0e21} + '@onelitefeathernet/pavo@0.3.0': + resolution: {integrity: sha512-/a6eYcbnNTytzFcKCvhevJa082pcv8H8jSAAuw4iRwKmVDvYqq5OXbUBf6SIc7MIkvAOEz+GjDZ3tY6Hv2IAWQ==, tarball: https://npm.pkg.github.com/download/@onelitefeathernet/pavo/0.3.0/309903b17e4dc9fc544d3c0545af5bcab93c6460} hasBin: true peerDependencies: tailwindcss: ^4.3.5 @@ -6017,7 +6017,7 @@ snapshots: '@one-ini/wasm@0.2.1': {} - '@onelitefeathernet/pavo@0.2.0(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.5)(mlly@1.8.2)(oxc-parser@0.141.0)(rolldown@1.2.19)(tailwindcss@4.3.5)(unplugin@3.7.0(esbuild@0.28.2)(rolldown@1.2.19)(rollup@4.68.8)(vite@8.3.8(@types/node@26.6.9)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.4)(yaml@2.9.1)))(vue@3.5.46(typescript@5.9.3))': + '@onelitefeathernet/pavo@0.3.0(confbox@0.2.4)(dotenv@17.4.2)(giget@3.3.1)(jiti@2.7.0)(magic-string@1.4.5)(mlly@1.8.2)(oxc-parser@0.141.0)(rolldown@1.2.19)(tailwindcss@4.3.5)(unplugin@3.7.0(esbuild@0.28.2)(rolldown@1.2.19)(rollup@4.68.8)(vite@8.3.8(@types/node@26.6.9)(esbuild@0.28.2)(jiti@2.7.0)(terser@5.51.4)(yaml@2.9.1)))(vue@3.5.46(typescript@5.9.3))': dependencies: '@fontsource/roboto': 5.3.0 '@material/material-color-utilities': 0.3.0