Skip to content

Commit

Permalink
Merge branch 'request_audit'
Browse files Browse the repository at this point in the history
  • Loading branch information
tpetr committed Oct 14, 2015
2 parents 1ef18f2 + ef09667 commit 63caff3
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 19 deletions.
10 changes: 5 additions & 5 deletions SingularityUI/app/controllers/TasksTable.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ TaskPending = require '../models/TaskPending'

Tasks = require '../collections/Tasks'
TasksPending = require '../collections/TasksPending'
Slaves = require '../collections/Slaves'
TaskCleanups = require '../collections/TaskCleanups'

TasksTableView = require '../views/tasks'

Expand All @@ -21,19 +21,19 @@ class TasksTableController extends Controller

else
@collections.tasks = new Tasks [], {@state}
@collections.slaves = new Slaves []
@collections.taskCleanups = new TaskCleanups

@setView new TasksTableView _.extend {@state, @searchFilter},
collection: @collections.tasks
pendingTasks: @collections.tasksPending
attributes:
slaves: @collections.slaves
cleaning: @collections.taskCleanups

# Fetch a pending task's full details
@view.on 'getPendingTask', (task) => @getPendingTask(task)

@collections.slaves.fetch()
@collections.tasks.fetch()
@collections.taskCleanups.fetch()
app.showView @view

getPendingTask: (task) ->
Expand All @@ -53,7 +53,7 @@ class TasksTableController extends Controller
# Don't refresh if the table is sorted
return if @view.isSorted

@collections.slaves.fetch()
@collections.taskCleanups.fetch()
@collections.tasks.fetch reset: true

module.exports = TasksTableController
6 changes: 6 additions & 0 deletions SingularityUI/app/handlebarsHelpers.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ Handlebars.registerHelper 'fixedDecimal', (value, options) ->
if options.hash.place then place = options.hash.place else place = 2
+(value).toFixed(place)

Handlebars.registerHelper 'ifTaskInList', (list, task, options) ->
for t in list
if t.id == task
return options.fn @
return options.inverse @

Handlebars.registerHelper 'ifInSubFilter', (needle, haystack, options) ->
return options.fn @ if haystack is 'all'
if haystack.indexOf(needle) isnt -1
Expand Down
4 changes: 2 additions & 2 deletions SingularityUI/app/templates/tasksTable/tasksActiveBody.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
</td>
<td class="hidden-xs">
{{ host }}
{{#ifInSubFilter host ../decommissioning_hosts}}
{{#ifTaskInList ../decomissioning_tasks taskId.id}}
<span class='label label-warning'>DECOM</span>
{{/ifInSubFilter}}
{{/ifTaskInList}}
</td>
<td class="visible-lg">
{{ rackId }}
Expand Down
14 changes: 2 additions & 12 deletions SingularityUI/app/views/tasks.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -122,21 +122,11 @@ class TasksView extends View
tasks = @currentTasks.slice(@renderProgress, newProgress)
@renderProgress = newProgress

decommissioning_hosts = new Slaves(
@attributes.slaves.filter (model) ->
model.attributes.state in ['DECOMMISSIONING','DECOMISSIONING', 'DECOMMISSIONED','DECOMISSIONED', 'STARTING_DECOMMISSION', 'STARTING_DECOMISSION']
).map((model) ->
model.get('host')
)
if decommissioning_hosts.length is 0
hosts = 'none'
else
hosts = decommissioning_hosts.join().replace(/_/g, "-")

decomTasks = @attributes.cleaning.pluck('taskId')
$contents = @bodyTemplate
tasks: tasks
rowsOnly: true
decommissioning_hosts: hosts
decomissioning_tasks: decomTasks

$table = @$ ".table-staged table"
$tableBody = $table.find "tbody"
Expand Down

0 comments on commit 63caff3

Please sign in to comment.