mirror of
https://github.com/nasa/openmct.git
synced 2025-02-05 02:29:21 +00:00
[Indicators] Support template override
Allow indicators to include their own custom templates. WTD-608.
This commit is contained in:
parent
c1ea620341
commit
1a50f50310
@ -11,6 +11,10 @@
|
||||
{
|
||||
"key": "action-button",
|
||||
"templateUrl": "templates/controls/action-button.html"
|
||||
},
|
||||
{
|
||||
"key": "indicator",
|
||||
"templateUrl": "templates/indicator.html"
|
||||
}
|
||||
],
|
||||
"controllers": [
|
||||
|
@ -1,23 +1,9 @@
|
||||
<div class='abs bottom-bar ue-bottom-bar' ng-controller="BottomBarController as bar">
|
||||
<div id='status' class='status-holder abs'>
|
||||
<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>
|
||||
<mct-include ng-repeat="indicator in bar.getIndicators()"
|
||||
ng-model="indicator.ngModel"
|
||||
key="indicator.template">
|
||||
</mct-include>
|
||||
</div>
|
||||
<!--mct-include key="'app-logo'"></mct-include-->
|
||||
</div>
|
17
platform/commonUI/general/res/templates/indicator.html
Normal file
17
platform/commonUI/general/res/templates/indicator.html
Normal file
@ -0,0 +1,17 @@
|
||||
<div class='status block'
|
||||
ng-click='ngModel.configure()'
|
||||
ng-class='ngModel.getClass()'>
|
||||
<span class="ui-symbol status-indicator"
|
||||
ng-class='ngModel.getGlyphClass()'>
|
||||
{{ngModel.getGlyph()}}
|
||||
</span>
|
||||
<span class="label"
|
||||
ng-class='ngModel.getTextClass()'>
|
||||
{{ngModel.getText()}}
|
||||
</span>
|
||||
<a href=''
|
||||
class="ui-symbol"
|
||||
ng-if="ngModel.configure">
|
||||
G
|
||||
</a>
|
||||
</div>
|
@ -11,13 +11,17 @@ define(
|
||||
* @constructor
|
||||
*/
|
||||
function BottomBarController(indicators) {
|
||||
// Utility function used to instantiate indicators
|
||||
// from their injected constructors.
|
||||
function instantiate(Indicator) {
|
||||
return new Indicator();
|
||||
// Utility function used to make indicators presentable
|
||||
// for display.
|
||||
function present(Indicator) {
|
||||
return {
|
||||
template: Indicator.template || "indicator",
|
||||
ngModel: typeof Indicator === 'function' ?
|
||||
new Indicator() : Indicator
|
||||
};
|
||||
}
|
||||
|
||||
indicators = indicators.map(instantiate);
|
||||
indicators = indicators.map(present);
|
||||
|
||||
return {
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user