@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
@@ -28,6 +28,10 @@ async function deleteFolderRecursive(folderPath) {
28
28
  function isErrorWithMessage(error) {
29
29
  return typeof error === "object" && error !== null && "message" in error && typeof error.message === "string";
30
30
  }
31
+ function describeError(error) {
32
+ if (isErrorWithMessage(error)) return error.message;
33
+ return String(error);
34
+ }
31
35
  async function killHttpMicroservice(microservice) {
32
36
  consola.debug("killHttpMicroservice", { ...microservice });
33
37
  const failMessage = `Failed to kill ${microservice.name}`;
@@ -36,7 +40,7 @@ async function killHttpMicroservice(microservice) {
36
40
  try {
37
41
  await fetch(microservice.url, { method: microservice.method });
38
42
  } catch (error) {
39
- const message = isErrorWithMessage(error) ? error.message : String(error);
43
+ const message = describeError(error);
40
44
  consola.info(`Expected error during kill of ${microservice.name}:`, message);
41
45
  }
42
46
  }
@@ -109,7 +113,8 @@ async function cleanupBackend(projectFolderPath) {
109
113
  }
110
114
  function getMicroserviceByName(microservices, name) {
111
115
  const found = microservices.find((microservice) => microservice.name === name);
112
- return found === void 0 ? void 0 : { ...found };
116
+ if (found === void 0) return;
117
+ return { ...found };
113
118
  }
114
119
  //#endregion
115
120
  export { cleanupBackend, deleteFolderRecursive, getMicroserviceByName, killMicroservice, microservicesMetadatasPath, projectMicroservices };
@@ -43,10 +43,14 @@ async function runScript(execPath, execName, args, expectedResponse, timeoutSeco
43
43
  function isPortInUseError(error) {
44
44
  return /EADDRINUSE|address already in use|port already in use/iu.test(String(error));
45
45
  }
46
+ function resolveUploadFolderPath(projectFolderPath, uploadFolderPath) {
47
+ if (uploadFolderPath !== void 0 && uploadFolderPath !== "") return uploadFolderPath;
48
+ return path.join(projectFolderPath, "uploads");
49
+ }
46
50
  function backArgs(args, port) {
47
51
  const { projectFolderPath } = args;
48
52
  if (!projectFolderPath) throw new Error("projectFolderPath is required");
49
- const uploadFolderPath = args.uploadFolderPath !== void 0 && args.uploadFolderPath !== "" ? args.uploadFolderPath : path.join(projectFolderPath, "uploads");
53
+ const uploadFolderPath = resolveUploadFolderPath(projectFolderPath, args.uploadFolderPath);
50
54
  const executableArgs = [
51
55
  "--port",
52
56
  String(port),
@@ -5,6 +5,10 @@ import { createError, defineEventHandler, getQuery, isError, readBody, setRespon
5
5
  //#region server/utils/typed_handler.ts
6
6
  const BAD_REQUEST = 400;
7
7
  const INTERNAL_SERVER_ERROR = 500;
8
+ function describeError(error) {
9
+ if (error instanceof Error) return error.message;
10
+ return String(error);
11
+ }
8
12
  function toErrorResponse(error) {
9
13
  if (isError(error)) return {
10
14
  code: error.statusCode,
@@ -14,7 +18,7 @@ function toErrorResponse(error) {
14
18
  return {
15
19
  code: INTERNAL_SERVER_ERROR,
16
20
  name: "Internal Server Error",
17
- description: error instanceof Error ? error.message : String(error)
21
+ description: describeError(error)
18
22
  };
19
23
  }
20
24
  function sendError(event, schema, error) {
@@ -11,7 +11,12 @@ function isWsRpcMessage(value) {
11
11
  }
12
12
  function rawDataToBlob(raw) {
13
13
  if (raw instanceof ArrayBuffer) return new Blob([raw]);
14
- return new Blob([Uint8Array.from(Array.isArray(raw) ? Buffer.concat(raw) : raw)]);
14
+ if (Array.isArray(raw)) return new Blob([Uint8Array.from(Buffer.concat(raw))]);
15
+ return new Blob([Uint8Array.from(raw)]);
16
+ }
17
+ function findPendingCall(pending, id) {
18
+ if (id === void 0) return;
19
+ return pending.get(id);
15
20
  }
16
21
  function createServerWsRpcClient(baseUrl) {
17
22
  const socket = new WebSocket(baseUrl);
@@ -46,7 +51,7 @@ function createServerWsRpcClient(baseUrl) {
46
51
  return;
47
52
  }
48
53
  if (typeof message.id === "string" && message.id.startsWith("publish:")) return;
49
- const entry = message.id === void 0 ? void 0 : pending.get(message.id);
54
+ const entry = findPendingCall(pending, message.id);
50
55
  if (!entry || message.id === void 0) return;
51
56
  pending.delete(message.id);
52
57
  if (message.error) entry.reject(new Error(message.error.message ?? "wslink RPC error"));
@@ -17,8 +17,8 @@ async function performFetch({ route, method, params, baseURL, headers, max_retry
17
17
  baseURL,
18
18
  method,
19
19
  headers,
20
- ...hasBody(params) ? { body: params } : {},
21
- ...max_retry === void 0 ? {} : { retry: max_retry },
20
+ ...hasBody(params) && { body: params },
21
+ ...max_retry !== void 0 && { retry: max_retry },
22
22
  async onRequestError({ error }) {
23
23
  if (request_error_function) await request_error_function(error);
24
24
  },
@@ -14,7 +14,8 @@ const FALSY_VALUES = /* @__PURE__ */ new Set([
14
14
  "no"
15
15
  ]);
16
16
  function parseBoolean(value) {
17
- const normalized = typeof value === "string" ? value.trim().toLowerCase() : value;
17
+ let normalized = value;
18
+ if (typeof value === "string") normalized = value.trim().toLowerCase();
18
19
  if (TRUTHY_VALUES.has(normalized)) return true;
19
20
  if (FALSY_VALUES.has(normalized)) return false;
20
21
  throw new Error(`Cannot parse boolean from: ${value}`);
@@ -38,9 +38,12 @@ const slices = ref<{ id: number; axis: SliceAxis; index: number }[]>([
38
38
  { id: newItemId(), axis: DEFAULT_SLICE_AXIS, index: 0 },
39
39
  ]);
40
40
  const sliceMaxIndices = ref<[number, number, number]>([0, 0, 0]);
41
- const targetIds = computed<string[]>(() =>
42
- targetAllVisible.value ? allItems.value.map((item) => item.id) : selectedDatasetIds.value,
43
- );
41
+ const targetIds = computed<string[]>(() => {
42
+ if (targetAllVisible.value) {
43
+ return allItems.value.map((item) => item.id);
44
+ }
45
+ return selectedDatasetIds.value;
46
+ });
44
47
  const isAllGrid = computed<boolean>(() => areAllGrids(allItems.value, targetIds.value));
45
48
  const isSliceActive = computed<boolean>(() => isAllGrid.value && sliceEnabled.value);
46
49
  const availableDatasets = computed<{ title: string; value: string }[]>(() =>
@@ -97,6 +100,13 @@ async function applyClippingPlanes(): Promise<void> {
97
100
  }
98
101
  }
99
102
 
103
+ function getSlicesPayload(isActive: boolean): { axis: SliceAxis; index: number }[] {
104
+ if (!isActive) {
105
+ return [];
106
+ }
107
+ return slices.value.map(({ axis, index }) => ({ axis, index }));
108
+ }
109
+
100
110
  async function sendSlices(): Promise<void> {
101
111
  if (!isAllGrid.value && !areSlicesApplied) {
102
112
  return;
@@ -106,7 +116,7 @@ async function sendSlices(): Promise<void> {
106
116
  if (targetIds.value.length > 0) {
107
117
  const maxIndices = await hybridViewerStore.setSlice(
108
118
  targetIds.value,
109
- isActive ? slices.value.map(({ axis, index }) => ({ axis, index })) : [],
119
+ getSlicesPayload(isActive),
110
120
  );
111
121
  if (isAllGrid.value) {
112
122
  sliceMaxIndices.value = maxIndices;
@@ -38,11 +38,12 @@ const {
38
38
  // oxlint-disable-next-line vue/max-props
39
39
  } = defineProps<Props>();
40
40
 
41
- const displayed_texts = computed<DragAndDropTexts>(() =>
42
- directory
43
- ? { ...texts, idle: "Click or drag and drop a folder", drop: "Drop the folder here" }
44
- : texts,
45
- );
41
+ const displayed_texts = computed<DragAndDropTexts>(() => {
42
+ if (directory) {
43
+ return { ...texts, idle: "Click or drag and drop a folder", drop: "Drop the folder here" };
44
+ }
45
+ return texts;
46
+ });
46
47
 
47
48
  const emit = defineEmits<{
48
49
  "files-selected": [files: UploadFile[]];
@@ -57,6 +58,13 @@ const fileInput = ref<HTMLInputElement | undefined>(undefined);
57
58
 
58
59
  const WILDCARD_SUFFIX_LENGTH = 2;
59
60
 
61
+ function getErrorMessage(error: unknown): string {
62
+ if (error instanceof Error) {
63
+ return error.message;
64
+ }
65
+ return String(error);
66
+ }
67
+
60
68
  function isFileAccepted(file: File, acceptValue: string | string[] | undefined): boolean {
61
69
  const fileName = (file.name || "").toLowerCase();
62
70
  const fileType = (file.type || "").toLowerCase();
@@ -160,7 +168,10 @@ async function emitDroppedEntries(entries: FileSystemEntry[]): Promise<void> {
160
168
  entries.map(async (entry) => {
161
169
  const files = await filesFromEntry(entry, entry.name);
162
170
  // Files inside a dropped folder are all needed: never filtered out.
163
- return entry.isDirectory ? files : files.filter((file) => isFileAccepted(file, accept));
171
+ if (entry.isDirectory) {
172
+ return files;
173
+ }
174
+ return files.filter((file) => isFileAccepted(file, accept));
164
175
  }),
165
176
  );
166
177
  const files = groups.flat();
@@ -168,8 +179,7 @@ async function emitDroppedEntries(entries: FileSystemEntry[]): Promise<void> {
168
179
  emit("files-selected", files);
169
180
  }
170
181
  } catch (error) {
171
- const message = error instanceof Error ? error.message : String(error);
172
- emit("folder-read-error", message);
182
+ emit("folder-read-error", getErrorMessage(error));
173
183
  }
174
184
  }
175
185
 
@@ -55,12 +55,15 @@ const toggle_loading = useToggle(loading);
55
55
 
56
56
  function files_uploaded_event(value: unknown[]): void {
57
57
  if (value.length > 0) {
58
- emit(
59
- "update_values",
60
- timeSeries
61
- ? { files: value, autoUpload: false, time_series: time_series.value }
62
- : { files: value, autoUpload: false },
63
- );
58
+ if (timeSeries) {
59
+ emit("update_values", {
60
+ files: value,
61
+ autoUpload: false,
62
+ time_series: time_series.value,
63
+ });
64
+ } else {
65
+ emit("update_values", { files: value, autoUpload: false });
66
+ }
64
67
  emit("increment_step");
65
68
  }
66
69
  }
@@ -92,7 +92,10 @@ function capitalize(val: string): string {
92
92
 
93
93
  const fieldTypeLabel = computed<string>(() => {
94
94
  const fieldType = hybridViewerStore.hoverData?.fieldType;
95
- return typeof fieldType === "string" ? capitalize(fieldType.toLowerCase()) : "";
95
+ if (typeof fieldType !== "string") {
96
+ return "";
97
+ }
98
+ return capitalize(fieldType.toLowerCase());
96
99
  });
97
100
 
98
101
  const coordinates = computed<number[] | undefined>(() => {
@@ -114,7 +117,10 @@ function formatAttributeValue(val: unknown): string {
114
117
  return `[ ${formattedValues.join(", ")} ]`;
115
118
  }
116
119
  if (typeof val === "number") {
117
- return Number.isInteger(val) ? String(val) : Number(val).toFixed(4);
120
+ if (Number.isInteger(val)) {
121
+ return String(val);
122
+ }
123
+ return Number(val).toFixed(4);
118
124
  }
119
125
  return val;
120
126
  }
@@ -56,9 +56,12 @@ const mandatory_files = ref<string[]>([]);
56
56
  const additional_files = ref<string[]>([]);
57
57
  const missing_by_file = ref<FileMissingFiles[]>([]);
58
58
  // Files left out at the data type step are not checked
59
- const checked_filenames = computed(() =>
60
- timeSeries ? filenames : filenames.filter((filename) => filename in geodeObjectTypes),
61
- );
59
+ const checked_filenames = computed(() => {
60
+ if (timeSeries) {
61
+ return filenames;
62
+ }
63
+ return filenames.filter((filename) => filename in geodeObjectTypes);
64
+ });
62
65
  // Files whose mandatory files are missing are skipped when the step is skipped
63
66
  const files_without_mandatory = computed(() =>
64
67
  checked_filenames.value.filter(
@@ -160,9 +163,10 @@ async function upload_missing_from(
160
163
  }
161
164
  const found = expected.flatMap((expected_path, index) => {
162
165
  const file = folder_files[match.indices[index] ?? -1];
163
- return file && !uploaded.includes(file)
164
- ? [Object.assign(file, { relativePath: expected_path })]
165
- : [];
166
+ if (file && !uploaded.includes(file)) {
167
+ return [Object.assign(file, { relativePath: expected_path })];
168
+ }
169
+ return [];
166
170
  });
167
171
  if (found.length === 0) {
168
172
  useFeedbackStore().add_warning(`The selected folder does not contain: ${expected.join(", ")}`);
@@ -131,9 +131,12 @@ function resolvePerFile(allowedObjectsList: readonly AllowedObjectMap[]): boolea
131
131
  }
132
132
  const pending = loadable.filter((file) => file.selectedGeodeObject === undefined);
133
133
  resolvedTypes.value = Object.fromEntries(
134
- loadable.flatMap((file) =>
135
- file.selectedGeodeObject === undefined ? [] : [[file.filename, file.selectedGeodeObject]],
136
- ),
134
+ loadable.flatMap((file) => {
135
+ if (file.selectedGeodeObject === undefined) {
136
+ return [];
137
+ }
138
+ return [[file.filename, file.selectedGeodeObject]];
139
+ }),
137
140
  );
138
141
  pendingFilenames.value = pending.map((file) => file.filename);
139
142
  skippedFiles.value = files
@@ -23,6 +23,13 @@ interface Props {
23
23
 
24
24
  const { width = DEFAULT_PANEL_WIDTH, escapeFunction = undefined } = defineProps<Props>();
25
25
 
26
+ function getErrorMessage(error: unknown): string {
27
+ if (error instanceof Error) {
28
+ return error.message;
29
+ }
30
+ return String(error);
31
+ }
32
+
26
33
  const output_extensions =
27
34
  viewer_schemas.opengeodeweb_viewer.viewer.take_screenshot.properties.output_extension.enum;
28
35
  const filename = ref<string>("");
@@ -64,7 +71,7 @@ async function deliverScreenshot(blob: Blob | Uint8Array, current_filename: stri
64
71
  await copy([new ClipboardItem({ "image/png": pngBlob })]);
65
72
  feedbackStore.add_success("Screenshot copied to clipboard");
66
73
  } catch (error) {
67
- const message = error instanceof Error ? error.message : String(error);
74
+ const message = getErrorMessage(error);
68
75
  feedbackStore.add_error(
69
76
  0,
70
77
  "",
@@ -138,7 +145,7 @@ async function takeUiScreenshot(current_filename: string): Promise<void> {
138
145
  const blob = await captureTab(mime_type);
139
146
  await deliverScreenshot(blob, current_filename);
140
147
  } catch (error) {
141
- const message = error instanceof Error ? error.message : String(error);
148
+ const message = getErrorMessage(error);
142
149
  feedbackStore.add_error(0, "", "Screenshot Error", `Failed to capture the page: ${message}`);
143
150
  }
144
151
  }
@@ -183,7 +183,11 @@ watch(selectedDatasetId, async (id, previousId) => {
183
183
  await hybridViewerStore.setThreshold([previousId]);
184
184
  }
185
185
  selectedSourceIndex.value = undefined;
186
- sources.value = id ? await fetchSources(id) : [];
186
+ if (id) {
187
+ sources.value = await fetchSources(id);
188
+ } else {
189
+ sources.value = [];
190
+ }
187
191
  });
188
192
 
189
193
  watch(selectedSourceIndex, async (index) => {
@@ -31,14 +31,16 @@ const referenceBlockId = computed<string | undefined>(() =>
31
31
  collections ? targetBlockIds[0] : undefined,
32
32
  );
33
33
 
34
- const blockComponentIds = computed<string[]>(() => (blockId === undefined ? [] : [blockId]));
34
+ const blockComponentIds = computed<string[]>(() => (blockId !== undefined && [blockId]) || []);
35
35
 
36
36
  // Visibility
37
37
  const blocksVisibility = computed<boolean>({
38
- get: () =>
39
- collections
40
- ? targetBlockIds.every((id) => dataStyleStore.modelBlockVisibility(modelId, id))
41
- : dataStyleStore.modelComponentTypeVisibility(modelId, "Block"),
38
+ get: () => {
39
+ if (collections) {
40
+ return targetBlockIds.every((id) => dataStyleStore.modelBlockVisibility(modelId, id));
41
+ }
42
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Block");
43
+ },
42
44
  set: async (newValue) => {
43
45
  await dataStyleStore.setModelBlocksVisibility(modelId, targetBlockIds, newValue);
44
46
  hybridViewerStore.remoteRender();
@@ -30,14 +30,16 @@ const referenceCornerId = computed<string | undefined>(() =>
30
30
  collections ? targetCornerIds[0] : undefined,
31
31
  );
32
32
 
33
- const cornerComponentIds = computed<string[]>(() => (cornerId === undefined ? [] : [cornerId]));
33
+ const cornerComponentIds = computed<string[]>(() => (cornerId !== undefined && [cornerId]) || []);
34
34
 
35
35
  // Visibility
36
36
  const cornersVisibility = computed<boolean>({
37
- get: () =>
38
- collections
39
- ? targetCornerIds.every((id) => dataStyleStore.modelCornerVisibility(modelId, id))
40
- : dataStyleStore.modelComponentTypeVisibility(modelId, "Corner"),
37
+ get: () => {
38
+ if (collections) {
39
+ return targetCornerIds.every((id) => dataStyleStore.modelCornerVisibility(modelId, id));
40
+ }
41
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Corner");
42
+ },
41
43
  set: async (newValue) => {
42
44
  await dataStyleStore.setModelCornersVisibility(modelId, targetCornerIds, newValue);
43
45
  hybridViewerStore.remoteRender();
@@ -26,18 +26,18 @@ const {
26
26
  const dataStyleStore = useDataStyleStore();
27
27
  const hybridViewerStore = useHybridViewerStore();
28
28
 
29
- const referenceLineId = computed<string | undefined>(() =>
30
- collections ? targetLineIds[0] : undefined,
31
- );
29
+ const referenceLineId = computed(() => (collections ? targetLineIds[0] : undefined));
32
30
 
33
- const lineComponentIds = computed<string[]>(() => (lineId === undefined ? [] : [lineId]));
31
+ const lineComponentIds = computed<string[]>(() => (lineId !== undefined && [lineId]) || []);
34
32
 
35
33
  // Visibility
36
34
  const linesVisibility = computed<boolean>({
37
- get: () =>
38
- collections
39
- ? targetLineIds.every((id) => dataStyleStore.modelLineVisibility(modelId, id))
40
- : dataStyleStore.modelComponentTypeVisibility(modelId, "Line"),
35
+ get: () => {
36
+ if (collections) {
37
+ return targetLineIds.every((id) => dataStyleStore.modelLineVisibility(modelId, id));
38
+ }
39
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Line");
40
+ },
41
41
  set: async (newValue) => {
42
42
  await dataStyleStore.setModelLinesVisibility(modelId, targetLineIds, newValue);
43
43
  hybridViewerStore.remoteRender();
@@ -88,20 +88,22 @@ watch(
88
88
  { immediate: true },
89
89
  );
90
90
 
91
- const typeTargets = computed(() =>
92
- edgesComponentType.value === undefined
93
- ? []
94
- : [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }],
95
- );
91
+ const typeTargets = computed(() => {
92
+ if (edgesComponentType.value === undefined) {
93
+ return [];
94
+ }
95
+ return [{ componentType: edgesComponentType.value, componentIds: targetComponentIds.value }];
96
+ });
96
97
  const typeReferenceId = computed<string | undefined>(() =>
97
98
  collections.value ? targetComponentIds.value[0] : undefined,
98
99
  );
99
100
 
100
- const componentTargets = computed(() =>
101
- edgesComponentType.value === undefined || componentId.value === undefined
102
- ? []
103
- : [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }],
104
- );
101
+ const componentTargets = computed(() => {
102
+ if (edgesComponentType.value === undefined || componentId.value === undefined) {
103
+ return [];
104
+ }
105
+ return [{ componentType: edgesComponentType.value, componentIds: [componentId.value] }];
106
+ });
105
107
 
106
108
  const { tabs, activeTab } = useModelTabs({
107
109
  componentType,
@@ -72,20 +72,22 @@ watch(
72
72
  { immediate: true },
73
73
  );
74
74
 
75
- const typeTargets = computed(() =>
76
- pointsComponentType.value === undefined
77
- ? []
78
- : [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }],
79
- );
75
+ const typeTargets = computed(() => {
76
+ if (pointsComponentType.value === undefined) {
77
+ return [];
78
+ }
79
+ return [{ componentType: pointsComponentType.value, componentIds: targetComponentIds.value }];
80
+ });
80
81
  const typeReferenceId = computed<string | undefined>(() =>
81
82
  collections.value ? targetComponentIds.value[0] : undefined,
82
83
  );
83
84
 
84
- const componentTargets = computed(() =>
85
- pointsComponentType.value === undefined || componentId.value === undefined
86
- ? []
87
- : [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }],
88
- );
85
+ const componentTargets = computed(() => {
86
+ if (pointsComponentType.value === undefined || componentId.value === undefined) {
87
+ return [];
88
+ }
89
+ return [{ componentType: pointsComponentType.value, componentIds: [componentId.value] }];
90
+ });
89
91
 
90
92
  const { tabs, activeTab } = useModelTabs({
91
93
  componentType,
@@ -31,14 +31,18 @@ const referenceSurfaceId = computed<string | undefined>(() =>
31
31
  collections ? targetSurfaceIds[0] : undefined,
32
32
  );
33
33
 
34
- const surfaceComponentIds = computed<string[]>(() => (surfaceId === undefined ? [] : [surfaceId]));
34
+ const surfaceComponentIds = computed<string[]>(
35
+ () => (surfaceId !== undefined && [surfaceId]) || [],
36
+ );
35
37
 
36
38
  // Visibility
37
39
  const surfacesVisibility = computed<boolean>({
38
- get: () =>
39
- collections
40
- ? targetSurfaceIds.every((id) => dataStyleStore.modelSurfaceVisibility(modelId, id))
41
- : dataStyleStore.modelComponentTypeVisibility(modelId, "Surface"),
40
+ get: () => {
41
+ if (collections) {
42
+ return targetSurfaceIds.every((id) => dataStyleStore.modelSurfaceVisibility(modelId, id));
43
+ }
44
+ return dataStyleStore.modelComponentTypeVisibility(modelId, "Surface");
45
+ },
42
46
  set: async (newValue) => {
43
47
  await dataStyleStore.setModelSurfacesVisibility(modelId, targetSurfaceIds, newValue);
44
48
  hybridViewerStore.remoteRender();
@@ -31,7 +31,10 @@ function summarize(components: readonly FormattedComponent[]): string {
31
31
  return MESH_COMPONENT_TYPES.filter((type) => counts.has(type))
32
32
  .map((type) => {
33
33
  const count = counts.get(type) ?? 0;
34
- return `${count} ${count > 1 ? pluralize(type) : type}`;
34
+ if (count > 1) {
35
+ return `${count} ${pluralize(type)}`;
36
+ }
37
+ return `${count} ${type}`;
35
38
  })
36
39
  .join(", ");
37
40
  }
@@ -126,7 +126,12 @@ function handleHoverEnter({
126
126
 
127
127
  onHoverEnter(
128
128
  actualItem.id,
129
- async () => (is_model ? await dataStore.getAllModelComponentsViewerIds(actualItem.id) : []),
129
+ async () => {
130
+ if (is_model) {
131
+ return await dataStore.getAllModelComponentsViewerIds(actualItem.id);
132
+ }
133
+ return [];
134
+ },
130
135
  is_model ? "model" : "mesh",
131
136
  immediate,
132
137
  );
@@ -11,10 +11,17 @@ const maximum = defineModel<number>("maximum");
11
11
  const minimumText = ref<string>("");
12
12
  const maximumText = ref<string>("");
13
13
 
14
- watch(minimum, (value) => (minimumText.value = value === undefined ? "" : String(value)), {
14
+ function formatValue(value: number | undefined): string {
15
+ if (value === undefined) {
16
+ return "";
17
+ }
18
+ return String(value);
19
+ }
20
+
21
+ watch(minimum, (value) => (minimumText.value = formatValue(value)), {
15
22
  immediate: true,
16
23
  });
17
- watch(maximum, (value) => (maximumText.value = value === undefined ? "" : String(value)), {
24
+ watch(maximum, (value) => (maximumText.value = formatValue(value)), {
18
25
  immediate: true,
19
26
  });
20
27
 
@@ -27,7 +34,7 @@ function parseValue(text: string): number | undefined {
27
34
  function commitMinimum(): void {
28
35
  const value = parseValue(minimumText.value);
29
36
  if (value === undefined) {
30
- minimumText.value = minimum.value === undefined ? "" : String(minimum.value);
37
+ minimumText.value = formatValue(minimum.value);
31
38
  return;
32
39
  }
33
40
  minimum.value = value;
@@ -36,7 +43,7 @@ function commitMinimum(): void {
36
43
  function commitMaximum(): void {
37
44
  const value = parseValue(maximumText.value);
38
45
  if (value === undefined) {
39
- maximumText.value = maximum.value === undefined ? "" : String(maximum.value);
46
+ maximumText.value = formatValue(maximum.value);
40
47
  return;
41
48
  }
42
49
  maximum.value = value;
@@ -139,24 +139,35 @@ function requestParams(): { id: string; component_ids?: string[] } | undefined {
139
139
  if (schemaProperties?.component_ids === undefined) {
140
140
  return { id };
141
141
  }
142
- return hasSelectedComponent(componentIds) ? { id, component_ids: componentIds } : undefined;
142
+ if (!hasSelectedComponent(componentIds)) {
143
+ return undefined;
144
+ }
145
+ return { id, component_ids: componentIds };
146
+ }
147
+
148
+ function getRangeTargets(
149
+ name: string,
150
+ ): [string, { id: string; component_ids?: string[] } | undefined][] {
151
+ if (groupTargetIds.value) {
152
+ return [...attributesPerTarget]
153
+ .filter(([, targetAttributes]) =>
154
+ targetAttributes.some((attribute) => attribute.attribute_name === name),
155
+ )
156
+ .map(([targetId]) => [targetId, { id: targetId }]);
157
+ }
158
+ return [[id, requestParams()]];
143
159
  }
144
160
 
145
161
  // Ranges are computed by the back for the selected attribute only, as scanning every step of every series is slow
146
162
  async function requestRanges(name: string): Promise<void> {
147
- const targets: [string, { id: string; component_ids?: string[] } | undefined][] =
148
- groupTargetIds.value
149
- ? [...attributesPerTarget]
150
- .filter(([, targetAttributes]) =>
151
- targetAttributes.some((attribute) => attribute.attribute_name === name),
152
- )
153
- .map(([targetId]) => [targetId, { id: targetId }])
154
- : [[id, requestParams()]];
163
+ const targets = getRangeTargets(name);
155
164
  const entries = await Promise.all(
156
- targets.map(async ([targetId, params]): Promise<[string, AttributeRangeInfo | undefined]> => [
157
- targetId,
158
- params ? await fetchAttributeRange(schemas.range, params, name) : undefined,
159
- ]),
165
+ targets.map(async ([targetId, params]): Promise<[string, AttributeRangeInfo | undefined]> => {
166
+ if (!params) {
167
+ return [targetId, undefined];
168
+ }
169
+ return [targetId, await fetchAttributeRange(schemas.range, params, name)];
170
+ }),
160
171
  );
161
172
  if (rangesName !== name) {
162
173
  return;
@@ -50,7 +50,10 @@ function onPickerUpdate(color: VuetifyColor): void {
50
50
  const red = Math.round(color.r);
51
51
  const green = Math.round(color.g);
52
52
  const blue = Math.round(color.b);
53
- const alpha = disabledAlpha ? 1 : Number(color.a.toFixed(2));
53
+ let alpha = 1;
54
+ if (!disabledAlpha) {
55
+ alpha = Number(color.a.toFixed(2));
56
+ }
54
57
 
55
58
  vuetifyColor.value = { r: red, g: green, b: blue, a: alpha };
56
59
  updateInputTextFromColor(red, green, blue, alpha);