File tree Expand file tree Collapse file tree 6 files changed +26
-30
lines changed Expand file tree Collapse file tree 6 files changed +26
-30
lines changed Original file line number Diff line number Diff line change 99 transition =" slide-x-reverse-transition"
1010 max-width =" 200px"
1111 height =" 20px"
12+ timeout =" 10000"
1213 >
1314 <v-row dense class =" flex-nowrap" >
1415 <v-col cols =" auto" >
Original file line number Diff line number Diff line change 4040 "version" : " 0.0.0-semantically-released" ,
4141 "main" : " ./nuxt.config.js" ,
4242 "dependencies" : {
43- "@geode/opengeodeweb-back" : " 5.0 .0" ,
43+ "@geode/opengeodeweb-back" : " 5.1 .0" ,
4444 "@geode/opengeodeweb-viewer" : " 0.2.0" ,
4545 "@kitware/vtk.js" : " 30.3.1" ,
4646 "@mdi/font" : " ^7.4.47" ,
Original file line number Diff line number Diff line change @@ -32,32 +32,39 @@ export const use_geode_store = defineStore("geode", {
3232 }
3333 return geode_url
3434 } ,
35- is_busy ( state ) {
36- return state . request_counter > 0
35+ is_busy ( ) {
36+ return this . request_counter > 0
3737 } ,
3838 } ,
3939 actions : {
4040 ping_task ( ) {
41- setInterval ( ( ) => this . do_ping ( ) , 10 * 1000 )
41+ setInterval ( ( ) => {
42+ if ( this . is_running ) {
43+ this . do_ping ( )
44+ }
45+ } , 10 * 1000 )
4246 } ,
4347 async do_ping ( ) {
4448 const feedback_store = use_feedback_store ( )
45- await api_fetch (
46- { schema : back_schemas . opengeodeweb_back . ping , params : { } } ,
47- {
48- request_error_function : async ( ) => {
49+ return new Promise ( ( resolve , reject ) => {
50+ useFetch ( back_schemas . opengeodeweb_back . ping . $id , {
51+ baseURL : this . base_url ,
52+ method : back_schemas . opengeodeweb_back . ping . methods [ 0 ] ,
53+ async onRequestError ( ) {
4954 await feedback_store . $patch ( { server_error : true } )
5055 this . is_running = false
56+ reject ( )
5157 } ,
52- response_function : async ( ) => {
53- this . is_running = true
58+ async onResponse ( ) {
59+ resolve ( )
5460 } ,
55- response_error_function : async ( ) => {
61+ async onResponseError ( ) {
5662 await feedback_store . $patch ( { server_error : true } )
5763 this . is_running = false
64+ reject ( )
5865 } ,
59- } ,
60- )
66+ } )
67+ } )
6168 } ,
6269 start_request ( ) {
6370 this . request_counter ++
Original file line number Diff line number Diff line change @@ -43,21 +43,11 @@ export const use_infra_store = defineStore("infra", {
4343 } ,
4444 actions : {
4545 async create_connexion ( ) {
46- const geode_store = use_geode_store ( )
4746 if ( this . is_connexion_launched ) {
4847 return
4948 }
5049 this . is_connexion_launched = true
51- if ( [ "" , null ] . includes ( this . ID ) || typeof this . ID === "undefined" ) {
52- return this . create_backend ( )
53- } else {
54- try {
55- await geode_store . do_ping ( )
56- return geode_store . ping_task ( )
57- } catch ( e ) {
58- return this . create_backend ( )
59- }
60- }
50+ return this . create_backend ( )
6151 } ,
6252 async create_backend ( ) {
6353 const geode_store = use_geode_store ( )
Original file line number Diff line number Diff line change @@ -40,8 +40,8 @@ export const use_viewer_store = defineStore("viewer", {
4040 viewer_url += "/ws"
4141 return viewer_url
4242 } ,
43- is_busy ( state ) {
44- return state . request_counter > 0
43+ is_busy ( ) {
44+ return this . request_counter > 0
4545 } ,
4646 } ,
4747 actions : {
Original file line number Diff line number Diff line change @@ -99,20 +99,18 @@ describe("Geode Store", () => {
9999 describe ( "do_ping" , ( ) => {
100100 test ( "request_error" , async ( ) => {
101101 geode_store . base_url = ""
102- geode_store . is_running = true
103102 try {
104103 await geode_store . do_ping ( )
105104 } catch ( e ) {
106- console . log ( e )
105+ console . log ( "e" , e )
107106 }
108-
109107 expect ( geode_store . is_running ) . toBe ( false )
110108 expect ( feedback_store . server_error ) . toBe ( true )
111- expect ( feedback_store . feedbacks . length ) . toBe ( 1 )
112109 } )
113110
114111 test ( "response" , async ( ) => {
115112 geode_store . base_url = ""
113+ geode_store . is_running = true
116114 registerEndpoint ( back_schemas . opengeodeweb_back . ping . $id , {
117115 method : "POST" ,
118116 handler : ( ) => ( { } ) ,
You can’t perform that action at this time.
0 commit comments