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: convert to angle bracket invocation #8075

Merged
merged 9 commits into from
Jun 1, 2020
2 changes: 1 addition & 1 deletion ui/app/components/fs/breadcrumbs.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export default Component.extend({
'data-test-fs-breadcrumbs': true,

allocation: null,
task: null,
taskState: null,
path: null,

breadcrumbs: computed('path', function() {
Expand Down
6 changes: 3 additions & 3 deletions ui/app/components/fs/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ export default Component.extend({
}
}),

task: computed('model', function() {
taskState: computed('model', function() {
if (this.model.allocation) {
return this.model;
}
}),

type: computed('task', function() {
if (this.task) {
type: computed('taskState', function() {
if (this.taskState) {
return 'task';
} else {
return 'allocation';
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/fs/directory-entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default Component.extend({
tagName: '',

allocation: null,
task: null,
taskState: null,

pathToEntry: computed('path', 'entry.Name', function() {
const pathWithNoLeadingSlash = this.get('path').replace(/^\//, '');
Expand Down
10 changes: 5 additions & 5 deletions ui/app/components/fs/file.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export default Component.extend({
'data-test-file-viewer': true,

allocation: null,
task: null,
taskState: null,
file: null,
stat: null, // { Name, IsDir, Size, FileMode, ModTime, ContentType }

Expand Down Expand Up @@ -48,8 +48,8 @@ export default Component.extend({
isStreamable: equal('fileComponent', 'stream'),
isStreaming: false,

catUrl: computed('allocation.id', 'task.name', 'file', function() {
const taskUrlPrefix = this.task ? `${this.task.name}/` : '';
catUrl: computed('allocation.id', 'taskState.name', 'file', function() {
const taskUrlPrefix = this.taskState ? `${this.taskState.name}/` : '';
const encodedPath = encodeURIComponent(`${taskUrlPrefix}${this.file}`);
return `/v1/client/fs/cat/${this.allocation.id}?path=${encodedPath}`;
}),
Expand Down Expand Up @@ -78,9 +78,9 @@ export default Component.extend({
}
),

fileParams: computed('task.name', 'file', 'mode', function() {
fileParams: computed('taskState.name', 'file', 'mode', function() {
// The Log class handles encoding query params
const taskUrlPrefix = this.task ? `${this.task.name}/` : '';
const taskUrlPrefix = this.taskState ? `${this.taskState.name}/` : '';
const path = `${taskUrlPrefix}${this.file}`;

switch (this.mode) {
Expand Down
2 changes: 1 addition & 1 deletion ui/app/components/fs/link.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export default Component.extend({
tagName: '',

allocation: null,
task: null,
taskState: null,
});
2 changes: 1 addition & 1 deletion ui/app/controllers/allocations/allocation/task/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default Controller.extend({
sortDescending: false,

path: null,
task: null,
taskState: null,
directoryEntries: null,
isFile: null,
stat: null,
Expand Down
20 changes: 10 additions & 10 deletions ui/app/routes/allocations/allocation/task/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ import notifyError from 'nomad-ui/utils/notify-error';
export default Route.extend({
model({ path = '/' }) {
const decodedPath = decodeURIComponent(path);
const task = this.modelFor('allocations.allocation.task');
const allocation = task.allocation;
const taskState = this.modelFor('allocations.allocation.task');
const allocation = taskState.allocation;

const pathWithTaskName = `${task.name}${decodedPath.startsWith('/') ? '' : '/'}${decodedPath}`;
const pathWithTaskName = `${taskState.name}${decodedPath.startsWith('/') ? '' : '/'}${decodedPath}`;

if (!task.isRunning) {
if (!taskState.isRunning) {
return {
path: decodedPath,
task,
taskState,
};
}

return RSVP.all([allocation.stat(pathWithTaskName), task.get('allocation.node')])
return RSVP.all([allocation.stat(pathWithTaskName), taskState.get('allocation.node')])
.then(([statJson]) => {
if (statJson.IsDir) {
return RSVP.hash({
path: decodedPath,
task,
taskState,
directoryEntries: allocation.ls(pathWithTaskName).catch(notifyError(this)),
isFile: false,
});
} else {
return {
path: decodedPath,
task,
taskState,
isFile: true,
stat: statJson,
};
Expand All @@ -38,8 +38,8 @@ export default Route.extend({
.catch(notifyError(this));
},

setupController(controller, { path, task, directoryEntries, isFile, stat } = {}) {
setupController(controller, { path, taskState, directoryEntries, isFile, stat } = {}) {
this._super(...arguments);
controller.setProperties({ path, task, directoryEntries, isFile, stat });
controller.setProperties({ path, taskState, directoryEntries, isFile, stat });
},
});
4 changes: 2 additions & 2 deletions ui/app/templates/allocations.hbs
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{{#page-layout}}
<PageLayout>
{{outlet}}
{{/page-layout}}
</PageLayout>
18 changes: 9 additions & 9 deletions ui/app/templates/allocations/allocation/fs.hbs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{title pathWithLeadingSlash " - Allocation " allocation.shortId " filesystem"}}
{{allocation-subnav allocation=allocation}}
{{fs/browser
model=allocation
path=path
stat=stat
isFile=isFile
directoryEntries=directoryEntries
sortProperty=sortProperty
sortDescending=sortDescending}}
<AllocationSubnav @allocation={{allocation}} />
<Fs::Browser
@model={{allocation}}
@path={{path}}
@stat={{stat}}
@isFile={{isFile}}
@directoryEntries={{directoryEntries}}
@sortProperty={{sortProperty}}
@sortDescending={{sortDescending}} />
Loading