TerriaJS / terriajs

A library for building rich, web-based geospatial data platforms.
https://terria.io
Apache License 2.0
1.14k stars 355 forks source link

Adding service that requires authentication causes repeating modals #1782

Open stevage opened 7 years ago

stevage commented 7 years ago

Try adding https://services.slip.wa.gov.au/arcgis/services/WAN_Restricted_Services/WAN_Restricted_Services/MapServer/WMSServer in the new UI, then cancel because you don't have credentials.

Result: the password box pops up 5 times in a row, then the conversion service is proposed.

chloeleichen commented 7 years ago

what should it do? modal appears once and then conversion?

kring commented 7 years ago

This is a tricky one. The way the "auto" option works when you add your own data is it tries to create each type of catalog item and loads it, until something works. Each catalog item we try accesses the URL in its own way. When the user hits cancel, that just causes the request to fail. So presumably @stevage you would like it to give up entirely when the user presses cancel, without trying all the other types of catalog items. In order to do that, we'd need to detect that sort of failure and then reject the load promise in a special way that says "not only did this fail, but everything else will fail too, so abandon all hope."

stevage commented 7 years ago

Yeah, I think that's what it should do. Not especially difficult I think, if the catalog items can throw a "UnauthorizedError" or something. Maybe even more general, like "NoAccessError".

kring commented 7 years ago

Yes, but be careful. An "unauthorized" response when trying to access something directly as a file does not necessarily mean it's unauthorized when accessing it as a WMS, for example.