mirror of
https://github.com/nasa/openmct.git
synced 2025-06-18 07:08:12 +00:00
[Time Conductor] Use time systems from time conductor
This commit is contained in:
@ -73,6 +73,18 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
],
|
||||||
|
"constants": [
|
||||||
|
{
|
||||||
|
"key": "TIME_CONDUCTOR_DOMAINS",
|
||||||
|
"value": [
|
||||||
|
{ "key": "time", "name": "Time" },
|
||||||
|
{ "key": "yesterday", "name": "Yesterday" },
|
||||||
|
{ "key": "index", "name": "Index", "system": "generator.index" }
|
||||||
|
],
|
||||||
|
"priority": -1,
|
||||||
|
"comment": "Placeholder; to be replaced by inspection of available domains."
|
||||||
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ define(
|
|||||||
initialDragValue;
|
initialDragValue;
|
||||||
|
|
||||||
function timeSystemKey() {
|
function timeSystemKey() {
|
||||||
return ($scope.parameters || {}).domain;
|
return ($scope.parameters || {}).system;
|
||||||
}
|
}
|
||||||
|
|
||||||
function formatTimestamp(ts) {
|
function formatTimestamp(ts) {
|
||||||
@ -57,7 +57,7 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// From 0.0-1.0 to "0%"-"1%"
|
// From 0.0-1.0 to "0%"-"100%"
|
||||||
function toPercent(p) {
|
function toPercent(p) {
|
||||||
return (100 * p) + "%";
|
return (100 * p) + "%";
|
||||||
}
|
}
|
||||||
|
@ -36,9 +36,9 @@
|
|||||||
{
|
{
|
||||||
"key": "TIME_CONDUCTOR_DOMAINS",
|
"key": "TIME_CONDUCTOR_DOMAINS",
|
||||||
"value": [
|
"value": [
|
||||||
{ "key": "time", "name": "Time" },
|
{ "key": "time", "name": "Time" }
|
||||||
{ "key": "yesterday", "name": "Yesterday" }
|
|
||||||
],
|
],
|
||||||
|
"priority": "fallback",
|
||||||
"comment": "Placeholder; to be replaced by inspection of available domains."
|
"comment": "Placeholder; to be replaced by inspection of available domains."
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
<mct-include key="'time-controller'"
|
<mct-include key="'time-controller'"
|
||||||
|
parameters='parameters'
|
||||||
ng-model='ngModel.conductor'>
|
ng-model='ngModel.conductor'>
|
||||||
</mct-include>
|
</mct-include>
|
||||||
<mct-control key="'select'"
|
<mct-control key="'select'"
|
||||||
|
@ -27,7 +27,10 @@ define(
|
|||||||
"use strict";
|
"use strict";
|
||||||
|
|
||||||
var TEMPLATE = [
|
var TEMPLATE = [
|
||||||
"<mct-include key=\"'time-conductor'\" ng-model='ngModel' class='l-time-controller'>",
|
"<mct-include key=\"'time-conductor'\" ",
|
||||||
|
"ng-model='ngModel' ",
|
||||||
|
"parameters='parameters' ",
|
||||||
|
"class='l-time-controller'>",
|
||||||
"</mct-include>"
|
"</mct-include>"
|
||||||
].join(''),
|
].join(''),
|
||||||
THROTTLE_MS = 200,
|
THROTTLE_MS = 200,
|
||||||
@ -74,11 +77,12 @@ define(
|
|||||||
broadcastBounds;
|
broadcastBounds;
|
||||||
|
|
||||||
// Combine start/end times into a single object
|
// Combine start/end times into a single object
|
||||||
function bounds(start, end) {
|
function bounds() {
|
||||||
|
var domain = conductor.domain();
|
||||||
return {
|
return {
|
||||||
start: conductor.displayStart(),
|
start: conductor.displayStart(),
|
||||||
end: conductor.displayEnd(),
|
end: conductor.displayEnd(),
|
||||||
domain: conductor.domain()
|
domain: domain && domain.key
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -97,12 +101,10 @@ define(
|
|||||||
}
|
}
|
||||||
|
|
||||||
function updateDomain(value) {
|
function updateDomain(value) {
|
||||||
conductor.domain(value);
|
var newDomain = conductor.domain(value);
|
||||||
repScope.$broadcast('telemetry:display:bounds', bounds(
|
conductorScope.parameters.system =
|
||||||
conductor.displayStart(),
|
newDomain && newDomain.system;
|
||||||
conductor.displayEnd(),
|
repScope.$broadcast('telemetry:display:bounds', bounds());
|
||||||
conductor.domain()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// telemetry domain metadata -> option for a select control
|
// telemetry domain metadata -> option for a select control
|
||||||
@ -130,7 +132,8 @@ define(
|
|||||||
{ outer: bounds(), inner: bounds() };
|
{ outer: bounds(), inner: bounds() };
|
||||||
conductorScope.ngModel.options =
|
conductorScope.ngModel.options =
|
||||||
conductor.domainOptions().map(makeOption);
|
conductor.domainOptions().map(makeOption);
|
||||||
conductorScope.ngModel.domain = conductor.domain();
|
conductorScope.ngModel.domain = (conductor.domain() || {}).key;
|
||||||
|
conductorScope.parameters = {};
|
||||||
|
|
||||||
conductorScope
|
conductorScope
|
||||||
.$watch('ngModel.conductor.inner.start', updateConductorInner);
|
.$watch('ngModel.conductor.inner.start', updateConductorInner);
|
||||||
|
@ -51,7 +51,7 @@ define(
|
|||||||
request = request || {};
|
request = request || {};
|
||||||
request.start = start;
|
request.start = start;
|
||||||
request.end = end;
|
request.end = end;
|
||||||
request.domain = domain;
|
request.domain = domain && domain.key;
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -43,7 +43,7 @@ define(
|
|||||||
function TimeConductor(start, end, domains) {
|
function TimeConductor(start, end, domains) {
|
||||||
this.range = { start: start, end: end };
|
this.range = { start: start, end: end };
|
||||||
this.domains = domains;
|
this.domains = domains;
|
||||||
this.activeDomain = domains[0].key;
|
this.activeDomain = domains[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -73,7 +73,7 @@ define(
|
|||||||
/**
|
/**
|
||||||
* Get available domain options which can be used to bound time
|
* Get available domain options which can be used to bound time
|
||||||
* selection.
|
* selection.
|
||||||
* @returns {TelemetryDomain[]} available domains
|
* @returns {TelemetryDomainMetadata[]} available domains
|
||||||
*/
|
*/
|
||||||
TimeConductor.prototype.domainOptions = function () {
|
TimeConductor.prototype.domainOptions = function () {
|
||||||
return this.domains;
|
return this.domains;
|
||||||
@ -82,19 +82,21 @@ define(
|
|||||||
/**
|
/**
|
||||||
* Get or set (if called with an argument) the active domain.
|
* Get or set (if called with an argument) the active domain.
|
||||||
* @param {string} [key] the key identifying the domain choice
|
* @param {string} [key] the key identifying the domain choice
|
||||||
* @returns {TelemetryDomain} the active telemetry domain
|
* @returns {TelemetryDomainMetadata} the active telemetry domain
|
||||||
*/
|
*/
|
||||||
TimeConductor.prototype.domain = function (key) {
|
TimeConductor.prototype.domain = function (key) {
|
||||||
function matchesKey(domain) {
|
var i;
|
||||||
return domain.key === key;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (arguments.length > 0) {
|
if (arguments.length > 0) {
|
||||||
if (!this.domains.some(matchesKey)) {
|
for (i = 0; i < this.domains.length; i += 1) {
|
||||||
|
if (this.domains[i].key === key) {
|
||||||
|
return (this.activeDomain = this.domains[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
throw new Error("Unknown domain " + key);
|
throw new Error("Unknown domain " + key);
|
||||||
}
|
}
|
||||||
this.activeDomain = key;
|
|
||||||
}
|
|
||||||
return this.activeDomain;
|
return this.activeDomain;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user