mirror of
https://github.com/lukaszraczylo/gohoarder.git
synced 2026-11-26 06:37:07 +00:00
fix(pypi): key rows on the file name and show the release version
A PyPI row keys on the file name so each file of a release keeps its own cache and storage key. A new release_version column holds the real version and the API and dashboard show it. Startup deletes old sidecar rows with their storage and fills the release version on old file rows, keeping their storage keys. Startup also drops an empty download_events_old table. This replaces the local-version suffix.
This commit is contained in:
@@ -218,4 +218,29 @@ describe('PackageList.vue', () => {
|
||||
const badges = wrapper.findAll('[data-slot="badge"]').map((badge) => badge.text())
|
||||
expect(badges).toEqual(['go', 'npm', 'pypi'])
|
||||
})
|
||||
|
||||
it('shows the release version for a PyPI file row, not the file name', async () => {
|
||||
const wrapper = await mountWithRouter()
|
||||
const store = usePackageStore()
|
||||
|
||||
store.packages = [
|
||||
{
|
||||
id: '1',
|
||||
registry: 'pypi',
|
||||
name: 'six',
|
||||
version: 'six-1.17.0-py2.py3-none-any.whl',
|
||||
release_version: '1.17.0',
|
||||
size: 1,
|
||||
cached_at: '2026-11-23T00:00:00Z',
|
||||
last_accessed: '2026-11-23T00:00:00Z',
|
||||
download_count: 0,
|
||||
},
|
||||
]
|
||||
await wrapper.vm.$nextTick()
|
||||
await wrapper.find('button[aria-expanded]').trigger('click')
|
||||
await wrapper.vm.$nextTick()
|
||||
|
||||
expect(wrapper.text()).toContain('v1.17.0')
|
||||
expect(wrapper.text()).not.toContain('py2.py3-none-any.whl')
|
||||
})
|
||||
})
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
</TableHeader>
|
||||
<TableBody>
|
||||
<TableRow v-for="version in group.versions" :key="version.id">
|
||||
<TableCell label="Version" class="font-medium">{{ withVersionPrefix(version.version) }}</TableCell>
|
||||
<TableCell label="Version" class="font-medium">{{ withVersionPrefix(displayVersion(version)) }}</TableCell>
|
||||
<TableCell label="Downloads" numeric>{{ formatNumber(version.download_count) }}</TableCell>
|
||||
<TableCell label="Size" numeric>{{ formatBytes(version.size) }}</TableCell>
|
||||
<TableCell label="Cached">{{ formatDate(version.cached_at) }}</TableCell>
|
||||
@@ -165,7 +165,7 @@ import {
|
||||
useToastStore,
|
||||
} from '@perfect-design/ui'
|
||||
import VulnerabilityBadge from './VulnerabilityBadge.vue'
|
||||
import { formatBytes, formatDate, formatNumber, withVersionPrefix } from '@/lib/format'
|
||||
import { formatBytes, formatDate, formatNumber, displayVersion, withVersionPrefix } from '@/lib/format'
|
||||
import { faBoxOpen, faMagnifyingGlass, faRotateRight, faTrash } from '@/lib/icons'
|
||||
|
||||
// Props from router
|
||||
@@ -207,6 +207,7 @@ const allGroupedPackages = computed(() => {
|
||||
const searchLower = searchTerm.value.toLowerCase()
|
||||
filteredPackages = filteredPackages.filter(pkg =>
|
||||
pkg.name.toLowerCase().includes(searchLower) ||
|
||||
displayVersion(pkg).toLowerCase().includes(searchLower) ||
|
||||
pkg.version.toLowerCase().includes(searchLower)
|
||||
)
|
||||
}
|
||||
|
||||
@@ -126,7 +126,7 @@ import {
|
||||
} from '@perfect-design/ui'
|
||||
import VulnerabilityBadge from './VulnerabilityBadge.vue'
|
||||
import SeveritySummary from './SeveritySummary.vue'
|
||||
import { formatBytes, formatDate, formatNumber, withVersionPrefix } from '@/lib/format'
|
||||
import { formatBytes, formatDate, formatNumber, displayVersion, withVersionPrefix } from '@/lib/format'
|
||||
import { faArrowLeft, faCircleCheck } from '@/lib/icons'
|
||||
import { NO_VULNERABILITIES } from '@/lib/severity'
|
||||
|
||||
@@ -244,7 +244,7 @@ const totalCounts = computed(() =>
|
||||
)
|
||||
|
||||
const versionColumns: DataTableColumn<Package>[] = [
|
||||
{ key: 'version', header: 'Version', rowHeader: true, accessor: (pkg) => withVersionPrefix(pkg.version) },
|
||||
{ key: 'version', header: 'Version', rowHeader: true, accessor: (pkg) => withVersionPrefix(displayVersion(pkg)) },
|
||||
{ key: 'download_count', header: 'Downloads', numeric: true, accessor: (pkg) => formatNumber(pkg.download_count) },
|
||||
{ key: 'size', header: 'Size', numeric: true, accessor: (pkg) => formatBytes(pkg.size) },
|
||||
{ key: 'cached_at', header: 'Cached', accessor: (pkg) => formatDate(pkg.cached_at) },
|
||||
|
||||
Reference in New Issue
Block a user