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

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.
Files changed (65) hide show
  1. package/.build/server/utils/cleanup.js +7 -2
  2. package/.build/server/utils/microservices.js +5 -1
  3. package/.build/server/utils/typed_handler.js +5 -1
  4. package/.build/server/utils/ws_client.js +7 -2
  5. package/.build/shared/utils/fetch_raw.js +2 -2
  6. package/.build/shared/utils/parse_boolean.js +2 -1
  7. package/app/components/ClippingPlanes.vue +14 -4
  8. package/app/components/DragAndDrop.vue +18 -8
  9. package/app/components/FileSelector.vue +9 -6
  10. package/app/components/HybridViewerTooltip.vue +8 -2
  11. package/app/components/MissingFilesSelector.vue +10 -6
  12. package/app/components/ObjectSelector.vue +6 -3
  13. package/app/components/Screenshot.vue +9 -2
  14. package/app/components/ThresholdFilter.vue +5 -1
  15. package/app/components/Viewer/Generic/Model/BlocksOptions.vue +7 -5
  16. package/app/components/Viewer/Generic/Model/CornersOptions.vue +7 -5
  17. package/app/components/Viewer/Generic/Model/LinesOptions.vue +8 -8
  18. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +12 -10
  19. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +12 -10
  20. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +9 -5
  21. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  22. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
  23. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  24. package/app/components/Viewer/Options/AttributeSelector.vue +24 -13
  25. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  26. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  27. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  28. package/app/composables/attribute_coloring_style.ts +8 -2
  29. package/app/composables/global_attribute_style.ts +4 -3
  30. package/app/composables/hover_highlight.ts +6 -5
  31. package/app/composables/project_manager.ts +5 -5
  32. package/app/composables/stepper_tree.ts +10 -2
  33. package/app/composables/tree_filter.ts +11 -2
  34. package/app/composables/tree_keyboard_nav.ts +4 -2
  35. package/app/composables/use_overlapping_picker.ts +5 -5
  36. package/app/composables/virtual_tree.ts +14 -7
  37. package/app/stores/app_helpers/extension.ts +1 -1
  38. package/app/stores/feedback.ts +2 -2
  39. package/app/stores/hybrid_viewer.ts +1 -1
  40. package/app/stores/treeview.ts +17 -10
  41. package/app/utils/clipping_planes.ts +4 -3
  42. package/app/utils/extension.ts +1 -1
  43. package/app/utils/import_workflow.ts +6 -4
  44. package/app/utils/upload_path.ts +15 -9
  45. package/internal/database/database.ts +4 -1
  46. package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
  47. package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
  48. package/internal/stores/data_style/model/corners/vertex.ts +14 -10
  49. package/internal/stores/data_style/model/lines/edge.ts +14 -10
  50. package/internal/stores/data_style/model/lines/vertex.ts +14 -10
  51. package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
  52. package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
  53. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  54. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  55. package/internal/stores/hybrid_viewer/highlight.ts +10 -9
  56. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  57. package/internal/utils/ws_client.ts +8 -1
  58. package/package.json +2 -2
  59. package/server/api/local/extensions/run.post.ts +6 -4
  60. package/server/utils/cleanup.ts +12 -2
  61. package/server/utils/microservices.ts +11 -4
  62. package/server/utils/typed_handler.ts +8 -1
  63. package/server/utils/ws_client.ts +15 -2
  64. package/shared/utils/fetch_raw.ts +2 -2
  65. package/shared/utils/parse_boolean.ts +4 -1
@@ -328,16 +328,20 @@ function useModelSurfacesVertexAttribute(): UseModelSurfacesVertexAttributeRetur
328
328
  reapplySameSeries(
329
329
  await dataStore.getSurfacesGeodeIds(modelId),
330
330
  surfaceIds,
331
- (id) =>
332
- modelSurfacesCommonStyle.modelSurfaceColoring(modelId, id).active === "vertex" &&
333
- modelSurfacesVertexAttributeName(modelId, id) === name
334
- ? [
335
- modelSurfacesVertexAttributeItem(modelId, id),
336
- modelSurfacesVertexAttributeRange(modelId, id),
337
- modelSurfacesVertexAttributeColorMap(modelId, id),
338
- JSON.stringify(modelSurfacesVertexAttributeNoDataColor(modelId, id)),
339
- ].join("|")
340
- : undefined,
331
+ (id) => {
332
+ if (
333
+ modelSurfacesCommonStyle.modelSurfaceColoring(modelId, id).active === "vertex" &&
334
+ modelSurfacesVertexAttributeName(modelId, id) === name
335
+ ) {
336
+ return [
337
+ modelSurfacesVertexAttributeItem(modelId, id),
338
+ modelSurfacesVertexAttributeRange(modelId, id),
339
+ modelSurfacesVertexAttributeColorMap(modelId, id),
340
+ JSON.stringify(modelSurfacesVertexAttributeNoDataColor(modelId, id)),
341
+ ].join("|");
342
+ }
343
+ return undefined;
344
+ },
341
345
  async (ids) => {
342
346
  await applyVertexAttribute(modelId, ids);
343
347
  },
@@ -97,13 +97,19 @@ function computeAverageBrightness(rect: Rect, options: BrightnessOptions): numbe
97
97
  return BACKGROUND_GREY_VALUE / RGB_MAX;
98
98
  }
99
99
  }
100
+ function createOffscreenCanvas(): HTMLCanvasElement | undefined {
101
+ if (typeof document === "undefined") {
102
+ return undefined;
103
+ }
104
+ return document.createElement("canvas");
105
+ }
106
+
100
107
  function useHybridViewerBrightness(): {
101
108
  latestImage: Ref<DrawableImage | undefined>;
102
109
  getAverageBrightness: (rect: Rect) => number;
103
110
  } {
104
111
  const latestImage = ref<DrawableImage | undefined>(undefined);
105
- const offscreenCanvas: HTMLCanvasElement | undefined =
106
- typeof document === "undefined" ? undefined : document.createElement("canvas");
112
+ const offscreenCanvas: HTMLCanvasElement | undefined = createOffscreenCanvas();
107
113
  const offscreenCtx: CanvasRenderingContext2D | undefined = offscreenCanvas
108
114
  ? (offscreenCanvas.getContext("2d", {
109
115
  willReadFrequently: true,
@@ -37,9 +37,10 @@ function slerp(from: Vector3, target: Vector3, ratio: number, mid?: Vector3): Ve
37
37
  ]);
38
38
  }
39
39
  if (dotProduct < -SLERP_LINEAR_THRESHOLD && mid) {
40
- return ratio < MID_ANIMATION_RATIO
41
- ? slerp(normFrom, mid, ratio * 2)
42
- : slerp(mid, normTarget, (ratio - MID_ANIMATION_RATIO) * 2);
40
+ if (ratio < MID_ANIMATION_RATIO) {
41
+ return slerp(normFrom, mid, ratio * 2);
42
+ }
43
+ return slerp(mid, normTarget, (ratio - MID_ANIMATION_RATIO) * 2);
43
44
  }
44
45
  const theta = Math.acos(dotProduct);
45
46
  const sinTheta = Math.sin(theta);
@@ -70,15 +70,16 @@ const useHybridViewerHighlight = createSharedComposable(() => {
70
70
  const hoverHighlight = useDebounceFn((event: MouseEvent) => {
71
71
  const { genericRenderWindow } = useHybridViewerCore();
72
72
  const containerElement = genericRenderWindow.value?.getContainer();
73
- const relativeMousePosition = containerElement
74
- ? {
75
- x: event.clientX - containerElement.getBoundingClientRect().left,
76
- y: event.clientY - containerElement.getBoundingClientRect().top,
77
- }
78
- : {
79
- x: event.clientX,
80
- y: event.clientY,
81
- };
73
+ let relativeMousePosition = {
74
+ x: event.clientX,
75
+ y: event.clientY,
76
+ };
77
+ if (containerElement) {
78
+ relativeMousePosition = {
79
+ x: event.clientX - containerElement.getBoundingClientRect().left,
80
+ y: event.clientY - containerElement.getBoundingClientRect().top,
81
+ };
82
+ }
82
83
  requestHoverHighlight(event, async (response) => {
83
84
  if (
84
85
  !is_hover_highlight.value ||
@@ -59,9 +59,10 @@ function useHybridViewerRuler(): {
59
59
  if (!ruler_point1.value) {
60
60
  return;
61
61
  }
62
- const points = ruler_point2.value
63
- ? [ruler_point1.value, ruler_point2.value]
64
- : [ruler_point1.value];
62
+ const points = [ruler_point1.value];
63
+ if (ruler_point2.value) {
64
+ points.push(ruler_point2.value);
65
+ }
65
66
  const { remoteRender } = useHybridViewerCore();
66
67
  const viewerStore = useViewerStore();
67
68
  const schema = viewer_schemas.opengeodeweb_viewer.viewer.ruler;
@@ -25,13 +25,20 @@ function isVtkWSLinkClient(value: unknown): value is VtkWSLinkClient {
25
25
  );
26
26
  }
27
27
 
28
+ function resolveClient(initialClient: unknown): VtkWSLinkClient {
29
+ if (isVtkWSLinkClient(initialClient)) {
30
+ return initialClient;
31
+ }
32
+ return newInstance();
33
+ }
34
+
28
35
  async function initWebSocketClient(
29
36
  baseUrl: string,
30
37
  initialClient: unknown = {},
31
38
  { onConnectionClose }: WsClientCallbacks = {},
32
39
  ): Promise<VtkWSLinkClient> {
33
40
  vtkWSLinkClient.setSmartConnectClass(SmartConnect);
34
- const client = isVtkWSLinkClient(initialClient) ? initialClient : newInstance();
41
+ const client = resolveClient(initialClient);
35
42
 
36
43
  client.onConnectionError((httpReq: WsConnectionEvent) => {
37
44
  const message = httpReq.response?.error ?? "Connection error";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
- "version": "10.44.0-rc.2",
3
+ "version": "10.44.0-rc.3",
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": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "scripts": {
52
52
  "lint": "oxlint --fix .",
53
- "prepare:types": "cross-env MODE=BROWSER nuxi prepare",
53
+ "prepare:types": "cross-env MODE=BROWSER npx nuxi prepare",
54
54
  "build:back": "npx opengeodeweb-microservice-pyinstaller ../OpenGeodeWeb-Back",
55
55
  "build:viewer": "npx opengeodeweb-microservice-pyinstaller ../OpenGeodeWeb-Viewer",
56
56
  "build:microservices": "concurrently \"npm run build:back\" \"npm run build:viewer\"",
@@ -55,10 +55,12 @@ async function runSingleExtension(
55
55
  port,
56
56
  });
57
57
 
58
- const serverPort =
59
- server === undefined
60
- ? undefined
61
- : await runExtensionServer(extensionServerEntryPath(unzippedExtensionPath, server.entry));
58
+ let serverPort: number | undefined = undefined;
59
+ if (server !== undefined) {
60
+ serverPort = await runExtensionServer(
61
+ extensionServerEntryPath(unzippedExtensionPath, server.entry),
62
+ );
63
+ }
62
64
  if (serverPort !== undefined) {
63
65
  setExtensionServerPort(id, serverPort);
64
66
  }
@@ -56,6 +56,13 @@ function isErrorWithMessage(error: unknown): error is { message: string } {
56
56
  );
57
57
  }
58
58
 
59
+ function describeError(error: unknown): string {
60
+ if (isErrorWithMessage(error)) {
61
+ return error.message;
62
+ }
63
+ return String(error);
64
+ }
65
+
59
66
  async function killHttpMicroservice(microservice: Microservice): Promise<void> {
60
67
  consola.debug("killHttpMicroservice", {
61
68
  ...microservice,
@@ -70,7 +77,7 @@ async function killHttpMicroservice(microservice: Microservice): Promise<void> {
70
77
  method: microservice.method,
71
78
  });
72
79
  } catch (error) {
73
- const message = isErrorWithMessage(error) ? error.message : String(error);
80
+ const message = describeError(error);
74
81
  consola.info(`Expected error during kill of ${microservice.name}:`, message);
75
82
  }
76
83
  }
@@ -180,7 +187,10 @@ function getMicroserviceByName(
180
187
  name: string,
181
188
  ): Microservice | undefined {
182
189
  const found = microservices.find((microservice) => microservice.name === name);
183
- return found === undefined ? undefined : { ...found };
190
+ if (found === undefined) {
191
+ return undefined;
192
+ }
193
+ return { ...found };
184
194
  }
185
195
 
186
196
  export {
@@ -63,15 +63,22 @@ function isPortInUseError(error: unknown): boolean {
63
63
  return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
64
64
  }
65
65
 
66
+ function resolveUploadFolderPath(
67
+ projectFolderPath: string,
68
+ uploadFolderPath: string | undefined,
69
+ ): string {
70
+ if (uploadFolderPath !== undefined && uploadFolderPath !== "") {
71
+ return uploadFolderPath;
72
+ }
73
+ return path.join(projectFolderPath, "uploads");
74
+ }
75
+
66
76
  function backArgs(args: RunArgs, port: number): string[] {
67
77
  const { projectFolderPath } = args;
68
78
  if (!projectFolderPath) {
69
79
  throw new Error("projectFolderPath is required");
70
80
  }
71
- const uploadFolderPath =
72
- args.uploadFolderPath !== undefined && args.uploadFolderPath !== ""
73
- ? args.uploadFolderPath
74
- : path.join(projectFolderPath, "uploads");
81
+ const uploadFolderPath = resolveUploadFolderPath(projectFolderPath, args.uploadFolderPath);
75
82
  const executableArgs = [
76
83
  "--port",
77
84
  String(port),
@@ -27,6 +27,13 @@ const INTERNAL_SERVER_ERROR = 500;
27
27
  type RouteSchema = JsonRpcSchema & { readonly response?: object };
28
28
 
29
29
  // Same body as the Flask microservices' errors, so the client reads every error the same way
30
+ function describeError(error: unknown): string {
31
+ if (error instanceof Error) {
32
+ return error.message;
33
+ }
34
+ return String(error);
35
+ }
36
+
30
37
  function toErrorResponse(error: unknown): ErrorResponse {
31
38
  if (isError(error)) {
32
39
  return {
@@ -38,7 +45,7 @@ function toErrorResponse(error: unknown): ErrorResponse {
38
45
  return {
39
46
  code: INTERNAL_SERVER_ERROR,
40
47
  name: "Internal Server Error",
41
- description: error instanceof Error ? error.message : String(error),
48
+ description: describeError(error),
42
49
  };
43
50
  }
44
51
 
@@ -31,7 +31,20 @@ function rawDataToBlob(raw: WebSocket.RawData): Blob {
31
31
  if (raw instanceof ArrayBuffer) {
32
32
  return new Blob([raw]);
33
33
  }
34
- return new Blob([Uint8Array.from(Array.isArray(raw) ? Buffer.concat(raw) : raw)]);
34
+ if (Array.isArray(raw)) {
35
+ return new Blob([Uint8Array.from(Buffer.concat(raw))]);
36
+ }
37
+ return new Blob([Uint8Array.from(raw)]);
38
+ }
39
+
40
+ function findPendingCall(
41
+ pending: ReadonlyMap<string, PendingCall>,
42
+ id: string | undefined,
43
+ ): PendingCall | undefined {
44
+ if (id === undefined) {
45
+ return undefined;
46
+ }
47
+ return pending.get(id);
35
48
  }
36
49
 
37
50
  interface ServerWsRpcClient {
@@ -98,7 +111,7 @@ function createServerWsRpcClient(baseUrl: string): ServerWsRpcClient {
98
111
  return;
99
112
  }
100
113
 
101
- const entry = message.id === undefined ? undefined : pending.get(message.id);
114
+ const entry = findPendingCall(pending, message.id);
102
115
  if (!entry || message.id === undefined) {
103
116
  return;
104
117
  }
@@ -58,8 +58,8 @@ async function performFetch({
58
58
  baseURL,
59
59
  method,
60
60
  headers,
61
- ...(hasBody(params) ? { body: params } : {}),
62
- ...(max_retry === undefined ? {} : { retry: max_retry }),
61
+ ...(hasBody(params) && { body: params }),
62
+ ...(max_retry !== undefined && { retry: max_retry }),
63
63
  async onRequestError({ error }: { error: unknown }) {
64
64
  if (request_error_function) {
65
65
  await request_error_function(error);
@@ -2,7 +2,10 @@ const TRUTHY_VALUES = new Set([true, 1, "1", "true", "yes"]);
2
2
  const FALSY_VALUES = new Set([false, 0, "0", "false", "no"]);
3
3
 
4
4
  function parseBoolean(value: string | number | boolean): boolean {
5
- const normalized = typeof value === "string" ? value.trim().toLowerCase() : value;
5
+ let normalized: string | number | boolean = value;
6
+ if (typeof value === "string") {
7
+ normalized = value.trim().toLowerCase();
8
+ }
6
9
 
7
10
  if (TRUTHY_VALUES.has(normalized)) {
8
11
  return true;