Merge pull request #9876 from hashicorp/b-ui/default-namespace-casing

UI: Use the same prefix pattern for both the region switcher and the namespace switcher
This commit is contained in:
Michael Lange 2021-01-22 13:43:54 -08:00 committed by GitHub
commit 5243428343
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 9 deletions

View file

@ -122,6 +122,7 @@
.ember-power-select-selected-item,
.dropdown-item {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

View file

@ -36,12 +36,9 @@
@onChange={{action this.gotoJobsForNamespace}}
@tagName="div"
@class="namespace-switcher"
title={{this.system.activeNamespace.name}}
as |namespace|>
{{#if (eq namespace.name "default")}}
Default Namespace
{{else}}
{{namespace.name}}
{{/if}}
<span class="ember-power-select-prefix">Namespace: </span>{{namespace.name}}
</PowerSelect>
</div>
</li>

View file

@ -130,12 +130,11 @@ module('Acceptance | job detail (with namespaces)', function(hooks) {
test('when switching namespaces, the app redirects to /jobs with the new namespace', async function(assert) {
const namespace = server.db.namespaces.find(job.namespaceId);
const otherNamespace = server.db.namespaces.toArray().find(ns => ns !== namespace).name;
const label = otherNamespace === 'default' ? 'Default Namespace' : otherNamespace;
await JobDetail.visit({ id: job.id, namespace: namespace.name });
// TODO: Migrate to Page Objects
await selectChoose('[data-test-namespace-switcher]', label);
await selectChoose('[data-test-namespace-switcher]', otherNamespace);
assert.equal(currentURL().split('?')[0], '/jobs', 'Navigated to /jobs');
const jobs = server.db.jobs

View file

@ -69,7 +69,7 @@ module('Acceptance | namespaces (enabled)', function(hooks) {
);
assert.equal(
JobsList.namespaceSwitcher.options.objectAt(0).label,
'Default Namespace',
'Namespace: default',
'The first namespace is always the default one'
);
@ -79,7 +79,11 @@ module('Acceptance | namespaces (enabled)', function(hooks) {
if (index === 0) return;
const namespace = sortedNamespaces[index - 1];
assert.equal(option.label, namespace.name, `index ${index}: ${namespace.name}`);
assert.equal(
option.label,
`Namespace: ${namespace.name}`,
`index ${index}: ${namespace.name}`
);
});
});