diff --git a/frontend/src/routes/(app)/libraries/+page.server.ts b/frontend/src/routes/(app)/libraries/+page.server.ts index 5ee001177..54bfa5aaf 100644 --- a/frontend/src/routes/(app)/libraries/+page.server.ts +++ b/frontend/src/routes/(app)/libraries/+page.server.ts @@ -9,13 +9,13 @@ import { urlParamModelVerboseName } from '$lib/utils/crud'; import { z } from 'zod'; import { tableSourceMapper } from '@skeletonlabs/skeleton'; import { listViewFields } from '$lib/utils/table'; -import type { urlModel } from '$lib/utils/types'; +import type { Library, urlModel } from '$lib/utils/types'; export const load = (async ({ fetch }) => { const endpoint = `${BASE_API_URL}/libraries/`; const res = await fetch(endpoint); - const libraries = await res.json().then((res) => res.results); + const libraries: Library[] = await res.json().then((res) => res.results); function countObjects(library: Library) { let result: { [key: string]: any } = new Object(); @@ -41,6 +41,7 @@ export const load = (async ({ fetch }) => { `Packager: ${row.packager}`, ...Object.entries(countObjects(row)).map(([key, value]) => `${key}: ${value}`) ]; + row.preventDelete = (row.reference_count && row.reference_count > 0) ?? false; }); const headData: Record = listViewFields['libraries' as urlModel].body.reduce(