open-consul/ui/packages/consul-ui/app/services
John Cowen d93d9d4e39
ui: Don't default to the default namespace, use the token default namespace instead (#10503)
The default namespace, and the tokens default namespace (or its origin namespace) is slightly more complicated than other things we deal with in the UI, there's plenty of info/docs on this that I've added in this PR.

Previously:

When a namespace was not specified in the URL, we used to default to the default namespace. When you logged in using a token we automatically forward you the namespace URL that your token originates from, so you are then using the namespace for your token by default. You can of course then edit the URL to remove the namespace portion, or perhaps revisit the UI at the root path with you token already set. In these latter cases we would show you information from the default namespace. So if you had no namespace segment/portion in the URL, we would assume default, perform actions against the default namespace and highlight the default namespace in the namespace selector menu. If you wanted to perform actions in your tokens origin namespace you would have to manually select it from the namespace selector menu.

This PR:

Now, when you have no namespace segment/portion in the URL, we use the token's origin namespace instead (and if you don't have a token, we then use the default namespace like it was previously)

Notes/thoughts:

I originally thought we were showing an incorrectly selected namespace in the namespace selector, but it also matched up with what we were doing with the API, so it was in fact correct. The issue was more that we weren't selecting the origin namespace of the token for the user when a namespace segment was omitted from the URL. Seeing as we automatically forward you to the tokens origin namespace when you log in, and we were correctly showing the namespace we were acting on when you had no namespace segment in the URL (in the previous case default), I'm not entirely sure how much of an issue this actually was.

This characteristic of namespace+token+namespace is a little weird and its easy to miss a subtlety or two so I tried to add some documentation in here for future me/someone else (including some in depth code comment around one of the API endpoints where this is very subtle and very hard to miss). I'm not the greatest at words, so would be great to get some edits there if it doesn't seem clear to folks.

The fact that we used to save your previous datacenter and namespace into local storage for reasons also meant the interaction here was slightly more complicated than it needed to be, so whilst we were here we rejigged things slightly to satisfy said reasons still but not use local storage (we try and grab the info from higher up). A lot of the related code here is from before we had our Routlets which I think could probably make all of this a lot less complicated, but I didn't want to do a wholesale replacement in this PR, we can save that for a separate PR on its own at some point.
2021-07-07 11:46:41 +01:00
..
client ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
clipboard ui: CopyButton amends (#10511) 2021-07-06 16:56:36 +01:00
code-mirror ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
data-sink ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
data-source ui: DataSource Decorator (#9746) 2021-02-23 08:56:42 +00:00
repository ui: Don't default to the default namespace, use the token default namespace instead (#10503) 2021-07-07 11:46:41 +01:00
atob.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
btoa.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
change.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
container.js ui: DataSource Decorator (#9746) 2021-02-23 08:56:42 +00:00
data-structs.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
dom.js ui: Sidebar navigation / redesign (#9553) 2021-01-26 17:40:33 +00:00
encoder.js ui: Change URI helper to a template based approach (#9344) 2020-12-09 09:22:46 +00:00
env.js ui: Support Route optional parameters/segments (#10212) 2021-05-26 17:43:46 +01:00
env.mdx ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
feedback.js ui: Topology intention saving improvements (#9513) 2021-01-19 15:40:39 +00:00
filter.js ui: Auth Methods List view (#9617) 2021-02-17 13:56:56 -05:00
form.js ui: Remove unnecessay reopens from sort and form services (#9146) 2020-11-10 14:36:27 +00:00
logger.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
repository.js ui: DataSource Decorator (#9746) 2021-02-23 08:56:42 +00:00
routlet.js ui: Support Route optional parameters/segments (#10212) 2021-05-26 17:43:46 +01:00
schema.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
search.js ui: Auth Methods List view (#9617) 2021-02-17 13:56:56 -05:00
settings.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
sort.js ui: Auth Methods List view (#9617) 2021-02-17 13:56:56 -05:00
state.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
store.js ui: Restrict the viewing/editing of certain UI elements based on the users ACLs (#9687) 2021-02-19 16:42:16 +00:00
temporal.js ui: Adds human formatting to nanosecond based session durations (#10062) 2021-04-28 12:12:56 +01:00
ticker.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
timeout.js ui: Run Ember native class code mod (#9093) 2020-11-09 09:25:35 +00:00
ui-config.js ui: Dev/Test environment configurable metrics (#9345) 2020-12-15 15:34:54 +00:00