diff --git a/ui/app/controllers/allocations/allocation.js b/ui/app/controllers/allocations/allocation.js index 5a764f2a6..1ee88420b 100644 --- a/ui/app/controllers/allocations/allocation.js +++ b/ui/app/controllers/allocations/allocation.js @@ -1,17 +1,5 @@ import Ember from 'ember'; -import Sortable from 'nomad-ui/mixins/sortable'; -const { Controller, computed } = Ember; +const { Controller } = Ember; -export default Controller.extend(Sortable, { - queryParams: { - sortProperty: 'sort', - sortDescending: 'desc', - }, - - sortProperty: 'name', - sortDescending: false, - - listToSort: computed.alias('model.states'), - sortedStates: computed.alias('listSorted'), -}); +export default Controller.extend({}); diff --git a/ui/app/controllers/allocations/allocation/index.js b/ui/app/controllers/allocations/allocation/index.js new file mode 100644 index 000000000..5a764f2a6 --- /dev/null +++ b/ui/app/controllers/allocations/allocation/index.js @@ -0,0 +1,17 @@ +import Ember from 'ember'; +import Sortable from 'nomad-ui/mixins/sortable'; + +const { Controller, computed } = Ember; + +export default Controller.extend(Sortable, { + queryParams: { + sortProperty: 'sort', + sortDescending: 'desc', + }, + + sortProperty: 'name', + sortDescending: false, + + listToSort: computed.alias('model.states'), + sortedStates: computed.alias('listSorted'), +}); diff --git a/ui/app/router.js b/ui/app/router.js index 367e311e2..bddf8813d 100644 --- a/ui/app/router.js +++ b/ui/app/router.js @@ -25,7 +25,11 @@ Router.map(function() { }); this.route('allocations', function() { - this.route('allocation', { path: '/:allocation_id' }); + this.route('allocation', { path: '/:allocation_id' }, function() { + this.route('task', { path: '/:name' }, function() { + this.route('logs'); + }); + }); }); this.route('settings', function() { diff --git a/ui/app/routes/allocations/allocation/task.js b/ui/app/routes/allocations/allocation/task.js new file mode 100644 index 000000000..4a57f1ad2 --- /dev/null +++ b/ui/app/routes/allocations/allocation/task.js @@ -0,0 +1,22 @@ +import Ember from 'ember'; + +const { Route, inject, Error: EmberError } = Ember; + +export default Route.extend({ + store: inject.service(), + + model({ name }) { + const allocation = this.modelFor('allocations.allocation'); + if (allocation) { + const task = allocation.get('states').findBy('name', name); + + if (task) { + return task; + } + + const err = new EmberError(`Task ${name} not found for allocation ${allocation.get('id')}`); + err.code = '404'; + this.controllerFor('application').set('error', err); + } + }, +}); diff --git a/ui/app/templates/allocations.hbs b/ui/app/templates/allocations.hbs index ce0bdbbe5..8fab3547f 100644 --- a/ui/app/templates/allocations.hbs +++ b/ui/app/templates/allocations.hbs @@ -1,8 +1,3 @@
- {{#global-header class="page-header"}} - Allocations - {{/global-header}} - {{#gutter-menu class="page-body"}} - {{outlet}} - {{/gutter-menu}} + {{outlet}}
diff --git a/ui/app/templates/allocations/allocation.hbs b/ui/app/templates/allocations/allocation.hbs index 5d9a53790..c24cd6895 100644 --- a/ui/app/templates/allocations/allocation.hbs +++ b/ui/app/templates/allocations/allocation.hbs @@ -1,91 +1 @@ -
-

Allocation {{model.name}}

-

- For job {{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id)}}{{model.job.name}}{{/link-to}} - on client {{#link-to "clients.client" model.node}}{{model.node.shortId}}{{/link-to}} -

- -
-
- Tasks -
- {{#list-table - source=sortedStates - sortProperty=sortProperty - sortDescending=sortDescending - class="is-striped tasks" as |t|}} - {{#t.head}} - {{#t.sort-by prop="name"}}Name{{/t.sort-by}} - {{#t.sort-by prop="state"}}State{{/t.sort-by}} - Last Event - {{#t.sort-by prop="events.lastObject.time"}}Time{{/t.sort-by}} - Addresses - {{/t.head}} - {{#t.body as |row|}} - - {{row.model.task.name}} - {{row.model.state}} - - {{#if row.model.events.lastObject.displayMessage}} - {{row.model.events.lastObject.displayMessage}} - {{else}} - No message - {{/if}} - - {{moment-format row.model.events.lastObject.time "MM/DD/YY HH:mm:ss [UTC]"}} - - - - - {{/t.body}} - {{/list-table}} -
- - {{#each model.states as |state|}} -
-
- {{state.task.name}} ({{state.state}}) Started: {{moment-format state.startedAt "MM/DD/YY HH:mm:ss [UTC]"}} - {{#unless state.isActive}} - Ended: {{moment-format state.finishedAt "MM/DD/YY HH:mm:ss [UTC]"}} - {{/unless}} -
- - - - - - - - - - {{#each (reverse state.events) as |event|}} - - - - - - {{/each}} - -
TimeTypeDescription
{{moment-format event.time "MM/DD/YY HH:mm:ss [UTC]"}}{{event.type}} - {{#if event.displayMessage}} - {{event.displayMessage}} - {{else}} - No message - {{/if}} -
-
- {{/each}} -
+{{outlet}} diff --git a/ui/app/templates/allocations/allocation/index.hbs b/ui/app/templates/allocations/allocation/index.hbs new file mode 100644 index 000000000..32112775c --- /dev/null +++ b/ui/app/templates/allocations/allocation/index.hbs @@ -0,0 +1,100 @@ +{{#global-header class="page-header"}} + Allocations +{{/global-header}} +{{#gutter-menu class="page-body"}} +
+

Allocation {{model.name}}

+

+ For job {{#link-to "jobs.job" model.job (query-params jobNamespace=model.job.namespace.id)}}{{model.job.name}}{{/link-to}} + on client {{#link-to "clients.client" model.node}}{{model.node.shortId}}{{/link-to}} +

+ +
+
+ Tasks +
+ {{#list-table + source=sortedStates + sortProperty=sortProperty + sortDescending=sortDescending + class="is-striped tasks" as |t|}} + {{#t.head}} + {{#t.sort-by prop="name"}}Name{{/t.sort-by}} + {{#t.sort-by prop="state"}}State{{/t.sort-by}} + Last Event + {{#t.sort-by prop="events.lastObject.time"}}Time{{/t.sort-by}} + Addresses + {{/t.head}} + {{#t.body as |row|}} + + + {{#link-to "allocations.allocation.task" row.model.allocation row.model}} + {{row.model.task.name}} + {{/link-to}} + + {{row.model.state}} + + {{#if row.model.events.lastObject.displayMessage}} + {{row.model.events.lastObject.displayMessage}} + {{else}} + No message + {{/if}} + + {{moment-format row.model.events.lastObject.time "MM/DD/YY HH:mm:ss [UTC]"}} + + + + + {{/t.body}} + {{/list-table}} +
+ + {{#each model.states as |state|}} +
+
+ {{state.task.name}} ({{state.state}}) Started: {{moment-format state.startedAt "MM/DD/YY HH:mm:ss [UTC]"}} + {{#unless state.isActive}} + Ended: {{moment-format state.finishedAt "MM/DD/YY HH:mm:ss [UTC]"}} + {{/unless}} +
+ + + + + + + + + + {{#each (reverse state.events) as |event|}} + + + + + + {{/each}} + +
TimeTypeDescription
{{moment-format event.time "MM/DD/YY HH:mm:ss [UTC]"}}{{event.type}} + {{#if event.displayMessage}} + {{event.displayMessage}} + {{else}} + No message + {{/if}} +
+
+ {{/each}} +
+{{/gutter-menu}} diff --git a/ui/app/templates/allocations/allocation/task.hbs b/ui/app/templates/allocations/allocation/task.hbs new file mode 100644 index 000000000..c24cd6895 --- /dev/null +++ b/ui/app/templates/allocations/allocation/task.hbs @@ -0,0 +1 @@ +{{outlet}} diff --git a/ui/app/templates/allocations/allocation/task/index.hbs b/ui/app/templates/allocations/allocation/task/index.hbs new file mode 100644 index 000000000..22e7dbef9 --- /dev/null +++ b/ui/app/templates/allocations/allocation/task/index.hbs @@ -0,0 +1,12 @@ +{{#global-header class="page-header"}} +{{/global-header}} +{{#gutter-menu class="page-body"}} + {{partial "allocations/allocation/task/subnav"}} +
+ +
+{{/gutter-menu}} diff --git a/ui/app/templates/allocations/allocation/task/subnav.hbs b/ui/app/templates/allocations/allocation/task/subnav.hbs new file mode 100644 index 000000000..f59c0cb66 --- /dev/null +++ b/ui/app/templates/allocations/allocation/task/subnav.hbs @@ -0,0 +1,5 @@ +
+ +