@geode/opengeodeweb-front 10.34.0-rc.13 → 10.34.0-rc.14
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/stores/app.ts +12 -15
- package/app/stores/viewer.ts +15 -9
- package/internal/utils/api_fetch.ts +19 -13
- package/package.json +1 -1
- package/shared/utils/fetch_raw.ts +1 -1
package/app/stores/app.ts
CHANGED
|
@@ -140,14 +140,21 @@ export const useAppStore = defineStore("app", () => {
|
|
|
140
140
|
getExtensionEnabled,
|
|
141
141
|
} = useAppExtensions();
|
|
142
142
|
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
143
|
+
const request_counter = ref(0);
|
|
144
|
+
function start_request(): void {
|
|
145
|
+
request_counter.value += 1;
|
|
146
|
+
}
|
|
147
|
+
function stop_request(): void {
|
|
148
|
+
request_counter.value -= 1;
|
|
149
|
+
}
|
|
150
|
+
const is_busy = computed(() => request_counter.value > 0);
|
|
151
|
+
|
|
152
|
+
async function upload(file: Readonly<File>, callbacks: RequestHandlers = {}): Promise<unknown> {
|
|
146
153
|
const schema = opengeodeweb_front_schemas.api.local.extensions.upload;
|
|
147
154
|
const { PROJECT: projectName } = useRuntimeConfig().public;
|
|
148
155
|
const params = { projectName };
|
|
149
156
|
const result = await upload_file(
|
|
150
|
-
|
|
157
|
+
{ $id: "app", base_url: base_url.value, start_request, stop_request },
|
|
151
158
|
{ schema, file, params },
|
|
152
159
|
{
|
|
153
160
|
...callbacks,
|
|
@@ -167,9 +174,8 @@ export const useAppStore = defineStore("app", () => {
|
|
|
167
174
|
{ schema, params }: { schema: JsonRpcSchema; params?: Record<string, unknown> },
|
|
168
175
|
callbacks: RequestHandlers = {},
|
|
169
176
|
): Promise<TResult> {
|
|
170
|
-
const store = useAppStore();
|
|
171
177
|
const result = await api_fetch(
|
|
172
|
-
|
|
178
|
+
{ $id: "app", base_url: base_url.value, start_request, stop_request },
|
|
173
179
|
// 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).
|
|
174
180
|
// oxlint-disable-next-line no-unsafe-type-assertion -- narrowing optional `methods` to required is safe here; see comment above.
|
|
175
181
|
{ schema: schema as JsonRpcSchema & { methods: string[] }, params },
|
|
@@ -186,15 +192,6 @@ export const useAppStore = defineStore("app", () => {
|
|
|
186
192
|
return result as TResult;
|
|
187
193
|
}
|
|
188
194
|
|
|
189
|
-
const request_counter = ref(0);
|
|
190
|
-
function start_request(): void {
|
|
191
|
-
request_counter.value += 1;
|
|
192
|
-
}
|
|
193
|
-
function stop_request(): void {
|
|
194
|
-
request_counter.value -= 1;
|
|
195
|
-
}
|
|
196
|
-
const is_busy = computed(() => request_counter.value > 0);
|
|
197
|
-
|
|
198
195
|
const projectFolderPath = ref("");
|
|
199
196
|
|
|
200
197
|
async function createProjectFolder(): Promise<unknown> {
|
package/app/stores/viewer.ts
CHANGED
|
@@ -58,6 +58,12 @@ export const useViewerStore = defineStore(
|
|
|
58
58
|
viewer_url += "/ws";
|
|
59
59
|
return viewer_url;
|
|
60
60
|
});
|
|
61
|
+
function start_request(): void {
|
|
62
|
+
request_counter.value += 1;
|
|
63
|
+
}
|
|
64
|
+
function stop_request(): void {
|
|
65
|
+
request_counter.value -= 1;
|
|
66
|
+
}
|
|
61
67
|
const is_busy = computed(() => request_counter.value > 0);
|
|
62
68
|
function toggle_picking_mode(value: boolean): void {
|
|
63
69
|
picking_mode.value = value;
|
|
@@ -75,9 +81,15 @@ export const useViewerStore = defineStore(
|
|
|
75
81
|
},
|
|
76
82
|
callbacks: RequestHandlers = {},
|
|
77
83
|
): Promise<unknown> {
|
|
78
|
-
const
|
|
84
|
+
const microservice = {
|
|
85
|
+
$id: "viewer",
|
|
86
|
+
client: client.value,
|
|
87
|
+
base_url: base_url.value,
|
|
88
|
+
start_request,
|
|
89
|
+
stop_request,
|
|
90
|
+
};
|
|
79
91
|
const result = await viewer_call(
|
|
80
|
-
|
|
92
|
+
microservice,
|
|
81
93
|
{
|
|
82
94
|
schema,
|
|
83
95
|
params,
|
|
@@ -148,13 +160,7 @@ export const useViewerStore = defineStore(
|
|
|
148
160
|
}
|
|
149
161
|
});
|
|
150
162
|
}
|
|
151
|
-
function
|
|
152
|
-
request_counter.value += 1;
|
|
153
|
-
}
|
|
154
|
-
function stop_request(): void {
|
|
155
|
-
request_counter.value -= 1;
|
|
156
|
-
}
|
|
157
|
-
async function launch(args: { projectFolderPath?: string } = {}): Promise<unknown> {
|
|
163
|
+
async function launch(args: Readonly<{ projectFolderPath?: string }> = {}): Promise<unknown> {
|
|
158
164
|
const appStore = useAppStore();
|
|
159
165
|
const { COMMAND_VIEWER, NUXT_ROOT_PATH } = useRuntimeConfig().public;
|
|
160
166
|
const schema = opengeodeweb_front_schemas.api.local.app.run_viewer;
|
|
@@ -57,6 +57,7 @@ function toFetchErrorResponseLike(response: unknown): FetchErrorResponseLike {
|
|
|
57
57
|
};
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
+
// oxlint-disable-next-line max-lines-per-function
|
|
60
61
|
async function api_fetch(
|
|
61
62
|
microservice: Microservice,
|
|
62
63
|
{ schema, params = {}, headers = {} }: ApiFetchParams,
|
|
@@ -65,7 +66,8 @@ async function api_fetch(
|
|
|
65
66
|
response_function,
|
|
66
67
|
response_error_function,
|
|
67
68
|
timeout,
|
|
68
|
-
|
|
69
|
+
skip_feedback_error,
|
|
70
|
+
}: RequestHandlersWithValidation & { timeout?: number; skip_feedback_error?: boolean } = {},
|
|
69
71
|
): Promise<unknown> {
|
|
70
72
|
console.log("[API] Fetching", microservice.base_url);
|
|
71
73
|
const feedbackStore = useFeedbackStore();
|
|
@@ -84,12 +86,14 @@ async function api_fetch(
|
|
|
84
86
|
request_error_function(error: unknown) {
|
|
85
87
|
microservice.stop_request();
|
|
86
88
|
const typedError = toFetchErrorLike(error);
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
if (!skip_feedback_error) {
|
|
90
|
+
feedbackStore.add_error(
|
|
91
|
+
typedError.code ?? 0,
|
|
92
|
+
schema.$id,
|
|
93
|
+
typedError.message ?? "",
|
|
94
|
+
typedError.stack ?? "",
|
|
95
|
+
);
|
|
96
|
+
}
|
|
93
97
|
if (request_error_function) {
|
|
94
98
|
request_error_function(error);
|
|
95
99
|
}
|
|
@@ -104,12 +108,14 @@ async function api_fetch(
|
|
|
104
108
|
response_error_function(response: unknown) {
|
|
105
109
|
microservice.stop_request();
|
|
106
110
|
const typedResponse = toFetchErrorResponseLike(response);
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
if (!skip_feedback_error) {
|
|
112
|
+
feedbackStore.add_error(
|
|
113
|
+
typedResponse.status ?? 0,
|
|
114
|
+
schema.$id,
|
|
115
|
+
typedResponse.name ?? "",
|
|
116
|
+
typedResponse.description ?? "",
|
|
117
|
+
);
|
|
118
|
+
}
|
|
113
119
|
if (response_error_function) {
|
|
114
120
|
response_error_function(response);
|
|
115
121
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@geode/opengeodeweb-front",
|
|
3
|
-
"version": "10.34.0-rc.
|
|
3
|
+
"version": "10.34.0-rc.14",
|
|
4
4
|
"description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
|
|
5
5
|
"homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
|
|
6
6
|
"bugs": {
|
|
@@ -67,8 +67,8 @@ async function performFetch({
|
|
|
67
67
|
},
|
|
68
68
|
async onResponse({
|
|
69
69
|
response,
|
|
70
|
-
// oxlint-disable-next-line eslint/id-length -- mirrors the real ofetch/vitest API field name (`ok`/`fn`)
|
|
71
70
|
}: {
|
|
71
|
+
// oxlint-disable-next-line eslint/id-length -- mirrors the real ofetch/vitest API field name (`ok`/`fn`)
|
|
72
72
|
response: { ok: boolean; _data?: unknown };
|
|
73
73
|
}) {
|
|
74
74
|
if (response.ok && response_function) {
|