open-consul/ui/packages/consul-ui/app/components
John Cowen d4d6466665
ui: Make it hard to not URLEncode DataSource srcs/URIs (#11117)
Our DataSource came in very iteratively, when we first started using it we specifically tried not to use it for things that would require portions of the @src="" attribute to be URL encoded (so things like service names couldn't be used, but dc etc would be fine). We then gradually added an easy way to url encode the @src="" attributes with a uri helper and began to use the DataSource component more and more. This meant that some DataSource usage continued to be used without our uri helper.

Recently we hit #10901 which was a direct result of us not encoding @src values/URIs (I didn't realise this was one of the places that required URL encoding) and not going back over things to finish things off once we had implemented our uri helper, resulting in ~half of the codebase using it and ~half of it not.

Now that almost all of the UI uses our DataSource component, this PR makes it even harder to not use the uri helper, by wrapping the string that it requires in a private URI class/object, that is then expected/asserted within the DataSource component/service. This means that as a result of this PR you cannot pass a plain string to the DataSource component without seeing an error in your JS console, which in turn means you have to use the uri helper, and it's very very hard to not URL encode any dynamic/user provided values, which otherwise could lead to bugs/errors similar to the one mentioned above.

The error that you see when you don't use the uri helper is currently a 'soft' dev time only error, but like our other functionality that produces a soft error when you mistakenly pass an undefined value to a uri, at some point soon we will make these hard failing "do not do this" errors.

Both of these 'soft error' DX features have been used this to great effect to implement our Admin Partition feature and these kind of things will minimize the amount of these types of bugs moving forwards in a preventative rather than curative manner. Hopefully these are the some of the kinds of things that get added to our codebase that prevent a multitude of problems and therefore are often never noticed/appreciated.

Additionally here we moved the remaining non-uri using DataSources to use uri (that were now super easy to find), and also fixed up a place where I noticed (due to the soft errors) where we were sometimes passing undefined values to a uri call.

The work here also led me to find another couple of non-important 'bugs' that I've PRed already separately, one of which is yet to be merged (#11105), hence the currently failing tests here. I'll rebase that once that PR is in and the tests here should then pass 🤞

Lastly, I didn't go the whole hog here to make DataSink also be this strict with its uri usage, there is a tiny bit more work on DataSink as a result of recently work, so I may (or may not) make DataSink equally as strict as part of that work in a separate PR.
2021-09-30 15:54:46 +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 ui: Notice component (#9011) 2020-10-23 09:26:32 +01:00
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: Show the correct 'ACLs Disabled' page when ACLs are disabled (#10604) 2021-07-14 18:52:13 +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: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +01:00
auth-form ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +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: Add partition parameter when clearing child-selector forms in ACLs (#11106) 2021-09-22 18:36:09 +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: Add copy button for Secret ID in Tokens list page (#10735) 2021-07-30 13:52:37 -04: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: Don't show the CRD menu for read-only intentions (#11149) 2021-09-27 17:19:32 +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: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
data-form ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
data-loader ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
data-sink ui: Improves UI engineering docs (#9875) 2021-03-17 15:58:17 +00:00
data-source ui: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +01: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: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +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: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +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: Add socket icon for UDS (#10573) 2021-07-12 09:28:01 -04: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: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
menu-panel ui: Add an isDestroyed check for the MenuPanel component (#11104) 2021-09-22 18:33:31 +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: Add Vault as a Service External Source (#10769) 2021-08-04 18:22:43 -04:00
policy-form ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
policy-selector ui: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +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: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
role-selector ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00
route ui: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +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: Make it hard to not URLEncode DataSource srcs/URIs (#11117) 2021-09-30 15:54:46 +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: Partitions Application Layer (#11017) 2021-09-15 19:50:11 +01:00