@geode/opengeodeweb-front 10.4.0-rc.1 → 10.4.0-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -34,27 +34,32 @@ export const useDataStore = defineStore("data", () => {
34
34
 
35
35
  async function formatedMeshComponents(id) {
36
36
  const items = await database.model_components.where({ id }).toArray()
37
- const distinctTypes = [...new Set(items.map((item) => item.type))]
38
-
39
- const formated_mesh_components = await Promise.all(
40
- distinctTypes.map(async (type) => {
41
- const meshComponents = await database.model_components
42
- .where({ id, type })
43
- .toArray()
44
-
45
- return {
46
- id: type,
47
- title: type,
48
- children: meshComponents.map((meshComponent) => ({
49
- id: meshComponent.geode_id,
50
- title: meshComponent.name,
51
- category: meshComponent.type,
52
- })),
53
- }
54
- }),
55
- )
37
+ const componentTitles = {
38
+ Corner: "Corners",
39
+ Line: "Lines",
40
+ Surface: "Surfaces",
41
+ Block: "Blocks",
42
+ }
56
43
 
57
- return formated_mesh_components
44
+ const componentsByType = items.reduce((accumulator, item) => {
45
+ if (componentTitles[item.type]) {
46
+ if (!accumulator[item.type]) accumulator[item.type] = []
47
+ accumulator[item.type].push(item)
48
+ }
49
+ return accumulator
50
+ }, {})
51
+
52
+ return Object.keys(componentTitles)
53
+ .filter((type) => componentsByType[type])
54
+ .map((type) => ({
55
+ id: type,
56
+ title: componentTitles[type],
57
+ children: componentsByType[type].map((meshComponent) => ({
58
+ id: meshComponent.geode_id,
59
+ title: meshComponent.name,
60
+ category: meshComponent.type,
61
+ })),
62
+ }))
58
63
  }
59
64
 
60
65
  async function meshComponentType(id, geode_id) {
@@ -109,15 +114,22 @@ export const useDataStore = defineStore("data", () => {
109
114
  await database.model_components.where({ id }).delete()
110
115
  }
111
116
 
112
- async function fetchMeshComponents(id) {
117
+ async function fetchModelComponents(id) {
113
118
  const geodeStore = useGeodeStore()
114
119
  return await geodeStore.request(
115
- back_model_schemas.mesh_components,
120
+ back_model_schemas.model_components,
116
121
  { id },
117
122
  {
118
123
  response_function: async (response) => {
119
- const { mesh_components } = response
120
- await addModelComponents(mesh_components)
124
+ const allComponents = [
125
+ ...response.mesh_components.map(
126
+ ({ boundaries, internals, ...component }) => component,
127
+ ),
128
+ ...response.collection_components.map(
129
+ ({ items, ...component }) => component,
130
+ ),
131
+ ].map((component) => ({ ...component, id }))
132
+ await addModelComponents(allComponents)
121
133
  },
122
134
  },
123
135
  )
@@ -178,7 +190,7 @@ export const useDataStore = defineStore("data", () => {
178
190
  addItem,
179
191
  deleteItem,
180
192
  updateItem,
181
- fetchMeshComponents,
193
+ fetchModelComponents,
182
194
  getCornersGeodeIds,
183
195
  getLinesGeodeIds,
184
196
  getSurfacesGeodeIds,
@@ -50,7 +50,7 @@ async function importItem(item) {
50
50
  await dataStyleStore.addDataStyle(item.id, item.geode_object_type)
51
51
 
52
52
  if (item.viewer_type === "model") {
53
- await dataStore.fetchMeshComponents(item.id)
53
+ await dataStore.fetchModelComponents(item.id)
54
54
  }
55
55
 
56
56
  await dataStyleStore.applyDefaultStyle(item.id)
@@ -3,6 +3,7 @@ import child_process from "node:child_process"
3
3
  import fs from "node:fs"
4
4
  import path from "node:path"
5
5
  import { setTimeout } from "timers/promises"
6
+ import { rimraf } from "rimraf"
6
7
 
7
8
  // Third party imports
8
9
  import { WebSocket } from "ws"
@@ -182,7 +183,7 @@ async function delete_folder_recursive(data_folder_path) {
182
183
  for (let i = 0; i <= MAX_DELETE_FOLDER_RETRIES; i += 1) {
183
184
  try {
184
185
  console.log(`Deleting folder: ${data_folder_path}`)
185
- fs.rmSync(data_folder_path, { recursive: true, force: true })
186
+ await rimraf(data_folder_path)
186
187
  console.log(`Deleted folder: ${data_folder_path}`)
187
188
  return
188
189
  } catch (error) {
@@ -190,6 +191,7 @@ async function delete_folder_recursive(data_folder_path) {
190
191
  // Wait before retrying
191
192
  const DELAY = 1000 * (i + 1)
192
193
  await setTimeout(DELAY)
194
+ console.log("Retrying delete folder")
193
195
  }
194
196
  }
195
197
  }
@@ -209,52 +211,52 @@ function kill_back(back_port) {
209
211
  }
210
212
  }
211
213
  return pTimeout(do_kill(), {
212
- milliseconds: 500,
214
+ milliseconds: 5000,
213
215
  message: "Failed to kill back",
214
216
  })
215
217
  }
216
218
 
217
219
  function kill_viewer(viewer_port) {
218
- async function do_kill() {
219
- const socket = new WebSocket(`ws://localhost:${viewer_port}/ws`)
220
- try {
221
- await once(socket, "open")
222
- console.log("Connected to WebSocket server")
223
- socket.send(
224
- JSON.stringify({
225
- id: "system:hello",
226
- method: "wslink.hello",
227
- args: [{ secret: "wslink-secret" }],
228
- }),
229
- )
230
-
231
- for await (const [data] of on(socket, "message")) {
220
+ function do_kill() {
221
+ return new Promise((resolve) => {
222
+ const socket = new WebSocket("ws://localhost:" + viewer_port + "/ws")
223
+ socket.on("open", () => {
224
+ console.log("Connected to WebSocket server")
225
+ socket.send(
226
+ JSON.stringify({
227
+ id: "system:hello",
228
+ method: "wslink.hello",
229
+ args: [{ secret: "wslink-secret" }],
230
+ }),
231
+ )
232
+ })
233
+ socket.on("message", (data) => {
232
234
  const message = data.toString()
233
235
  console.log("Received from server:", message)
234
-
235
236
  if (message.includes("hello")) {
236
237
  socket.send(
237
238
  JSON.stringify({
238
- id: viewer_schemas.opengeodeweb_viewer.kill.$id,
239
- method: viewer_schemas.opengeodeweb_viewer.kill.$id,
239
+ id: "application.exit",
240
+ method: "application.exit",
240
241
  }),
241
242
  )
242
- break
243
+ socket.close()
244
+ resolve()
243
245
  }
244
- }
245
- await once(socket, "close")
246
- console.log("Disconnected from WebSocket server")
247
- } catch (error) {
248
- console.error("WebSocket error:", error)
249
- } finally {
250
- if (socket.readyState === WebSocket.OPEN) {
246
+ })
247
+ socket.on("close", () => {
248
+ console.log("Disconnected from WebSocket server")
249
+ resolve()
250
+ })
251
+ socket.on("error", (error) => {
252
+ console.error("WebSocket error:", error)
251
253
  socket.close()
252
- }
253
- }
254
+ resolve()
255
+ })
256
+ })
254
257
  }
255
-
256
258
  return pTimeout(do_kill(), {
257
- milliseconds: 500,
259
+ milliseconds: 5000,
258
260
  message: "Failed to kill viewer",
259
261
  })
260
262
  }
@@ -1,4 +1,4 @@
1
1
  export const modelComponentsTable = {
2
2
  name: "model_components",
3
- schema: "[id+geode_id], [id+type], viewer_id, type, name, created_at",
3
+ schema: "[id+geode_id], [id+type], viewer_id, name",
4
4
  }
package/package.json CHANGED
@@ -1,9 +1,26 @@
1
1
  {
2
2
  "name": "@geode/opengeodeweb-front",
3
+ "version": "10.4.0-rc.3",
3
4
  "description": "OpenSource Vue/Nuxt/Pinia/Vuetify framework for web applications",
5
+ "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
6
+ "bugs": {
7
+ "url": "https://github.com/Geode-solutions/OpenGeodeWeb-Front/issues"
8
+ },
9
+ "license": "MIT",
10
+ "author": {
11
+ "name": "Geode-solutions",
12
+ "email": "contact@geode-solutions.com",
13
+ "url": "https://geode-solutions.com/"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/Geode-solutions/OpenGeodeWeb-Front.git"
18
+ },
4
19
  "type": "module",
5
- "version": "10.4.0-rc.1",
6
20
  "main": "./nuxt.config.js",
21
+ "publishConfig": {
22
+ "access": "public"
23
+ },
7
24
  "scripts": {
8
25
  "lint": "eslint --fix --ext .js,.vue --ignore-path .gitignore .",
9
26
  "test": "npm run test:unit",
@@ -31,7 +48,8 @@
31
48
  "nuxt": "4.2.2",
32
49
  "p-timeout": "7.0.1",
33
50
  "pinia": "3.0.4",
34
- "rxjs": "^7.8.2",
51
+ "rimraf": "6.1.3",
52
+ "rxjs": "7.8.2",
35
53
  "sass": "1.87.0",
36
54
  "semver": "7.7.1",
37
55
  "uuid": "11.1.0",
@@ -70,22 +88,5 @@
70
88
  },
71
89
  "overrides": {
72
90
  "vue": "latest"
73
- },
74
- "repository": {
75
- "type": "git",
76
- "url": "git+https://github.com/Geode-solutions/OpenGeodeWeb-Front.git"
77
- },
78
- "author": {
79
- "name": "Geode-solutions",
80
- "email": "contact@geode-solutions.com",
81
- "url": "https://geode-solutions.com/"
82
- },
83
- "license": "MIT",
84
- "bugs": {
85
- "url": "https://github.com/Geode-solutions/OpenGeodeWeb-Front/issues"
86
- },
87
- "homepage": "https://github.com/Geode-solutions/OpenGeodeWeb-Front",
88
- "publishConfig": {
89
- "access": "public"
90
91
  }
91
92
  }
@@ -5,4 +5,4 @@
5
5
  # pip-compile --output-file=tests/integration/microservices/back/requirements.txt tests/integration/microservices/back/requirements.in
6
6
  #
7
7
 
8
- opengeodeweb-back==6.*,>=6.1.3
8
+ opengeodeweb-back==6.*,>=6.2.0rc2
@@ -5,4 +5,4 @@
5
5
  # pip-compile --output-file=tests/integration/microservices/viewer/requirements.txt tests/integration/microservices/viewer/requirements.in
6
6
  #
7
7
 
8
- opengeodeweb-viewer==1.*,>=1.15.3
8
+ opengeodeweb-viewer==1.*,>=1.15.4rc1