|
185 | 185 | > |
186 | 186 | {{ t("{count} résultats | {count} résultat | {count} résultats", searchResults.total) }} |
187 | 187 | </p> |
188 | | - <div class="fr-col-auto fr-grid-row fr-grid-row--middle"> |
189 | | - <label |
190 | | - for="sort-search" |
191 | | - class="fr-col-auto text-sm m-0 mr-2" |
192 | | - > |
193 | | - {{ t('Trier par :') }} |
194 | | - </label> |
195 | | - <div class="fr-col"> |
196 | | - <select |
197 | | - id="sort-search" |
198 | | - v-model="searchSort" |
199 | | - class="fr-select !shadow-input-blue" |
200 | | - name="sort" |
201 | | - @change="currentPage = 1" |
| 188 | + <div class="fr-col-auto fr-grid-row fr-grid-row--middle gap-4"> |
| 189 | + <div class="fr-grid-row fr-grid-row--middle"> |
| 190 | + <label |
| 191 | + for="sort-search" |
| 192 | + class="fr-col-auto text-sm m-0 mr-2" |
202 | 193 | > |
203 | | - <option value=""> |
204 | | - {{ t('Pertinence') }} |
205 | | - </option> |
206 | | - <option |
207 | | - v-for="{ value, label } in sortOptions" |
208 | | - :key="label" |
209 | | - :value="value" |
| 194 | + {{ t('Trier par :') }} |
| 195 | + </label> |
| 196 | + <div class="fr-col"> |
| 197 | + <select |
| 198 | + id="sort-search" |
| 199 | + v-model="searchSort" |
| 200 | + class="fr-select !shadow-input-blue" |
| 201 | + name="sort" |
| 202 | + @change="currentPage = 1" |
210 | 203 | > |
211 | | - {{ label }} |
212 | | - </option> |
213 | | - </select> |
| 204 | + <option value=""> |
| 205 | + {{ t('Pertinence') }} |
| 206 | + </option> |
| 207 | + <option |
| 208 | + v-for="{ value, label } in sortOptions" |
| 209 | + :key="label" |
| 210 | + :value="value" |
| 211 | + > |
| 212 | + {{ label }} |
| 213 | + </option> |
| 214 | + </select> |
| 215 | + </div> |
214 | 216 | </div> |
| 217 | + <BrandedButton |
| 218 | + :href="atomFeedUrl" |
| 219 | + :icon="RiRssLine" |
| 220 | + :title="t('Flux Atom de cette recherche')" |
| 221 | + color="secondary" |
| 222 | + size="sm" |
| 223 | + external |
| 224 | + /> |
215 | 225 | </div> |
216 | 226 | </div> |
217 | 227 | <transition mode="out-in"> |
|
284 | 294 | import { BrandedButton, getLink, getOrganizationTypes, LoadingBlock, Pagination, OTHER, USER, toast } from '@datagouv/components-next' |
285 | 295 | import type { DatasetV2, License, Organization, OrganizationTypes, RegisteredSchema, TranslatedBadge, OrganizationOrSuggest } from '@datagouv/components-next' |
286 | 296 | import { ref, computed, type Component } from 'vue' |
287 | | -import { RiCloseCircleLine, RiDownloadLine } from '@remixicon/vue' |
| 297 | +import { RiCloseCircleLine, RiDownloadLine, RiRssLine } from '@remixicon/vue' |
288 | 298 | import { computedAsync, debouncedRef, useUrlSearchParams } from '@vueuse/core' |
289 | 299 | import SearchInput from '~/components/Search/SearchInput.vue' |
290 | 300 | import type { PaginatedArray, SpatialGranularity, SpatialZone, Tag } from '~/types/types' |
@@ -317,10 +327,16 @@ const params = useUrlSearchParams<DatasetSearchParams>('history', { |
317 | 327 | removeFalsyValues: true, |
318 | 328 | }) |
319 | 329 |
|
320 | | -const nonFalsyParams = computed(() => { |
| 330 | +const nonFalsyParams = computed<DatasetSearchParams>(() => { |
321 | 331 | const filteredParams = Object.entries(toValue(params)).filter(([_k, v]) => v) |
322 | 332 | const propsParams = props.organization ? { organization: props.organization.id } : {} |
323 | | - return { ...propsParams, ...Object.fromEntries(filteredParams), page_size: pageSize } |
| 333 | + return { ...propsParams, ...Object.fromEntries(filteredParams) as DatasetSearchParams, page_size: pageSize.toFixed(0) } |
| 334 | +}) |
| 335 | +
|
| 336 | +const atomFeedUrl = computed(() => { |
| 337 | + const { page, page_size, ...feedParams } = nonFalsyParams.value |
| 338 | + const query = new URLSearchParams(feedParams).toString() |
| 339 | + return `${config.public.apiBase}/api/1/datasets/recent.atom${query ? `?${query}` : ''}` |
324 | 340 | }) |
325 | 341 |
|
326 | 342 | const { data: searchResults, status: searchResultsStatus, refresh } = await useAPI<PaginatedArray<DatasetV2>>('/api/2/datasets/search/', { |
|
0 commit comments