[Indicators] Add notion of indicators

Add indicators as a category-of-extension, utilized
from the bottom bar to populate its contents.
WTD-608.
This commit is contained in:
Victor Woeltjen 2014-12-15 10:17:00 -08:00
parent 03179284f4
commit 48bcb662c6
3 changed files with 59 additions and 8 deletions

View File

@ -42,6 +42,11 @@
"key": "ViewSwitcherController",
"implementation": "ViewSwitcherController.js",
"depends": [ "$scope" ]
},
{
"key": "BottomBarController",
"implementation": "BottomBarController.js",
"depends": [ "indicators[]" ]
}
],
"directives": [

View File

@ -1,13 +1,23 @@
<div class='abs bottom-bar ue-bottom-bar'>
<div class='abs bottom-bar ue-bottom-bar' ng-controller="BottomBarController as bar">
<div id='status' class='status-holder abs'>
<div id='status_data_flow' class='status block data-flow'>
<span class='ui-symbol status-indicator ok'>.</span>
<span class='label'>Connected</span>
<div ng-repeat="indicator in bar.getIndicators()"
class='status block'
ng-class='indicator.getClass()'>
<span class="ui-symbol status-indicator"
ng-class='indicator.getGlyphClass()'>
{{indicator.getGlyph()}}
</span>
<span class="label"
ng-class='indicator.getTextClass()'>
{{indicator.getText()}}
</span>
<a href=''
class="ui-symbol"
ng-if="indicator.configure"
ng-click="indicator.configure()">
G
</a>
</div>
<!--div id='status_data_connection' class='status block data-connection'>
<span class='ui-symbol status-indicator caution'>D</span>
<span class='label'>Connected CPU 0.1% / Mem 1.9%</span>
</div-->
</div>
<!--mct-include key="'app-logo'"></mct-include-->
</div>

View File

@ -0,0 +1,36 @@
/*global define*/
define(
[],
function () {
"use strict";
/**
* Controller for the bottombar template. Exposes
* available indicators (of extension category "indicators")
* @constructor
*/
function BottomBarController(indicators) {
// Utility function used to instantiate indicators
// from their injected constructors.
function instantiate(Indicator) {
return new Indicator();
}
indicators = indicators.map(instantiate);
return {
/**
* Get all indicators to display.
* @returns {Indicator[]} all indicators
* to display in the bottom bar.
*/
getIndicators: function () {
return indicators;
}
};
}
return BottomBarController;
}
);