Skip to content

Commit

Permalink
Change name for task state FS model component
Browse files Browse the repository at this point in the history
This fixes errors such as these:
https://app.circleci.com/pipelines/github/hashicorp/nomad/9595/workflows/69183c14-c50d-4076-a1f7-da5a36fb8b24/jobs/71633/tests

It seems that there’s now a shadowing situation where {{task}}
is being interpreted as an Ember Concurrency helper…? Since
this is actually a task state anyway, easier to just rename it.
  • Loading branch information
backspace committed May 29, 2020
1 parent def33f5 commit 2078c2a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
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 @@ -12,7 +12,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,30 +5,30 @@ 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 taskState = this.modelFor('allocations.allocation.task');

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

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

return RSVP.all([task.stat(pathWithTaskName), task.get('allocation.node')])
return RSVP.all([taskState.stat(pathWithTaskStateName), taskState.get('allocation.node')])
.then(([statJson]) => {
if (statJson.IsDir) {
return RSVP.hash({
path: decodedPath,
task,
directoryEntries: task.ls(pathWithTaskName).catch(notifyError(this)),
taskState,
directoryEntries: taskState.ls(pathWithTaskStateName).catch(notifyError(this)),
isFile: false,
});
} else {
return {
path: decodedPath,
task,
taskState,
isFile: true,
stat: statJson,
};
Expand All @@ -37,8 +37,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 });
},
});
14 changes: 7 additions & 7 deletions ui/app/templates/allocations/allocation/task/fs.hbs
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
{{title pathWithLeadingSlash " - Task " task.name " filesystem"}}
<TaskSubnav @task={{task}} />
{{title pathWithLeadingSlash " - Task " taskState.name " filesystem"}}
<TaskSubnav @task={{taskState}} />
<section class="section is-closer {{if isFile "full-width-section"}}">
{{#if task.isRunning}}
{{#if taskState.isRunning}}
{{#if isFile}}
<TaskFile @allocation={{task.allocation}} @task={{task}} @file={{path}} @stat={{stat}} @class="fs-explorer">
<FsBreadcrumbs @task={{task}} @path={{path}} />
<TaskFile @allocation={{taskState.allocation}} @task={{taskState}} @file={{path}} @stat={{stat}} @class="fs-explorer">
<FsBreadcrumbs @task={{taskState}} @path={{path}} />
</TaskFile>
{{else}}
<div class="fs-explorer boxed-section">
<div class="boxed-section-head">
<FsBreadcrumbs @task={{task}} @path={{path}} />
<FsBreadcrumbs @task={{taskState}} @path={{path}} />
</div>
{{#if directoryEntries}}
<ListTable
Expand All @@ -23,7 +23,7 @@
<t.sort-by @prop="ModTime" @class="has-text-right">Last Modified</t.sort-by>
</t.head>
<t.body as |row|>
<FsDirectoryEntry @path={{path}} @task={{task}} @entry={{row.model}} />
<FsDirectoryEntry @path={{path}} @task={{taskState}} @entry={{row.model}} />
</t.body>
</ListTable>
{{else}}
Expand Down

0 comments on commit 2078c2a

Please sign in to comment.