ui: Change the URL prefix of partitions from `-` to `_` (#11801)

This commit is contained in:
John Cowen 2021-12-13 15:39:56 +00:00 committed by GitHub
parent 56525615ec
commit ca04a62702
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 3 deletions

3
.changelog/11801.txt Normal file
View File

@ -0,0 +1,3 @@
```release-note:enhancement
ui: Change partition URL segment prefix from `-` to `_`
```

View File

@ -1,7 +1,7 @@
import { env } from 'consul-ui/env'; import { env } from 'consul-ui/env';
const OPTIONAL = {}; const OPTIONAL = {};
if (env('CONSUL_PARTITIONS_ENABLED')) { if (env('CONSUL_PARTITIONS_ENABLED')) {
OPTIONAL.partition = /^-([a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?)$/; OPTIONAL.partition = /^_([a-zA-Z0-9]([a-zA-Z0-9-]{0,62}[a-zA-Z0-9])?)$/;
} }
if (env('CONSUL_NSPACES_ENABLED')) { if (env('CONSUL_NSPACES_ENABLED')) {
@ -194,7 +194,7 @@ export default class FSMWithOptionalLocation {
hash.nspace = `~${hash.nspace}`; hash.nspace = `~${hash.nspace}`;
} }
if (typeof hash.partition !== 'undefined') { if (typeof hash.partition !== 'undefined') {
hash.partition = `-${hash.partition}`; hash.partition = `_${hash.partition}`;
} }
if (typeof this.router === 'undefined') { if (typeof this.router === 'undefined') {
this.router = this.container.lookup('router:main'); this.router = this.container.lookup('router:main');

View File

@ -18,7 +18,7 @@ export default class UiConfigService extends Service {
case item.startsWith('~'): case item.startsWith('~'):
prev.nspace = item.substr(1); prev.nspace = item.substr(1);
break; break;
case item.startsWith('-'): case item.startsWith('_'):
prev.partition = item.substr(1); prev.partition = item.substr(1);
break; break;
case typeof prev.dc === 'undefined': case typeof prev.dc === 'undefined':