Add page titles to filesystem routes (#6024)
This commit is contained in:
parent
9f3754b46b
commit
88b708f188
|
@ -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',
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
{{title pathWithLeadingSlash " - Task " task.name " filesystem"}}
|
||||
{{task-subnav task=task}}
|
||||
<section class="section is-closer">
|
||||
{{#if task.isRunning}}
|
||||
|
|
|
@ -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());
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue