Skip to content

Commit 19ed5f4

Browse files
committed
feat: use search endpoint in admin table
1 parent dc5a4ae commit 19ed5f4

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

components/Dataservices/AdminDataservicesPage.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,8 @@ function sort(column: DataserviceSortedBy, newDirection: SortDirection) {
126126
direction.value = newDirection
127127
}
128128
129+
const apiUrl = computed(() => qDebounced.value ? '/api/2/dataservices/search/' : '/api/1/dataservices/')
130+
129131
const params = computed(() => {
130132
return {
131133
organization: props.organization?.id,
@@ -138,7 +140,7 @@ const params = computed(() => {
138140
}
139141
})
140142
141-
const { data: pageData, status, refresh } = await useAPI<PaginatedArray<Dataservice>>('/api/1/dataservices/', { lazy: true, query: params })
143+
const { data: pageData, status, refresh } = await useAPI<PaginatedArray<Dataservice>>(apiUrl, { lazy: true, query: params })
142144
143145
watchEffect(async () => {
144146
if (pageData.value) {

components/Datasets/AdminDatasetsPage.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,8 @@ function resetFilters() {
170170
datasetsStatus.value = null
171171
}
172172
173+
const apiUrl = computed(() => qDebounced.value && !datasetsStatus.value ? '/api/2/datasets/search/' : '/api/2/datasets/')
174+
173175
const params = computed(() => {
174176
const query: {
175177
organization: string | undefined
@@ -211,7 +213,7 @@ const params = computed(() => {
211213
return query
212214
})
213215
214-
const { data: pageData, status, refresh } = await useAPI<PaginatedArray<DatasetV2>>('/api/2/datasets/', { lazy: true, query: params })
216+
const { data: pageData, status, refresh } = await useAPI<PaginatedArray<DatasetV2>>(apiUrl, { lazy: true, query: params })
215217
216218
watchEffect(async () => {
217219
if (pageData.value) {

components/Reuses/AdminReusesPage.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ function sort(column: ReuseSortedBy, newDirection: SortDirection) {
118118
direction.value = newDirection
119119
}
120120
121+
const apiUrl = computed(() => qDebounced.value ? '/api/2/reuses/search/' : '/api/1/reuses/')
122+
121123
const params = computed(() => {
122124
return {
123125
organization: props.organization?.id,
@@ -130,7 +132,7 @@ const params = computed(() => {
130132
}
131133
})
132134
133-
const { data: pageData, status, refresh } = await useAPI<PaginatedArray<Reuse>>('/api/1/reuses/', { lazy: true, query: params })
135+
const { data: pageData, status, refresh } = await useAPI<PaginatedArray<Reuse>>(apiUrl, { lazy: true, query: params })
134136
135137
watchEffect(async () => {
136138
if (pageData.value) {

pages/admin/site/organizations.vue

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,8 @@ const q = ref('')
192192
const qDebounced = refDebounced(q, config.public.searchDebounce)
193193
194194
const url = computed(() => {
195-
const url = new URL(`/api/1/organizations`, config.public.apiBase)
195+
const baseEndpoint = qDebounced.value ? '/api/2/organizations/search/' : '/api/1/organizations'
196+
const url = new URL(baseEndpoint, config.public.apiBase)
196197
197198
url.searchParams.set('deleted', 'true')
198199
url.searchParams.set('sort', sortDirection.value)

0 commit comments

Comments
 (0)