Sha256: 967c2ee2ffc7fc4142eabe41bec1cc391fa30ca07f85cb9d681f50920611300e

Contents?: true

Size: 1.54 KB

Versions: 6

Compression:

Stored size: 1.54 KB

Contents

namespace "SensuDashboard.Views.Stashes", (exports) ->

  class exports.Index extends SensuDashboard.Views.Base

    name: "stashes/index"

    events:
      "click #toggle-checkboxes": "toggleSelected"
      "click #select-all": "selectAll"
      "click #select-none": "selectNone"
      "click #remove-selected": "removeSelected"

    initialize: ->
      @autocomplete_view = new SensuDashboard.Views.AutoCompleteField()
      @counts_subview = new SensuDashboard.Views.Stashes.Counts(collection: @collection)
      @stashes_view = new exports.List({
        collection: @collection
        autocomplete_view: @autocomplete_view
      })

    render: ->
      @$el.html(@template(stashes: @collection))
      @assign(@counts_subview, "#counts")
      @assign(@stashes_view, "#stashes_container")
      @$el.find("#filter").html(@autocomplete_view.render().el)
      this

    toggleSelected: ->
      @collection.toggleSelected()

    selectAll: ->
      @collection.selectAll()

    selectNone: ->
      @collection.selectNone()

    removeSelected: ->
      @collection.removeSelected
        success: (model) ->
          stash_name = model.get("path")
          toastr.success("Removed stash #{stash_name}."
            , "Success!"
            , { positionClass: "toast-bottom-right" })
        error: (model) ->
          stash_name = model.get("path")
          toastr.error("Error removing stash #{stash_name}.
            The stash may already be removed or Sensu API is down."
            , "Removal Error!"
            , { positionClass: "toast-bottom-right" })

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
sensu-dashboard-0.10.4 lib/sensu-dashboard/assets/javascripts/views/stashes/index.coffee
sensu-dashboard-0.10.3 lib/sensu-dashboard/assets/javascripts/views/stashes/index.coffee
sensu-dashboard-0.10.2 lib/sensu-dashboard/assets/javascripts/views/stashes/index.coffee
sensu-dashboard-0.10.1 lib/sensu-dashboard/assets/javascripts/views/stashes/index.coffee
sensu-dashboard-0.10.0 lib/sensu-dashboard/assets/javascripts/views/stashes/index.coffee
sensu-dashboard-0.9.9 lib/sensu-dashboard/assets/javascripts/views/stashes/index.coffee