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 tasks from /killed to decom badges #804

Merged
merged 4 commits into from Dec 14, 2015
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions SingularityUI/app/collections/TaskKillRecords.coffee
@@ -0,0 +1,13 @@
Collection = require './collection'

TaskKillRecord = require '../models/TaskKillRecord'

class TaskKillRecords extends Collection

model: TaskKillRecord

comparator: 'timestamp'

url: -> "#{ config.apiRoot }/tasks/killed"

module.exports = TaskKillRecords
7 changes: 5 additions & 2 deletions SingularityUI/app/controllers/TasksTable.coffee
Expand Up @@ -5,6 +5,7 @@ TaskPending = require '../models/TaskPending'
Tasks = require '../collections/Tasks'
TasksPending = require '../collections/TasksPending'
TaskCleanups = require '../collections/TaskCleanups'
TaskKillRecords = require '../collections/TaskKillRecords'

TasksTableView = require '../views/tasks'

Expand All @@ -22,18 +23,19 @@ class TasksTableController extends Controller
else
@collections.tasks = new Tasks [], {@state}
@collections.taskCleanups = new TaskCleanups
@collections.taskKills = new TaskKillRecords

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

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

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

getPendingTask: (task) ->
Expand All @@ -54,6 +56,7 @@ class TasksTableController extends Controller
return if @view.isSorted

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

module.exports = TasksTableController
18 changes: 18 additions & 0 deletions SingularityUI/app/models/TaskKillRecord.coffee
@@ -0,0 +1,18 @@
Model = require './model'

class TaskKillRecord extends Model

url: => "#{ config.apiRoot }/tasks/task/#{ @get('id') }"

initialize: ->

parse: (kill) ->
kill.isDueToDecomission = kill.taskCleanupType == 'DECOMISSIONING'

kill.id = "#{ kill.taskId.id }-#{ kill.timestamp }"

kill.requestId = kill.taskId?.requestId

kill

module.exports = TaskKillRecord
4 changes: 3 additions & 1 deletion SingularityUI/app/views/tasks.coffee
Expand Up @@ -41,6 +41,8 @@ class TasksView extends View
@bodyTemplate = @bodyTemplateMap[@state]

@listenTo @collection, 'sync', @render
@listenTo @collection.cleaning, 'reset', @render
@listenTo @collection.killing, 'reset', @render

@searchChange = _.debounce @searchChange, 200

Expand Down Expand Up @@ -122,7 +124,7 @@ class TasksView extends View
tasks = @currentTasks.slice(@renderProgress, newProgress)
@renderProgress = newProgress

decomTasks = @attributes.cleaning.pluck('taskId')
decomTasks = _.union(@attributes.cleaning.pluck('taskId'), @attributes.killing.pluck('taskId'))
$contents = @bodyTemplate
tasks: tasks
rowsOnly: true
Expand Down