@geode/opengeodeweb-front 10.34.0-rc.8 → 10.34.0
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.
- package/{server → .build/server}/utils/app_config.js +10 -9
- package/{server → .build/server}/utils/cleanup.js +31 -17
- package/{server → .build/server}/utils/cloud.js +1 -4
- package/{server → .build/server}/utils/microservices.js +21 -9
- package/{server → .build/server}/utils/path.js +4 -4
- package/{server → .build/server}/utils/scripts.js +9 -9
- package/.build/server/utils/server_config.js +51 -0
- package/.build/server/utils/stream.js +6 -0
- package/{server → .build/server}/utils/ws_client.js +18 -3
- package/{shared → .build/shared}/scripts.js +10 -10
- package/.build/shared/utils/call_raw.js +31 -0
- package/{shared → .build/shared}/utils/call_schema.js +2 -2
- package/.build/shared/utils/fetch_raw.js +52 -0
- package/{shared → .build/shared}/utils/fetch_schema.js +2 -2
- package/{shared → .build/shared}/utils/file.js +3 -1
- package/{shared → .build/shared}/utils/response_handlers/load.js +10 -7
- package/{shared → .build/shared}/utils/validate_schema.js +1 -1
- package/app/components/ActionButton.vue +6 -6
- package/app/components/CameraManager/List.vue +5 -5
- package/app/components/CameraManager/Saver.vue +3 -5
- package/app/components/CameraManager.vue +6 -4
- package/app/components/CameraOrientation.vue +12 -12
- package/app/components/ClippingPlaneCard.vue +4 -2
- package/app/components/ClippingPlanes.vue +8 -8
- package/app/components/CrsSelector.vue +9 -10
- package/app/components/DeleteDialog.vue +4 -2
- package/app/components/DragAndDrop.vue +10 -12
- package/app/components/DragAndDropInternal/DragAndDropInline.vue +4 -2
- package/app/components/ExtensionSelector.vue +4 -4
- package/app/components/FeedBack/ErrorBanner.vue +3 -1
- package/app/components/FeedBack/Snackers.vue +4 -3
- package/app/components/FileSelector.vue +10 -8
- package/app/components/FileUploader.vue +11 -11
- package/app/components/GlassCard.vue +1 -1
- package/app/components/HybridRenderingView.vue +7 -5
- package/app/components/HybridViewerTooltip.vue +7 -7
- package/app/components/Launcher.vue +1 -1
- package/app/components/Loading/EcoMessages.vue +9 -3
- package/app/components/Loading.vue +2 -2
- package/app/components/MissingFilesSelector.vue +12 -10
- package/app/components/ObjectSelector.vue +10 -9
- package/app/components/PackagesVersions.vue +6 -5
- package/app/components/Recaptcha.vue +3 -3
- package/app/components/RemoteRenderingView.vue +6 -7
- package/app/components/Ruler.vue +3 -3
- package/app/components/Screenshot.vue +6 -6
- package/app/components/SearchBar.vue +4 -2
- package/app/components/ShrinkFilter.vue +7 -7
- package/app/components/Step.vue +6 -5
- package/app/components/Stepper.vue +4 -3
- package/app/components/ToolPanel.vue +6 -3
- package/app/components/ViewToolbar.vue +25 -28
- package/app/components/Viewer/ContextMenu/CenterButton.vue +7 -5
- package/app/components/Viewer/ContextMenu/CircularItems.vue +3 -3
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +22 -19
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +10 -8
- package/app/components/Viewer/ContextMenu/InfoCard.vue +11 -12
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +13 -17
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +11 -15
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +12 -16
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +8 -12
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +11 -15
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +11 -15
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +67 -38
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +53 -23
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +1 -3
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +67 -38
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +31 -15
- package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +2 -3
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +6 -6
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +69 -38
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +64 -46
- package/app/components/Viewer/ObjectTree/Base/Controls.vue +5 -5
- package/app/components/Viewer/ObjectTree/Base/ItemLabel.vue +13 -9
- package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +5 -5
- package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +10 -10
- package/app/components/Viewer/ObjectTree/Box.vue +6 -4
- package/app/components/Viewer/ObjectTree/Layout.vue +23 -21
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +14 -14
- package/app/components/Viewer/ObjectTree/Views/{ModelCollections.vue → ModelTree.vue} +59 -24
- package/app/components/Viewer/Options/AttributeColorBar.vue +4 -2
- package/app/components/Viewer/Options/AttributeRangeSelector.vue +4 -2
- package/app/components/Viewer/Options/AttributeSelector.vue +7 -9
- package/app/components/Viewer/Options/ColorMapList.vue +15 -13
- package/app/components/Viewer/Options/ColorMapPicker.vue +4 -4
- package/app/components/Viewer/Options/ColorPicker.vue +223 -41
- package/app/components/Viewer/Options/ColoringTypeSelector.vue +16 -16
- package/app/components/Viewer/Options/ColormapQuickPicker.vue +7 -5
- package/app/components/Viewer/Options/OptionsSection.vue +1 -1
- package/app/components/Viewer/Options/TextureItem.vue +8 -6
- package/app/components/Viewer/Options/TexturesSelector.vue +1 -1
- package/app/components/Viewer/OverlappingObjectsPicker.vue +8 -9
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +2 -6
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +12 -16
- package/app/components/Viewer/Surface/PolygonsOptions.vue +12 -16
- package/app/components/Viewer/Ui.vue +2 -2
- package/app/components/Wrapper.vue +1 -4
- package/app/components/ZScaling.vue +5 -3
- package/app/components/csv-preview/CsvPreviewer.vue +38 -37
- package/app/components/csv-preview/CsvSettings.vue +6 -4
- package/app/components/csv-preview/CsvTable.vue +1 -1
- package/app/composables/batch_style.ts +5 -6
- package/app/composables/clipping_planes_widget.ts +73 -181
- package/app/composables/clipping_planes_widget_entries.ts +189 -0
- package/app/composables/copy_to_clipboard.ts +7 -0
- package/app/composables/global_attribute_style.ts +163 -83
- package/app/composables/hover_highlight.ts +46 -14
- package/app/composables/model_collections.ts +26 -13
- package/app/composables/model_components.ts +26 -13
- package/app/composables/project_manager.ts +76 -19
- package/app/composables/responsive_middle_truncate.ts +13 -13
- package/app/composables/stepper_tree.ts +34 -11
- package/app/composables/tree_filter.ts +66 -44
- package/app/composables/tree_keyboard_nav.ts +25 -11
- package/app/composables/tree_scroll.ts +44 -14
- package/app/composables/use_adaptive_styles.ts +66 -23
- package/app/composables/use_overlapping_picker.ts +66 -16
- package/app/composables/use_quick_colormap.ts +16 -5
- package/app/composables/virtual_tree.ts +75 -43
- package/app/composables/vtk_implicit_plane_widget.d.ts +2 -0
- package/app/plugins/auto_store_register.ts +2 -7
- package/app/plugins/click_outside_ignore_snackbars.client.ts +39 -0
- package/app/stores/app.ts +57 -192
- package/app/stores/app_helpers/extension.ts +179 -0
- package/app/stores/back.ts +37 -21
- package/app/stores/camera_manager.ts +22 -20
- package/app/stores/cloud.ts +17 -13
- package/app/stores/data.ts +88 -47
- package/app/stores/data_helpers/collections.ts +36 -38
- package/app/stores/data_helpers/mesh.ts +45 -36
- package/app/stores/data_style.ts +50 -28
- package/app/stores/feedback.ts +6 -6
- package/app/stores/hybrid_viewer.ts +41 -52
- package/app/stores/infra.ts +39 -37
- package/app/stores/menu.ts +23 -14
- package/app/stores/treeview.ts +72 -42
- package/app/stores/viewer.ts +39 -27
- package/app/utils/attributes.ts +3 -3
- package/app/utils/clipping_planes.ts +111 -14
- package/app/utils/color_picker.ts +57 -0
- package/app/utils/colormap.ts +58 -35
- package/app/utils/default_styles/index.ts +2 -2
- package/app/utils/default_styles/meshes.ts +107 -13
- package/app/utils/default_styles/models.ts +83 -14
- package/app/utils/extension.ts +47 -20
- package/app/utils/import_workflow.ts +21 -13
- package/app/utils/name_cleaner.ts +1 -1
- package/app/utils/string.ts +1 -1
- package/app/utils/treeview.ts +2 -2
- package/internal/database/base_database.ts +7 -3
- package/internal/database/database.ts +36 -26
- package/internal/database/extended_database.ts +1 -1
- package/internal/stores/data_style/mesh/cells/cell.ts +70 -34
- package/internal/stores/data_style/mesh/cells/color.ts +12 -6
- package/internal/stores/data_style/mesh/cells/common.ts +18 -8
- package/internal/stores/data_style/mesh/cells/index.ts +122 -42
- package/internal/stores/data_style/mesh/cells/textures.ts +12 -6
- package/internal/stores/data_style/mesh/cells/vertex.ts +75 -34
- package/internal/stores/data_style/mesh/cells/visibility.ts +15 -4
- package/internal/stores/data_style/mesh/edges/color.ts +12 -6
- package/internal/stores/data_style/mesh/edges/common.ts +14 -6
- package/internal/stores/data_style/mesh/edges/edge.ts +71 -39
- package/internal/stores/data_style/mesh/edges/index.ts +117 -42
- package/internal/stores/data_style/mesh/edges/vertex.ts +76 -39
- package/internal/stores/data_style/mesh/edges/visibility.ts +15 -4
- package/internal/stores/data_style/mesh/edges/width.ts +12 -4
- package/internal/stores/data_style/mesh/index.ts +30 -11
- package/internal/stores/data_style/mesh/points/color.ts +12 -6
- package/internal/stores/data_style/mesh/points/common.ts +21 -8
- package/internal/stores/data_style/mesh/points/index.ts +101 -50
- package/internal/stores/data_style/mesh/points/size.ts +12 -4
- package/internal/stores/data_style/mesh/points/vertex.ts +75 -34
- package/internal/stores/data_style/mesh/points/visibility.ts +17 -7
- package/internal/stores/data_style/mesh/polygons/color.ts +12 -6
- package/internal/stores/data_style/mesh/polygons/common.ts +23 -6
- package/internal/stores/data_style/mesh/polygons/index.ts +130 -70
- package/internal/stores/data_style/mesh/polygons/polygon.ts +77 -43
- package/internal/stores/data_style/mesh/polygons/textures.ts +12 -6
- package/internal/stores/data_style/mesh/polygons/vertex.ts +79 -39
- package/internal/stores/data_style/mesh/polygons/visibility.ts +16 -6
- package/internal/stores/data_style/mesh/polyhedra/color.ts +12 -6
- package/internal/stores/data_style/mesh/polyhedra/common.ts +14 -6
- package/internal/stores/data_style/mesh/polyhedra/index.ts +115 -56
- package/internal/stores/data_style/mesh/polyhedra/polyhedron.ts +80 -39
- package/internal/stores/data_style/mesh/polyhedra/vertex.ts +79 -39
- package/internal/stores/data_style/mesh/polyhedra/visibility.ts +16 -6
- package/internal/stores/data_style/model/blocks/color.ts +43 -13
- package/internal/stores/data_style/model/blocks/common.ts +21 -6
- package/internal/stores/data_style/model/blocks/index.ts +89 -59
- package/internal/stores/data_style/model/blocks/polyhedron.ts +101 -44
- package/internal/stores/data_style/model/blocks/vertex.ts +107 -42
- package/internal/stores/data_style/model/blocks/visibility.ts +17 -4
- package/internal/stores/data_style/model/color.ts +171 -83
- package/internal/stores/data_style/model/common.ts +70 -21
- package/internal/stores/data_style/model/corners/color.ts +43 -11
- package/internal/stores/data_style/model/corners/common.ts +25 -6
- package/internal/stores/data_style/model/corners/index.ts +66 -41
- package/internal/stores/data_style/model/corners/vertex.ts +105 -74
- package/internal/stores/data_style/model/corners/visibility.ts +19 -4
- package/internal/stores/data_style/model/edges/common.ts +12 -4
- package/internal/stores/data_style/model/edges/index.ts +2 -1
- package/internal/stores/data_style/model/edges/visibility.ts +24 -7
- package/internal/stores/data_style/model/index.ts +24 -11
- package/internal/stores/data_style/model/lines/color.ts +41 -11
- package/internal/stores/data_style/model/lines/common.ts +17 -6
- package/internal/stores/data_style/model/lines/edge.ts +105 -42
- package/internal/stores/data_style/model/lines/index.ts +86 -59
- package/internal/stores/data_style/model/lines/vertex.ts +105 -42
- package/internal/stores/data_style/model/lines/visibility.ts +17 -4
- package/internal/stores/data_style/model/points/common.ts +8 -4
- package/internal/stores/data_style/model/points/index.ts +10 -3
- package/internal/stores/data_style/model/points/size.ts +12 -4
- package/internal/stores/data_style/model/points/visibility.ts +16 -6
- package/internal/stores/data_style/model/selection.ts +80 -58
- package/internal/stores/data_style/model/surfaces/color.ts +41 -11
- package/internal/stores/data_style/model/surfaces/common.ts +23 -6
- package/internal/stores/data_style/model/surfaces/index.ts +89 -59
- package/internal/stores/data_style/model/surfaces/polygon.ts +107 -67
- package/internal/stores/data_style/model/surfaces/vertex.ts +111 -67
- package/internal/stores/data_style/model/surfaces/visibility.ts +18 -5
- package/internal/stores/data_style/model/visibility.ts +82 -20
- package/internal/stores/data_style/state.ts +77 -65
- package/internal/stores/hybrid_viewer/brightness.ts +49 -31
- package/internal/stores/hybrid_viewer/camera.ts +191 -177
- package/internal/stores/hybrid_viewer/camera_animation.ts +11 -10
- package/internal/stores/hybrid_viewer/core.ts +64 -0
- package/internal/stores/hybrid_viewer/filters.ts +10 -16
- package/internal/stores/hybrid_viewer/highlight.ts +91 -130
- package/internal/stores/hybrid_viewer/ruler.ts +24 -15
- package/internal/stores/hybrid_viewer/scene.ts +96 -117
- package/internal/stores/hybrid_viewer/viewport.ts +74 -65
- package/internal/stores/hybrid_viewer/vtk_types.ts +13 -29
- package/internal/utils/api_fetch.ts +54 -23
- package/internal/utils/upload_file.ts +74 -53
- package/internal/utils/viewer_call.ts +22 -13
- package/internal/utils/ws_client.ts +24 -13
- package/nuxt.config.ts +58 -1
- package/package.json +20 -8
- package/server/api/cloud/extensions/run.post.ts +6 -10
- package/server/api/local/app/project_folder_path.post.ts +4 -4
- package/server/api/local/app/run_back.post.ts +5 -7
- package/server/api/local/app/run_viewer.post.ts +5 -7
- package/server/api/local/extensions/kill.post.ts +4 -3
- package/server/api/local/extensions/run.post.ts +7 -10
- package/server/api/local/extensions/upload.put.ts +44 -54
- package/server/api/microservice/app/get_is_app_ready.get.ts +4 -5
- package/server/api/microservice/app/set_app_base_url.post.ts +5 -6
- package/server/api/microservice/app/set_back_base_url.post.ts +5 -6
- package/server/api/microservice/app/set_is_app_ready.post.ts +5 -6
- package/server/api/microservice/app/set_viewer_base_url.post.ts +5 -6
- package/server/api/microservice/extensions/download.post.ts +5 -4
- package/server/api/serverless/run_cloud.post.ts +53 -11
- package/server/utils/app_config.ts +29 -22
- package/server/utils/cleanup.ts +60 -30
- package/server/utils/cloud.ts +9 -8
- package/server/utils/extension.ts +23 -9
- package/server/utils/microservices.ts +33 -24
- package/server/utils/path.ts +4 -4
- package/server/utils/scripts.ts +26 -23
- package/server/utils/server.ts +2 -2
- package/server/utils/server_config.ts +41 -27
- package/server/utils/stream.ts +6 -0
- package/server/utils/ws_client.ts +42 -8
- package/shared/scripts.ts +15 -10
- package/shared/utils/call_raw.ts +23 -16
- package/shared/utils/call_schema.ts +5 -8
- package/shared/utils/fetch_raw.ts +87 -47
- package/shared/utils/fetch_schema.ts +6 -9
- package/shared/utils/file.ts +8 -2
- package/shared/utils/response_handlers/load.ts +26 -11
- package/shared/utils/types.ts +9 -9
- package/shared/utils/validate_schema.ts +1 -1
- package/app/components/Viewer/ObjectTree/Views/ModelComponents.vue +0 -276
- package/server/types/vendor.d.ts +0 -64
- package/server/utils/server_config.js +0 -43
- package/shared/utils/call_raw.js +0 -30
- package/shared/utils/fetch_raw.js +0 -40
- /package/{opengeodeweb_front_schemas.js → .build/opengeodeweb_front_schemas.js} +0 -0
- /package/{server → .build/server}/utils/server.js +0 -0
- /package/{shared → .build/shared}/app_mode.js +0 -0
- /package/{shared → .build/shared}/utils/parse_boolean.js +0 -0
- /package/{shared → .build/shared}/utils/types.js +0 -0
package/app/utils/extension.ts
CHANGED
|
@@ -3,12 +3,10 @@
|
|
|
3
3
|
// Third party imports
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
|
+
import type { RegisterableStore, useAppStore } from "@ogw_front/stores/app";
|
|
7
|
+
import type { Microservice } from "@ogw_front/stores/infra";
|
|
6
8
|
import { isCloudMode } from "@ogw_front/utils/stores";
|
|
7
9
|
import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_schemas.json" with { type: "json" };
|
|
8
|
-
import { useAppStore } from "@ogw_front/stores/app";
|
|
9
|
-
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
10
|
-
// oxlint-disable-next-line eslint/no-duplicate-imports
|
|
11
|
-
import type { Microservice } from "@ogw_front/stores/infra";
|
|
12
10
|
|
|
13
11
|
interface ExtensionDescriptor {
|
|
14
12
|
id: string;
|
|
@@ -23,12 +21,22 @@ interface DownloadExtensionParams {
|
|
|
23
21
|
extensionFileName: string;
|
|
24
22
|
}
|
|
25
23
|
|
|
24
|
+
type AppStoreInstance = ReturnType<typeof useAppStore>;
|
|
25
|
+
type ExtensionModuleType = Awaited<ReturnType<AppStoreInstance["loadExtension"]>>;
|
|
26
|
+
interface RegisteredExtension {
|
|
27
|
+
name: string;
|
|
28
|
+
version: string;
|
|
29
|
+
extensionModule: ExtensionModuleType;
|
|
30
|
+
}
|
|
31
|
+
|
|
26
32
|
async function uploadExtension(file: File): Promise<void> {
|
|
33
|
+
const { useAppStore } = await import("@ogw_front/stores/app");
|
|
27
34
|
const appStore = useAppStore();
|
|
28
35
|
await appStore.upload(file);
|
|
29
36
|
}
|
|
30
37
|
|
|
31
|
-
function runExtensions() {
|
|
38
|
+
async function runExtensions(): Promise<{ extensionsArray: ExtensionDescriptor[] }> {
|
|
39
|
+
const { useAppStore } = await import("@ogw_front/stores/app");
|
|
32
40
|
const appStore = useAppStore();
|
|
33
41
|
const { projectFolderPath } = appStore;
|
|
34
42
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
@@ -39,13 +47,18 @@ function runExtensions() {
|
|
|
39
47
|
projectFolderPath,
|
|
40
48
|
projectName,
|
|
41
49
|
};
|
|
42
|
-
|
|
50
|
+
const result = await appStore.request<{ extensionsArray: ExtensionDescriptor[] }>({
|
|
43
51
|
schema,
|
|
44
52
|
params,
|
|
45
|
-
})
|
|
53
|
+
});
|
|
54
|
+
return result;
|
|
46
55
|
}
|
|
47
56
|
|
|
48
|
-
function downloadExtension({
|
|
57
|
+
async function downloadExtension({
|
|
58
|
+
url,
|
|
59
|
+
extensionFileName,
|
|
60
|
+
}: DownloadExtensionParams): Promise<unknown> {
|
|
61
|
+
const { useAppStore } = await import("@ogw_front/stores/app");
|
|
49
62
|
const appStore = useAppStore();
|
|
50
63
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
51
64
|
const schema = opengeodeweb_front_schemas.api.microservice.extensions.download;
|
|
@@ -54,18 +67,25 @@ function downloadExtension({ url, extensionFileName }: DownloadExtensionParams)
|
|
|
54
67
|
url,
|
|
55
68
|
extensionFileName,
|
|
56
69
|
};
|
|
57
|
-
|
|
70
|
+
const result = await appStore.request({
|
|
58
71
|
schema,
|
|
59
72
|
params,
|
|
60
73
|
});
|
|
74
|
+
return result;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function isMicroservice(store: RegisterableStore): store is RegisterableStore & Microservice {
|
|
78
|
+
return typeof store.connect === "function";
|
|
61
79
|
}
|
|
62
80
|
|
|
63
|
-
async function registerRunningExtensions() {
|
|
81
|
+
async function registerRunningExtensions(): Promise<RegisteredExtension[]> {
|
|
82
|
+
const { useAppStore } = await import("@ogw_front/stores/app");
|
|
83
|
+
const { useInfraStore } = await import("@ogw_front/stores/infra");
|
|
64
84
|
const appStore = useAppStore();
|
|
65
85
|
const infraStore = useInfraStore();
|
|
66
86
|
const { extensionsArray } = await runExtensions();
|
|
67
87
|
return Promise.all(
|
|
68
|
-
extensionsArray.map(async (extension) => {
|
|
88
|
+
extensionsArray.map(async (extension: ExtensionDescriptor) => {
|
|
69
89
|
const { id, name, version, frontendContent, port } = extension;
|
|
70
90
|
const blob = new Blob([frontendContent], {
|
|
71
91
|
type: "application/javascript",
|
|
@@ -80,7 +100,11 @@ async function registerRunningExtensions() {
|
|
|
80
100
|
// Extension-provided stores are expected to satisfy the fuller
|
|
81
101
|
// Microservice contract (connect, etc.) even though the loader's own
|
|
82
102
|
// RegisterableStore type only models what app.ts itself needs.
|
|
83
|
-
|
|
103
|
+
if (isMicroservice(store)) {
|
|
104
|
+
infraStore.register_microservice(store);
|
|
105
|
+
} else {
|
|
106
|
+
console.warn("[ExtensionManager] Store does not implement Microservice:", store.$id);
|
|
107
|
+
}
|
|
84
108
|
return {
|
|
85
109
|
name,
|
|
86
110
|
version,
|
|
@@ -90,17 +114,18 @@ async function registerRunningExtensions() {
|
|
|
90
114
|
);
|
|
91
115
|
}
|
|
92
116
|
|
|
93
|
-
async function importExtensionFile(file: File) {
|
|
117
|
+
async function importExtensionFile(file: File): Promise<RegisteredExtension[]> {
|
|
94
118
|
await uploadExtension(file);
|
|
95
119
|
return registerRunningExtensions();
|
|
96
120
|
}
|
|
97
121
|
|
|
98
|
-
async function importExtensionURL(url: DownloadExtensionParams) {
|
|
122
|
+
async function importExtensionURL(url: DownloadExtensionParams): Promise<RegisteredExtension[]> {
|
|
99
123
|
await downloadExtension(url);
|
|
100
124
|
return registerRunningExtensions();
|
|
101
125
|
}
|
|
102
126
|
|
|
103
127
|
async function unloadExtension(extensionId: string): Promise<boolean> {
|
|
128
|
+
const { useAppStore } = await import("@ogw_front/stores/app");
|
|
104
129
|
const appStore = useAppStore();
|
|
105
130
|
console.log("[ExtensionManager] Unloading extension:", extensionId);
|
|
106
131
|
const extensionData = appStore.getExtension(extensionId);
|
|
@@ -111,21 +136,22 @@ async function unloadExtension(extensionId: string): Promise<boolean> {
|
|
|
111
136
|
|
|
112
137
|
// Get the store if it exists
|
|
113
138
|
const storeFactory = extensionData.metadata?.store;
|
|
114
|
-
if (storeFactory) {
|
|
139
|
+
if (storeFactory !== undefined) {
|
|
115
140
|
const store = storeFactory();
|
|
116
141
|
// Stop the microservice if possible
|
|
117
|
-
if (
|
|
118
|
-
await
|
|
142
|
+
if (store.kill) {
|
|
143
|
+
await store.kill();
|
|
119
144
|
}
|
|
120
145
|
}
|
|
121
146
|
|
|
122
147
|
// Unload from AppStore
|
|
123
|
-
appStore.unloadExtension(extensionId);
|
|
148
|
+
await appStore.unloadExtension(extensionId);
|
|
124
149
|
console.log("[ExtensionManager] Extension unloaded:", extensionId);
|
|
125
150
|
return true;
|
|
126
151
|
}
|
|
127
152
|
|
|
128
|
-
function killExtension(extensionId: string) {
|
|
153
|
+
async function killExtension(extensionId: string): Promise<unknown> {
|
|
154
|
+
const { useAppStore } = await import("@ogw_front/stores/app");
|
|
129
155
|
const appStore = useAppStore();
|
|
130
156
|
const { projectFolderPath } = appStore;
|
|
131
157
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
@@ -135,10 +161,11 @@ function killExtension(extensionId: string) {
|
|
|
135
161
|
projectFolderPath,
|
|
136
162
|
projectName,
|
|
137
163
|
};
|
|
138
|
-
|
|
164
|
+
const result = await appStore.request({
|
|
139
165
|
schema,
|
|
140
166
|
params,
|
|
141
167
|
});
|
|
168
|
+
return result;
|
|
142
169
|
}
|
|
143
170
|
export {
|
|
144
171
|
importExtensionFile,
|
|
@@ -3,20 +3,20 @@
|
|
|
3
3
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_schemas.json";
|
|
4
4
|
|
|
5
5
|
// Local imports
|
|
6
|
+
import { type NewDataItem, useDataStore } from "@ogw_front/stores/data";
|
|
6
7
|
import { useBackStore } from "@ogw_front/stores/back";
|
|
7
|
-
import { useDataStore } from "@ogw_front/stores/data";
|
|
8
|
-
// oxlint-disable-next-line eslint/no-duplicate-imports
|
|
9
|
-
import type { NewDataItem } from "@ogw_front/stores/data";
|
|
10
8
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
11
9
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
12
10
|
import { useHybridViewerStore } from "@ogw_front/stores/hybrid_viewer";
|
|
13
11
|
import { useTreeviewStore } from "@ogw_front/stores/treeview";
|
|
14
12
|
|
|
15
13
|
interface FileToImport {
|
|
16
|
-
filename: string;
|
|
17
|
-
geode_object_type: string;
|
|
14
|
+
readonly filename: string;
|
|
15
|
+
readonly geode_object_type: string;
|
|
18
16
|
}
|
|
19
17
|
|
|
18
|
+
// NewDataItem has mutable array fields (mesh_components, collection_components), so it can't
|
|
19
|
+
// Satisfy prefer-readonly-parameter-types deeply; left unfixed (same pattern as app/plugins/auto_store_register.ts).
|
|
20
20
|
async function importItem(item: NewDataItem): Promise<string> {
|
|
21
21
|
const dataStore = useDataStore();
|
|
22
22
|
const dataStyleStore = useDataStyleStore();
|
|
@@ -74,10 +74,11 @@ async function importFile(filename: string, geode_object_type: string): Promise<
|
|
|
74
74
|
schema,
|
|
75
75
|
params,
|
|
76
76
|
});
|
|
77
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- this is the trusted API boundary; the back-end response shape matches NewDataItem.
|
|
77
78
|
return importItem(response as NewDataItem);
|
|
78
79
|
}
|
|
79
80
|
|
|
80
|
-
async function importWorkflow(files: FileToImport[]): Promise<string[]> {
|
|
81
|
+
async function importWorkflow(files: readonly FileToImport[]): Promise<string[]> {
|
|
81
82
|
const chunk_size = 5;
|
|
82
83
|
const chunks: FileToImport[][] = [];
|
|
83
84
|
for (let i = 0; i < files.length; i += chunk_size) {
|
|
@@ -91,20 +92,22 @@ async function importWorkflow(files: FileToImport[]): Promise<string[]> {
|
|
|
91
92
|
}
|
|
92
93
|
const chunk = chunks[chunkIndex] ?? [];
|
|
93
94
|
const chunk_results = await Promise.all(
|
|
94
|
-
chunk.map(
|
|
95
|
-
|
|
96
|
-
|
|
95
|
+
chunk.map(async ({ filename, geode_object_type }) => {
|
|
96
|
+
const id = await importFile(filename, geode_object_type);
|
|
97
|
+
return id;
|
|
98
|
+
}),
|
|
97
99
|
);
|
|
98
100
|
results.push(...chunk_results);
|
|
99
101
|
await processChunk(chunkIndex + 1);
|
|
100
102
|
}
|
|
101
103
|
await processChunk(0);
|
|
102
104
|
const hybridViewerStore = useHybridViewerStore();
|
|
103
|
-
hybridViewerStore.remoteRender();
|
|
105
|
+
await hybridViewerStore.remoteRender();
|
|
104
106
|
return results;
|
|
105
107
|
}
|
|
106
108
|
|
|
107
|
-
|
|
109
|
+
// NewDataItem has mutable array fields (mesh_components, collection_components), so a readonly array of it can't satisfy prefer-readonly-parameter-types deeply; left unfixed (same pattern as app/plugins/auto_store_register.ts).
|
|
110
|
+
async function importWorkflowFromSnapshot(items: readonly NewDataItem[]): Promise<string[]> {
|
|
108
111
|
console.log("[importWorkflowFromSnapshot] start", { count: items?.length });
|
|
109
112
|
const hybridViewerStore = useHybridViewerStore();
|
|
110
113
|
const chunk_size = 5;
|
|
@@ -118,12 +121,17 @@ async function importWorkflowFromSnapshot(items: NewDataItem[]): Promise<string[
|
|
|
118
121
|
return;
|
|
119
122
|
}
|
|
120
123
|
const chunk = chunks[chunkIndex] ?? [];
|
|
121
|
-
const chunk_ids = await Promise.all(
|
|
124
|
+
const chunk_ids = await Promise.all(
|
|
125
|
+
chunk.map(async (item) => {
|
|
126
|
+
const id = await importItem(item);
|
|
127
|
+
return id;
|
|
128
|
+
}),
|
|
129
|
+
);
|
|
122
130
|
ids.push(...chunk_ids);
|
|
123
131
|
await processChunk(chunkIndex + 1);
|
|
124
132
|
}
|
|
125
133
|
await processChunk(0);
|
|
126
|
-
hybridViewerStore.remoteRender();
|
|
134
|
+
await hybridViewerStore.remoteRender();
|
|
127
135
|
console.log("[importWorkflowFromSnapshot] done", {
|
|
128
136
|
ids,
|
|
129
137
|
});
|
package/app/utils/string.ts
CHANGED
|
@@ -16,7 +16,7 @@ export function middleTruncate(
|
|
|
16
16
|
startChars: number = DEFAULT_START_CHARS,
|
|
17
17
|
endChars: number = DEFAULT_END_CHARS,
|
|
18
18
|
): string | undefined | null {
|
|
19
|
-
if (
|
|
19
|
+
if (text === undefined || text === null || text.length <= maxLength) {
|
|
20
20
|
return text;
|
|
21
21
|
}
|
|
22
22
|
|
package/app/utils/treeview.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
function compareSelections<Item>(
|
|
2
|
-
current: Item[],
|
|
3
|
-
previous: Item[],
|
|
2
|
+
current: readonly Item[],
|
|
3
|
+
previous: readonly Item[],
|
|
4
4
|
): { added: Item[]; removed: Item[] } {
|
|
5
5
|
const added = current.filter((item) => !previous.includes(item));
|
|
6
6
|
const removed = previous.filter((item) => !current.includes(item));
|
|
@@ -8,7 +8,7 @@ import { modelComponentsRelationTable } from "./tables/model_components_relation
|
|
|
8
8
|
import { modelComponentsTable } from "./tables/model_components";
|
|
9
9
|
|
|
10
10
|
export class BaseDatabase extends Dexie {
|
|
11
|
-
static get initialStores(): Record<string, string> {
|
|
11
|
+
public static get initialStores(): Record<string, string> {
|
|
12
12
|
return {
|
|
13
13
|
[dataTable.name]: dataTable.schema,
|
|
14
14
|
[modelComponentsTable.name]: modelComponentsTable.schema,
|
|
@@ -21,7 +21,11 @@ export class BaseDatabase extends Dexie {
|
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
clear(): Promise<void
|
|
25
|
-
|
|
24
|
+
public async clear(): Promise<void> {
|
|
25
|
+
await Promise.all(
|
|
26
|
+
this.tables.map(async (table) => {
|
|
27
|
+
await table.clear();
|
|
28
|
+
}),
|
|
29
|
+
);
|
|
26
30
|
}
|
|
27
31
|
}
|
|
@@ -1,9 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
// oxlint-disable eslint/sort-imports
|
|
1
|
+
import { Dexie, type Table } from "dexie";
|
|
3
2
|
import { BaseDatabase } from "./base_database";
|
|
4
|
-
import { Dexie } from "dexie";
|
|
5
|
-
// oxlint-disable-next-line eslint/no-duplicate-imports
|
|
6
|
-
import type { Table } from "dexie";
|
|
7
3
|
import { ExtendedDatabase } from "./extended_database";
|
|
8
4
|
|
|
9
5
|
interface DatabaseContainer {
|
|
@@ -13,17 +9,17 @@ interface DatabaseContainer {
|
|
|
13
9
|
const databaseContainer: DatabaseContainer = { instance: undefined };
|
|
14
10
|
|
|
15
11
|
class Database extends BaseDatabase {
|
|
16
|
-
constructor() {
|
|
12
|
+
public constructor() {
|
|
17
13
|
super("Database");
|
|
18
14
|
|
|
19
15
|
this.version(3).stores(BaseDatabase.initialStores);
|
|
20
16
|
}
|
|
21
17
|
|
|
22
|
-
static async addTable(tableName: string, schemaDefinition: string): Promise<void> {
|
|
18
|
+
public static async addTable(tableName: string, schemaDefinition: string): Promise<void> {
|
|
23
19
|
await this.addTables({ [tableName]: schemaDefinition });
|
|
24
20
|
}
|
|
25
21
|
|
|
26
|
-
static async addTables(newTables: Record<string, string>): Promise<void> {
|
|
22
|
+
public static async addTables(newTables: Record<string, string>): Promise<void> {
|
|
27
23
|
let currentVersion = 1;
|
|
28
24
|
let currentStores: Record<string, string> = { ...BaseDatabase.initialStores };
|
|
29
25
|
|
|
@@ -44,10 +40,12 @@ class Database extends BaseDatabase {
|
|
|
44
40
|
tempDb.close();
|
|
45
41
|
}
|
|
46
42
|
|
|
47
|
-
const allExisting = Object.keys(newTables).every(
|
|
43
|
+
const allExisting = Object.keys(newTables).every(
|
|
44
|
+
(tableName) => currentStores[tableName] !== undefined,
|
|
45
|
+
);
|
|
48
46
|
|
|
49
47
|
// Set at module load time below; always defined by the time addTable/addTables runs.
|
|
50
|
-
databaseContainer.instance
|
|
48
|
+
databaseContainer.instance?.close();
|
|
51
49
|
|
|
52
50
|
if (allExisting) {
|
|
53
51
|
const existingDb = new Dexie("Database");
|
|
@@ -70,23 +68,35 @@ class Database extends BaseDatabase {
|
|
|
70
68
|
|
|
71
69
|
// oxlint-disable-next-line no-top-level-await
|
|
72
70
|
await Dexie.delete("Database");
|
|
73
|
-
|
|
74
|
-
|
|
71
|
+
const initialDatabase = new Database();
|
|
72
|
+
databaseContainer.instance = initialDatabase;
|
|
73
|
+
// oxlint-disable-next-line no-top-level-await
|
|
74
|
+
await initialDatabase.clear();
|
|
75
75
|
|
|
76
76
|
// The set of tables is assembled dynamically at runtime (Database.addTable/addTables add stores on the fly), so fully modelling this with Dexie's row generics isn't worth it here: the proxy target is typed loosely as "any table name maps to a Dexie Table of loosely-typed rows".
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
77
|
+
type DatabaseTables = Record<string, Table<Record<string, unknown>, string>>;
|
|
78
|
+
|
|
79
|
+
const database = new Proxy<DatabaseTables>(
|
|
80
|
+
{},
|
|
81
|
+
{
|
|
82
|
+
get(_target, prop: string | symbol): unknown {
|
|
83
|
+
// The instance is a Dexie subclass whose tables are only known dynamically at runtime.
|
|
84
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
85
|
+
const instance = databaseContainer.instance as unknown as Record<string | symbol, unknown>;
|
|
86
|
+
const value = instance[prop];
|
|
87
|
+
if (typeof value === "function") {
|
|
88
|
+
// oxlint-disable-next-line no-unsafe-return
|
|
89
|
+
return value.bind(databaseContainer.instance);
|
|
90
|
+
}
|
|
91
|
+
return value;
|
|
92
|
+
},
|
|
89
93
|
},
|
|
90
|
-
|
|
94
|
+
);
|
|
95
|
+
|
|
96
|
+
// The proxy only knows the loose DatabaseTables shape; callers cast to the row type they know a given table holds.
|
|
97
|
+
function getTable<TRow>(tableName: string): Table<TRow, string> {
|
|
98
|
+
// oxlint-disable-next-line no-unsafe-type-assertion
|
|
99
|
+
return database[tableName] as unknown as Table<TRow, string>;
|
|
100
|
+
}
|
|
91
101
|
|
|
92
|
-
export { Database, database };
|
|
102
|
+
export { Database, database, getTable };
|
|
@@ -49,10 +49,32 @@ function isMeshCellsCellAttributeValid({
|
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
// oxlint-disable-next-line max-lines-per-function
|
|
52
|
-
function useMeshCellsCellAttributeStyle() {
|
|
52
|
+
function useMeshCellsCellAttributeStyle(): {
|
|
53
|
+
meshCellsCellAttributeName: (id: string) => string | undefined;
|
|
54
|
+
meshCellsCellAttributeItem: (id: string) => number;
|
|
55
|
+
meshCellsCellAttributeRange: (id: string) => [number | undefined, number | undefined];
|
|
56
|
+
meshCellsCellAttributeColorMap: (id: string) => string | undefined;
|
|
57
|
+
meshCellsCellAttributeStoredConfig: (
|
|
58
|
+
id: string,
|
|
59
|
+
name: string | undefined,
|
|
60
|
+
item: number | undefined,
|
|
61
|
+
) => AttributeStoredConfig;
|
|
62
|
+
setMeshCellsCellAttribute: (id: string, input: AttributeInput) => Promise<unknown>;
|
|
63
|
+
setMeshCellsCellAttributeName: (id: string, name: string) => Promise<unknown>;
|
|
64
|
+
setMeshCellsCellAttributeItem: (id: string, item: number) => Promise<unknown>;
|
|
65
|
+
setMeshCellsCellAttributeRange: (
|
|
66
|
+
id: string,
|
|
67
|
+
minimum: number,
|
|
68
|
+
maximum: number,
|
|
69
|
+
) => Promise<unknown>;
|
|
70
|
+
setMeshCellsCellAttributeColorMap: (id: string, colorMap: string | undefined) => Promise<unknown>;
|
|
71
|
+
meshCellsCellAttributeNoDataColor: (id: string) => unknown;
|
|
72
|
+
setMeshCellsCellAttributeNoDataColor: (id: string, no_data_color: unknown) => Promise<unknown>;
|
|
73
|
+
} {
|
|
53
74
|
const viewerStore = useViewerStore();
|
|
54
75
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
55
76
|
function meshCellsCellAttribute(id: string): AttributeState {
|
|
77
|
+
// oxlint-disable-next-line no-unsafe-type-assertion -- coloring.cell shape is defined by the data style schema.
|
|
56
78
|
return meshCellsCommonStyle.meshCellsColoring(id).cell as AttributeState;
|
|
57
79
|
}
|
|
58
80
|
function meshCellsCellAttributeStoredConfig(
|
|
@@ -61,14 +83,10 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
61
83
|
item: number | undefined,
|
|
62
84
|
): AttributeStoredConfig {
|
|
63
85
|
const { storedConfigs } = meshCellsCellAttribute(id);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
item !== undefined &&
|
|
69
|
-
item in storedConfigs[name]!
|
|
70
|
-
) {
|
|
71
|
-
return storedConfigs[name]![item]!;
|
|
86
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
87
|
+
const itemConfig = item === undefined ? undefined : nameConfig?.[item];
|
|
88
|
+
if (itemConfig !== undefined) {
|
|
89
|
+
return itemConfig;
|
|
72
90
|
}
|
|
73
91
|
return {
|
|
74
92
|
minimum: undefined,
|
|
@@ -77,35 +95,41 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
77
95
|
no_data_color: DEFAULT_NO_DATA_COLOR,
|
|
78
96
|
};
|
|
79
97
|
}
|
|
80
|
-
function mutateMeshCellsCellStyle(
|
|
81
|
-
|
|
98
|
+
async function mutateMeshCellsCellStyle(
|
|
99
|
+
id: string,
|
|
100
|
+
values: Record<string, unknown>,
|
|
101
|
+
): Promise<string> {
|
|
102
|
+
const result = await meshCellsCommonStyle.mutateMeshCellsStyle(id, {
|
|
82
103
|
coloring: {
|
|
83
104
|
cell: values,
|
|
84
105
|
},
|
|
85
106
|
});
|
|
107
|
+
return result;
|
|
86
108
|
}
|
|
87
|
-
function setMeshCellsCellAttributeStoredConfig(
|
|
109
|
+
async function setMeshCellsCellAttributeStoredConfig(
|
|
88
110
|
id: string,
|
|
89
111
|
name: string | undefined,
|
|
90
112
|
item: number | undefined,
|
|
91
113
|
config: Partial<AttributeStoredConfig>,
|
|
92
|
-
) {
|
|
93
|
-
|
|
114
|
+
): Promise<string> {
|
|
115
|
+
const result = await mutateMeshCellsCellStyle(id, {
|
|
94
116
|
storedConfigs: {
|
|
95
|
-
[name
|
|
117
|
+
[name ?? ""]: {
|
|
96
118
|
lastItem: item,
|
|
97
|
-
[item
|
|
119
|
+
[item ?? 0]: config,
|
|
98
120
|
},
|
|
99
121
|
},
|
|
100
122
|
});
|
|
123
|
+
return result;
|
|
101
124
|
}
|
|
102
125
|
function meshCellsCellAttributeName(id: string): string | undefined {
|
|
103
126
|
return meshCellsCellAttribute(id).name;
|
|
104
127
|
}
|
|
105
128
|
function meshCellsCellAttributeLastItem(id: string, name: string | undefined): number {
|
|
106
129
|
const { storedConfigs } = meshCellsCellAttribute(id);
|
|
107
|
-
|
|
108
|
-
|
|
130
|
+
const nameConfig = name === undefined ? undefined : storedConfigs?.[name];
|
|
131
|
+
if (nameConfig !== undefined) {
|
|
132
|
+
return nameConfig.lastItem;
|
|
109
133
|
}
|
|
110
134
|
return 0;
|
|
111
135
|
}
|
|
@@ -113,7 +137,7 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
113
137
|
const { item, name } = meshCellsCellAttribute(id);
|
|
114
138
|
return item ?? meshCellsCellAttributeLastItem(id, name);
|
|
115
139
|
}
|
|
116
|
-
function setMeshCellsCellAttribute(
|
|
140
|
+
async function setMeshCellsCellAttribute(
|
|
117
141
|
id: string,
|
|
118
142
|
{
|
|
119
143
|
name,
|
|
@@ -123,18 +147,18 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
123
147
|
colorMap,
|
|
124
148
|
no_data_color = DEFAULT_NO_DATA_COLOR,
|
|
125
149
|
}: AttributeInput,
|
|
126
|
-
) {
|
|
127
|
-
mutateMeshCellsCellStyle(id, {
|
|
150
|
+
): Promise<unknown> {
|
|
151
|
+
await mutateMeshCellsCellStyle(id, {
|
|
128
152
|
name,
|
|
129
153
|
item,
|
|
130
154
|
});
|
|
131
|
-
setMeshCellsCellAttributeStoredConfig(id, name, item, {
|
|
155
|
+
await setMeshCellsCellAttributeStoredConfig(id, name, item, {
|
|
132
156
|
minimum,
|
|
133
157
|
maximum,
|
|
134
158
|
colorMap,
|
|
135
159
|
no_data_color,
|
|
136
160
|
});
|
|
137
|
-
const points = getRGBPointsFromPreset(colorMap
|
|
161
|
+
const points = getRGBPointsFromPreset(colorMap ?? "");
|
|
138
162
|
const schema = meshCellsCellAttributeSchemas.attribute;
|
|
139
163
|
const params = {
|
|
140
164
|
id,
|
|
@@ -150,7 +174,7 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
150
174
|
params,
|
|
151
175
|
});
|
|
152
176
|
}
|
|
153
|
-
function applyCellAttribute(id: string) {
|
|
177
|
+
async function applyCellAttribute(id: string): Promise<unknown> {
|
|
154
178
|
const name = meshCellsCellAttributeName(id);
|
|
155
179
|
const item = meshCellsCellAttributeItem(id);
|
|
156
180
|
const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
|
|
@@ -163,19 +187,21 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
163
187
|
no_data_color: storedConfig.no_data_color,
|
|
164
188
|
};
|
|
165
189
|
if (isMeshCellsCellAttributeValid(attribute)) {
|
|
166
|
-
|
|
190
|
+
const result = await setMeshCellsCellAttribute(id, attribute);
|
|
191
|
+
return result;
|
|
167
192
|
}
|
|
193
|
+
return undefined;
|
|
168
194
|
}
|
|
169
|
-
function setMeshCellsCellAttributeName(id: string, name: string) {
|
|
195
|
+
async function setMeshCellsCellAttributeName(id: string, name: string): Promise<unknown> {
|
|
170
196
|
const item = meshCellsCellAttributeLastItem(id, name);
|
|
171
|
-
mutateMeshCellsCellStyle(id, {
|
|
197
|
+
await mutateMeshCellsCellStyle(id, {
|
|
172
198
|
name,
|
|
173
199
|
item,
|
|
174
200
|
});
|
|
175
201
|
return applyCellAttribute(id);
|
|
176
202
|
}
|
|
177
|
-
function setMeshCellsCellAttributeItem(id: string, item: number) {
|
|
178
|
-
mutateMeshCellsCellStyle(id, {
|
|
203
|
+
async function setMeshCellsCellAttributeItem(id: string, item: number): Promise<unknown> {
|
|
204
|
+
await mutateMeshCellsCellStyle(id, {
|
|
179
205
|
item,
|
|
180
206
|
});
|
|
181
207
|
return applyCellAttribute(id);
|
|
@@ -186,10 +212,14 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
186
212
|
const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
|
|
187
213
|
return [storedConfig.minimum, storedConfig.maximum];
|
|
188
214
|
}
|
|
189
|
-
function setMeshCellsCellAttributeRange(
|
|
215
|
+
async function setMeshCellsCellAttributeRange(
|
|
216
|
+
id: string,
|
|
217
|
+
minimum: number,
|
|
218
|
+
maximum: number,
|
|
219
|
+
): Promise<unknown> {
|
|
190
220
|
const name = meshCellsCellAttributeName(id);
|
|
191
221
|
const item = meshCellsCellAttributeItem(id);
|
|
192
|
-
setMeshCellsCellAttributeStoredConfig(id, name, item, {
|
|
222
|
+
await setMeshCellsCellAttributeStoredConfig(id, name, item, {
|
|
193
223
|
minimum,
|
|
194
224
|
maximum,
|
|
195
225
|
});
|
|
@@ -201,10 +231,13 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
201
231
|
const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
|
|
202
232
|
return storedConfig.colorMap;
|
|
203
233
|
}
|
|
204
|
-
function setMeshCellsCellAttributeColorMap(
|
|
234
|
+
async function setMeshCellsCellAttributeColorMap(
|
|
235
|
+
id: string,
|
|
236
|
+
colorMap: string | undefined,
|
|
237
|
+
): Promise<unknown> {
|
|
205
238
|
const name = meshCellsCellAttributeName(id);
|
|
206
239
|
const item = meshCellsCellAttributeItem(id);
|
|
207
|
-
setMeshCellsCellAttributeStoredConfig(id, name, item, {
|
|
240
|
+
await setMeshCellsCellAttributeStoredConfig(id, name, item, {
|
|
208
241
|
colorMap,
|
|
209
242
|
});
|
|
210
243
|
return applyCellAttribute(id);
|
|
@@ -215,7 +248,10 @@ function useMeshCellsCellAttributeStyle() {
|
|
|
215
248
|
const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
|
|
216
249
|
return storedConfig.no_data_color;
|
|
217
250
|
}
|
|
218
|
-
async function setMeshCellsCellAttributeNoDataColor(
|
|
251
|
+
async function setMeshCellsCellAttributeNoDataColor(
|
|
252
|
+
id: string,
|
|
253
|
+
no_data_color: unknown,
|
|
254
|
+
): Promise<unknown> {
|
|
219
255
|
const name = meshCellsCellAttributeName(id);
|
|
220
256
|
const item = meshCellsCellAttributeItem(id);
|
|
221
257
|
const storedConfig = meshCellsCellAttributeStoredConfig(id, name, item);
|
|
@@ -8,27 +8,33 @@ import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
|
8
8
|
// Local constants
|
|
9
9
|
const schema = viewer_schemas.opengeodeweb_viewer.mesh.cells.color;
|
|
10
10
|
|
|
11
|
-
export function useMeshCellsColorStyle() {
|
|
11
|
+
export function useMeshCellsColorStyle(): {
|
|
12
|
+
meshCellsColor: (id: string) => unknown;
|
|
13
|
+
setMeshCellsColor: (id: string, color: unknown) => Promise<unknown>;
|
|
14
|
+
} {
|
|
12
15
|
const viewerStore = useViewerStore();
|
|
13
16
|
const meshCellsCommonStyle = useMeshCellsCommonStyle();
|
|
14
17
|
|
|
15
18
|
function meshCellsColor(id: string): unknown {
|
|
16
19
|
return meshCellsCommonStyle.meshCellsColoring(id).constant;
|
|
17
20
|
}
|
|
18
|
-
function setMeshCellsColor(id: string, color: unknown) {
|
|
21
|
+
async function setMeshCellsColor(id: string, color: unknown): Promise<unknown> {
|
|
19
22
|
const params = { id, color };
|
|
20
|
-
|
|
23
|
+
const result = await viewerStore.request(
|
|
21
24
|
{
|
|
22
25
|
schema,
|
|
23
26
|
params,
|
|
24
27
|
},
|
|
25
28
|
{
|
|
26
|
-
response_function: () =>
|
|
27
|
-
meshCellsCommonStyle.mutateMeshCellsColoring(id, {
|
|
29
|
+
response_function: async () => {
|
|
30
|
+
const mutateResult = await meshCellsCommonStyle.mutateMeshCellsColoring(id, {
|
|
28
31
|
constant: color,
|
|
29
|
-
})
|
|
32
|
+
});
|
|
33
|
+
return mutateResult;
|
|
34
|
+
},
|
|
30
35
|
},
|
|
31
36
|
);
|
|
37
|
+
return result;
|
|
32
38
|
}
|
|
33
39
|
|
|
34
40
|
return {
|