Skip to content

Commit

Permalink
basic overview directive
Browse files Browse the repository at this point in the history
  • Loading branch information
shanzi committed May 26, 2015
1 parent 4a632c3 commit 423aa64
Show file tree
Hide file tree
Showing 4 changed files with 106 additions and 3 deletions.
5 changes: 5 additions & 0 deletions www/md_base/src/app/common/directives/panel/panel.less
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ panel {
padding: 10px;
}

.title-bar {
border-bottom: 1px solid #efefef;
padding-bottom: 5px;
}

.title {
text-transform: uppercase;
letter-spacing: 1px;
Expand Down
40 changes: 38 additions & 2 deletions www/md_base/src/app/home/panels/overview/overview.directive.coffee
Original file line number Diff line number Diff line change
@@ -1,8 +1,44 @@
class Overview extends Directive

constructor: ->
constructor: ->
return {
restrict: 'E'
templateUrl: 'views/overview_panel.html'
controller: '_OverviewController'
controllerAs: 'overview'
}


class _Overview extends Controller
masters:
count: 0
active: 0

slaves:
count: 0
connections: 0

builders:
count: 0

schedulers:
count: 0

constructor: (buildbotService) ->
buildbotService.all('masters').getList().then (entries) =>
actives = 0
for master in entries
actives += 1 if master.active
@masters.count = entries.length
@masters.active = actives

buildbotService.all('buildslaves').getList().then (entries) =>
connections = 0
connections += slave.connected_to.length for slave in entries
@slaves.count = entries.length
@slaves.connections = connections

buildbotService.all('builders').getList().then (entries) =>
@builders.count = entries.length

buildbotService.all('schedulers').getList().then (entries) =>
@schedulers.count = entries.length
43 changes: 43 additions & 0 deletions www/md_base/src/app/home/panels/overview/overview.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
overview {
display: block;
overflow: hidden;
padding: 20px 0;

.tile {
float: left;
width: 25%;
text-align: center;

.title {
font-size: 0.8em;
color: #333;
}

.count {
font-size: 80px;
color: #673ab7;
}

.extra {
color: #999;
font-size: 14px;
}
}
}

.collapsed overview {
.tile {
width: 50%;
margin-bottom: 5px;
}

.count {
font-size: 50px;
}
}

@media (max-width: 640px) {
overview .count {
font-size: 50px !important;
}
}
21 changes: 20 additions & 1 deletion www/md_base/src/app/home/panels/overview/overview_panel.tpl.jade
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
| overview panel content
div.tile
div.title Masters
div.count {{ overview.masters.count }}
div.extra
| {{ overview.masters.active }} active.
div.tile
div.title Slaves
div.count {{ overview.slaves.count }}
div.extra
| {{ overview.slaves.connections }} connections.
div.tile
div.title Builders
div.count {{ overview.builders.count }}
div.extra
a(ui-sref="builds") View all builders
div.tile
div.title Schedulers
div.count {{ overview.schedulers.count }}
div.extra
a(ui-sref="builds") View all schedulers

0 comments on commit 423aa64

Please sign in to comment.