aboutsummaryrefslogtreecommitdiffstats
path: root/app/assets
diff options
context:
space:
mode:
authorKazuki Yamaguchi <k@rhe.jp>2015-08-02 16:24:59 +0900
committerKazuki Yamaguchi <k@rhe.jp>2015-08-02 16:24:59 +0900
commit001ffeb91f3862d16b88f673efd8d095be3c3c71 (patch)
treef00eacc349cdf84be8eb8a7b4e78dc83bdd088ac /app/assets
parent1a10e04aa84f741eadad4818e74c9328e86f034f (diff)
parent7a91591b92bfd86aa7c45705027a6be7f7270202 (diff)
downloadaclog-001ffeb91f3862d16b88f673efd8d095be3c3c71.tar.gz
Merge branch 'master' of gitlab.rhe.jp:rhenium/aclog
Diffstat (limited to 'app/assets')
-rw-r--r--app/assets/javascripts/controllers/about.coffee.erb38
-rw-r--r--app/assets/stylesheets/users.scss2
2 files changed, 40 insertions, 0 deletions
diff --git a/app/assets/javascripts/controllers/about.coffee.erb b/app/assets/javascripts/controllers/about.coffee.erb
index 79688e0..b72c0d0 100644
--- a/app/assets/javascripts/controllers/about.coffee.erb
+++ b/app/assets/javascripts/controllers/about.coffee.erb
@@ -5,3 +5,41 @@ Views.about =
node.onclick = (e) ->
e.preventDefault()
Helpers.openTwitterIntent(node.getAttribute("href"))
+ status: ->
+ vm = new Vue
+ el: "#status"
+ data:
+ nodes: {}
+ active_nodes: []
+ inactive_nodes: []
+ loading: false
+ error: null
+ methods:
+ uptime: (i) ->
+ diff = Math.floor(Date.now() / 1000) - this.nodes[i].activated_at
+ if diff < 5 * 60
+ diff.toString() + " seconds"
+ else if diff < 5 * 60 * 60
+ Math.floor(diff / 60).toString() + " minutes"
+ else if diff < 48 * 60 * 60
+ Math.floor(diff / 60 / 60).toString() + " hours"
+ else
+ Math.floor(diff / 60 / 60 / 24).toString() + " days"
+ reload: (e = null) ->
+ e.preventDefault() if e
+ return if vm.loading
+ vm.loading = true
+ superagent
+ .get "/i/status.json"
+ .accept "json"
+ .end (err, res) ->
+ json = res.body
+ vm.loading = false
+ if json.error
+ vm.error = json.error
+ else
+ vm.error = null
+ vm.nodes = json.nodes
+ vm.active_nodes = json.active_nodes
+ vm.inactive_nodes = json.inactive_nodes
+ vm.reload()
diff --git a/app/assets/stylesheets/users.scss b/app/assets/stylesheets/users.scss
index 966a0ee..159ab08 100644
--- a/app/assets/stylesheets/users.scss
+++ b/app/assets/stylesheets/users.scss
@@ -15,7 +15,9 @@
display: block;
line-height: 50px;
width: 100%;
+ height: 100%;
text-align: center;
+ overflow: hidden;
}
.popout {