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 ui: Search/filtering 'Filtered by:' search status (#9442) 2021-01-25 18:13:54 +00:00
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 ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
app-view ui: Fixup prettier for scss files and run (#10296) 2021-05-27 13:23:54 +01:00
aria-menu ui: Adds CRD popover 'informed action' for intentions managed by CRDs (#10100) 2021-05-04 17:21:54 +01:00
auth-dialog ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
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 ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
badge ui: %horizontal-kv-list CSS component (and related) (#10285) 2021-06-21 11:40:14 +01:00
brand-loader ui: Loader amends/improvements (#10181) 2021-05-07 12:23:29 +01:00
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 ui: Add a README to the new Certificate component (#9908) 2021-03-23 09:22:09 -04:00
checkbox-group ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
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 ui: Search/filtering 'Filtered by:' search status (#9442) 2021-01-25 18:13:54 +00:00
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 ui: Fix text search for upstream instances (#10151) 2021-05-04 17:25:57 +01:00
data-form ui: Change URI helper to a template based approach (#9344) 2020-12-09 09:22:46 +00:00
data-loader ui: Restrict the viewing/editing of certain UI elements based on the users ACLs (#9687) 2021-02-19 16:42:16 +00:00
data-sink ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
data-source ui: Remove storybook, add docfy (#9831) 2021-03-08 12:22:01 +00:00
data-writer
debug/navigation ui: Remove storybook, add docfy (#9831) 2021-03-08 12:22:01 +00:00
definition-table ui: Fixup definition-table + copy-button margin (#10512) 2021-07-06 16:57:20 +01:00
delete-confirmation
display-toggle ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
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 ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
event-source ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
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 ui: Move linting to the node:test script (#9385) 2020-12-14 15:28:35 +00:00
form-elements ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
form-group ui: [BUGFIX] Replace all replaceAll with split.join for older browsers without replaceAll (#9715) 2021-02-11 09:49:39 +00:00
freetext-filter ui: [BUGFIX] Replace all replaceAll with split.join for older browsers without replaceAll (#9715) 2021-02-11 09:49:39 +00:00
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 ui: Adds CRD popover 'informed action' for intentions managed by CRDs (#10100) 2021-05-04 17:21:54 +01:00
inline-alert ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
inline-code ui: Add information regarding Host header for ingress gateways (#10050) 2021-04-22 12:16:56 +01:00
jwt-source ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
list-collection ui: Adds ability to show a 'partial' list in list-collections (#10174) 2021-05-07 16:54:45 +01:00
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 ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
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 ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
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 ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
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 ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
policy-selector ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
popover-menu ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
popover-select ui: Colocate remaining CSS components to the app/components folder (#10328) 2021-06-23 09:19:35 +01:00
power-select ui: Initial Intention Permission Integration and acceptance testing (#9003) 2020-10-23 17:26:06 +01:00
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 ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
role-form ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
role-selector ui: Move control of login modal to use JS rather than HTML (label/id) (#9883) 2021-04-06 13:40:40 +01:00
route ui: Support Route optional parameters/segments (#10212) 2021-05-26 17:43:46 +01:00
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 ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
state ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
state-chart ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
tab-nav ui: change coloring of secondary navigation elements (#10259) 2021-05-24 11:51:16 +01:00
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 ui: Colocate old base components into our app/component folder (#10275) 2021-05-26 15:08:57 +01:00
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