@geode/opengeodeweb-front 10.44.0-rc.1 → 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 (69) 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 +14 -12
  16. package/app/components/Viewer/Generic/Model/CornersOptions.vue +14 -12
  17. package/app/components/Viewer/Generic/Model/LinesOptions.vue +15 -15
  18. package/app/components/Viewer/Generic/Model/ModelCardTabs.vue +35 -0
  19. package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +34 -25
  20. package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +34 -25
  21. package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +17 -5
  22. package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +16 -12
  23. package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +4 -1
  24. package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +6 -1
  25. package/app/components/Viewer/Options/AttributeRangeSelector.vue +11 -4
  26. package/app/components/Viewer/Options/AttributeSelector.vue +24 -13
  27. package/app/components/Viewer/Options/ColorPicker.vue +4 -1
  28. package/app/components/Viewer/Options/ColormapQuickPicker.vue +13 -7
  29. package/app/components/csv-preview/CsvPreviewer.vue +4 -1
  30. package/app/composables/attribute_coloring_style.ts +8 -2
  31. package/app/composables/global_attribute_style.ts +4 -3
  32. package/app/composables/hover_highlight.ts +6 -5
  33. package/app/composables/model_tabs.ts +86 -0
  34. package/app/composables/project_manager.ts +5 -5
  35. package/app/composables/stepper_tree.ts +10 -2
  36. package/app/composables/tree_filter.ts +11 -2
  37. package/app/composables/tree_keyboard_nav.ts +4 -2
  38. package/app/composables/use_overlapping_picker.ts +5 -5
  39. package/app/composables/virtual_tree.ts +14 -7
  40. package/app/stores/app_helpers/extension.ts +1 -1
  41. package/app/stores/feedback.ts +2 -2
  42. package/app/stores/hybrid_viewer.ts +1 -1
  43. package/app/stores/treeview.ts +17 -10
  44. package/app/utils/clipping_planes.ts +4 -3
  45. package/app/utils/extension.ts +1 -1
  46. package/app/utils/import_workflow.ts +6 -4
  47. package/app/utils/upload_path.ts +15 -9
  48. package/internal/database/database.ts +4 -1
  49. package/internal/stores/data_style/model/blocks/polyhedron.ts +14 -10
  50. package/internal/stores/data_style/model/blocks/vertex.ts +14 -10
  51. package/internal/stores/data_style/model/corners/vertex.ts +14 -10
  52. package/internal/stores/data_style/model/lines/edge.ts +14 -10
  53. package/internal/stores/data_style/model/lines/vertex.ts +14 -10
  54. package/internal/stores/data_style/model/surfaces/polygon.ts +14 -10
  55. package/internal/stores/data_style/model/surfaces/vertex.ts +14 -10
  56. package/internal/stores/hybrid_viewer/brightness.ts +8 -2
  57. package/internal/stores/hybrid_viewer/camera_animation.ts +4 -3
  58. package/internal/stores/hybrid_viewer/highlight.ts +10 -9
  59. package/internal/stores/hybrid_viewer/ruler.ts +4 -3
  60. package/internal/utils/ws_client.ts +8 -1
  61. package/package.json +2 -2
  62. package/server/api/local/extensions/run.post.ts +6 -4
  63. package/server/utils/cleanup.ts +12 -2
  64. package/server/utils/microservices.ts +11 -4
  65. package/server/utils/typed_handler.ts +8 -1
  66. package/server/utils/ws_client.ts +15 -2
  67. package/shared/utils/fetch_raw.ts +2 -2
  68. package/shared/utils/parse_boolean.ts +4 -1
  69. package/app/components/Viewer/Options/OptionsSection.vue +0 -76
@@ -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) => {
@@ -1,7 +1,6 @@
1
1
  <script setup lang="ts">
2
2
  // oxlint-disable eslint/max-lines
3
3
  import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
4
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
5
4
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
6
5
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
7
6
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -14,6 +13,7 @@ interface Props {
14
13
  blockId?: string;
15
14
  targetBlockIds: string[];
16
15
  collections?: CollectionComponent[];
16
+ activeTab?: string;
17
17
  }
18
18
 
19
19
  const {
@@ -21,6 +21,7 @@ const {
21
21
  blockId = undefined,
22
22
  targetBlockIds,
23
23
  collections = undefined,
24
+ activeTab = undefined,
24
25
  } = defineProps<Props>();
25
26
 
26
27
  const dataStyleStore = useDataStyleStore();
@@ -30,14 +31,16 @@ const referenceBlockId = computed<string | undefined>(() =>
30
31
  collections ? targetBlockIds[0] : undefined,
31
32
  );
32
33
 
33
- const blockComponentIds = computed<string[]>(() => (blockId === undefined ? [] : [blockId]));
34
+ const blockComponentIds = computed<string[]>(() => (blockId !== undefined && [blockId]) || []);
34
35
 
35
36
  // Visibility
36
37
  const blocksVisibility = computed<boolean>({
37
- get: () =>
38
- collections
39
- ? targetBlockIds.every((id) => dataStyleStore.modelBlockVisibility(modelId, id))
40
- : 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
+ },
41
44
  set: async (newValue) => {
42
45
  await dataStyleStore.setModelBlocksVisibility(modelId, targetBlockIds, newValue);
43
46
  hybridViewerStore.remoteRender();
@@ -472,7 +475,7 @@ const attributeSchemas = {
472
475
  </script>
473
476
 
474
477
  <template>
475
- <OptionsSection title="Blocks Options" class="mt-4" data-testid="modelComponentTypeOptions">
478
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
476
479
  <VisibilitySwitch data-testid="modelBlocksVisibilitySwitch" v-model="blocksVisibility" />
477
480
  <ViewerOptionsColoringTypeSelector
478
481
  :id="modelId"
@@ -495,12 +498,11 @@ const attributeSchemas = {
495
498
  :schemas="attributeSchemas"
496
499
  :allowRandom="true"
497
500
  />
498
- </OptionsSection>
501
+ </div>
499
502
 
500
- <OptionsSection
503
+ <div
501
504
  v-if="blockId"
502
- title="Component Options"
503
- class="mt-4"
505
+ v-show="!activeTab || activeTab === 'component'"
504
506
  data-testid="modelComponentOptions"
505
507
  >
506
508
  <VisibilitySwitch v-model="blockVisibility" />
@@ -525,5 +527,5 @@ const attributeSchemas = {
525
527
  :schemas="attributeSchemas"
526
528
  :allowRandom="true"
527
529
  />
528
- </OptionsSection>
530
+ </div>
529
531
  </template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
3
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
4
3
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
5
4
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
6
5
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -13,6 +12,7 @@ interface Props {
13
12
  cornerId?: string;
14
13
  targetCornerIds: string[];
15
14
  collections?: CollectionComponent[];
15
+ activeTab?: string;
16
16
  }
17
17
 
18
18
  const {
@@ -20,6 +20,7 @@ const {
20
20
  cornerId = undefined,
21
21
  targetCornerIds,
22
22
  collections = undefined,
23
+ activeTab = undefined,
23
24
  } = defineProps<Props>();
24
25
 
25
26
  const dataStyleStore = useDataStyleStore();
@@ -29,14 +30,16 @@ const referenceCornerId = computed<string | undefined>(() =>
29
30
  collections ? targetCornerIds[0] : undefined,
30
31
  );
31
32
 
32
- const cornerComponentIds = computed<string[]>(() => (cornerId === undefined ? [] : [cornerId]));
33
+ const cornerComponentIds = computed<string[]>(() => (cornerId !== undefined && [cornerId]) || []);
33
34
 
34
35
  // Visibility
35
36
  const cornersVisibility = computed<boolean>({
36
- get: () =>
37
- collections
38
- ? targetCornerIds.every((id) => dataStyleStore.modelCornerVisibility(modelId, id))
39
- : 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
+ },
40
43
  set: async (newValue) => {
41
44
  await dataStyleStore.setModelCornersVisibility(modelId, targetCornerIds, newValue);
42
45
  hybridViewerStore.remoteRender();
@@ -270,7 +273,7 @@ const attributeSchemas = {
270
273
  </script>
271
274
 
272
275
  <template>
273
- <OptionsSection title="Corners Options" class="mt-4" data-testid="modelComponentTypeOptions">
276
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
274
277
  <VisibilitySwitch data-testid="modelCornersVisibilitySwitch" v-model="cornersVisibility" />
275
278
  <ViewerOptionsColoringTypeSelector
276
279
  :id="modelId"
@@ -287,12 +290,11 @@ const attributeSchemas = {
287
290
  :schemas="attributeSchemas"
288
291
  :allowRandom="true"
289
292
  />
290
- </OptionsSection>
293
+ </div>
291
294
 
292
- <OptionsSection
295
+ <div
293
296
  v-if="cornerId"
294
- title="Component Options"
295
- class="mt-4"
297
+ v-show="!activeTab || activeTab === 'component'"
296
298
  data-testid="modelComponentOptions"
297
299
  >
298
300
  <VisibilitySwitch v-model="cornerVisibility" />
@@ -311,5 +313,5 @@ const attributeSchemas = {
311
313
  :schemas="attributeSchemas"
312
314
  :allowRandom="true"
313
315
  />
314
- </OptionsSection>
316
+ </div>
315
317
  </template>
@@ -1,6 +1,5 @@
1
1
  <script setup lang="ts">
2
2
  import type { CollectionComponent } from "@ogw_front/stores/data_helpers/collections";
3
- import OptionsSection from "@ogw_front/components/Viewer/Options/OptionsSection.vue";
4
3
  import type { RGBAColor } from "@ogw_front/utils/default_styles/constants";
5
4
  import ViewerOptionsColoringTypeSelector from "@ogw_front/components/Viewer/Options/ColoringTypeSelector.vue";
6
5
  import VisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
@@ -13,6 +12,7 @@ interface Props {
13
12
  lineId?: string;
14
13
  targetLineIds: string[];
15
14
  collections?: CollectionComponent[];
15
+ activeTab?: string;
16
16
  }
17
17
 
18
18
  const {
@@ -20,23 +20,24 @@ const {
20
20
  lineId = undefined,
21
21
  targetLineIds,
22
22
  collections = undefined,
23
+ activeTab = undefined,
23
24
  } = defineProps<Props>();
24
25
 
25
26
  const dataStyleStore = useDataStyleStore();
26
27
  const hybridViewerStore = useHybridViewerStore();
27
28
 
28
- const referenceLineId = computed<string | undefined>(() =>
29
- collections ? targetLineIds[0] : undefined,
30
- );
29
+ const referenceLineId = computed(() => (collections ? targetLineIds[0] : undefined));
31
30
 
32
- const lineComponentIds = computed<string[]>(() => (lineId === undefined ? [] : [lineId]));
31
+ const lineComponentIds = computed<string[]>(() => (lineId !== undefined && [lineId]) || []);
33
32
 
34
33
  // Visibility
35
34
  const linesVisibility = computed<boolean>({
36
- get: () =>
37
- collections
38
- ? targetLineIds.every((id) => dataStyleStore.modelLineVisibility(modelId, id))
39
- : 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
+ },
40
41
  set: async (newValue) => {
41
42
  await dataStyleStore.setModelLinesVisibility(modelId, targetLineIds, newValue);
42
43
  hybridViewerStore.remoteRender();
@@ -391,7 +392,7 @@ const attributeSchemas = {
391
392
  </script>
392
393
 
393
394
  <template>
394
- <OptionsSection title="Lines Options" class="mt-4" data-testid="modelComponentTypeOptions">
395
+ <div v-show="!activeTab || activeTab === 'type'" data-testid="modelComponentTypeOptions">
395
396
  <VisibilitySwitch data-testid="modelLinesVisibilitySwitch" v-model="linesVisibility" />
396
397
  <ViewerOptionsColoringTypeSelector
397
398
  :id="modelId"
@@ -414,12 +415,11 @@ const attributeSchemas = {
414
415
  :schemas="attributeSchemas"
415
416
  :allowRandom="true"
416
417
  />
417
- </OptionsSection>
418
+ </div>
418
419
 
419
- <OptionsSection
420
+ <div
420
421
  v-if="lineId"
421
- title="Component Options"
422
- class="mt-4"
422
+ v-show="!activeTab || activeTab === 'component'"
423
423
  data-testid="modelComponentOptions"
424
424
  >
425
425
  <VisibilitySwitch v-model="lineVisibility" />
@@ -444,5 +444,5 @@ const attributeSchemas = {
444
444
  :schemas="attributeSchemas"
445
445
  :allowRandom="true"
446
446
  />
447
- </OptionsSection>
447
+ </div>
448
448
  </template>
@@ -0,0 +1,35 @@
1
+ <script setup lang="ts">
2
+ import type { ModelTabItem } from "@ogw_front/composables/model_tabs";
3
+
4
+ interface Props {
5
+ tabs: ModelTabItem[];
6
+ }
7
+
8
+ const { tabs } = defineProps<Props>();
9
+ const activeTab = defineModel<string>({ required: true });
10
+ </script>
11
+
12
+ <template>
13
+ <v-row v-if="tabs.length > 0" justify="center" dense class="mb-2">
14
+ <v-col cols="12" class="py-0 d-flex justify-center">
15
+ <v-btn-toggle
16
+ v-model="activeTab"
17
+ mandatory
18
+ color="primary"
19
+ variant="outlined"
20
+ density="compact"
21
+ >
22
+ <v-btn
23
+ v-for="tab in tabs"
24
+ :key="tab.value"
25
+ :value="tab.value"
26
+ :data-testid="tab.testId"
27
+ size="small"
28
+ class="text-caption text-none"
29
+ >
30
+ {{ tab.label }}
31
+ </v-btn>
32
+ </v-btn-toggle>
33
+ </v-col>
34
+ </v-row>
35
+ </template>