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

add titles to breadcrumbs #11687

Merged
merged 6 commits into from
Dec 17, 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
13 changes: 12 additions & 1 deletion ui/app/components/breadcrumbs/default.hbs
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
<li data-test-breadcrumb-default>
<LinkTo @params={{@crumb.args}} data-test-breadcrumb={{@crumb.args.firstObject}}>
{{@crumb.label}}
{{#if @crumb.title}}
<dl>
<dt>
{{@crumb.title}}
</dt>
<dd>
{{@crumb.label}}
</dd>
</dl>
{{else}}
{{@crumb.label}}
{{/if}}
</LinkTo>
</li>
18 changes: 16 additions & 2 deletions ui/app/components/breadcrumbs/job.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,14 @@
@query={{hash namespace=(or trigger.data.result.namespace.name "default")}}
data-test-breadcrumb={{"jobs.job.index"}}
>
{{trigger.data.result.trimmedName}}
<dl>
<dt>
Parent Job
</dt>
<dd>
{{trigger.data.result.trimmedName}}
</dd>
</dl>
</LinkTo>
</li>
{{/if}}
Expand All @@ -28,7 +35,14 @@
data-test-breadcrumb={{"jobs.job.index"}}
data-test-job-breadcrumb
>
{{this.job.trimmedName}}
<dl>
<dt>
{{if this.job.hasChildren "Parent Job" "Job"}}
</dt>
<dd>
{{this.job.trimmedName}}
</dd>
</dl>
</LinkTo>
</li>
{{/if}}
Expand Down
2 changes: 2 additions & 0 deletions ui/app/controllers/allocations/allocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,12 @@ export default class AllocationsAllocationController extends Controller {
{ label: 'Jobs', args: ['jobs.index', jobQueryParams] },
{ type: 'job', job: job },
{
title: 'Task Group',
label: allocation.taskGroupName,
args: ['jobs.job.task-group', job.plainId, allocation.taskGroupName, jobQueryParams],
},
{
title: 'Allocation',
label: allocation.shortId,
args: ['allocations.allocation', allocation],
},
Expand Down
1 change: 1 addition & 0 deletions ui/app/controllers/allocations/allocation/task.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default class AllocationsAllocationTaskController extends Controller {
if (!model) return [];
return [
{
title: 'Task',
label: model.get('name'),
args: ['allocations.allocation.task', model.get('allocation'), model],
},
Expand Down
1 change: 1 addition & 0 deletions ui/app/controllers/clients/client.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export default class ClientsClientController extends Controller {
if (!model) return [];
return [
{
title: 'Client',
label: model.get('shortId'),
args: ['clients.client', model.get('id')],
},
Expand Down
1 change: 1 addition & 0 deletions ui/app/controllers/jobs/job/task-group.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export default class TaskGroupController extends Controller.extend(
if (!model) return [];
return [
{
title: 'Task Group',
label: model.get('name'),
args: [
'jobs.job.task-group',
Expand Down
1 change: 1 addition & 0 deletions ui/app/controllers/servers/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ export default class ServersServerController extends Controller {

get breadcrumb() {
return {
title: 'Server',
label: this.server.name,
args: ['servers.server', this.server.id],
};
Expand Down
17 changes: 17 additions & 0 deletions ui/app/styles/core/breadcrumb.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,24 @@
}
}

ul {
align-items: center;
}

li::before {
font-size: x-large;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes causes a small move in the file explorer breadcrumb. We could limit this to .breadcrumb.is-large elements

ezgif com-gif-maker(1)

}

li.is-active a {
opacity: 1;
}

dl dd {
margin: -4px 0px;
font-size: medium;
}

dl dt {
font-size: small;
}
}
1 change: 1 addition & 0 deletions ui/app/styles/core/navbar.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
.navbar {
display: flex;
align-items: center;

&.is-primary {
background: linear-gradient(to right, $nomad-green-darker, $nomad-green-dark);
Expand Down
4 changes: 2 additions & 2 deletions ui/tests/acceptance/client-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ module('Acceptance | client detail', function(hooks) {
);
assert.equal(
Layout.breadcrumbFor('clients.client').text,
node.id.split('-')[0],
'Second breadcrumb says the node short id'
`Client ${node.id.split('-')[0]}`,
'Second breadcrumb is a titled breadcrumb saying the node short id'
);
await Layout.breadcrumbFor('clients.index').visit();
assert.equal(currentURL(), '/clients', 'First breadcrumb links back to clients');
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/client-monitor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ module('Acceptance | client monitor', function(hooks) {
await ClientMonitor.visit({ id: node.id });

assert.equal(Layout.breadcrumbFor('clients.index').text, 'Clients');
assert.equal(Layout.breadcrumbFor('clients.client').text, node.id.split('-')[0]);
assert.equal(Layout.breadcrumbFor('clients.client').text, `Client ${node.id.split('-')[0]}`);

await Layout.breadcrumbFor('clients.index').visit();
assert.equal(currentURL(), '/clients');
Expand Down
2 changes: 1 addition & 1 deletion ui/tests/acceptance/server-monitor-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ module('Acceptance | server monitor', function(hooks) {
'Servers',
'The page should read the breadcrumb Servers'
);
assert.equal(Layout.breadcrumbFor('servers.server').text, agent.name);
assert.equal(Layout.breadcrumbFor('servers.server').text, `Server ${agent.name}`);

await Layout.breadcrumbFor('servers.index').visit();
assert.equal(currentURL(), '/servers');
Expand Down
8 changes: 4 additions & 4 deletions ui/tests/acceptance/task-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,22 +62,22 @@ module('Acceptance | task detail', function(hooks) {
await waitFor('[data-test-job-breadcrumb]');
assert.equal(
Layout.breadcrumbFor('jobs.job.index').text,
job.name,
`Job ${job.name}`,
'Job is the second breadcrumb'
);
assert.equal(
Layout.breadcrumbFor('jobs.job.task-group').text,
taskGroup,
`Task Group ${taskGroup}`,
'Task Group is the third breadcrumb'
);
assert.equal(
Layout.breadcrumbFor('allocations.allocation').text,
shortId,
`Allocation ${shortId}`,
'Allocation short id is the fourth breadcrumb'
);
assert.equal(
Layout.breadcrumbFor('allocations.allocation.task').text,
task.name,
`Task ${task.name}`,
'Task name is the fifth breadcrumb'
);

Expand Down
4 changes: 2 additions & 2 deletions ui/tests/acceptance/task-group-detail-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,12 @@ module('Acceptance | task group detail', function(hooks) {
assert.equal(Layout.breadcrumbFor('jobs.index').text, 'Jobs', 'First breadcrumb says jobs');
assert.equal(
Layout.breadcrumbFor('jobs.job.index').text,
job.name,
`Job ${job.name}`,
'Second breadcrumb says the job name'
);
assert.equal(
Layout.breadcrumbFor('jobs.job.task-group').text,
taskGroup.name,
`Task Group ${taskGroup.name}`,
'Third breadcrumb says the job name'
);
});
Expand Down