@@ -43,63 +43,63 @@ export const use_viewer_store = defineStore("viewer", {
4343 this . picking_mode = false
4444 } ,
4545 ws_connect ( ) {
46- const config = { application : "Viewer" }
47- config . sessionURL = this . base_url
46+ if ( process . env . NODE_ENV != "test" ) {
47+ const config = { application : "Viewer" }
48+ config . sessionURL = this . base_url
4849
49- const { client } = this
50- if ( this . is_running && client . isConnected ( ) ) {
51- client . disconnect ( - 1 )
52- this . is_running = false
53- }
54- let clientToConnect = client
55- if ( _ . isEmpty ( clientToConnect ) ) {
56- clientToConnect = vtkWSLinkClient . newInstance ( )
57- }
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+ }
5859
59- // Connect to busy store
60- clientToConnect . onBusyChange ( ( count ) => {
61- this . buzy = count
62- } )
63- clientToConnect . beginBusy ( )
60+ // Connect to busy store
61+ clientToConnect . onBusyChange ( ( count ) => {
62+ this . buzy = count
63+ } )
64+ clientToConnect . beginBusy ( )
6465
65- // Error
66- clientToConnect . onConnectionError ( ( httpReq ) => {
67- const message =
68- ( httpReq && httpReq . response && httpReq . response . error ) ||
69- `Connection error`
70- console . error ( message )
71- console . log ( httpReq )
72- } )
66+ // Error
67+ clientToConnect . onConnectionError ( ( httpReq ) => {
68+ const message =
69+ ( httpReq && httpReq . response && httpReq . response . error ) ||
70+ `Connection error`
71+ console . error ( message )
72+ } )
7373
74- // Close
75- clientToConnect . onConnectionClose ( ( httpReq ) => {
76- const message =
77- ( httpReq && httpReq . response && httpReq . response . error ) ||
78- `Connection close`
79- console . error ( message )
80- console . log ( httpReq )
81- } )
74+ // Close
75+ clientToConnect . onConnectionClose ( ( httpReq ) => {
76+ const message =
77+ ( httpReq && httpReq . response && httpReq . response . error ) ||
78+ `Connection close`
79+ console . error ( message )
80+ } )
8281
83- // Connect
84- clientToConnect
85- . connect ( config )
86- . then ( ( validClient ) => {
87- connectImageStream ( validClient . getConnection ( ) . getSession ( ) )
88- this . client = validClient
89- clientToConnect . endBusy ( )
82+ // Connect
83+ clientToConnect
84+ . connect ( config )
85+ . then ( ( validClient ) => {
86+ connectImageStream ( validClient . getConnection ( ) . getSession ( ) )
87+ this . client = validClient
88+ clientToConnect . endBusy ( )
9089
91- // Now that the client is ready let's setup the server for us
92- viewer_call ( {
93- schema : schemas . opengeodeweb_viewer . create_visualization ,
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
9498 } )
95- viewer_call ( {
96- schema : schemas . opengeodeweb_viewer . reset ,
99+ . catch ( ( error ) => {
100+ console . error ( error )
97101 } )
98- this . is_running = true
99- } )
100- . catch ( ( error ) => {
101- console . error ( error )
102- } )
102+ }
103103 } ,
104104 start_request ( ) {
105105 this . request_counter ++
0 commit comments