diff --git a/package-lock.json b/package-lock.json index a3f4f520a..7d33716bc 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,6 +12,7 @@ "@datagouv/components": "^1.3.0", "@datagouv/select-a11y": "^3.6.1", "@gouvfr/dsfr": "~1.11.2", + "@vueuse/router": "^11.0.3", "leaflet": "^1.9.4" }, "devDependencies": { @@ -8610,6 +8611,60 @@ "url": "https://github.com/sponsors/antfu" } }, + "node_modules/@vueuse/router": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@vueuse/router/-/router-11.0.3.tgz", + "integrity": "sha512-Sa8wNATd4DoAWkO5NgV+sfTU9dOtC8pi+GEbtzOdC7/99fWK8k5/dfbfkt+OWcpwXoToNidBqnAZafknlYb2ig==", + "license": "MIT", + "dependencies": { + "@vueuse/shared": "11.0.3", + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "vue-router": ">=4.0.0-rc.1" + } + }, + "node_modules/@vueuse/router/node_modules/@vueuse/shared": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.0.3.tgz", + "integrity": "sha512-0rY2m6HS5t27n/Vp5cTDsKTlNnimCqsbh/fmT2LgE+aaU42EMfXo8+bNX91W9I7DDmxfuACXMmrd7d79JxkqWA==", + "license": "MIT", + "dependencies": { + "vue-demi": ">=0.14.10" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + } + }, + "node_modules/@vueuse/router/node_modules/vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "hasInstallScript": true, + "license": "MIT", + "bin": { + "vue-demi-fix": "bin/vue-demi-fix.js", + "vue-demi-switch": "bin/vue-demi-switch.js" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/antfu" + }, + "peerDependencies": { + "@vue/composition-api": "^1.0.0-rc.1", + "vue": "^3.0.0-0 || ^2.6.0" + }, + "peerDependenciesMeta": { + "@vue/composition-api": { + "optional": true + } + } + }, "node_modules/@vueuse/shared": { "version": "10.5.0", "dev": true, @@ -28188,6 +28243,31 @@ "version": "10.5.0", "dev": true }, + "@vueuse/router": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@vueuse/router/-/router-11.0.3.tgz", + "integrity": "sha512-Sa8wNATd4DoAWkO5NgV+sfTU9dOtC8pi+GEbtzOdC7/99fWK8k5/dfbfkt+OWcpwXoToNidBqnAZafknlYb2ig==", + "requires": { + "@vueuse/shared": "11.0.3", + "vue-demi": ">=0.14.10" + }, + "dependencies": { + "@vueuse/shared": { + "version": "11.0.3", + "resolved": "https://registry.npmjs.org/@vueuse/shared/-/shared-11.0.3.tgz", + "integrity": "sha512-0rY2m6HS5t27n/Vp5cTDsKTlNnimCqsbh/fmT2LgE+aaU42EMfXo8+bNX91W9I7DDmxfuACXMmrd7d79JxkqWA==", + "requires": { + "vue-demi": ">=0.14.10" + } + }, + "vue-demi": { + "version": "0.14.10", + "resolved": "https://registry.npmjs.org/vue-demi/-/vue-demi-0.14.10.tgz", + "integrity": "sha512-nMZBOwuzabUO0nLgIcc6rycZEebF6eeUfaiQx9+WSk8e29IbLvPU9feI6tqW4kTo3hvoYAJkMh8n8D0fuISphg==", + "requires": {} + } + } + }, "@vueuse/shared": { "version": "10.5.0", "dev": true, diff --git a/package.json b/package.json index 4ff82eb71..9dfdacfff 100644 --- a/package.json +++ b/package.json @@ -108,6 +108,7 @@ "@datagouv/components": "^1.3.0", "@datagouv/select-a11y": "^3.6.1", "@gouvfr/dsfr": "~1.11.2", + "@vueuse/router": "^11.0.3", "leaflet": "^1.9.4" }, "msw": { diff --git a/udata_front/theme/gouvfr/assets/js/api/types.ts b/udata_front/theme/gouvfr/assets/js/api/types.ts new file mode 100644 index 000000000..fc92d66c7 --- /dev/null +++ b/udata_front/theme/gouvfr/assets/js/api/types.ts @@ -0,0 +1,8 @@ +export type PaginatedArray = { + data: Array; + next_page: string | null; + page: number; + page_size: number; + previous_page: string | null; + total: number; +}; \ No newline at end of file diff --git a/udata_front/theme/gouvfr/assets/js/components/DataservicesSearch/DataservicesSearch.stories.ts b/udata_front/theme/gouvfr/assets/js/components/DataservicesSearch/DataservicesSearch.stories.ts new file mode 100644 index 000000000..f7be5624c --- /dev/null +++ b/udata_front/theme/gouvfr/assets/js/components/DataservicesSearch/DataservicesSearch.stories.ts @@ -0,0 +1,23 @@ +import { withActions } from '@storybook/addon-actions/decorator'; +import type { Meta, StoryObj } from '@storybook/vue3'; +import DataservicesSearch from './DataservicesSearch.vue'; + +const meta = { + title: 'Components/DataservicesSearch', + component: DataservicesSearch, + decorators: [withActions], + args: {}, +} satisfies Meta; + +export default meta; + +export const DataservicesSearchExample: StoryObj = { + render: (args) => ({ + components: { DataservicesSearch }, + setup() { + return { args }; + }, + template: '', + }), + args: {}, +}; diff --git a/udata_front/theme/gouvfr/assets/js/components/DataservicesSearch/DataservicesSearch.vue b/udata_front/theme/gouvfr/assets/js/components/DataservicesSearch/DataservicesSearch.vue new file mode 100644 index 000000000..a105aa8fd --- /dev/null +++ b/udata_front/theme/gouvfr/assets/js/components/DataservicesSearch/DataservicesSearch.vue @@ -0,0 +1,493 @@ + + + diff --git a/udata_front/theme/gouvfr/assets/js/components/Form/ActionCard/ActionCard.vue b/udata_front/theme/gouvfr/assets/js/components/Form/ActionCard/ActionCard.vue index 3ea144c2b..528bf27aa 100644 --- a/udata_front/theme/gouvfr/assets/js/components/Form/ActionCard/ActionCard.vue +++ b/udata_front/theme/gouvfr/assets/js/components/Form/ActionCard/ActionCard.vue @@ -55,7 +55,6 @@ export default defineComponent({ }, content: { type: String, - required: true, }, type: { type: String, diff --git a/udata_front/theme/gouvfr/assets/js/index.ts b/udata_front/theme/gouvfr/assets/js/index.ts index 45638ecc5..98accf406 100644 --- a/udata_front/theme/gouvfr/assets/js/index.ts +++ b/udata_front/theme/gouvfr/assets/js/index.ts @@ -36,6 +36,7 @@ import EventBus from "./plugins/eventbus.ts"; import Auth from "./plugins/auth.ts"; import InitSentry from "./sentry.ts"; import ReportModalButton from "./components/Report/ReportModalButton.vue"; +import DataservicesSearch from "./components/DataservicesSearch/DataservicesSearch.vue"; setupComponents({ admin_root, @@ -82,6 +83,7 @@ const configAndMountApp = (el: HTMLElement) => { app.component("owner-type-icon", OwnerTypeIcon); app.component("publishing-form", PublishingForm); app.component("search", Search); + app.component("dataservices-search", DataservicesSearch); app.component("toggletip", Toggletip); app.component("user-dataset-list", UserDatasetList); app.component("user-reuse-list", UserReuseList); diff --git a/udata_front/theme/gouvfr/templates/dataservice/list.html b/udata_front/theme/gouvfr/templates/dataservice/list.html new file mode 100644 index 000000000..c61fd4028 --- /dev/null +++ b/udata_front/theme/gouvfr/templates/dataservice/list.html @@ -0,0 +1,82 @@ +{% extends theme("layouts/1-column.html") %} +{% from theme('macros/paginator.html') import paginator with context %} +{% from theme('macros/sort_search.html') import sort_search %} + +{% block breadcrumb %} +
  • + + {{ _('Datasets') }} + +
  • +{% endblock %} + +{% set meta = { + 'title': _('Datasets'), + 'description': _("%(site)s dataset search", site=config['SITE_TITLE']), + 'keywords': [_('search'), _('datasets')], + 'robots': 'noindex', +} %} + +{% set bundle = 'search' %} + +{% set sorts = [ + {"label": _('Creation date'),"value": "created", "order": "desc"}, + {"label": _('Last update'),"value": "last_update", "order": "desc"}, + {"label": _('Number of followers'),"value": "followers", "order": "desc"}, + {"label": _('Number of reuses'), "value": "reuses", "order": "desc"} +] %} + +{% block main_content %} + +{% endblock %}