Skip to content

Commit

Permalink
Dashboard wip
Browse files Browse the repository at this point in the history
  • Loading branch information
rafiki270 committed Jul 11, 2019
1 parent c8c90c1 commit e7bf222
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 3 deletions.
6 changes: 6 additions & 0 deletions Dashboard/systemator/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-13s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)

start: ## Start dashboard
smashing start

1 change: 0 additions & 1 deletion Dashboard/systemator/dashboards/sample.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@
<div data-id="convergence" data-view="Graph" data-title="Convergence" style="background-color:#ff9618"></div>
</li>
</ul>
<center><div style="font-size: 12px">Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>
</div>
1 change: 0 additions & 1 deletion Dashboard/systemator/dashboards/sampletv.erb
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,4 @@ $(function() {
</li>

</ul>
<center><div style="font-size: 12px">Try this: curl -d '{ "auth_token": "YOUR_AUTH_TOKEN", "text": "Hey, Look what I can do!" }' \http://<%=request.host%>:<%=request.port%>/widgets/welcome</div></center>
</div>
2 changes: 1 addition & 1 deletion Dashboard/systemator/jobs/buzzwords.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
buzzwords = ['Paradigm shift', 'Leverage', 'Pivoting', 'Turn-key', 'Streamlininess', 'Exit strategy', 'Synergy', 'Enterprise', 'Web 2.0']
buzzwords = ['Enterprise', 'Web 2.0']
buzzword_counts = Hash.new({ value: 0 })

SCHEDULER.every '2s' do
Expand Down
23 changes: 23 additions & 0 deletions Dashboard/systemator/widgets/hotness/hotness.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
class Dashing.Hotness extends Dashing.Widget

@accessor 'value', Dashing.AnimatedValue

constructor: ->
super

onData: (data) ->
node = $(@node)
value = parseInt data.value
cool = parseInt node.data "cool"
warm = parseInt node.data "warm"
level = switch
when value <= cool then 0
when value >= warm then 4
else
bucketSize = (warm - cool) / 3 # Total # of colours in middle
Math.ceil (value - cool) / bucketSize

backgroundClass = "hotness#{level}"
lastClass = @get "lastClass"
node.toggleClass "#{lastClass} #{backgroundClass}"
@set "lastClass", backgroundClass
5 changes: 5 additions & 0 deletions Dashboard/systemator/widgets/hotness/hotness.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<h1 class="title" data-bind="title"></h1>

<h2 class="value" data-bind="value | shortenedNumber | prepend prefix | append suffix"></h2>

<p class="updated-at" data-bind="updatedAtMessage"></p>
52 changes: 52 additions & 0 deletions Dashboard/systemator/widgets/hotness/hotness.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
// ----------------------------------------------------------------------------
// Mixins
// ----------------------------------------------------------------------------
@mixin transition($transition-property, $transition-time, $method) {
-webkit-transition: $transition-property $transition-time $method;
-moz-transition: $transition-property $transition-time $method;
-o-transition: $transition-property $transition-time $method;
transition: $transition-property $transition-time $method;
}

// ----------------------------------------------------------------------------
// Sass declarations
// ----------------------------------------------------------------------------
$background-color: #000000;
$value-color: #FFFFFF;
$title-color: rgba(255, 255, 255, 0.7);
$updated-at-color: rgba(0, 0, 0, 0.3);

// ----------------------------------------------------------------------------
// Widget-hotness styles
// ----------------------------------------------------------------------------
.widget-hotness {

background-color: $background-color;
@include transition(background-color, 1s, linear);

.title {
color: $title-color;
}

.value {
color: $value-color;
}

.updated-at {
color: $updated-at-color;
}

}

.hotness0 { background-color: #00C176; }
.hotness1 { background-color: #88C100; }
.hotness2 { background-color: #FABE28; }
.hotness3 { background-color: #FF8A00; }
.hotness4 { background-color: #FF003C; }

// // More colour-blind friendly palette
// .hotness0 { background-color: #046D8B; }
// .hotness1 { background-color: #309292; }
// .hotness2 { background-color: #2FB8AC; }
// .hotness3 { background-color: #93A42A; }
// .hotness4 { background-color: #ECBE13; }

0 comments on commit e7bf222

Please sign in to comment.