diff --git a/.changelog/10212.txt b/.changelog/10212.txt
new file mode 100644
index 000000000000..c4e2fb674542
--- /dev/null
+++ b/.changelog/10212.txt
@@ -0,0 +1,3 @@
+```release-note:improvement
+ui: Add 'optional route segments' and move namespaces to use them
+```
diff --git a/ui/.gitignore b/ui/.gitignore
index 98f2e8b08059..08df27ddb9e6 100644
--- a/ui/.gitignore
+++ b/ui/.gitignore
@@ -21,10 +21,6 @@ npm-debug.log*
testem.log
yarn-error.log
-# storybook
-storybook-static
-**/.storybook/*.html
-
# ember-try
.node_modules.ember-try
bower.json.ember-try
diff --git a/ui/packages/consul-ui/app/abilities/nspace.js b/ui/packages/consul-ui/app/abilities/nspace.js
index 8d2e400d8176..0dc1a233f8e8 100644
--- a/ui/packages/consul-ui/app/abilities/nspace.js
+++ b/ui/packages/consul-ui/app/abilities/nspace.js
@@ -16,6 +16,10 @@ export default class NspaceAbility extends BaseAbility {
}
get canChoose() {
- return this.env.var('CONSUL_NSPACES_ENABLED') && this.nspaces.length > 0;
+ return this.canUse && this.nspaces.length > 0;
+ }
+
+ get canUse() {
+ return this.env.var('CONSUL_NSPACES_ENABLED');
}
}
diff --git a/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs b/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs
index 8ed0ff618b02..8ce4b213e55e 100644
--- a/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs
+++ b/ui/packages/consul-ui/app/components/consul/upstream/list/index.hbs
@@ -24,15 +24,22 @@ as |item index|>
- {{#if (and (env 'CONSUL_NSPACES_ENABLED') (not-eq item.Namespace @nspace))}}
-
+{{#if (and (can 'use nspaces') (not-eq item.Namespace @nspace))}}
+
{{item.Name}}
- {{else}}
+{{else}}
{{item.Name}}
- {{/if}}
+{{/if}}
{{else}}
{{item.Name}}
diff --git a/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs b/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs
index d69f37a1e9ff..0adc50e1b747 100644
--- a/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs
+++ b/ui/packages/consul-ui/app/components/hashicorp-consul/index.hbs
@@ -36,7 +36,7 @@