open-consul/ui/packages/consul-ui/app/components
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
..
action
anchors ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
anonymous
app ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
app-error
app-view ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
aria-menu
auth-dialog
auth-form ui: Don't default to the default namespace, use the token default namespace instead (#10503) 2021-07-07 11:46:41 +01:00
auth-modal ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
auth-profile
badge ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
brand-loader
breadcrumbs ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
buttons ui: CopyButton amends (#10511) 2021-07-06 16:56:36 +01:00
card ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
certificate
checkbox-group
child-selector ui: Don't default to the default namespace, use the token default namespace instead (#10503) 2021-07-07 11:46:41 +01:00
code-editor ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
collapsible-notices ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
composite-row ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
confirmation-alert
confirmation-dialog ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
consul ui: Rename icons for consistency and remove unused icons (#10311) 2021-06-22 18:56:17 +01:00
copy-button ui: CopyButton amends (#10511) 2021-07-06 16:56:36 +01:00
csv-list ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
data-collection
data-form
data-loader
data-sink
data-source
data-writer
debug/navigation
definition-table ui: Fixup definition-table + copy-button margin (#10512) 2021-07-06 16:57:20 +01:00
delete-confirmation
display-toggle
dom-recycling-table ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
empty-state ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
error-state
event-source
expanded-single-select ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
filter-bar ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
flash-message ui: Rename icons for consistency and remove unused icons (#10311) 2021-06-22 18:56:17 +01:00
form-component
form-elements ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
form-group
freetext-filter
hashicorp-consul ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
horizontal-kv-list ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
icon-definition ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
informed-action
inline-alert ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
inline-code
jwt-source
list-collection
list-row ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
main-header-horizontal ui: Increase z-index of main menus to avoid layering issues (#10428) 2021-06-22 14:19:13 +01:00
main-nav-horizontal
main-nav-vertical ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
menu-panel ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
modal-dialog ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
modal-layer
more-popover-menu ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
notice ui: Rename icons for consistency and remove unused icons (#10311) 2021-06-22 18:56:17 +01:00
notification
oidc-select ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
outlet
overlay ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
pill ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
policy-form
policy-selector
popover-menu
popover-select ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
power-select
progress ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
radio-card ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
radio-group ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
ref
role-form
role-selector
route
search-bar ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
secret-button ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
skip-links ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
sliding-toggle
state
state-chart
tab-nav
table ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
tabular-collection ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
tabular-details ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
tabular-dl ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
tag-list ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
toggle-button
token-list
token-source ui: Don't default to the default namespace, use the token default namespace instead (#10503) 2021-07-07 11:46:41 +01:00
tooltip ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
tooltip-panel ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
topology-metrics ui: Rename icons for consistency and remove unused icons (#10311) 2021-06-22 18:56:17 +01:00