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

Location Picker: Set default to system location, otherwise set to worldwide zoom level #3047

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jimtng
Copy link
Contributor

@jimtng jimtng commented Jan 30, 2025

Resolve #2999

…ldwide zoom level

Signed-off-by: Jimmy Tanagra <jcode@tanagra.id.au>
@jimtng jimtng marked this pull request as draft January 30, 2025 04:41
@jimtng
Copy link
Contributor Author

jimtng commented Jan 30, 2025

Waiting for feedback

Copy link

relativeci bot commented Jan 30, 2025

#2758 Bundle Size — 10.98MiB (~+0.01%).

6ba1d65(current) vs 95844d2 main#2743(baseline)

Warning

Bundle contains 2 duplicate packages – View duplicate packages

Bundle metrics  Change 1 change
                 Current
#2758
     Baseline
#2743
No change  Initial JS 1.9MiB 1.9MiB
No change  Initial CSS 577.21KiB 577.21KiB
Change  Cache Invalidation 17.39% 17.51%
No change  Chunks 227 227
No change  Assets 250 250
No change  Modules 2952 2952
No change  Duplicate Modules 154 154
No change  Duplicate Code 1.8% 1.8%
No change  Packages 98 98
No change  Duplicate Packages 2 2
Bundle size by type  Change 7 changes Regression 7 regressions
                 Current
#2758
     Baseline
#2743
Regression  JS 9.19MiB (+100%) undefined
Regression  CSS 867.33KiB (+100%) undefined
Regression  Fonts 526.1KiB (+100%) undefined
Regression  Media 295.6KiB (+100%) undefined
Regression  IMG 140.74KiB (+100%) undefined
Regression  HTML 1.38KiB (+100%) undefined
Regression  Other 871B (+100%) undefined

Bundle analysis reportBranch jimtng:map-default-location-zoomProject dashboard


Generated by RelativeCIDocumentationReport issue

@jimtng jimtng marked this pull request as ready for review January 31, 2025 00:23
@jimtng
Copy link
Contributor Author

jimtng commented Jan 31, 2025

this is now ready

@ghys
Copy link
Member

ghys commented Feb 1, 2025

Just to make you aware, because the location picker is potentially user-facing and /rest/services is only for admins, you can have 403 errors when you do call that from this widget.

@jimtng
Copy link
Contributor Author

jimtng commented Feb 2, 2025

because the location picker is potentially user-facing and /rest/services is only for admins, you can have 403 errors when you do call that from this widget.

Thanks, I wasn't aware of that! I'm struggling to find where/how to create a user-facing page that would invoke the location picker. As far as I can see, the location picker (popup) is only called by parameter-location, which in turn is used by config-parameter, all of these are (currently) admin-only stuff.

In the event that it ever gets used in user-facing, wouldn't the 403 error be hidden in the javascript console, and not visible to user? In which case, they'd simply get a worldwide view, instead of the current mostly-Europe-only view.

A possible fallback from this is to query the location from the browser, but it would trigger a permission prompt. Perhaps we can add that later when the need arises.

@ghys
Copy link
Member

ghys commented Feb 2, 2025

In the event that it ever gets used in user-facing, wouldn't the 403 error be hidden in the javascript console, and not visible to user? In which case, they'd simply get a worldwide view, instead of the current mostly-Europe-only view.

Yes I suppose, but in general it shouldn't be "let's try something and fall back if it fails?"

@jimtng
Copy link
Contributor Author

jimtng commented Feb 2, 2025

I can add an isAdmin check before calling the REST, but this creates a "hard coded logic", assuming that this rest call is always going to be admin-only. Whilst the risk is small, if one day this particular endpoint is opened up to non-admin (e.g. for read-only access), then we'd have multiple places to update.

Your call - I can add an isAdmin here check if you prefer.

@jimtng
Copy link
Contributor Author

jimtng commented Feb 2, 2025

Alternatively I can just catch the exception and fail silently, or log a message telling them that beause they're not admin, the system location cannot be retrieved.

@florian-h05 florian-h05 added enhancement New feature or request main ui Main UI labels Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request main ui Main UI
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[MainUI] Map picker should center on location set in regional settings
3 participants