Skip to content
This repository has been archived by the owner on May 18, 2021. It is now read-only.

Commit

Permalink
Merge pull request #123 from jamesdphillips/double_quotes
Browse files Browse the repository at this point in the history
Standardize string formatting
  • Loading branch information
amdprophet committed Mar 27, 2013
2 parents 1bd9a0c + 9cf5105 commit 349eb15
Show file tree
Hide file tree
Showing 47 changed files with 454 additions and 455 deletions.
4 changes: 2 additions & 2 deletions lib/sensu-dashboard/assets/javascripts/application.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

class Application

Expand All @@ -13,7 +13,7 @@ namespace 'SensuDashboard', (exports) ->
new SensuDashboard.Views.Error
toastr.error("Error during bootstrap. Is Sensu API running?"
, "Bootstrap Error"
, { positionClass: 'toast-bottom-right' })
, { positionClass: "toast-bottom-right" })

boot: ->
Backbone.history.start()
Expand Down
8 changes: 4 additions & 4 deletions lib/sensu-dashboard/assets/javascripts/bootstrapper.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

class exports.Bootstrapper

Expand All @@ -8,10 +8,10 @@ namespace 'SensuDashboard', (exports) ->

try
$.ajax
type: 'GET'
url: '/all'
type: "GET"
url: "/all"
context: this
dataType: 'json'
dataType: "json"
success: (data, textStatus, jqXHR) ->
SensuDashboard.PollFrequency = data.info.sensu_dashboard.poll_frequency
SensuDashboard.Stashes = new SensuDashboard.Collections.Stashes(data.stashes)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard.Collections', (exports) ->
namespace "SensuDashboard.Collections", (exports) ->

class exports.Base extends Backbone.Collection
longPolling: false
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace 'SensuDashboard.Collections', (exports) ->
namespace "SensuDashboard.Collections", (exports) ->

class exports.Checks extends SensuDashboard.Collections.Base
model: SensuDashboard.Models.Check,
url: '/checks'
url: "/checks"

comparator: (event) ->
event.get 'name'
event.get "name"
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
namespace 'SensuDashboard.Collections', (exports) ->
namespace "SensuDashboard.Collections", (exports) ->

class exports.Clients extends SensuDashboard.Collections.Base
model: SensuDashboard.Models.Client,
url: '/clients'
url: "/clients"

comparator: (event) ->
event.get('name')
event.get("name")

getSelected: ->
@where(selected: true)
Expand Down
14 changes: 7 additions & 7 deletions lib/sensu-dashboard/assets/javascripts/collections/events.coffee
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
namespace 'SensuDashboard.Collections', (exports) ->
namespace "SensuDashboard.Collections", (exports) ->

class exports.Events extends SensuDashboard.Collections.Base
model: SensuDashboard.Models.Event,
url: '/events'
url: "/events"

comparator: (event) ->
event.get('status_name')
event.get("status_name")

getSelected: ->
@where(selected: true)

getSelectedClients: ->
_.map(@getSelected(), (event) -> event.get('client'))
_.map(@getSelected(), (event) -> event.get("client"))

getUniqueSelectedClients: ->
clients = _.uniq(@getSelectedClients())
Expand All @@ -21,7 +21,7 @@ namespace 'SensuDashboard.Collections', (exports) ->

getUnknowns: ->
@filter (event) ->
status = event.get('status')
status = event.get("status")
return status != 1 && status != 2

getWarnings: ->
Expand All @@ -44,8 +44,8 @@ namespace 'SensuDashboard.Collections', (exports) ->

getSelectedUnknowns: ->
@filter (event) ->
status = event.get('status')
selected = event.get('selected')
status = event.get("status")
selected = event.get("selected")
return status != 1 && status != 2 && selected == true

getSelectedWarnings: ->
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace 'SensuDashboard.Collections', (exports) ->
namespace "SensuDashboard.Collections", (exports) ->

class exports.Stashes extends SensuDashboard.Collections.Base
model: SensuDashboard.Models.Stash,
url: '/stashes'
url: "/stashes"

getSelected: ->
@where(selected: true)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

exports.States = new exports.StateManager {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Handlebars.registerHelper 'selected', (selected) ->
return if selected then 'checked' else ''
Handlebars.registerHelper "selected", (selected) ->
return if selected then "checked" else ""
2 changes: 1 addition & 1 deletion lib/sensu-dashboard/assets/javascripts/matcher.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

class exports.Matcher

Expand Down
4 changes: 2 additions & 2 deletions lib/sensu-dashboard/assets/javascripts/models/check.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard.Models', (exports) ->
namespace "SensuDashboard.Models", (exports) ->

class exports.Check extends Backbone.Model

Expand All @@ -8,4 +8,4 @@ namespace 'SensuDashboard.Models', (exports) ->
subscribers: ["all"]
interval: 60

idAttribute: 'name'
idAttribute: "name"
20 changes: 10 additions & 10 deletions lib/sensu-dashboard/assets/javascripts/models/client.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard.Models', (exports) ->
namespace "SensuDashboard.Models", (exports) ->

class exports.Client extends Backbone.Model

Expand All @@ -8,26 +8,26 @@ namespace 'SensuDashboard.Models', (exports) ->
subscriptions: []
timestamp: 0

idAttribute: 'name'
idAttribute: "name"

initialize: ->
@set(silence_path: 'silence/'+@get('name'))
@listenTo(SensuDashboard.Stashes, 'reset', @setSilencing)
@listenTo(SensuDashboard.Stashes, 'add', @setSilencing)
@listenTo(SensuDashboard.Stashes, 'remove', @setSilencing)
@set(silence_path: "silence/#{@get("name")}")
@listenTo(SensuDashboard.Stashes, "reset", @setSilencing)
@listenTo(SensuDashboard.Stashes, "add", @setSilencing)
@listenTo(SensuDashboard.Stashes, "remove", @setSilencing)
@setSilencing()

setSilencing: ->
silenced = false
silenced = true if SensuDashboard.Stashes.get(@get('silence_path'))
if @get('silenced') != silenced
silenced = true if SensuDashboard.Stashes.get(@get("silence_path"))
if @get("silenced") != silenced
@set(silenced: silenced)

silence: (options = {}) =>
@successCallback = options.success
@errorCallback = options.error
stash = SensuDashboard.Stashes.create({
path: @get('silence_path')
path: @get("silence_path")
content: { timestamp: Math.round(new Date().getTime() / 1000) }}, {
success: (model, response, opts) =>
@successCallback.apply(this, [this, response]) if @successCallback
Expand All @@ -37,7 +37,7 @@ namespace 'SensuDashboard.Models', (exports) ->
unsilence: (options = {}) =>
@successCallback = options.success
@errorCallback = options.error
stash = SensuDashboard.Stashes.get(@get('silence_path'))
stash = SensuDashboard.Stashes.get(@get("silence_path"))
if stash
stash.destroy
success: (model, response, opts) =>
Expand Down
42 changes: 21 additions & 21 deletions lib/sensu-dashboard/assets/javascripts/models/event.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard.Models', (exports) ->
namespace "SensuDashboard.Models", (exports) ->

class exports.Event extends Backbone.Model

Expand All @@ -9,40 +9,40 @@ namespace 'SensuDashboard.Models', (exports) ->
output: null
status: 3
flapping: false
issued: '0000-00-00T00:00:00Z'
issued: "0000-00-00T00:00:00Z"

initialize: ->
@set(id: @get('client')+'/'+@get('check'))
@setOutputIfEmpty(@get('output'))
@setStatusName(@get('status'))
@set(id: "#{@get("client")}/#{@get("check")}")
@setOutputIfEmpty(@get("output"))
@setStatusName(@get("status"))
@set
url: '/events/'+@get('id')
client_silence_path: 'silence/'+@get('client')
silence_path: 'silence/'+@get('id')
@listenTo(SensuDashboard.Stashes, 'reset', @setSilencing)
@listenTo(SensuDashboard.Stashes, 'add', @setSilencing)
@listenTo(SensuDashboard.Stashes, 'remove', @setSilencing)
url: "/events/#{@get("id")}"
client_silence_path: "silence/#{@get("client")}"
silence_path: "silence/#{@get("id")}"
@listenTo(SensuDashboard.Stashes, "reset", @setSilencing)
@listenTo(SensuDashboard.Stashes, "add", @setSilencing)
@listenTo(SensuDashboard.Stashes, "remove", @setSilencing)
@setSilencing()

setSilencing: ->
silenced = false
client_silenced = false
silenced = true if SensuDashboard.Stashes.get(@get('silence_path'))
client_silenced = true if SensuDashboard.Stashes.get(@get('client_silence_path'))
if @get('silenced') != silenced || @get('client_silenced') != client_silenced
silenced = true if SensuDashboard.Stashes.get(@get("silence_path"))
client_silenced = true if SensuDashboard.Stashes.get(@get("client_silence_path"))
if @get("silenced") != silenced || @get("client_silenced") != client_silenced
@set
silenced: silenced
client_silenced: client_silenced

setOutputIfEmpty: (output) ->
if output == ''
@set(output: 'nil output')
if output == ""
@set(output: "nil output")

setStatusName: (status) ->
switch status
when 1 then @set(status_name: 'warning')
when 2 then @set(status_name: 'critical')
else @set(status_name: 'unknown')
when 1 then @set(status_name: "warning")
when 2 then @set(status_name: "critical")
else @set(status_name: "unknown")

resolve: (options = {}) =>
@successCallback = options.success
Expand All @@ -57,7 +57,7 @@ namespace 'SensuDashboard.Models', (exports) ->
@successCallback = options.success
@errorCallback = options.error
stash = SensuDashboard.Stashes.create({
path: @get('silence_path')
path: @get("silence_path")
content: { timestamp: Math.round(new Date().getTime() / 1000) }}, {
success: (model, response, opts) =>
@successCallback.apply(this, [this, response]) if @successCallback
Expand All @@ -67,7 +67,7 @@ namespace 'SensuDashboard.Models', (exports) ->
unsilence: (options = {}) =>
@successCallback = options.success
@errorCallback = options.error
stash = SensuDashboard.Stashes.get(@get('silence_path'))
stash = SensuDashboard.Stashes.get(@get("silence_path"))
if stash
stash.destroy
success: (model, response, opts) =>
Expand Down
10 changes: 5 additions & 5 deletions lib/sensu-dashboard/assets/javascripts/models/info.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard.Models', (exports) ->
namespace "SensuDashboard.Models", (exports) ->

class exports.Info extends Backbone.Model

Expand All @@ -21,11 +21,11 @@ namespace 'SensuDashboard.Models', (exports) ->
version: null
poll_frequency: 10

url: '/info'
url: "/info"

initialize: ->
@setRMQStatus @get('rabbitmq').connected
@setRedisStatus @get('redis').connected
@setRMQStatus @get("rabbitmq").connected
@setRedisStatus @get("redis").connected

setRMQStatus: (status) ->
@set { rmq_status: @_onlineStatus(status) }
Expand All @@ -35,7 +35,7 @@ namespace 'SensuDashboard.Models', (exports) ->

# Private
_onlineStatus: (status) ->
if status then 'Online' else 'Offline'
if status then "Online" else "Offline"

longPolling: false

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard.Models.Metadata', (exports) ->
namespace "SensuDashboard.Models.Metadata", (exports) ->

class exports.Events extends Backbone.Model

Expand All @@ -9,7 +9,7 @@ namespace 'SensuDashboard.Models.Metadata', (exports) ->
unknown: 0

initialize: ->
SensuDashboard.Events.on 'all', @updateCounts, this
SensuDashboard.Events.on "all", @updateCounts, this
@updateCounts()

updateCounts: ->
Expand Down
10 changes: 5 additions & 5 deletions lib/sensu-dashboard/assets/javascripts/models/stash.coffee
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
namespace 'SensuDashboard.Models', (exports) ->
namespace "SensuDashboard.Models", (exports) ->

class exports.Stash extends Backbone.Model

defaults:
path: 'silence'
path: "silence"
content: {}

idAttribute: 'path'
idAttribute: "path"

isNew: =>
!_.contains(SensuDashboard.Stashes.models, this)
Expand All @@ -18,8 +18,8 @@ namespace 'SensuDashboard.Models', (exports) ->

sync: (method, model, options) =>
options ||= {}
if method == 'delete'
options.url = SensuDashboard.Stashes.url + '/' + model.get('path')
if method == "delete"
options.url = "#{SensuDashboard.Stashes.url}/#{model.get("path")}"
Backbone.sync(method, model, options)

remove: (options = {}) =>
Expand Down
4 changes: 2 additions & 2 deletions lib/sensu-dashboard/assets/javascripts/namespace.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
payload = payload || {}
context = context || window

parts = nspace.split '.'
parts = nspace.split "."
parent = context
currentPart = ''
currentPart = ""

while currentPart = parts.shift()
if parts.length != 0
Expand Down
2 changes: 1 addition & 1 deletion lib/sensu-dashboard/assets/javascripts/state.coffee
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

class exports.State

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

class exports.StateManager extends Backbone.Router

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
namespace 'SensuDashboard', (exports) ->
namespace "SensuDashboard", (exports) ->

class exports.MainState extends exports.State
transition: (manager, view) ->
$('#main').html(view.render().el)
$("#main").html(view.render().el)
manager.pushTop(view)
Loading

0 comments on commit 349eb15

Please sign in to comment.