@geode/opengeodeweb-front 12.2.0-rc.4 → 12.2.0-rc.6
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/CameraOrientation.vue +85 -68
- package/app/components/CameraOrientationDial.vue +195 -0
- 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/OrientationCompass.vue +11 -34
- package/app/components/Viewer/OrientationGlobe.vue +2 -2
- 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/compass_dial.ts +40 -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/brand_colors.ts +9 -0
- package/app/utils/camera_orientations.ts +136 -0
- package/app/utils/import_item.ts +5 -4
- package/app/utils/orientation_compass.ts +15 -0
- package/app/utils/orientation_cube_style.ts +70 -0
- 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
package/app/stores/back.ts
CHANGED
|
@@ -1,93 +1,72 @@
|
|
|
1
1
|
import { getRestApiPort, getRestApiProtocol, isCloudMode } from "@ogw_front/utils/stores";
|
|
2
|
+
import {
|
|
3
|
+
useHttpTransport,
|
|
4
|
+
useMicroserviceVersion,
|
|
5
|
+
usePing,
|
|
6
|
+
useRequestCounter,
|
|
7
|
+
} from "@ogw_internal/stores/microservice";
|
|
8
|
+
import type { RequestHandlers } from "@ogw_shared/utils/types.js";
|
|
2
9
|
import { Status } from "@ogw_front/utils/status";
|
|
3
|
-
import { api_fetch } from "@ogw_internal/utils/api_fetch";
|
|
4
10
|
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
5
|
-
import
|
|
11
|
+
import opengeodeweb_front_schemas from "@geode/opengeodeweb-front/opengeodeweb_front_typed_schemas.js";
|
|
6
12
|
import { useAppStore } from "@ogw_front/stores/app";
|
|
7
13
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
8
14
|
import { useInfraStore } from "@ogw_front/stores/infra";
|
|
9
15
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
} from "@ogw_shared/utils/types.js";
|
|
16
|
+
export const useBackStore = defineStore(
|
|
17
|
+
"back",
|
|
18
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
19
|
+
() => {
|
|
20
|
+
const default_local_port = ref("5000");
|
|
21
|
+
const status = ref(Status.NOT_CONNECTED);
|
|
17
22
|
|
|
18
|
-
|
|
23
|
+
const protocol = computed(() => getRestApiProtocol());
|
|
24
|
+
const port = computed(() => getRestApiPort(default_local_port.value));
|
|
19
25
|
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
function base_url_for(domain_name: string): string {
|
|
27
|
+
let back_url = `${protocol.value}://${domain_name}:${port.value}`;
|
|
28
|
+
if (isCloudMode()) {
|
|
29
|
+
back_url += `/geode`;
|
|
30
|
+
}
|
|
31
|
+
return back_url;
|
|
32
|
+
}
|
|
22
33
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
return (domain_name: string) => {
|
|
42
|
-
let back_url = `${this.protocol}://${domain_name}:${this.port}`;
|
|
43
|
-
if (isCloudMode()) {
|
|
44
|
-
back_url += `/geode`;
|
|
45
|
-
}
|
|
46
|
-
return back_url;
|
|
47
|
-
};
|
|
48
|
-
},
|
|
49
|
-
is_busy(): boolean {
|
|
50
|
-
return this.request_counter > 0;
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
actions: {
|
|
54
|
-
set_ping() {
|
|
55
|
-
// oxlint-disable-next-line typescript/no-floating-promises
|
|
56
|
-
this.ping();
|
|
57
|
-
setInterval(() => {
|
|
58
|
-
// oxlint-disable-next-line typescript/no-floating-promises
|
|
59
|
-
this.ping();
|
|
60
|
-
}, DEFAULT_PING_INTERVAL_SECONDS * MILLISECONDS_IN_SECOND);
|
|
61
|
-
},
|
|
62
|
-
async ping() {
|
|
63
|
-
const feedbackStore = useFeedbackStore();
|
|
64
|
-
const schema = back_schemas.opengeodeweb_back.ping;
|
|
65
|
-
const result = await this.request(
|
|
66
|
-
{ schema, log_success: false },
|
|
34
|
+
// The infra store is read lazily: this store can be created before the Nuxt app context
|
|
35
|
+
const base_url = computed(() => base_url_for(useInfraStore().microservice_domain_name));
|
|
36
|
+
|
|
37
|
+
const counter = useRequestCounter();
|
|
38
|
+
const { request_counter, is_busy, start_request, stop_request } = counter;
|
|
39
|
+
const transport = useHttpTransport("back", base_url, counter);
|
|
40
|
+
const { request } = transport;
|
|
41
|
+
const { version, get_version } = useMicroserviceVersion(request);
|
|
42
|
+
|
|
43
|
+
// The status and the server error banner always change together
|
|
44
|
+
function set_connected(connected: boolean): void {
|
|
45
|
+
useFeedbackStore().set_server_error(!connected);
|
|
46
|
+
status.value = connected ? Status.CONNECTED : Status.NOT_CONNECTED;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
async function ping(): Promise<unknown> {
|
|
50
|
+
const result = await request(
|
|
51
|
+
{ schema: back_schemas.opengeodeweb_back.ping, log_success: false },
|
|
67
52
|
{
|
|
68
53
|
request_error_function: () => {
|
|
69
|
-
|
|
70
|
-
this.status = Status.NOT_CONNECTED;
|
|
54
|
+
set_connected(false);
|
|
71
55
|
},
|
|
72
56
|
response_function: () => {
|
|
73
|
-
|
|
74
|
-
this.status = Status.CONNECTED;
|
|
57
|
+
set_connected(true);
|
|
75
58
|
},
|
|
76
59
|
response_error_function: () => {
|
|
77
|
-
|
|
78
|
-
this.status = Status.NOT_CONNECTED;
|
|
60
|
+
set_connected(false);
|
|
79
61
|
},
|
|
80
62
|
},
|
|
81
63
|
);
|
|
82
64
|
return result;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
this.request_counter -= 1;
|
|
89
|
-
},
|
|
90
|
-
async launch(args: { projectFolderPath: string }) {
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const { start_ping, stop_ping } = usePing(ping);
|
|
68
|
+
|
|
69
|
+
async function launch(args: { projectFolderPath: string }): Promise<unknown> {
|
|
91
70
|
const appStore = useAppStore();
|
|
92
71
|
const { COMMAND_BACK, NUXT_ROOT_PATH } = useRuntimeConfig().public;
|
|
93
72
|
const schema = opengeodeweb_front_schemas.api.local.app.run_back;
|
|
@@ -97,86 +76,48 @@ export const useBackStore = defineStore("back", {
|
|
|
97
76
|
{ schema, params },
|
|
98
77
|
{
|
|
99
78
|
response_function: (response) => {
|
|
100
|
-
|
|
79
|
+
default_local_port.value = String(response.port);
|
|
101
80
|
},
|
|
102
81
|
},
|
|
103
82
|
);
|
|
104
83
|
return result;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
schema,
|
|
113
|
-
params,
|
|
114
|
-
log_success,
|
|
115
|
-
}: { schema: Schema; params?: ParamsOf<Schema>; log_success?: boolean },
|
|
116
|
-
callbacks: RequestHandlers<ResponseOf<Schema>> = {},
|
|
117
|
-
): Promise<ResponseOf<Schema>> {
|
|
118
|
-
const rpc_schema: JsonRpcSchema = schema;
|
|
119
|
-
const result = await api_fetch(
|
|
120
|
-
this,
|
|
121
|
-
// The back store is only ever used with HTTP ("front"/"back") schemas,
|
|
122
|
-
// Which always carry `methods`; the wider JsonRpcSchema param above is
|
|
123
|
-
// Kept as-is to match this action's public signature.
|
|
124
|
-
{
|
|
125
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
126
|
-
schema: rpc_schema as JsonRpcSchema & { methods: string[] },
|
|
127
|
-
params: params ?? {},
|
|
128
|
-
headers: {},
|
|
129
|
-
...(log_success !== undefined && { log_success }),
|
|
130
|
-
},
|
|
131
|
-
{
|
|
132
|
-
...callbacks,
|
|
133
|
-
response_function: async (response: unknown) => {
|
|
134
|
-
if (callbacks.response_function) {
|
|
135
|
-
// The back validates its responses against the schema `response` it was generated from.
|
|
136
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
137
|
-
await callbacks.response_function(response as ResponseOf<Schema>);
|
|
138
|
-
}
|
|
139
|
-
},
|
|
140
|
-
},
|
|
141
|
-
);
|
|
142
|
-
// oxlint-disable-next-line typescript/no-unsafe-type-assertion
|
|
143
|
-
return result as ResponseOf<Schema>;
|
|
144
|
-
},
|
|
145
|
-
async upload(file: File, callbacks: RequestHandlers = {}) {
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
function connect(): void {
|
|
87
|
+
start_ping();
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
async function upload(file: File, callbacks: RequestHandlers = {}): Promise<unknown> {
|
|
146
91
|
const schema = back_schemas.opengeodeweb_back.upload_file;
|
|
147
|
-
const result = await
|
|
148
|
-
this,
|
|
149
|
-
{
|
|
150
|
-
schema,
|
|
151
|
-
file,
|
|
152
|
-
},
|
|
153
|
-
{
|
|
154
|
-
...callbacks,
|
|
155
|
-
response_function: async (response: unknown) => {
|
|
156
|
-
if (callbacks.response_function) {
|
|
157
|
-
await callbacks.response_function(response);
|
|
158
|
-
}
|
|
159
|
-
},
|
|
160
|
-
},
|
|
161
|
-
);
|
|
92
|
+
const result = await transport.upload({ schema, file }, callbacks);
|
|
162
93
|
return result;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
return {
|
|
97
|
+
default_local_port,
|
|
98
|
+
request_counter,
|
|
99
|
+
status,
|
|
100
|
+
version,
|
|
101
|
+
protocol,
|
|
102
|
+
port,
|
|
103
|
+
base_url,
|
|
104
|
+
base_url_for,
|
|
105
|
+
is_busy,
|
|
106
|
+
ping,
|
|
107
|
+
start_ping,
|
|
108
|
+
stop_ping,
|
|
109
|
+
start_request,
|
|
110
|
+
stop_request,
|
|
111
|
+
launch,
|
|
112
|
+
connect,
|
|
113
|
+
request,
|
|
114
|
+
upload,
|
|
115
|
+
get_version,
|
|
116
|
+
};
|
|
178
117
|
},
|
|
179
|
-
|
|
180
|
-
|
|
118
|
+
{
|
|
119
|
+
share: {
|
|
120
|
+
omit: ["status"],
|
|
121
|
+
},
|
|
181
122
|
},
|
|
182
|
-
|
|
123
|
+
);
|
|
@@ -1,34 +1,21 @@
|
|
|
1
|
-
import type { Table } from "dexie";
|
|
2
|
-
import { useObservable } from "@vueuse/rxjs";
|
|
3
|
-
|
|
4
1
|
// Local imports
|
|
5
2
|
import type { CameraOptions } from "@ogw_internal/stores/hybrid_viewer/vtk_types.js";
|
|
6
|
-
import {
|
|
3
|
+
import type { CameraPositionRecord } from "@ogw_internal/database/tables/camera_positions";
|
|
4
|
+
import { cameraPositionsDb } from "@ogw_internal/database/database.js";
|
|
7
5
|
import { liveObservable } from "@ogw_front/utils/live_observable";
|
|
6
|
+
import { useObservable } from "@vueuse/rxjs";
|
|
8
7
|
import { useViewerStore } from "@ogw_front/stores/viewer";
|
|
9
8
|
import viewer_schemas from "@geode/opengeodeweb-viewer/opengeodeweb_viewer_typed_schemas.js";
|
|
10
|
-
|
|
11
|
-
interface CameraPositionRecord {
|
|
12
|
-
id?: number;
|
|
13
|
-
name: string;
|
|
14
|
-
camera_options: CameraOptions;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
9
|
// oxlint-disable-next-line max-lines-per-function
|
|
18
|
-
export const useCameraManagerStore = defineStore("
|
|
10
|
+
export const useCameraManagerStore = defineStore("cameraManager", () => {
|
|
19
11
|
const viewerStore = useViewerStore();
|
|
20
|
-
//
|
|
21
|
-
|
|
22
|
-
// oxlint-disable-next-line no-unsafe-type-assertion -- trusted database table boundary.
|
|
23
|
-
const camera_positions_db = database.camera_positions as unknown as Table<
|
|
24
|
-
CameraPositionRecord,
|
|
25
|
-
number
|
|
26
|
-
>;
|
|
12
|
+
// Keyed by an auto-incremented number
|
|
13
|
+
const cameraPositionsTable = cameraPositionsDb();
|
|
27
14
|
|
|
28
15
|
function refAllCameraPositions(): Ref<CameraPositionRecord[]> {
|
|
29
16
|
return useObservable(
|
|
30
17
|
liveObservable(async () => {
|
|
31
|
-
const positions = await
|
|
18
|
+
const positions = await cameraPositionsTable.toArray();
|
|
32
19
|
return positions;
|
|
33
20
|
}),
|
|
34
21
|
{ initialValue: [] as CameraPositionRecord[] },
|
|
@@ -36,19 +23,19 @@ export const useCameraManagerStore = defineStore("camera_manager", () => {
|
|
|
36
23
|
}
|
|
37
24
|
|
|
38
25
|
async function getCameraPosition(id: number): Promise<CameraPositionRecord | undefined> {
|
|
39
|
-
const position = await
|
|
26
|
+
const position = await cameraPositionsTable.get(id);
|
|
40
27
|
return position;
|
|
41
28
|
}
|
|
42
29
|
|
|
43
30
|
async function saveCameraPosition(name: string, camera_options: CameraOptions): Promise<void> {
|
|
44
|
-
await
|
|
31
|
+
await cameraPositionsTable.put({
|
|
45
32
|
name,
|
|
46
33
|
camera_options,
|
|
47
34
|
});
|
|
48
35
|
}
|
|
49
36
|
|
|
50
37
|
async function restoreCameraPosition(id: number): Promise<void> {
|
|
51
|
-
const position = await
|
|
38
|
+
const position = await cameraPositionsTable.get(id);
|
|
52
39
|
if (position) {
|
|
53
40
|
const schema = viewer_schemas.opengeodeweb_viewer.viewer.update_camera;
|
|
54
41
|
const params = { camera_options: position.camera_options };
|
|
@@ -57,11 +44,11 @@ export const useCameraManagerStore = defineStore("camera_manager", () => {
|
|
|
57
44
|
}
|
|
58
45
|
|
|
59
46
|
async function deleteCameraPosition(id: number): Promise<void> {
|
|
60
|
-
await
|
|
47
|
+
await cameraPositionsTable.delete(id);
|
|
61
48
|
}
|
|
62
49
|
|
|
63
50
|
async function renameCameraPosition(id: number, newName: string): Promise<void> {
|
|
64
|
-
await
|
|
51
|
+
await cameraPositionsTable.update(id, { name: newName });
|
|
65
52
|
}
|
|
66
53
|
|
|
67
54
|
return {
|
package/app/stores/cloud.ts
CHANGED
|
@@ -1,107 +1,27 @@
|
|
|
1
|
-
import { clearCloudUrlParam, getCloudUrlParam } from "@ogw_front/utils/cloud";
|
|
2
1
|
import { Status } from "@ogw_front/utils/status";
|
|
3
|
-
import { api_fetch } from "@ogw_internal/utils/api_fetch";
|
|
4
|
-
import back_schemas from "@geode/opengeodeweb-back/opengeodeweb_back_typed_schemas.js";
|
|
5
|
-
import cloud_api_schemas from "@geode/cloud-api/cloud_api_typed_schemas.js";
|
|
6
|
-
import { setAppBaseUrl } from "@ogw_shared/scripts";
|
|
7
|
-
import { useAPIStore } from "@ogw_front/stores/api";
|
|
8
2
|
import { useFeedbackStore } from "@ogw_front/stores/feedback";
|
|
9
3
|
|
|
10
|
-
|
|
4
|
+
// State of the cloud service; launching or reaching it is done by utils/backend_lifecycle.ts
|
|
5
|
+
export const useCloudStore = defineStore(
|
|
6
|
+
"cloud",
|
|
7
|
+
() => {
|
|
8
|
+
const status = ref(Status.NOT_CONNECTED);
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
throw new Error("Launching a cloud service requires an authenticated user");
|
|
24
|
-
}
|
|
25
|
-
await this.launch(authToken);
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
try {
|
|
29
|
-
await this.connect_existing(existing_host);
|
|
30
|
-
} finally {
|
|
31
|
-
clearCloudUrlParam();
|
|
32
|
-
}
|
|
33
|
-
},
|
|
34
|
-
// `authToken` is the user's Firebase ID token, checked by the Cloud API
|
|
35
|
-
async launch(authToken: string) {
|
|
36
|
-
this.status = Status.CONNECTING;
|
|
37
|
-
const { PROJECT, BRANCH } = useRuntimeConfig().public;
|
|
38
|
-
const params = { project: PROJECT, branch: BRANCH };
|
|
39
|
-
const headers = { Authorization: `Bearer ${authToken}` };
|
|
40
|
-
const feedbackStore = useFeedbackStore();
|
|
41
|
-
const APIStore = useAPIStore();
|
|
42
|
-
const result = await APIStore.request(
|
|
43
|
-
{ schema: run_cloud_schema, params, headers },
|
|
44
|
-
{
|
|
45
|
-
request_error_function: () => {
|
|
46
|
-
feedbackStore.$patch({ server_error: true });
|
|
47
|
-
this.status = Status.NOT_CONNECTED;
|
|
48
|
-
},
|
|
49
|
-
response_function: async ({ url }) => {
|
|
50
|
-
await this.on_connected(url);
|
|
51
|
-
},
|
|
52
|
-
response_error_function: () => {
|
|
53
|
-
feedbackStore.$patch({ server_error: true });
|
|
54
|
-
this.status = Status.NOT_CONNECTED;
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
);
|
|
58
|
-
return result;
|
|
59
|
-
},
|
|
60
|
-
async connect_existing(host: string) {
|
|
61
|
-
this.status = Status.CONNECTING;
|
|
62
|
-
const { useBackStore } = await import("./back");
|
|
63
|
-
const backStore = useBackStore();
|
|
64
|
-
// Probe the candidate host directly so domain_name is only updated once the service answers.
|
|
65
|
-
try {
|
|
66
|
-
await api_fetch(
|
|
67
|
-
{
|
|
68
|
-
$id: backStore.$id,
|
|
69
|
-
base_url: backStore.base_url_for(host),
|
|
70
|
-
start_request: () => {
|
|
71
|
-
backStore.start_request();
|
|
72
|
-
},
|
|
73
|
-
stop_request: () => {
|
|
74
|
-
backStore.stop_request();
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
{ schema: back_schemas.opengeodeweb_back.ping, log_success: false },
|
|
78
|
-
);
|
|
79
|
-
} catch (error) {
|
|
80
|
-
useFeedbackStore().$patch({ server_error: true });
|
|
81
|
-
this.status = Status.NOT_CONNECTED;
|
|
82
|
-
throw error;
|
|
83
|
-
}
|
|
84
|
-
await this.on_connected(host);
|
|
85
|
-
},
|
|
86
|
-
async on_connected(url: string) {
|
|
87
|
-
const { useAppStore } = await import("./app");
|
|
88
|
-
const { useInfraStore } = await import("./infra");
|
|
89
|
-
const appStore = useAppStore();
|
|
90
|
-
useFeedbackStore().$patch({ server_error: false });
|
|
91
|
-
this.status = Status.CONNECTED;
|
|
92
|
-
useInfraStore().$patch({
|
|
93
|
-
domain_name: url,
|
|
94
|
-
});
|
|
95
|
-
appStore.$patch({
|
|
96
|
-
projectFolderPath: "/project",
|
|
97
|
-
});
|
|
98
|
-
await setAppBaseUrl(appStore.base_url);
|
|
99
|
-
},
|
|
100
|
-
connect() {
|
|
101
|
-
this.status = Status.CONNECTED;
|
|
102
|
-
},
|
|
10
|
+
function set_connecting(): void {
|
|
11
|
+
status.value = Status.CONNECTING;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
// The status and the server error banner always change together
|
|
15
|
+
function set_connected(connected: boolean): void {
|
|
16
|
+
useFeedbackStore().set_server_error(!connected);
|
|
17
|
+
status.value = connected ? Status.CONNECTED : Status.NOT_CONNECTED;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
return { status, set_connecting, set_connected };
|
|
103
21
|
},
|
|
104
|
-
|
|
105
|
-
|
|
22
|
+
{
|
|
23
|
+
share: {
|
|
24
|
+
omit: ["status"],
|
|
25
|
+
},
|
|
106
26
|
},
|
|
107
|
-
|
|
27
|
+
);
|
package/app/stores/crs.ts
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
|
+
import { type CrsItem, useDataStore } from "@ogw_front/stores/data";
|
|
1
2
|
import type { CRS } from "@geode/opengeodeweb-back/schema_types";
|
|
2
3
|
import { oldestCrs } from "@ogw_front/utils/crs";
|
|
3
4
|
import { useCrsRequests } from "./crs_helpers/requests.js";
|
|
4
|
-
import { useDataStore } from "@ogw_front/stores/data";
|
|
5
5
|
import { useGeographicList } from "./crs_helpers/geographic_list.js";
|
|
6
6
|
import { useProjectCrsState } from "./crs_helpers/project_crs.js";
|
|
7
7
|
|
|
8
8
|
// Session cache of the available CRS, the project CRS, and the channel the shared components use to ask the host app for a CRS edit
|
|
9
9
|
export const useCrsStore = defineStore("crs", () => {
|
|
10
|
-
const
|
|
10
|
+
const dataStore = useDataStore();
|
|
11
|
+
const crsItems = computed<CrsItem[]>(() => dataStore.items);
|
|
11
12
|
const { geographicList } = useGeographicList();
|
|
12
13
|
const { projectCrs, mismatchedCrs, setProjectCrs } = useProjectCrsState(crsItems);
|
|
13
14
|
// Edit and alignment requests, returned as they are
|