Skip to content

Commit

Permalink
migrate: bouquets to main components, views, utils and services (#502)
Browse files Browse the repository at this point in the history
* migrate: bouquets to main components, views, utils and services

* delete unused BouquetDatasetListExport

---------

Co-authored-by: Alexandre Bulté <[email protected]>
  • Loading branch information
geoffreyaldebert and abulte authored Aug 12, 2024
1 parent 5f59221 commit 2c9a4c3
Show file tree
Hide file tree
Showing 26 changed files with 67 additions and 235 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@ import { NoOptionSelected } from '@/model/theme'
import type { Topic } from '@/model/topic'
import { stripFromMarkdown } from '@/utils'
import { getOwnerAvatar } from '@/utils/avatar'
import { useExtras } from '@/utils/bouquet'
import { useSpatialCoverage } from '@/utils/spatial'
import { getThemeColor, getThemeTextColor } from '@/utils/theme'
import { useExtras } from '../utils/bouquet'
const props = defineProps({
bouquet: {
type: Object as () => Topic,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { DatasetProperties } from '@/model/topic'
import { isAvailable } from '../utils/bouquet'
import { isAvailable } from '@/utils/bouquet'
defineProps({
datasetProperties: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
import { computed, ref, defineModel, type Ref } from 'vue'
import { VueDraggableNext as draggable } from 'vue-draggable-next'
import DatasetEditModal, {
type DatasetEditModalType
} from '@/components/forms/dataset/DatasetEditModal.vue'
import config from '@/config'
import { isAvailable } from '@/custom/ecospheres/utils/bouquet'
import { type DatasetProperties } from '@/model/topic'
import { fromMarkdown } from '@/utils'
import { isAvailable } from '@/utils/bouquet'
import BouquetDatasetAccordionTitle from './BouquetDatasetAccordionTitle.vue'
import BouquetDatasetCard from './BouquetDatasetCard.vue'
import DatasetEditModal, {
type DatasetEditModalType
} from './forms/dataset/DatasetEditModal.vue'
const datasets = defineModel({
type: Array<DatasetProperties>,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<script setup lang="ts">
import type { DatasetProperties } from '@/model/topic'
import { exportDatasets } from '../services/export'
import { exportDatasets } from '@/services/export'
const props = defineProps({
filename: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@ import { computed, onMounted } from 'vue'
import { useLoading } from 'vue-loading-overlay'
import { useRouter, useRoute, type LocationQueryRaw } from 'vue-router'
import BouquetCard from '@/components/bouquets/BouquetCard.vue'
import { NoOptionSelected } from '@/model/theme'
import type { Topic } from '@/model/topic'
import { useTopicStore } from '@/store/TopicStore'
import BouquetCard from '../components/BouquetCard.vue'
const router = useRouter()
const route = useRoute()
const topicStore = useTopicStore()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,13 @@
import { ref, watchEffect, toRef, type Ref, type PropType } from 'vue'
import { useRouter, useRoute, type LocationQueryRaw } from 'vue-router'
import SelectSpatialCoverage from '@/components/forms/SelectSpatialCoverage.vue'
import type { SpatialCoverage } from '@/model/spatial'
import { NoOptionSelected } from '@/model/theme'
import SpatialAPI from '@/services/api/SpatialAPI'
import { useUserStore } from '@/store/UserStore'
import { useThemeOptions } from '@/utils/theme'
import SelectSpatialCoverage from './forms/SelectSpatialCoverage.vue'
const spatialAPI = new SpatialAPI()
const props = defineProps({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import { toast } from 'vue3-toastify'
import { useLoading } from 'vue-loading-overlay'
import Tooltip from '@/components/TooltipWrapper.vue'
import DatasetPropertiesTextFields from '@/components/forms/dataset/DatasetPropertiesTextFields.vue'
import { Availability, type DatasetProperties, type Topic } from '@/model/topic'
import { useTopicStore } from '@/store/TopicStore'
import DatasetPropertiesTextFields from '../forms/dataset/DatasetPropertiesTextFields.vue'
const props = defineProps({
show: {
type: Boolean,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<script setup lang="ts">
import { defineModel, computed, ref, onMounted, watch } from 'vue'
import { updateEcospheresExtras } from '@/custom/ecospheres/utils/bouquet'
import type { SpatialCoverage } from '@/model/spatial'
import { NoOptionSelected } from '@/model/theme'
import type { Topic } from '@/model/topic'
import { updateEcospheresExtras } from '@/utils/bouquet'
import { useSpatialCoverage } from '@/utils/spatial'
import { useThemeOptions } from '@/utils/theme'
Expand Down
8 changes: 2 additions & 6 deletions src/custom/defis/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ export const routes = [
path: '',
name: 'bouquets',
component: async () =>
await import(
'@/custom/ecospheres/views/bouquets/BouquetsListView.vue'
),
await import('@/views/bouquets/BouquetsListView.vue'),
props: (route: RouteLocationNormalizedLoaded) => ({
query: route.query.q
})
Expand All @@ -22,9 +20,7 @@ export const routes = [
bouquetId: route.params.bid
}),
component: async () =>
await import(
'@/custom/ecospheres/views/bouquets/BouquetDetailView.vue'
)
await import('@/views/bouquets/BouquetDetailView.vue')
}
]
}
Expand Down
49 changes: 0 additions & 49 deletions src/custom/ecospheres/routes.ts
Original file line number Diff line number Diff line change
@@ -1,56 +1,7 @@
import type { RouteLocationNormalizedLoaded } from 'vue-router'

export const routes = [
{
path: '/',
name: 'home',
component: async () => await import('./views/HomeView.vue')
},
{
path: '/bouquets',
children: [
{
path: '',
name: 'bouquets',
component: async () =>
await import(
'@/custom/ecospheres/views/bouquets/BouquetsListView.vue'
),
props: (route: RouteLocationNormalizedLoaded) => ({
query: route.query.q,
subtheme: route.query.subtheme,
theme: route.query.theme,
geozone: route.query.geozone,
drafts: route.query.drafts
})
},
{
path: ':bid',
name: 'bouquet_detail',
props: (route: RouteLocationNormalizedLoaded) => ({
bouquetId: route.params.bid
}),
component: async () =>
await import(
'@/custom/ecospheres/views/bouquets/BouquetDetailView.vue'
)
}
]
},
{
path: `/admin/bouquets/add`,
name: 'bouquet_add',
component: async () =>
await import('@/custom/ecospheres/views/bouquets/BouquetFormView.vue'),
meta: { requiresAuth: true },
props: { isCreate: true }
},
{
path: `/admin/bouquets/edit/:bid`,
name: 'bouquet_edit',
component: async () =>
await import('@/custom/ecospheres/views/bouquets/BouquetFormView.vue'),
meta: { requiresAuth: true },
props: { isCreate: false }
}
]
47 changes: 41 additions & 6 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,6 @@ const defaultRoutes: RouteRecordRaw[] = [
}
]
},
// topics
{
path: '/topics',
name: 'topics',
component: async () => await import('@/views/topics/TopicsListView.vue')
},
// organizations
{
path: '/organizations',
Expand All @@ -69,6 +63,47 @@ const defaultRoutes: RouteRecordRaw[] = [
}
]
},
{
path: '/bouquets',
children: [
{
path: '',
name: 'bouquets',
component: async () =>
await import('@/views/bouquets/BouquetsListView.vue'),
props: (route: RouteLocationNormalizedLoaded) => ({
query: route.query.q,
subtheme: route.query.subtheme,
theme: route.query.theme,
geozone: route.query.geozone,
drafts: route.query.drafts
})
},
{
path: ':bid',
name: 'bouquet_detail',
props: (route: RouteLocationNormalizedLoaded) => ({
bouquetId: route.params.bid
}),
component: async () =>
await import('@/views/bouquets/BouquetDetailView.vue')
}
]
},
{
path: `/admin/bouquets/add`,
name: 'bouquet_add',
component: async () => await import('@/views/bouquets/BouquetFormView.vue'),
meta: { requiresAuth: true },
props: { isCreate: true }
},
{
path: `/admin/bouquets/edit/:bid`,
name: 'bouquet_edit',
component: async () => await import('@/views/bouquets/BouquetFormView.vue'),
meta: { requiresAuth: true },
props: { isCreate: false }
},
// technical pages
{
path: '/404',
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,22 @@ import DiscussionsList from '@/components/DiscussionsList.vue'
import GenericContainer from '@/components/GenericContainer.vue'
import OrganizationLogo from '@/components/OrganizationLogo.vue'
import ReusesList from '@/components/ReusesList.vue'
import BouquetDatasetList from '@/components/bouquets/BouquetDatasetList.vue'
import BouquetDatasetListExport from '@/components/bouquets/BouquetDatasetListExport.vue'
import config from '@/config'
import BouquetDatasetList from '@/custom/ecospheres/components/BouquetDatasetList.vue'
import {
useBreadcrumbLinksForTopic,
useExtras,
updateEcospheresExtras
} from '@/custom/ecospheres/utils/bouquet'
import { type Topic } from '@/model/topic'
import { useTopicStore } from '@/store/TopicStore'
import { useUserStore } from '@/store/UserStore'
import { descriptionFromMarkdown, formatDate } from '@/utils'
import { getOwnerAvatar } from '@/utils/avatar'
import {
useBreadcrumbLinksForTopic,
useExtras,
updateEcospheresExtras
} from '@/utils/bouquet'
import { useSpatialCoverage } from '@/utils/spatial'
import { getThemeTextColor, getThemeColor } from '@/utils/theme'
import BouquetDatasetListExport from '../../components/BouquetDatasetListExport.vue'
const props = defineProps({
bouquetId: {
type: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@ import { useLoading } from 'vue-loading-overlay'
import { useRouter } from 'vue-router'
import GenericContainer from '@/components/GenericContainer.vue'
import BouquetForm from '@/components/forms/bouquet/BouquetForm.vue'
import BouquetOwnerForm from '@/components/forms/bouquet/BouquetOwnerForm.vue'
import config from '@/config'
import { cloneTopic } from '@/custom/ecospheres/utils/bouquet'
import { NoOptionSelected } from '@/model/theme'
import type { TopicPostData } from '@/model/topic'
import { useRouteParamsAsString, useRouteQueryAsString } from '@/router/utils'
import { useTopicStore } from '@/store/TopicStore'
import BouquetForm from '../../components/forms/bouquet/BouquetForm.vue'
import BouquetOwnerForm from '../../components/forms/bouquet/BouquetOwnerForm.vue'
import { cloneTopic } from '@/utils/bouquet'
const props = defineProps({
isCreate: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { ref, computed, watch, type Ref } from 'vue'
import { useRoute, useRouter } from 'vue-router'
import GenericContainer from '@/components/GenericContainer.vue'
import BouquetList from '@/custom/ecospheres/components/BouquetList.vue'
import BouquetSearch from '@/custom/ecospheres/components/BouquetSearch.vue'
import BouquetList from '@/components/bouquets/BouquetList.vue'
import BouquetSearch from '@/components/bouquets/BouquetSearch.vue'
import type { BreadcrumbItem } from '@/model/breadcrumb'
import { NoOptionSelected } from '@/model/theme'
Expand Down
2 changes: 1 addition & 1 deletion src/views/datasets/DatasetDetailView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import { computed, onMounted, ref, watch } from 'vue'
import { useLoading } from 'vue-loading-overlay'
import GenericContainer from '@/components/GenericContainer.vue'
import DatasetAddToBouquetModal from '@/components/datasets/DatasetAddToBouquetModal.vue'
import config from '@/config'
import DatasetAddToBouquetModal from '@/custom/ecospheres/components/datasets/DatasetAddToBouquetModal.vue'
import ChartData from '../../components/ChartData.vue'
import DiscussionsList from '../../components/DiscussionsList.vue'
Expand Down
Loading

0 comments on commit 2c9a4c3

Please sign in to comment.