mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-25 06:35:21 +00:00
The packages and security pages ask for one page of rows instead of the whole cache. Search is debounced, and the filters and sort stay in the URL.
13 lines
574 B
TypeScript
13 lines
574 B
TypeScript
import type { RouteLocationRaw } from 'vue-router'
|
|
import type { Package } from '@/stores/packages'
|
|
import { displayVersion } from '@/lib/format'
|
|
|
|
/** Route of a package's full page. A name with slashes becomes the repeatable `name` segments. */
|
|
export function packageRoute(pkg: Pick<Package, 'registry' | 'name' | 'version'>): RouteLocationRaw {
|
|
return { name: 'package-details', params: { registry: pkg.registry, name: pkg.name.split('/'), version: pkg.version } }
|
|
}
|
|
|
|
export function packageLabel(pkg: Package): string {
|
|
return `${pkg.name} ${displayVersion(pkg)}`
|
|
}
|