@geode/opengeodeweb-front 12.2.0-rc.4 → 12.2.0-rc.5
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/app/components/ClippingPlanes.vue +1 -1
- package/app/components/FactorFilterPanel.vue +1 -1
- package/app/components/Launcher.vue +3 -2
- package/app/components/ThresholdFilter.vue +1 -2
- package/app/components/Viewer/Basemap/CropOptions.vue +7 -8
- package/app/components/Viewer/Basemap/OpacityOptions.vue +7 -8
- package/app/components/Viewer/ContextMenu/CircularItems.vue +6 -43
- package/app/components/Viewer/ContextMenu/ContextMenu.vue +1 -6
- package/app/components/Viewer/ContextMenu/ContextMenuItem.vue +14 -16
- package/app/components/Viewer/EdgedCurve/PointsOptions.vue +5 -4
- package/app/components/Viewer/EdgedCurve/SpecificEdgesOptions.vue +10 -13
- package/app/components/Viewer/Generic/Mesh/CellsOptions.vue +8 -11
- package/app/components/Viewer/Generic/Mesh/EdgesOptions.vue +16 -13
- package/app/components/Viewer/Generic/Mesh/PointsOptions.vue +28 -31
- package/app/components/Viewer/Generic/Mesh/PolygonsOptions.vue +9 -11
- package/app/components/Viewer/Generic/Mesh/PolyhedraOptions.vue +8 -11
- package/app/components/Viewer/Generic/Model/BlocksOptions.vue +1 -1
- package/app/components/Viewer/Generic/Model/CornersOptions.vue +1 -1
- package/app/components/Viewer/Generic/Model/CornersTypeOptions.vue +1 -1
- package/app/components/Viewer/Generic/Model/EdgesOptions.vue +7 -8
- package/app/components/Viewer/Generic/Model/LinesOptions.vue +1 -1
- package/app/components/Viewer/Generic/Model/LinesTypeOptions.vue +1 -1
- package/app/components/Viewer/Generic/Model/ModelEdgesCard.vue +5 -7
- package/app/components/Viewer/Generic/Model/ModelPointsCard.vue +5 -7
- package/app/components/Viewer/Generic/Model/ModelStyleCard.vue +5 -7
- package/app/components/Viewer/Generic/Model/ModelStyleOptions.vue +7 -8
- package/app/components/Viewer/Generic/Model/PointsOptions.vue +7 -8
- package/app/components/Viewer/Generic/Model/SurfacesOptions.vue +1 -1
- package/app/components/Viewer/Grid/2D/CellsOptions.vue +6 -4
- package/app/components/Viewer/Grid/2D/EdgesOptions.vue +6 -4
- package/app/components/Viewer/Grid/2D/PointsOptions.vue +5 -4
- package/app/components/Viewer/Grid/3D/CellsOptions.vue +6 -4
- package/app/components/Viewer/Grid/3D/EdgesOptions.vue +6 -4
- package/app/components/Viewer/Grid/3D/FacetsOptions.vue +6 -4
- package/app/components/Viewer/Grid/3D/PointsOptions.vue +5 -4
- package/app/components/Viewer/Image/ImageOptions.vue +10 -13
- package/app/components/Viewer/ObjectTree/Base/CommonTreeView.vue +5 -0
- package/app/components/Viewer/ObjectTree/Base/ComponentRelations.vue +2 -2
- package/app/components/Viewer/ObjectTree/Base/StickyHeader.vue +4 -1
- package/app/components/Viewer/ObjectTree/Base/TreeRow.vue +6 -8
- package/app/components/Viewer/ObjectTree/Views/GlobalObjects.vue +10 -15
- package/app/components/Viewer/ObjectTree/Views/ModelTree.vue +3 -0
- package/app/components/Viewer/PointSet/SpecificPointsOptions.vue +28 -31
- package/app/components/Viewer/Scene/BackgroundOptions.vue +4 -7
- package/app/components/Viewer/Scene/OrientationWidgetOptions.vue +4 -7
- package/app/components/Viewer/Scene/TextOptions.vue +4 -7
- package/app/components/Viewer/Solid/EdgesOptions.vue +6 -4
- package/app/components/Viewer/Solid/PointsOptions.vue +5 -4
- package/app/components/Viewer/Solid/PolygonsOptions.vue +6 -4
- package/app/components/Viewer/Solid/SpecificPolyhedraOptions.vue +8 -11
- package/app/components/Viewer/Surface/EdgesOptions.vue +6 -4
- package/app/components/Viewer/Surface/PointsOptions.vue +6 -4
- package/app/components/Viewer/Surface/PolygonsOptions.vue +8 -11
- package/app/components/Viewer/Surface/Triangulated/TrianglesOptions.vue +5 -4
- package/app/components/Viewer/TetrahedralSolid/TetrahedraOptions.vue +6 -4
- package/app/components/Viewer/TetrahedralSolid/TrianglesOptions.vue +6 -4
- package/app/composables/circular_menu.ts +45 -0
- package/app/composables/hover_highlight.ts +1 -1
- package/app/composables/model_menu_context.ts +7 -11
- package/app/composables/model_tree.ts +3 -3
- package/app/composables/project_manager_helpers/types.ts +2 -3
- package/app/composables/use_overlapping_picker.ts +7 -19
- package/app/composables/viewer_context_menu.ts +2 -1
- package/app/stores/api.ts +6 -59
- package/app/stores/app.ts +21 -55
- package/app/stores/back.ts +86 -145
- package/app/stores/camera_manager.ts +12 -25
- package/app/stores/cloud.ts +21 -101
- package/app/stores/crs.ts +3 -2
- package/app/stores/data.ts +66 -409
- package/app/stores/data_style.ts +99 -93
- package/app/stores/feedback.ts +57 -53
- package/app/stores/infra.ts +61 -101
- package/app/stores/treeview.ts +12 -31
- package/app/stores/viewer.ts +9 -29
- package/app/stores/viewer_helpers/actions.ts +1 -23
- package/app/utils/backend_lifecycle.ts +155 -0
- package/app/utils/import_item.ts +5 -4
- package/app/utils/threshold_sources.ts +3 -2
- package/app/utils/treeview.ts +25 -1
- package/app/utils/viewer_object_type.ts +21 -0
- package/internal/database/base_database.ts +2 -1
- package/internal/database/database.ts +90 -7
- package/internal/database/queries.ts +45 -0
- package/internal/database/tables/camera_positions.ts +11 -1
- package/internal/database/tables/data.ts +20 -1
- package/internal/database/tables/data_style.ts +3 -1
- package/internal/database/tables/model_component_datastyle.ts +3 -1
- package/internal/database/tables/model_component_type_datastyle.ts +3 -1
- package/internal/database/tables/model_components.ts +12 -1
- package/internal/database/tables/model_components_relation.ts +11 -1
- package/internal/database/tables/scene_style.ts +3 -1
- package/internal/database/tables/treeview_config.ts +31 -0
- package/internal/stores/data/items.ts +110 -0
- package/internal/stores/data/model/collections.ts +107 -0
- package/internal/stores/data/model/components.ts +129 -0
- package/internal/stores/data/model/mesh_components.ts +134 -0
- package/internal/stores/data/model/relations.ts +76 -0
- package/internal/stores/data/model/types.ts +14 -0
- package/internal/stores/data/registration.ts +54 -0
- package/internal/stores/data/snapshot.ts +83 -0
- package/internal/stores/data/types.ts +26 -0
- package/internal/stores/data_style/model/common_mutations.ts +47 -77
- package/internal/stores/data_style/model/selection.ts +3 -10
- package/internal/stores/data_style/scene.ts +2 -2
- package/internal/stores/data_style/state.ts +10 -8
- package/internal/stores/data_style/state_shared.ts +10 -7
- package/internal/stores/hybrid_viewer/highlight.ts +9 -14
- package/internal/stores/hybrid_viewer/scene.ts +1 -1
- package/internal/stores/microservice.ts +192 -0
- package/package.json +1 -1
- package/tests/browser/helpers/data/helpers/attribute.ts +2 -1
- package/app/stores/data_helpers/collections.ts +0 -122
- package/app/stores/data_helpers/mesh.ts +0 -167
- package/app/stores/data_helpers/relations.ts +0 -94
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import
|
|
3
|
-
type ItemProps,
|
|
4
|
-
} from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
2
|
+
import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
5
3
|
import type { MeshId } from "@ogw_front/types/identifiers";
|
|
6
4
|
import PolygonalSurfacePolygons from "@ogw_front/assets/viewer_svgs/surface_triangles.svg";
|
|
5
|
+
import ViewerContextMenuItem from "@ogw_front/components/Viewer/ContextMenu/ContextMenuItem.vue";
|
|
7
6
|
import ViewerOptionsVisibilitySwitch from "@ogw_front/components/Viewer/Options/VisibilitySwitch.vue";
|
|
8
7
|
import ViewerSurfacePolygonsColoring from "@ogw_front/components/Viewer/Surface/PolygonsColoring.vue";
|
|
9
8
|
import type { Visibility } from "@geode/opengeodeweb-viewer/schema_types";
|
|
@@ -16,18 +15,17 @@ const hybridViewerStore = useHybridViewerStore();
|
|
|
16
15
|
const { applyBatchStyle } = useBatchStyle();
|
|
17
16
|
|
|
18
17
|
interface Props {
|
|
19
|
-
|
|
18
|
+
dataId: DataId;
|
|
19
|
+
index: number;
|
|
20
20
|
tooltip?: string;
|
|
21
21
|
}
|
|
22
22
|
|
|
23
|
-
const {
|
|
24
|
-
|
|
25
|
-
const dataId = toRef(() => itemProps.id);
|
|
23
|
+
const { dataId, index, tooltip = "Polygons options" } = defineProps<Props>();
|
|
26
24
|
|
|
27
25
|
const visibility = computed<Visibility>({
|
|
28
|
-
get: () => dataStyleStore.meshPolygonsVisibility(dataId
|
|
26
|
+
get: () => dataStyleStore.meshPolygonsVisibility(dataId),
|
|
29
27
|
set: async (newValue) => {
|
|
30
|
-
await applyBatchStyle(dataId
|
|
28
|
+
await applyBatchStyle(dataId, (meshId: MeshId) =>
|
|
31
29
|
dataStyleStore.setMeshPolygonsVisibility(meshId, newValue),
|
|
32
30
|
);
|
|
33
31
|
hybridViewerStore.remoteRender();
|
|
@@ -38,8 +36,7 @@ const visibility = computed<Visibility>({
|
|
|
38
36
|
<template>
|
|
39
37
|
<ViewerContextMenuItem
|
|
40
38
|
data-testid="meshPolygonsMenu"
|
|
41
|
-
:index="
|
|
42
|
-
:itemProps="itemProps"
|
|
39
|
+
:index="index"
|
|
43
40
|
:tooltip="tooltip"
|
|
44
41
|
:btnImage="PolygonalSurfacePolygons"
|
|
45
42
|
>
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
3
3
|
import ViewerSpecificPolygonsOptions from "@ogw_front/components/Viewer/Surface/PolygonsOptions.vue";
|
|
4
4
|
|
|
5
5
|
interface Props {
|
|
6
|
-
|
|
6
|
+
dataId: DataId;
|
|
7
|
+
index: number;
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const {
|
|
10
|
+
const { dataId, index } = defineProps<Props>();
|
|
10
11
|
</script>
|
|
11
12
|
|
|
12
13
|
<template>
|
|
13
|
-
<ViewerSpecificPolygonsOptions :
|
|
14
|
+
<ViewerSpecificPolygonsOptions :data-id="dataId" :index="index" tooltip="Triangles options" />
|
|
14
15
|
</template>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
3
3
|
import TetrahedralSolidTetrahedra from "@ogw_front/assets/viewer_svgs/solid_polyhedra.svg";
|
|
4
4
|
import ViewerGenericMeshPolyhedraOptions from "@ogw_front/components/Viewer/Generic/Mesh/PolyhedraOptions.vue";
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
|
|
7
|
+
dataId: DataId;
|
|
8
|
+
index: number;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
const {
|
|
11
|
+
const { dataId, index } = defineProps<Props>();
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
14
|
<template>
|
|
14
15
|
<ViewerGenericMeshPolyhedraOptions
|
|
15
|
-
:
|
|
16
|
+
:data-id="dataId"
|
|
17
|
+
:index="index"
|
|
16
18
|
:btnImage="TetrahedralSolidTetrahedra"
|
|
17
19
|
tooltip="Tetrahedra options"
|
|
18
20
|
/>
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
3
3
|
import TetrahedralSolidTriangles from "@ogw_front/assets/viewer_svgs/solid_facets.svg";
|
|
4
4
|
import ViewerGenericMeshPolygonsOptions from "@ogw_front/components/Viewer/Generic/Mesh/PolygonsOptions.vue";
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
|
|
7
|
+
dataId: DataId;
|
|
8
|
+
index: number;
|
|
8
9
|
}
|
|
9
10
|
|
|
10
|
-
const {
|
|
11
|
+
const { dataId, index } = defineProps<Props>();
|
|
11
12
|
</script>
|
|
12
13
|
|
|
13
14
|
<template>
|
|
14
15
|
<ViewerGenericMeshPolygonsOptions
|
|
15
|
-
:
|
|
16
|
+
:data-id="dataId"
|
|
17
|
+
:index="index"
|
|
16
18
|
:btnImage="TetrahedralSolidTriangles"
|
|
17
19
|
tooltip="Triangles options"
|
|
18
20
|
/>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type ComputedRef, type InjectionKey, computed, inject, provide } from "vue";
|
|
2
|
+
|
|
3
|
+
type MenuSide = "right" | "top" | "left" | "bottom";
|
|
4
|
+
|
|
5
|
+
const FULL_ANGLE = 360;
|
|
6
|
+
const ANGLE_45 = 45;
|
|
7
|
+
const ANGLE_135 = 135;
|
|
8
|
+
const ANGLE_225 = 225;
|
|
9
|
+
const ANGLE_315 = 315;
|
|
10
|
+
|
|
11
|
+
const OPPOSITE_SIDE: Record<MenuSide, MenuSide> = {
|
|
12
|
+
right: "left",
|
|
13
|
+
top: "bottom",
|
|
14
|
+
left: "right",
|
|
15
|
+
bottom: "top",
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const MENU_ITEM_COUNT_KEY: InjectionKey<ComputedRef<number>> = Symbol("menu_item_count");
|
|
19
|
+
|
|
20
|
+
// The circular menu shares its item count with its items: each one places itself on the circle
|
|
21
|
+
function provideMenuItemCount(count: () => number): void {
|
|
22
|
+
provide(MENU_ITEM_COUNT_KEY, computed(count));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function injectMenuItemCount(): ComputedRef<number> {
|
|
26
|
+
return inject(MENU_ITEM_COUNT_KEY, () => computed(() => 1), true);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Side of the circle an item sits on, where its tooltip shows
|
|
30
|
+
function menuItemSide(index: number, count: number): MenuSide {
|
|
31
|
+
const angle = (index / count) * FULL_ANGLE;
|
|
32
|
+
if (angle < ANGLE_45 || angle >= ANGLE_315) {
|
|
33
|
+
return "right";
|
|
34
|
+
}
|
|
35
|
+
if (angle < ANGLE_135) {
|
|
36
|
+
return "top";
|
|
37
|
+
}
|
|
38
|
+
if (angle < ANGLE_225) {
|
|
39
|
+
return "left";
|
|
40
|
+
}
|
|
41
|
+
return "bottom";
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export { OPPOSITE_SIDE, injectMenuItemCount, menuItemSide, provideMenuItemCount };
|
|
45
|
+
export type { MenuSide };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type ComputedRef, type Ref, computed, ref, watch } from "vue";
|
|
2
|
+
import { type MenuViewerObjectType, useMenuStore } from "@ogw_front/stores/menu";
|
|
2
3
|
import type { ModelId, ModelIdentified } from "@ogw_front/types/identifiers";
|
|
3
|
-
import type { CollectionComponent } from "@
|
|
4
|
+
import type { CollectionComponent } from "@ogw_internal/stores/data/model/collections";
|
|
5
|
+
import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
4
6
|
import { MESH_COMPONENT_TYPES } from "@ogw_front/utils/default_styles";
|
|
5
|
-
import type { MenuViewerObjectType } from "@ogw_front/stores/menu";
|
|
6
7
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
7
8
|
|
|
8
9
|
interface ModelMenuMetaData extends Partial<ModelIdentified> {
|
|
@@ -12,11 +13,6 @@ interface ModelMenuMetaData extends Partial<ModelIdentified> {
|
|
|
12
13
|
targetComponentIds?: string[];
|
|
13
14
|
}
|
|
14
15
|
|
|
15
|
-
interface ModelMenuItemProps {
|
|
16
|
-
id: string;
|
|
17
|
-
meta_data: Record<string, unknown>;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
interface ModelMenuContext {
|
|
21
17
|
modelId: ComputedRef<ModelId>;
|
|
22
18
|
componentId: ComputedRef<string | undefined>;
|
|
@@ -27,12 +23,13 @@ interface ModelMenuContext {
|
|
|
27
23
|
|
|
28
24
|
// Resolves what a model context menu targets: the whole model, a component type, a collection or one component
|
|
29
25
|
// oxlint-disable-next-line max-lines-per-function
|
|
30
|
-
function useModelMenuContext(
|
|
26
|
+
function useModelMenuContext(getDataId: () => DataId): ModelMenuContext {
|
|
31
27
|
const dataStore = useDataStore();
|
|
28
|
+
const menuStore = useMenuStore();
|
|
32
29
|
// oxlint-disable-next-line no-unsafe-type-assertion -- meta_data is filled by the viewer context menu with these keys.
|
|
33
|
-
const metaData = computed(() =>
|
|
30
|
+
const metaData = computed(() => menuStore.current_meta_data as ModelMenuMetaData);
|
|
34
31
|
|
|
35
|
-
const modelId = computed<string>(() => metaData.value.modelId ??
|
|
32
|
+
const modelId = computed<string>(() => metaData.value.modelId ?? getDataId());
|
|
36
33
|
const componentId = computed<string | undefined>(() => metaData.value.pickedComponentId);
|
|
37
34
|
const componentType = ref<string | undefined>(undefined);
|
|
38
35
|
const collections = ref<CollectionComponent[] | undefined>(undefined);
|
|
@@ -104,4 +101,3 @@ function useModelMenuContext(getItemProps: () => ModelMenuItemProps): ModelMenuC
|
|
|
104
101
|
}
|
|
105
102
|
|
|
106
103
|
export { useModelMenuContext };
|
|
107
|
-
export type { ModelMenuItemProps };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import type {
|
|
2
2
|
CollectionComponent,
|
|
3
3
|
CollectionComponentGroup,
|
|
4
|
-
} from "@
|
|
4
|
+
} from "@ogw_internal/stores/data/model/collections";
|
|
5
5
|
import { type FilterableItem, sortAndFormatItems } from "@ogw_front/composables/tree_filter";
|
|
6
6
|
import type {
|
|
7
7
|
FormattedComponent,
|
|
8
8
|
FormattedComponentGroup,
|
|
9
|
-
} from "@
|
|
10
|
-
import type { ComponentRelations } from "@
|
|
9
|
+
} from "@ogw_internal/stores/data/model/mesh_components";
|
|
10
|
+
import type { ComponentRelations } from "@ogw_internal/stores/data/model/relations";
|
|
11
11
|
import type { ModelId } from "@ogw_front/types/identifiers";
|
|
12
12
|
import { compareSelections } from "@ogw_front/utils/treeview";
|
|
13
13
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
@@ -3,11 +3,10 @@ import type { CRS } from "@geode/opengeodeweb-back/schema_types";
|
|
|
3
3
|
import type { CameraSnapshot } from "@ogw_internal/stores/hybrid_viewer/camera";
|
|
4
4
|
import type { DataStyleSnapshot } from "@ogw_front/stores/data_style";
|
|
5
5
|
import type { LegacyDataId } from "@ogw_front/utils/legacy_data_id";
|
|
6
|
-
import type { ModelComponentRecord } from "@
|
|
7
|
-
import type { ModelComponentRelationRecord } from "@
|
|
6
|
+
import type { ModelComponentRecord } from "@ogw_internal/stores/data/model/mesh_components";
|
|
7
|
+
import type { ModelComponentRelationRecord } from "@ogw_internal/stores/data/model/relations";
|
|
8
8
|
import type { NewDataItem } from "@ogw_front/stores/data";
|
|
9
9
|
import type { TreeviewSnapshot } from "@ogw_front/stores/treeview";
|
|
10
|
-
|
|
11
10
|
// Projects saved before data_id existed hold the data id of their rows as `id`
|
|
12
11
|
interface ProjectDataSnapshot {
|
|
13
12
|
items: (LegacyDataId<NewDataItem> | NewDataItem)[];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { ref } from "vue";
|
|
2
|
-
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
3
|
-
|
|
4
1
|
import { type DataItem, useDataStore } from "@ogw_front/stores/data";
|
|
5
2
|
import type {
|
|
6
3
|
GeodeObjectType,
|
|
@@ -10,8 +7,11 @@ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
|
10
7
|
import type { DataIdentified } from "@ogw_front/types/identifiers";
|
|
11
8
|
import type { ViewerId } from "@geode/opengeodeweb-viewer/schema_types";
|
|
12
9
|
import { computeMenuPosition } from "@ogw_front/composables/overlapping_picker_menu";
|
|
10
|
+
import { isImage } from "@ogw_front/utils/viewer_object_type";
|
|
11
|
+
import { ref } from "vue";
|
|
13
12
|
import { useDataStyleStore } from "@ogw_front/stores/data_style";
|
|
14
13
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
14
|
+
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
15
15
|
|
|
16
16
|
interface PickedItem {
|
|
17
17
|
id: DataId;
|
|
@@ -55,7 +55,6 @@ export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
|
55
55
|
const dataStore = useDataStore();
|
|
56
56
|
const dataStyleStore = useDataStyleStore();
|
|
57
57
|
const viewerStore = useViewerStore();
|
|
58
|
-
const dataItems = dataStore.refAllItems();
|
|
59
58
|
|
|
60
59
|
const displayIntermediate = ref(false);
|
|
61
60
|
const intermediateItems = ref<ProposedItem[]>([]);
|
|
@@ -111,27 +110,16 @@ export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
|
111
110
|
}
|
|
112
111
|
}
|
|
113
112
|
|
|
114
|
-
|
|
113
|
+
function getViewableIds(): string[] {
|
|
115
114
|
// Images are not pickable
|
|
116
115
|
const activeIds = new Set(
|
|
117
|
-
|
|
118
|
-
.filter((i: DataItem) => i.viewer_object_type !== "image")
|
|
119
|
-
.map((i: DataItem) => i.data_id),
|
|
116
|
+
dataStore.items.filter((i: DataItem) => !isImage(i)).map((i: DataItem) => i.data_id),
|
|
120
117
|
);
|
|
121
118
|
const visibleStyleIds = Object.keys(dataStyleStore.styles).filter(
|
|
122
119
|
(styleId) => activeIds.has(styleId) && dataStyleStore.objectVisibility(styleId) === true,
|
|
123
120
|
);
|
|
124
121
|
|
|
125
|
-
|
|
126
|
-
visibleStyleIds.map(async (styleId) => {
|
|
127
|
-
try {
|
|
128
|
-
return (await dataStore.isItemViewable(styleId)) ? styleId : undefined;
|
|
129
|
-
} catch {
|
|
130
|
-
return undefined;
|
|
131
|
-
}
|
|
132
|
-
}),
|
|
133
|
-
);
|
|
134
|
-
return viewableChecks.filter((id): id is string => Boolean(id));
|
|
122
|
+
return visibleStyleIds.filter((styleId) => dataStore.isViewable(styleId));
|
|
135
123
|
}
|
|
136
124
|
|
|
137
125
|
function showIntermediateMenu(
|
|
@@ -145,7 +133,7 @@ export function useOverlappingPicker(): UseOverlappingPickerReturn {
|
|
|
145
133
|
}
|
|
146
134
|
|
|
147
135
|
async function get_viewer_id(params: GetViewerIdParams): Promise<ViewerIdResult> {
|
|
148
|
-
const ids =
|
|
136
|
+
const ids = getViewableIds();
|
|
149
137
|
|
|
150
138
|
const schema = viewer_schemas.opengeodeweb_viewer.viewer.picked_ids;
|
|
151
139
|
const { array_ids, viewer_id } = await viewerStore.request({
|
|
@@ -5,6 +5,7 @@ import type { DataId } from "@geode/opengeodeweb-microservice/schema_types";
|
|
|
5
5
|
import type { TreeMenuPayload } from "@ogw_front/utils/treeview";
|
|
6
6
|
import type { ViewerId } from "@geode/opengeodeweb-viewer/schema_types";
|
|
7
7
|
import type { ViewerIdResult } from "@ogw_front/composables/use_overlapping_picker";
|
|
8
|
+
import { isModel } from "@ogw_front/utils/viewer_object_type";
|
|
8
9
|
import { useDataStore } from "@ogw_front/stores/data";
|
|
9
10
|
import { useElementSize } from "@vueuse/core";
|
|
10
11
|
|
|
@@ -76,7 +77,7 @@ async function viewerMenuTarget(
|
|
|
76
77
|
): Promise<MenuTarget> {
|
|
77
78
|
const item = await dataStore.item(pickedId);
|
|
78
79
|
const meta_data: MenuMetaData = { ...item };
|
|
79
|
-
if (item
|
|
80
|
+
if (isModel(item) && viewer_id !== undefined) {
|
|
80
81
|
const component = await dataStore.getComponentByViewerId(pickedId, viewer_id);
|
|
81
82
|
if (component) {
|
|
82
83
|
meta_data.pickedComponentId = component.geode_id;
|
package/app/stores/api.ts
CHANGED
|
@@ -1,68 +1,15 @@
|
|
|
1
|
-
import
|
|
2
|
-
import { api_fetch } from "@ogw_internal/utils/api_fetch";
|
|
3
|
-
import { consola } from "consola";
|
|
4
|
-
|
|
5
|
-
interface ApiSchema {
|
|
6
|
-
$id: string;
|
|
7
|
-
methods: string[];
|
|
8
|
-
[key: string]: unknown;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
type ApiCallbacks<Response = unknown> = RequestHandlers<Response> & {
|
|
12
|
-
skip_feedback_error?: boolean;
|
|
13
|
-
};
|
|
14
|
-
|
|
15
|
-
const MILLISECONDS_IN_SECOND = 1000;
|
|
1
|
+
import { useHttpTransport, useRequestCounter } from "@ogw_internal/stores/microservice";
|
|
16
2
|
|
|
17
3
|
export const useAPIStore = defineStore("api", () => {
|
|
18
|
-
const request_counter = ref(0);
|
|
19
4
|
const base_url = ref(useRuntimeConfig().public.CLOUD_API_URL);
|
|
5
|
+
const counter = useRequestCounter();
|
|
6
|
+
const { request_counter, is_busy, start_request, stop_request } = counter;
|
|
7
|
+
const { request } = useHttpTransport("api", base_url, counter);
|
|
20
8
|
|
|
21
|
-
function start_request(): void {
|
|
22
|
-
request_counter.value += 1;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
function stop_request(): void {
|
|
26
|
-
request_counter.value -= 1;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// The response type comes from the schema's generated `response` type (see the Cloud API typed schemas), asserted at the API boundary below, not verified
|
|
30
|
-
async function request<Schema extends ApiSchema>(
|
|
31
|
-
{
|
|
32
|
-
schema,
|
|
33
|
-
params,
|
|
34
|
-
headers = {},
|
|
35
|
-
}: { schema: Schema; params?: ParamsOf<Schema>; headers?: Record<string, string> },
|
|
36
|
-
callbacks: ApiCallbacks<ResponseOf<Schema>> = {},
|
|
37
|
-
): Promise<ResponseOf<Schema>> {
|
|
38
|
-
consola.info("[API] Request:", schema.$id);
|
|
39
|
-
const start = Date.now();
|
|
40
|
-
|
|
41
|
-
const result = await api_fetch(
|
|
42
|
-
{ $id: schema.$id, base_url: base_url.value, start_request, stop_request },
|
|
43
|
-
{ schema, params: params ?? {}, headers },
|
|
44
|
-
{
|
|
45
|
-
...callbacks,
|
|
46
|
-
response_function: async (response: unknown) => {
|
|
47
|
-
consola.info(
|
|
48
|
-
"[API] Request completed:",
|
|
49
|
-
schema.$id,
|
|
50
|
-
"in",
|
|
51
|
-
(Date.now() - start) / MILLISECONDS_IN_SECOND,
|
|
52
|
-
"s",
|
|
53
|
-
);
|
|
54
|
-
if (callbacks.response_function) {
|
|
55
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- trusted API boundary; see comment above.
|
|
56
|
-
await callbacks.response_function(response as ResponseOf<Schema>);
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
);
|
|
61
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- trusted API boundary; see comment above.
|
|
62
|
-
return result as ResponseOf<Schema>;
|
|
63
|
-
}
|
|
64
9
|
return {
|
|
65
10
|
base_url,
|
|
11
|
+
request_counter,
|
|
12
|
+
is_busy,
|
|
66
13
|
request,
|
|
67
14
|
start_request,
|
|
68
15
|
stop_request,
|
package/app/stores/app.ts
CHANGED
|
@@ -5,18 +5,12 @@ import {
|
|
|
5
5
|
importRegisteredStores,
|
|
6
6
|
} from "./app_helpers/registry.js";
|
|
7
7
|
import { getRestApiPort, getRestApiProtocol, isCloudMode } from "@ogw_front/utils/stores.js";
|
|
8
|
+
import { useHttpTransport, useRequestCounter } from "@ogw_internal/stores/microservice";
|
|
8
9
|
import { Status } from "@ogw_front/utils/status";
|
|
9
|
-
import { api_fetch } from "@ogw_internal/utils/api_fetch.js";
|
|
10
|
-
import { upload_file } from "@ogw_internal/utils/upload_file.js";
|
|
11
10
|
import { useAppExtensions } from "./app_helpers/extension.js";
|
|
12
11
|
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
13
12
|
|
|
14
|
-
import type {
|
|
15
|
-
JsonRpcSchema,
|
|
16
|
-
ParamsOf,
|
|
17
|
-
RequestHandlers,
|
|
18
|
-
ResponseOf,
|
|
19
|
-
} from "@ogw_shared/utils/types.js";
|
|
13
|
+
import type { RequestHandlers } from "@ogw_shared/utils/types.js";
|
|
20
14
|
import type { StateTree } from "pinia";
|
|
21
15
|
|
|
22
16
|
import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_typed_schemas.js";
|
|
@@ -75,6 +69,14 @@ export const useAppStore = defineStore("app", () => {
|
|
|
75
69
|
stores.push(store);
|
|
76
70
|
}
|
|
77
71
|
|
|
72
|
+
// An uninstalled extension unregisters its stores: they are no longer saved in projects
|
|
73
|
+
function unregisterStore(storeId: string): void {
|
|
74
|
+
const index = stores.findIndex((registeredStore) => registeredStore.$id === storeId);
|
|
75
|
+
if (index !== -1) {
|
|
76
|
+
stores.splice(index, 1);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
78
80
|
async function exportStores(
|
|
79
81
|
params: Record<string, unknown> = {},
|
|
80
82
|
): Promise<Record<string, unknown>> {
|
|
@@ -100,62 +102,24 @@ export const useAppStore = defineStore("app", () => {
|
|
|
100
102
|
getExtensionEnabled,
|
|
101
103
|
} = useAppExtensions();
|
|
102
104
|
|
|
103
|
-
const
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}
|
|
107
|
-
function stop_request(): void {
|
|
108
|
-
request_counter.value -= 1;
|
|
109
|
-
}
|
|
110
|
-
const is_busy = computed(() => request_counter.value > 0);
|
|
105
|
+
const counter = useRequestCounter();
|
|
106
|
+
const { request_counter, is_busy, start_request, stop_request } = counter;
|
|
107
|
+
const transport = useHttpTransport("app", base_url, counter);
|
|
108
|
+
const { request } = transport;
|
|
111
109
|
|
|
112
110
|
async function upload(file: Readonly<File>, callbacks: RequestHandlers = {}): Promise<unknown> {
|
|
113
111
|
const schema = opengeodeweb_front_schemas.api.local.extensions.upload;
|
|
114
112
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
115
|
-
const
|
|
116
|
-
const result = await upload_file(
|
|
117
|
-
{ $id: "app", base_url: base_url.value, start_request, stop_request },
|
|
118
|
-
{ schema, file, params },
|
|
119
|
-
{
|
|
120
|
-
...callbacks,
|
|
121
|
-
response_function: async (response: unknown) => {
|
|
122
|
-
if (callbacks.response_function) {
|
|
123
|
-
await callbacks.response_function(response);
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
);
|
|
113
|
+
const result = await transport.upload({ schema, file, params: { projectName } }, callbacks);
|
|
128
114
|
return result;
|
|
129
115
|
}
|
|
130
116
|
|
|
131
|
-
// The response type comes from the schema's generated `response` type, asserted at the single `as ResponseOf<Schema>` boundary below: the server checks its responses against that schema outside production.
|
|
132
|
-
// oxlint-disable-next-line unicorn/consistent-function-scoping
|
|
133
|
-
async function request<Schema extends JsonRpcSchema>(
|
|
134
|
-
{ schema, params }: { schema: Schema; params?: ParamsOf<Schema> },
|
|
135
|
-
callbacks: RequestHandlers<ResponseOf<Schema>> = {},
|
|
136
|
-
): Promise<ResponseOf<Schema>> {
|
|
137
|
-
const rpc_schema: JsonRpcSchema = schema;
|
|
138
|
-
const result = await api_fetch(
|
|
139
|
-
{ $id: "app", base_url: base_url.value, start_request, stop_request },
|
|
140
|
-
// The app store is only ever used with HTTP ("front") schemas, which always carry `methods`; the wider JsonRpcSchema param above is kept as-is to match this action's public signature (e.g. relayed from get_version-style callers that only know about the shared, looser schema shape).
|
|
141
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- narrowing optional `methods` to required is safe here; see comment above.
|
|
142
|
-
{ schema: rpc_schema as JsonRpcSchema & { methods: string[] }, params: params ?? {} },
|
|
143
|
-
{
|
|
144
|
-
...callbacks,
|
|
145
|
-
response_function: async (response: unknown) => {
|
|
146
|
-
if (callbacks.response_function) {
|
|
147
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- this is the trusted API boundary; see comment above.
|
|
148
|
-
await callbacks.response_function(response as ResponseOf<Schema>);
|
|
149
|
-
}
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
);
|
|
153
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- this is the trusted API boundary; see comment above.
|
|
154
|
-
return result as ResponseOf<Schema>;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
117
|
const projectFolderPath = ref("");
|
|
158
118
|
|
|
119
|
+
function set_project_folder_path(path: string): void {
|
|
120
|
+
projectFolderPath.value = path;
|
|
121
|
+
}
|
|
122
|
+
|
|
159
123
|
async function createProjectFolder(): Promise<unknown> {
|
|
160
124
|
const { PROJECT } = useRuntimeConfig().public;
|
|
161
125
|
const schema = opengeodeweb_front_schemas.api.local.app.project_folder_path;
|
|
@@ -181,6 +145,7 @@ export const useAppStore = defineStore("app", () => {
|
|
|
181
145
|
base_url,
|
|
182
146
|
is_busy,
|
|
183
147
|
registerStore,
|
|
148
|
+
unregisterStore,
|
|
184
149
|
exportStores,
|
|
185
150
|
importStores,
|
|
186
151
|
loadedExtensions,
|
|
@@ -197,6 +162,7 @@ export const useAppStore = defineStore("app", () => {
|
|
|
197
162
|
request,
|
|
198
163
|
upload,
|
|
199
164
|
projectFolderPath,
|
|
165
|
+
set_project_folder_path,
|
|
200
166
|
createProjectFolder,
|
|
201
167
|
start_request,
|
|
202
168
|
stop_request,
|