Add page titles to filesystem routes (#6024)

This commit is contained in:
Buck Doyle 2019-08-01 11:17:46 -05:00 committed by GitHub
parent 9f3754b46b
commit 88b708f188
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 21 additions and 0 deletions

View File

@ -20,6 +20,16 @@ export default Controller.extend({
directories: filterBy('directoryEntries', 'IsDir'),
files: filterBy('directoryEntries', 'IsDir', false),
pathWithLeadingSlash: computed('path', function() {
const path = this.path;
if (path.startsWith('/')) {
return path;
} else {
return `/${path}`;
}
}),
sortedDirectoryEntries: computed(
'directoryEntries.[]',
'sortProperty',

View File

@ -1,3 +1,4 @@
{{title pathWithLeadingSlash " - Task " task.name " filesystem"}}
{{task-subnav task=task}}
<section class="section is-closer">
{{#if task.isRunning}}

View File

@ -49,12 +49,22 @@ module('Acceptance | task fs', function(hooks) {
const paths = ['some-file.log', 'a/deep/path/to/a/file.log', '/', 'Unicode™®'];
const testPath = async filePath => {
let pathWithLeadingSlash = filePath;
if (!pathWithLeadingSlash.startsWith('/')) {
pathWithLeadingSlash = `/${filePath}`;
}
await FS.visitPath({ id: allocation.id, name: task.name, path: filePath });
assert.equal(
currentURL(),
`/allocations/${allocation.id}/${task.name}/fs/${encodeURIComponent(filePath)}`,
'No redirect'
);
assert.equal(
document.title,
`${pathWithLeadingSlash} - Task ${task.name} filesystem - Nomad`
);
assert.equal(FS.breadcrumbsText, `${task.name} ${filePath.replace(/\//g, ' ')}`.trim());
};