From 56d44287120df80233adf44037d11a58b1d13e68 Mon Sep 17 00:00:00 2001 From: Herman Snevajs Date: Thu, 16 Oct 2025 14:25:43 +0200 Subject: [PATCH 1/2] Publish map button - add slot to project view buttons - add publish method to projectStore - add post call to project Api --- .../lib/src/modules/project/projectApi.ts | 6 +++++ .../packages/lib/src/modules/project/store.ts | 22 +++++++++++++++++++ .../project/views/ProjectViewTemplate.vue | 1 + 3 files changed, 29 insertions(+) diff --git a/web-app/packages/lib/src/modules/project/projectApi.ts b/web-app/packages/lib/src/modules/project/projectApi.ts index 657675c8..26e03951 100644 --- a/web-app/packages/lib/src/modules/project/projectApi.ts +++ b/web-app/packages/lib/src/modules/project/projectApi.ts @@ -344,5 +344,11 @@ export const ProjectApi = { return ProjectModule.httpService.get( `/v2/projects/${projectId}/collaborators` ) + }, + + async publishMap(projectId: string) { + return ProjectModule.httpService.post( + `/app/projects/${projectId}/map-links` + ) } } diff --git a/web-app/packages/lib/src/modules/project/store.ts b/web-app/packages/lib/src/modules/project/store.ts index 6b2f2cb9..c329f431 100644 --- a/web-app/packages/lib/src/modules/project/store.ts +++ b/web-app/packages/lib/src/modules/project/store.ts @@ -980,6 +980,28 @@ export const useProjectStore = defineStore('projectModule', { await notificationStore.error({ text: getErrorMessage(err, 'Failed to push changes') }) + }, + + /** + * Publishes the map of the latest project version. + */ + async publishMap() { + const notificationStore = useNotificationStore() + + try { + const response = await ProjectApi.publishMap(this.project.id) + const hash = response.data.map_link + const url = `${window.location.origin}/${hash}` + navigator.clipboard.writeText(url) + notificationStore.show({ + text: 'Link to public map copied to your clipboard.', + severity: 'success' + }) + } catch { + notificationStore.error({ + text: `Failed to publish map` + }) + } } } }) diff --git a/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue b/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue index 16535528..ff27f1b8 100644 --- a/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue +++ b/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue @@ -12,6 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial >
+ Date: Thu, 16 Oct 2025 15:26:34 +0200 Subject: [PATCH 2/2] mv to mapsmodule --- .../lib/src/modules/project/projectApi.ts | 6 ----- .../packages/lib/src/modules/project/store.ts | 22 ------------------- .../project/views/ProjectViewTemplate.vue | 2 +- 3 files changed, 1 insertion(+), 29 deletions(-) diff --git a/web-app/packages/lib/src/modules/project/projectApi.ts b/web-app/packages/lib/src/modules/project/projectApi.ts index 26e03951..657675c8 100644 --- a/web-app/packages/lib/src/modules/project/projectApi.ts +++ b/web-app/packages/lib/src/modules/project/projectApi.ts @@ -344,11 +344,5 @@ export const ProjectApi = { return ProjectModule.httpService.get( `/v2/projects/${projectId}/collaborators` ) - }, - - async publishMap(projectId: string) { - return ProjectModule.httpService.post( - `/app/projects/${projectId}/map-links` - ) } } diff --git a/web-app/packages/lib/src/modules/project/store.ts b/web-app/packages/lib/src/modules/project/store.ts index c329f431..6b2f2cb9 100644 --- a/web-app/packages/lib/src/modules/project/store.ts +++ b/web-app/packages/lib/src/modules/project/store.ts @@ -980,28 +980,6 @@ export const useProjectStore = defineStore('projectModule', { await notificationStore.error({ text: getErrorMessage(err, 'Failed to push changes') }) - }, - - /** - * Publishes the map of the latest project version. - */ - async publishMap() { - const notificationStore = useNotificationStore() - - try { - const response = await ProjectApi.publishMap(this.project.id) - const hash = response.data.map_link - const url = `${window.location.origin}/${hash}` - navigator.clipboard.writeText(url) - notificationStore.show({ - text: 'Link to public map copied to your clipboard.', - severity: 'success' - }) - } catch { - notificationStore.error({ - text: `Failed to publish map` - }) - } } } }) diff --git a/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue b/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue index ff27f1b8..e8ea5b63 100644 --- a/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue +++ b/web-app/packages/lib/src/modules/project/views/ProjectViewTemplate.vue @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-MerginMaps-Commercial >
- +