@geode/opengeodeweb-front 10.43.2 → 10.44.0-rc.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,6 +5,11 @@ const DEFAULT_FEEDBACKS_TIMEOUT_SECONDS = 10;
5
5
 
6
6
  type FeedbackType = "error" | "success" | "warning";
7
7
 
8
+ interface FeedbackAction {
9
+ label: string;
10
+ onClick: () => void;
11
+ }
12
+
8
13
  interface Feedback {
9
14
  id: string;
10
15
  type: FeedbackType;
@@ -12,6 +17,7 @@ interface Feedback {
12
17
  route?: string;
13
18
  name?: string;
14
19
  description?: string;
20
+ action?: FeedbackAction;
15
21
  }
16
22
 
17
23
  export const useFeedbackStore = defineStore("feedback", {
@@ -35,23 +41,25 @@ export const useFeedbackStore = defineStore("feedback", {
35
41
  this.delete_feedback(feedbackId);
36
42
  }, this.feedbacks_timeout_miliseconds);
37
43
  },
38
- add_success(description: string) {
44
+ add_success(description: string, action?: FeedbackAction) {
39
45
  const feedbackId = uuidv4();
40
46
  this.feedbacks.push({
41
47
  id: feedbackId,
42
48
  type: "success",
43
49
  description,
50
+ ...(action === undefined ? {} : { action }),
44
51
  });
45
52
  setTimeout(() => {
46
53
  this.delete_feedback(feedbackId);
47
54
  }, this.feedbacks_timeout_miliseconds);
48
55
  },
49
- add_warning(description: string) {
56
+ add_warning(description: string, action?: FeedbackAction) {
50
57
  const feedbackId = uuidv4();
51
58
  this.feedbacks.push({
52
59
  id: feedbackId,
53
60
  type: "warning",
54
61
  description,
62
+ ...(action === undefined ? {} : { action }),
55
63
  });
56
64
  setTimeout(() => {
57
65
  this.delete_feedback(feedbackId);
@@ -65,3 +73,5 @@ export const useFeedbackStore = defineStore("feedback", {
65
73
  },
66
74
  },
67
75
  });
76
+
77
+ export type { FeedbackAction };
@@ -0,0 +1,38 @@
1
+ import type { CrsItem, NewDataItem } from "@ogw_front/stores/data";
2
+ import type { CRSList } from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
3
+
4
+ function formatCrs(crs: CRSList | undefined): string {
5
+ return crs ? `${crs.authority}:${crs.code} — ${crs.name}` : "None";
6
+ }
7
+
8
+ // Code alone, for narrow places: the full name goes in a tooltip
9
+ function formatCrsCode(crs: CRSList | undefined): string {
10
+ return crs ? `${crs.authority}:${crs.code}` : "None";
11
+ }
12
+
13
+ // The name is only a label: two CRS are the same when their authority code is
14
+ function sameCrs(left: CRSList | undefined, right: CRSList | undefined): boolean {
15
+ return (
16
+ left !== undefined &&
17
+ right !== undefined &&
18
+ left.authority === right.authority &&
19
+ left.code === right.code
20
+ );
21
+ }
22
+
23
+ // Same CRS, or both still in local coordinates
24
+ function sameCrsState(left: CRSList | undefined, right: CRSList | undefined): boolean {
25
+ return (left === undefined && right === undefined) || sameCrs(left, right);
26
+ }
27
+
28
+ // The CRS of the oldest georeferenced data: the project CRS of a project saved before it was stored
29
+ function oldestCrs(
30
+ items: readonly Pick<CrsItem, "crs" | "created_at">[] | readonly NewDataItem[],
31
+ ): CRSList | undefined {
32
+ return items
33
+ .filter((item) => item.crs !== undefined)
34
+ .toSorted((left, right) => (left.created_at ?? "").localeCompare(right.created_at ?? ""))[0]
35
+ ?.crs;
36
+ }
37
+
38
+ export { formatCrs, formatCrsCode, oldestCrs, sameCrs, sameCrsState };
@@ -162,21 +162,33 @@ async function importWorkflowFromSnapshot(items: readonly NewDataItem[]): Promis
162
162
  return ids;
163
163
  }
164
164
 
165
- // The time series only adds attributes to the model, so the viewer object is reloaded under the same id with its stored style.
166
- async function applyTimeSeriesWorkflow(filename: string, id: string): Promise<string> {
167
- const backStore = useBackStore();
165
+ // Reloads the viewer object under the same id with its stored style, after the back rewrote its files.
166
+ async function reloadObject(
167
+ id: string,
168
+ { rebuildActor = false }: { rebuildActor?: boolean } = {},
169
+ ): Promise<void> {
168
170
  const dataStore = useDataStore();
169
171
  const dataStyleStore = useDataStyleStore();
170
172
  const hybridViewerStore = useHybridViewerStore();
171
- await backStore.request({
172
- schema: back_schemas.opengeodeweb_back.apply_time_series,
173
- params: { id, filename },
174
- });
175
173
  const item = await dataStore.item(id);
176
174
  await dataStore.deregisterObject(id);
177
175
  await dataStore.registerObject(id, item.name ?? id);
176
+ // Only when the geometry moved: the local actor is rebuilt from the stored light viewable
177
+ if (rebuildActor) {
178
+ await hybridViewerStore.addItem(id);
179
+ }
178
180
  await dataStyleStore.applyDefaultStyle(id);
179
181
  await hybridViewerStore.remoteRender();
182
+ }
183
+
184
+ // The time series only adds attributes to the model, so the viewer object is reloaded.
185
+ async function applyTimeSeriesWorkflow(filename: string, id: string): Promise<string> {
186
+ const backStore = useBackStore();
187
+ await backStore.request({
188
+ schema: back_schemas.opengeodeweb_back.apply_time_series,
189
+ params: { id, filename },
190
+ });
191
+ await reloadObject(id);
180
192
  return id;
181
193
  }
182
194
 
@@ -186,4 +198,5 @@ export {
186
198
  importWorkflowFromSnapshot,
187
199
  importItem,
188
200
  applyTimeSeriesWorkflow,
201
+ reloadObject,
189
202
  };
@@ -69,12 +69,14 @@ const useHybridViewerScene = createSharedComposable(() => {
69
69
  const property = actor.getProperty();
70
70
  property.setColor(ACTOR_COLOR);
71
71
  actor.setMapper(mapper);
72
+ // The scene z-scaling also applies to actors added after it was set
73
+ actor.setScale(1, 1, zScale.value);
72
74
  const renderer = genericRenderWindow.value.getRenderer();
75
+ // Replacing an actor keeps the camera where the user left it
76
+ const isFirst = !hybridDb[id] && renderer.getActors().length === 0;
73
77
  if (hybridDb[id]) {
74
78
  renderer.removeActor(hybridDb[id].actor);
75
79
  }
76
- const actors = renderer.getActors();
77
- const isFirst = actors.length === 0;
78
80
  renderer.addActor(actor);
79
81
  if (isFirst) {
80
82
  renderer.resetCamera();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.43.2",
3
+ "version": "10.44.0-rc.2",
4
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
5
  "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
6
  "bugs": {
@@ -64,9 +64,9 @@
64
64
  "prepublishOnly": "npm run build"
65
65
  },
66
66
  "dependencies": {
67
- "@geode/cloud-api": "latest",
68
- "@geode/opengeodeweb-back": "latest",
69
- "@geode/opengeodeweb-viewer": "latest",
67
+ "@geode/cloud-api": "next",
68
+ "@geode/opengeodeweb-back": "next",
69
+ "@geode/opengeodeweb-viewer": "next",
70
70
  "@kitware/vtk.js": "33.3.0",
71
71
  "@mdi/font": "7.4.47",
72
72
  "@msgpack/msgpack": "2.8.0",
@@ -1,76 +0,0 @@
1
- <script setup lang="ts">
2
- interface Props {
3
- title: string;
4
- }
5
-
6
- const { title } = defineProps<Props>();
7
-
8
- const isCollapsed = ref<boolean>(false);
9
- </script>
10
-
11
- <template>
12
- <div class="options-section">
13
- <div class="section-badge" @click="isCollapsed = !isCollapsed">
14
- {{ title }}
15
- <v-icon class="collapse-icon" :class="{ rotated: isCollapsed }" size="12">
16
- mdi-chevron-down
17
- </v-icon>
18
- </div>
19
- <v-container v-show="!isCollapsed" class="pa-0">
20
- <slot />
21
- </v-container>
22
- </div>
23
- </template>
24
-
25
- <style scoped>
26
- .options-section {
27
- position: relative;
28
- border: 1px solid rgba(255, 255, 255, 0.2);
29
- border-radius: 8px;
30
- padding: 8px 4px 6px 4px;
31
- }
32
-
33
- .section-badge {
34
- position: absolute;
35
- top: -10px;
36
- left: 12px;
37
- background-color: rgba(255, 255, 255, 0.1);
38
- backdrop-filter: blur(8px);
39
- padding: 1px 8px;
40
- font-size: 0.65rem;
41
- font-weight: 700;
42
- text-transform: uppercase;
43
- letter-spacing: 0.5px;
44
- color: white;
45
- border: 1px solid rgba(255, 255, 255, 0.2);
46
- border-radius: 20px;
47
- box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
48
- cursor: pointer;
49
- user-select: none;
50
- display: flex;
51
- align-items: center;
52
- gap: 4px;
53
- }
54
-
55
- .section-badge:hover {
56
- background-color: rgba(255, 255, 255, 0.2);
57
- }
58
-
59
- .collapse-icon {
60
- transition: transform 0.2s ease;
61
- }
62
-
63
- .collapse-icon.rotated {
64
- transform: rotate(-90deg);
65
- }
66
-
67
- .v-theme--light .options-section {
68
- border-color: rgba(0, 0, 0, 0.12);
69
- }
70
-
71
- .v-theme--light .section-badge {
72
- background-color: white;
73
- color: #444;
74
- border-color: rgba(0, 0, 0, 0.12);
75
- }
76
- </style>