diff --git a/frontend/src/components/admin/LazyDataTable.vue b/frontend/src/components/admin/LazyDataTable.vue index 79e0591b..14c49b06 100644 --- a/frontend/src/components/admin/LazyDataTable.vue +++ b/frontend/src/components/admin/LazyDataTable.vue @@ -4,6 +4,7 @@ import { onMounted, watch, ref, defineExpose, toRef } from "vue"; import { PaginatorResponse } from '@/types/filter/Paginator.ts' import { usePaginator } from '@/composables/filters/paginator.ts'; import { Filter } from "@/types/filter/Filter.ts"; +import Column from "primevue/column"; /* Properties */ const props = defineProps<{ @@ -98,6 +99,7 @@ defineExpose({fetch}) + diff --git a/frontend/src/composables/services/docker.service.ts b/frontend/src/composables/services/docker.service.ts index 869d6528..a15a785d 100644 --- a/frontend/src/composables/services/docker.service.ts +++ b/frontend/src/composables/services/docker.service.ts @@ -3,13 +3,15 @@ import { Response } from "@/types/Response.ts"; import { endpoints } from '@/config/endpoints.ts'; import { type Ref, ref } from "vue"; import { Filter } from "@/types/filter/Filter.ts"; -import { create, getPaginatedList } from "@/composables/services/helpers.ts"; +import {create, getList, getPaginatedList} from "@/composables/services/helpers.ts"; import {PaginatorResponse} from "@/types/filter/Paginator.ts"; interface DockerImagesState { pagination: Ref | null>; + dockerImages: Ref; response: Ref; + getDockerImages: () => Promise; searchDockerImages: (filters: Filter, page: number, pageSize: number) => Promise; createDockerImage: (dockerData: DockerImage, file: File) => Promise; } @@ -17,8 +19,14 @@ interface DockerImagesState { export function useDockerImages(): DockerImagesState { const pagination = ref | null>(null); + const dockerImages = ref(null); const response = ref(null); + async function getDockerImages(): Promise { + const endpoint = endpoints.dockerImages.index; + await getList(endpoint, dockerImages, DockerImage.fromJSON); + } + async function searchDockerImages(filters: Filter, page: number, pageSize: number): Promise { const endpoint = endpoints.dockerImages.search; await getPaginatedList(endpoint, filters, page, pageSize, pagination, DockerImage.fromJSON); @@ -41,8 +49,10 @@ export function useDockerImages(): DockerImagesState { return { pagination, + dockerImages, response, + getDockerImages, searchDockerImages, createDockerImage } diff --git a/frontend/src/types/filter/Filter.ts b/frontend/src/types/filter/Filter.ts index 08effec6..79d4bad2 100644 --- a/frontend/src/types/filter/Filter.ts +++ b/frontend/src/types/filter/Filter.ts @@ -1,4 +1,4 @@ -import { type LocationQuery } from 'vue-router'; +import {type LocationQuery} from 'vue-router'; export type UserFilter = { id: string; @@ -12,6 +12,12 @@ export type CourseFilter = { years: string[]; } & Filter; +export type DockerImageFilter = { + id: string; + name: string; + owner: string; +} & Filter + export interface Filter { search: string; [key: string]: string | string[]; @@ -61,6 +67,15 @@ export function getCourseFilters(query: LocationQuery): CourseFilter { return filters; } +export function getDockerImageFilters(query:LocationQuery): DockerImageFilter { + return { + search: query.search?.toString() ?? '', + id: query.id?.toString() ?? '', + name: query.id?.toString() ?? '', + owner: query.id?.toString() ?? '', + }; +} + /** * Get the query list. * diff --git a/frontend/src/views/admin/DockerImagesView.vue b/frontend/src/views/admin/DockerImagesView.vue index 0a851ca0..02d7b639 100644 --- a/frontend/src/views/admin/DockerImagesView.vue +++ b/frontend/src/views/admin/DockerImagesView.vue @@ -1,5 +1,4 @@