Skip to content

Commit

Permalink
Merge pull request #379 from HubSpot/hide_run_now
Browse files Browse the repository at this point in the history
hide icon for run-now when daemon task
  • Loading branch information
tpetr committed Jan 6, 2015
2 parents 101f3e0 + 521aa2c commit 511b22e
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 15 deletions.
6 changes: 4 additions & 2 deletions SingularityUI/app/controllers/RequestDetail.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,10 @@ class RequestDetailController extends Controller
template: @templates.activeTasks

@subviews.scheduledTasks = new SimpleSubview
collection: @collections.scheduledTasks
template: @templates.scheduledTasks
collection: @collections.scheduledTasks
template: @templates.scheduledTasks
extraRenderData: (subView) =>
{ request: @models.request.toJSON() }

@subviews.taskHistory = new ExpandableTableSubview
collection: @collections.taskHistory
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,11 @@
{{timestampFromNow pendingTask.pendingTaskId.nextRunAt}}
</td>
<td class="hidden-xs actions-column">
<a data-action="run-now" title="Run now">
<span class="glyphicon glyphicon-flash"></span>
</a>
{{#unless ../request.attributes.daemon}}
<a data-action="run-now" title="Run now">
<span class="glyphicon glyphicon-flash"></span>
</a>
{{/unless}}
<a data-action="viewJSON" title="JSON">
{ }
</a>
Expand Down
4 changes: 2 additions & 2 deletions SingularityUI/app/views/request.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -70,15 +70,15 @@ class RequestView extends View
scaleRequest: (e) =>
@model.promptScale =>
@trigger 'refreshrequest'

pauseRequest: (e) =>
@model.promptPause =>
@trigger 'refreshrequest'

unpauseRequest: (e) =>
@model.promptUnpause =>
@trigger 'refreshrequest'

bounceRequest: (e) =>
@model.promptBounce =>
@trigger 'refreshrequest'
Expand Down
24 changes: 16 additions & 8 deletions SingularityUI/app/views/simpleSubview.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,36 @@ class SimpleSubview extends View
_.extend super,
'click [data-action="expandToggle"]': 'expandToggle'

initialize: ({@template}) ->
initialize: (@params) ->
{ @template } = @params
@data = if @collection? then @collection else @model

for eventName in ['sync', 'add', 'remove', 'change']
@listenTo @data, eventName, @render

@listenTo @data, 'reset', =>
@$el.empty()

render: ->
return if not @data.synced and @data.isEmpty?()

@$el.html @template
config: config
data: @data.toJSON()
synced: @data.synced
expanded: @expanded

@$el.html @template(@renderData())

@$('.actions-column a[title]').tooltip()

utils.setupCopyLinks @$el if @$('.horizontal-description-list').length

renderData: ->
data =
config: config
data: @data.toJSON()
synced: @data.synced
expanded: @expanded
if @params.extraRenderData?
_.extend data, @params.extraRenderData(this)

data

expandToggle: (event) ->
@expanded = not @expanded
@render()
Expand Down

0 comments on commit 511b22e

Please # to comment.