Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI: Use the same prefix pattern for both the region switcher and the namespace switcher #9876

Merged
merged 2 commits into from
Jan 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions ui/app/styles/components/dropdown.scss
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@
.ember-power-select-selected-item,
.dropdown-item {
text-overflow: ellipsis;
overflow: hidden;
white-space: nowrap;
}

Expand Down
7 changes: 2 additions & 5 deletions ui/app/templates/components/gutter-menu.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 1 addition & 2 deletions ui/tests/acceptance/job-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 6 additions & 2 deletions ui/tests/acceptance/namespaces-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
);

Expand All @@ -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}`
);
});
});

Expand Down