Skip to content

Commit 60c5805

Browse files
Merge branch 'next' into feat/opengeodeweb-viewer
2 parents 9e29943 + 97db804 commit 60c5805

File tree

2 files changed

+58
-54
lines changed

2 files changed

+58
-54
lines changed

components/Recaptcha.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<ClientOnly>
33
<vue-recaptcha
44
ref="recaptcha"
5-
sitekey="6Lce72wgAAAAAOXrHyDxRQBhk6NDTD80MrXOlgbC"
5+
:sitekey="site_key"
66
:load-recaptcha-script="true"
77
align-self="center"
88
@expired="is_captcha_validated = false"

stores/viewer.js

Lines changed: 57 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
11
import _ from "lodash"
22
import vtkWSLinkClient from "@kitware/vtk.js/IO/Core/WSLinkClient"
3-
import SmartConnect from "wslink/src/SmartConnect"
43
import "@kitware/vtk.js/Rendering/OpenGL/Profiles/Geometry"
54
import { connectImageStream } from "@kitware/vtk.js/Rendering/Misc/RemoteView"
65
import schemas from "@geode/opengeodeweb-viewer/schemas.json"
76

8-
vtkWSLinkClient.setSmartConnectClass(SmartConnect)
9-
107
export const use_viewer_store = defineStore("viewer", {
118
state: () => ({
129
client: {},
@@ -42,64 +39,71 @@ export const use_viewer_store = defineStore("viewer", {
4239
this.picked_point.y = world_y
4340
this.picking_mode = false
4441
},
45-
ws_connect() {
46-
if (process.env.NODE_ENV != "test") {
47-
const config = { application: "Viewer" }
48-
config.sessionURL = this.base_url
42+
async ws_connect() {
43+
if (process.env.NODE_ENV == "test") {
44+
return
45+
}
46+
const SmartConnect = await import("wslink/src/SmartConnect")
47+
vtkWSLinkClient.setSmartConnectClass(SmartConnect)
4948

50-
const { client } = this
51-
if (this.is_running && client.isConnected()) {
52-
client.disconnect(-1)
53-
this.is_running = false
54-
}
55-
let clientToConnect = client
56-
if (_.isEmpty(clientToConnect)) {
57-
clientToConnect = vtkWSLinkClient.newInstance()
58-
}
49+
const config = { application: "Viewer" }
50+
config.sessionURL = this.base_url
5951

60-
// Connect to busy store
61-
clientToConnect.onBusyChange((count) => {
62-
this.buzy = count
63-
})
64-
clientToConnect.beginBusy()
52+
const { client } = this
53+
if (this.is_running && client.isConnected()) {
54+
client.disconnect(-1)
55+
this.is_running = false
56+
}
57+
let clientToConnect = client
58+
if (_.isEmpty(clientToConnect)) {
59+
clientToConnect = vtkWSLinkClient.newInstance()
60+
}
6561

66-
// Error
67-
clientToConnect.onConnectionError((httpReq) => {
68-
const message =
69-
(httpReq && httpReq.response && httpReq.response.error) ||
70-
`Connection error`
71-
console.error(message)
72-
})
62+
// Connect to busy store
63+
clientToConnect.onBusyChange((count) => {
64+
this.buzy = count
65+
})
66+
clientToConnect.beginBusy()
7367

74-
// Close
75-
clientToConnect.onConnectionClose((httpReq) => {
76-
const message =
77-
(httpReq && httpReq.response && httpReq.response.error) ||
78-
`Connection close`
79-
console.error(message)
80-
})
68+
// Error
69+
clientToConnect.onConnectionError((httpReq) => {
70+
const message =
71+
(httpReq && httpReq.response && httpReq.response.error) ||
72+
`Connection error`
73+
console.error(message)
74+
})
75+
76+
// Close
77+
clientToConnect.onConnectionClose((httpReq) => {
78+
const message =
79+
(httpReq && httpReq.response && httpReq.response.error) ||
80+
`Connection close`
81+
console.error(message)
82+
})
8183

82-
// Connect
83-
clientToConnect
84-
.connect(config)
85-
.then((validClient) => {
86-
connectImageStream(validClient.getConnection().getSession())
87-
this.client = validClient
88-
clientToConnect.endBusy()
84+
// Connect
85+
const { connectImageStream } = await import(
86+
"@kitware/vtk.js/Rendering/Misc/RemoteView"
87+
)
88+
clientToConnect
89+
.connect(config)
90+
.then((validClient) => {
91+
connectImageStream(validClient.getConnection().getSession())
92+
this.client = validClient
93+
clientToConnect.endBusy()
8994

90-
// Now that the client is ready let's setup the server for us
91-
viewer_call({
92-
schema: schemas.opengeodeweb_viewer.create_visualization,
93-
})
94-
viewer_call({
95-
schema: schemas.opengeodeweb_viewer.reset,
96-
})
97-
this.is_running = true
95+
// Now that the client is ready let's setup the server for us
96+
viewer_call({
97+
schema: schemas.opengeodeweb_viewer.create_visualization,
9898
})
99-
.catch((error) => {
100-
console.error(error)
99+
viewer_call({
100+
schema: schemas.opengeodeweb_viewer.reset,
101101
})
102-
}
102+
this.is_running = true
103+
})
104+
.catch((error) => {
105+
console.error(error)
106+
})
103107
},
104108
start_request() {
105109
this.request_counter++

0 commit comments

Comments
 (0)