Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the missing "startup_service" parameter from config.js #120

Closed
theduckylittle opened this issue Mar 29, 2016 · 15 comments
Closed

Fix the missing "startup_service" parameter from config.js #120

theduckylittle opened this issue Mar 29, 2016 · 15 comments
Assignees
Milestone

Comments

@theduckylittle
Copy link
Member

From @brentfraser :

Specifying a startup service in the mapbook or in config.js doesn't seem to work. And I can't find any place in the code where startup_service is referenced.

So I added a few lines to main.js (at line 73):
/* --- new: --- */
if(GeoMOOSE.isDefined(CONFIGURATION['startup_service'])) {
var service_name = CONFIGURATION['startup_service'];
GeoMOOSE.startService(service_name, params, true);
}

@theduckylittle theduckylittle self-assigned this Mar 29, 2016
@theduckylittle theduckylittle added this to the 2.9 milestone Mar 29, 2016
theduckylittle pushed a commit to geomoose/geomoose-js that referenced this issue Mar 29, 2016
@tchaddad
Copy link
Contributor

tchaddad commented Apr 6, 2016

Can someone provide a hint as to how to test this correctly?

I tried to use the example method in the Docs explained here:
http://docs.geomoose.org/2.8/howto/startup.html

But that didn't seem to work, and I'm wondering if I missed a config setting in the Mapbook?

Tested with 97b9ce2 and ?call=search_parcels&qstring=Jackson as URL params, and with
<param name="startup_service">true</param> in the Mapbook.

@brentfraser
Copy link

It was my understanding that its is possible to name the startup service in the mapbook section (http://docs.geomoose.org/2.8/docs/configuration.html#configuration):

my_startup_service

or in the config.js file:
'startup_service' : 'my_startup_service',

but neither of these work (since there is no code to handle them).

The "call=" in the URL does work, although I don't know why the example given in the doc doesn't work.

@elil
Copy link
Member

elil commented Apr 6, 2016

Based on those docs and mapbook.xml line 371, 393 and 405, I would think the url would be ?call=search_parcels&value0=Jackson&value1=130060002080. Not sure if you need &value1=130060002080

@tchaddad
Copy link
Contributor

tchaddad commented Apr 6, 2016

Eli, you are correct that I was missing that there was a second user input, and also that I didn't catch that I should specify the field name using value0. However, at least for me the URL pathway is still not working with: ?call=search_parcels&value0=Jackson&value1=0.

These 2 values do produce results via the form, so I think there is something else preventing the service from starting. Do I need to add anything to the <service> block itself?

@theduckylittle
Copy link
Member Author

Hey folks this should be reviewable now, I found a few different issues:

  1. I added a semaphore to test of "startup_service" has been called. If it was then "call=" would be ignored. That semaphore was not being set properly.
  2. The URL parser was including the hash-tag in with the parameter value. That's been fixed as well.

@theduckylittle
Copy link
Member Author

I'm marking this as closeable if someone disagrees, update and remove the flag. I'll leave this open for a few more days.

@tchaddad
Copy link
Contributor

I'll test here in a little bit...

@tchaddad
Copy link
Contributor

OK - I just did a little testing with 97b9ce2 & geomoose/geomoose-js@8ff516d and I'm seeing a little progress, but still not quite sure if this is working as expected:

  • with <param name="startup_service">false</param> in the MapBook, startup query by URL works on the demo with ?call=search_parcels&value0=Jackson&value1=0.
  • with <param name="startup_service">true</param> startup query by URL is disabled (which is expected), but nothing else seems activated or different

This second bullet is where I'm confused - is there anything else that is intended to happen when <param name="startup_service">true</param>?? What should I be testing there, and is there any other change in the MapBook needed to successfully test?

@theduckylittle
Copy link
Member Author

startup_service should not be a boolean but the name of a service. Realistically, it should be either undefined or the name of a service not true or false.

@tchaddad
Copy link
Contributor

tchaddad commented Apr 14, 2016

So tested with <param name="startup_service">search_parcels</param> and with this setting URL test with ?call=search_parcels&value0=Jackson&value1=0 does work.

Is that all that is expected? or is there another non-URL test that should happen?

@brentfraser
Copy link

Interesting. There are 3 separate ways of calling a startup service: config.js, mapbook, and URL. Should there be a priority if all 3 are used (which would not be the normal case)? BTW, in the past, I've just used the mapbook method to execute a service, which executes some PHP to send some GeoMOOSE API calls.

@theduckylittle
Copy link
Member Author

Brent, the URL overrides the Mapbook which overrides the Config settings.

@brentfraser
Copy link

That makes sense. We will have to document that.

@brentfraser
Copy link

brentfraser commented May 16, 2016

Hmm; a couple of problems with the code in trunk.

  1. Config.js needs a string value.

Currently as shipped, the value in config.js is boolean:
'startup_service' : false,
so when I add an entry to the mapbook:
<param name="startup_service">on_startup</param>
Application.js (around line 247) simply sets the value to 'true', which is not good. The solution is ship config.js with:
'startup_service' : 'put your startup service name or in the mapbook',
or something similar.

  1. If a startup service is set in config.js or the mapbook, the call parameter in the URL will not be executed.
    Currently main.js (around line 81) has:
     if(GeoMOOSE.isDefined(params.call) && !startup_service_called) {
            var service_name = params.call;

The startup_service_called variable is set just previously if already set. So we need to either change the code (this would be best), or document the priority.

theduckylittle pushed a commit to geomoose/geomoose-js that referenced this issue May 18, 2016
@theduckylittle
Copy link
Member Author

I fixed the ordering so that call overrides startup_service. It should be noted, however, that users are not supposed to be modifying config.js. That's what the mapbook <param..> convention is meant to do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants