mirror of
https://github.com/nasa/openmct.git
synced 2025-02-08 03:50:39 +00:00
[Time Conductor] Show domain options
This commit is contained in:
parent
5d5a7c26c5
commit
d238b669a5
@ -21,7 +21,13 @@
|
|||||||
"depends": [ "now", "TIME_CONDUCTOR_DOMAINS" ]
|
"depends": [ "now", "TIME_CONDUCTOR_DOMAINS" ]
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"contants": [
|
"templates": [
|
||||||
|
{
|
||||||
|
"key": "time-conductor",
|
||||||
|
"templateUrl": "templates/time-conductor.html"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constants": [
|
||||||
{
|
{
|
||||||
"key": "TIME_CONDUCTOR_DOMAINS",
|
"key": "TIME_CONDUCTOR_DOMAINS",
|
||||||
"value": [
|
"value": [
|
||||||
|
@ -0,0 +1,8 @@
|
|||||||
|
<mct-control key="'select'"
|
||||||
|
ng-model='ngModel'
|
||||||
|
field="'domain'"
|
||||||
|
options="ngModel.options">
|
||||||
|
</mct-control>
|
||||||
|
<mct-include key="'time-controller'"
|
||||||
|
ng-model='ngModel.conductor'>
|
||||||
|
</mct-include>
|
@ -32,7 +32,7 @@ define(
|
|||||||
'"position: absolute; bottom: 0; width: 100%; ',
|
'"position: absolute; bottom: 0; width: 100%; ',
|
||||||
'overflow: hidden; ',
|
'overflow: hidden; ',
|
||||||
'height: ' + CONDUCTOR_HEIGHT + '">',
|
'height: ' + CONDUCTOR_HEIGHT + '">',
|
||||||
"<mct-include key=\"'time-controller'\" ng-model='conductor'>",
|
"<mct-include key=\"'time-conductor'\" ng-model='ngModel'>",
|
||||||
"</mct-include>",
|
"</mct-include>",
|
||||||
'</div>'
|
'</div>'
|
||||||
].join(''),
|
].join(''),
|
||||||
@ -68,8 +68,8 @@ define(
|
|||||||
// Update the time conductor from the scope
|
// Update the time conductor from the scope
|
||||||
function wireScope(conductor, conductorScope, repScope) {
|
function wireScope(conductor, conductorScope, repScope) {
|
||||||
function updateConductorOuter() {
|
function updateConductorOuter() {
|
||||||
conductor.queryStart(conductorScope.conductor.outer.start);
|
conductor.queryStart(conductorScope.ngModel.conductor.outer.start);
|
||||||
conductor.queryEnd(conductorScope.conductor.outer.end);
|
conductor.queryEnd(conductorScope.ngModel.conductor.outer.end);
|
||||||
repScope.$broadcast(
|
repScope.$broadcast(
|
||||||
'telemetry:query:bounds',
|
'telemetry:query:bounds',
|
||||||
bounds(conductor.queryStart(), conductor.queryEnd())
|
bounds(conductor.queryStart(), conductor.queryEnd())
|
||||||
@ -77,27 +77,49 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateConductorInner() {
|
function updateConductorInner() {
|
||||||
conductor.displayStart(conductorScope.conductor.inner.start);
|
conductor.displayStart(conductorScope.ngModel.conductor.inner.start);
|
||||||
conductor.displayEnd(conductorScope.conductor.inner.end);
|
conductor.displayEnd(conductorScope.ngModel.conductor.inner.end);
|
||||||
repScope.$broadcast(
|
repScope.$broadcast(
|
||||||
'telemetry:display:bounds',
|
'telemetry:display:bounds',
|
||||||
bounds(conductor.displayStart(), conductor.displayEnd())
|
bounds(conductor.displayStart(), conductor.displayEnd())
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
conductorScope.conductor = {
|
function updateDomain(value) {
|
||||||
|
conductor.activeDomain(value);
|
||||||
|
repScope.$broadcast(
|
||||||
|
'telemetry:query:bounds',
|
||||||
|
bounds(conductor.queryStart(), conductor.queryEnd())
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// telemetry domain metadata -> option for a select control
|
||||||
|
function makeOption(domainOption) {
|
||||||
|
return {
|
||||||
|
name: domainOption.name,
|
||||||
|
value: domainOption.key
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
conductorScope.ngModel = {};
|
||||||
|
conductorScope.ngModel.conductor = {
|
||||||
outer: bounds(conductor.queryStart(), conductor.queryEnd()),
|
outer: bounds(conductor.queryStart(), conductor.queryEnd()),
|
||||||
inner: bounds(conductor.displayStart(), conductor.displayEnd())
|
inner: bounds(conductor.displayStart(), conductor.displayEnd())
|
||||||
};
|
};
|
||||||
|
conductorScope.ngModel.options =
|
||||||
|
conductor.domainOptions().map(makeOption);
|
||||||
|
conductorScope.ngModel.domain = conductor.activeDomain();
|
||||||
|
|
||||||
conductorScope
|
conductorScope
|
||||||
.$watch('conductor.outer.start', updateConductorOuter);
|
.$watch('ngModel.conductor.outer.start', updateConductorOuter);
|
||||||
conductorScope
|
conductorScope
|
||||||
.$watch('conductor.outer.end', updateConductorOuter);
|
.$watch('ngModel.conductor.outer.end', updateConductorOuter);
|
||||||
conductorScope
|
conductorScope
|
||||||
.$watch('conductor.inner.start', updateConductorInner);
|
.$watch('ngModel.conductor.inner.start', updateConductorInner);
|
||||||
conductorScope
|
conductorScope
|
||||||
.$watch('conductor.inner.end', updateConductorInner);
|
.$watch('ngModel.conductor.inner.end', updateConductorInner);
|
||||||
|
conductorScope
|
||||||
|
.$watch('ngModel.domain', updateDomain);
|
||||||
|
|
||||||
repScope.$on('telemetry:view', updateConductorInner);
|
repScope.$on('telemetry:view', updateConductorInner);
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ define(
|
|||||||
this.inner = { start: start, end: end };
|
this.inner = { start: start, end: end };
|
||||||
this.outer = { start: start, end: end };
|
this.outer = { start: start, end: end };
|
||||||
this.domains = domains;
|
this.domains = domains;
|
||||||
this.domain = domains[0];
|
this.domain = domains[0].key;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -111,13 +111,15 @@ define(
|
|||||||
* @returns {TelemetryDomain} the active telemetry domain
|
* @returns {TelemetryDomain} the active telemetry domain
|
||||||
*/
|
*/
|
||||||
TimeConductor.prototype.activeDomain = function (key) {
|
TimeConductor.prototype.activeDomain = function (key) {
|
||||||
var i;
|
function matchesKey(domain) {
|
||||||
|
return domain.key === key;
|
||||||
|
}
|
||||||
|
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0) {
|
||||||
for (i = 0; i < this.domains.length; i += 1) {
|
if (!this.domains.some(matchesKey)) {
|
||||||
if (this.domains[i].key === key) {
|
throw new Error("Unknown domain " + key);
|
||||||
this.domain = this.domains[i];
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
this.domain = key;
|
||||||
}
|
}
|
||||||
return this.domain;
|
return this.domain;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user