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 page titles to filesystem routes #6024

Merged
merged 1 commit into from
Aug 1, 2019
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
10 changes: 10 additions & 0 deletions ui/app/controllers/allocations/allocation/task/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

We might also want to check that it doesn't start with [A-Z]:\ too? Not sure how the FS api works on windows tho tbh

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm good question, thanks. Is there some cloud-y deployment of Nomad I can use? Or maybe I can set it up locally in a virtual machine 😯

Copy link
Contributor

Choose a reason for hiding this comment

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

A local vm is probably your best bet right now 😞

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I finally managed it. It looks like \s are abstracted away:

image

I was able to query server\empty.txt and get the same response. So maybe I don’t have to care about \s 🤔

Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

}
}),

sortedDirectoryEntries: computed(
'directoryEntries.[]',
'sortProperty',
Expand Down
1 change: 1 addition & 0 deletions ui/app/templates/allocations/allocation/task/fs.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{{title pathWithLeadingSlash " - Task " task.name " filesystem"}}
{{task-subnav task=task}}
<section class="section is-closer">
{{#if task.isRunning}}
Expand Down
10 changes: 10 additions & 0 deletions ui/tests/acceptance/task-fs-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
};

Expand Down