diff --git a/platform/features/conductor/bundle.json b/platform/features/conductor/bundle.json
index 0b62d74762..3a0cf12f92 100644
--- a/platform/features/conductor/bundle.json
+++ b/platform/features/conductor/bundle.json
@@ -21,7 +21,13 @@
"depends": [ "now", "TIME_CONDUCTOR_DOMAINS" ]
}
],
- "contants": [
+ "templates": [
+ {
+ "key": "time-conductor",
+ "templateUrl": "templates/time-conductor.html"
+ }
+ ],
+ "constants": [
{
"key": "TIME_CONDUCTOR_DOMAINS",
"value": [
diff --git a/platform/features/conductor/res/templates/time-conductor.html b/platform/features/conductor/res/templates/time-conductor.html
new file mode 100644
index 0000000000..c597bf33c3
--- /dev/null
+++ b/platform/features/conductor/res/templates/time-conductor.html
@@ -0,0 +1,8 @@
+
+
+
+
diff --git a/platform/features/conductor/src/ConductorRepresenter.js b/platform/features/conductor/src/ConductorRepresenter.js
index b1b35477b6..9ca7d4f228 100644
--- a/platform/features/conductor/src/ConductorRepresenter.js
+++ b/platform/features/conductor/src/ConductorRepresenter.js
@@ -32,7 +32,7 @@ define(
'"position: absolute; bottom: 0; width: 100%; ',
'overflow: hidden; ',
'height: ' + CONDUCTOR_HEIGHT + '">',
- "",
+ "",
"",
''
].join(''),
@@ -68,8 +68,8 @@ define(
// Update the time conductor from the scope
function wireScope(conductor, conductorScope, repScope) {
function updateConductorOuter() {
- conductor.queryStart(conductorScope.conductor.outer.start);
- conductor.queryEnd(conductorScope.conductor.outer.end);
+ conductor.queryStart(conductorScope.ngModel.conductor.outer.start);
+ conductor.queryEnd(conductorScope.ngModel.conductor.outer.end);
repScope.$broadcast(
'telemetry:query:bounds',
bounds(conductor.queryStart(), conductor.queryEnd())
@@ -77,27 +77,49 @@ define(
}
function updateConductorInner() {
- conductor.displayStart(conductorScope.conductor.inner.start);
- conductor.displayEnd(conductorScope.conductor.inner.end);
+ conductor.displayStart(conductorScope.ngModel.conductor.inner.start);
+ conductor.displayEnd(conductorScope.ngModel.conductor.inner.end);
repScope.$broadcast(
'telemetry:display:bounds',
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()),
inner: bounds(conductor.displayStart(), conductor.displayEnd())
};
+ conductorScope.ngModel.options =
+ conductor.domainOptions().map(makeOption);
+ conductorScope.ngModel.domain = conductor.activeDomain();
conductorScope
- .$watch('conductor.outer.start', updateConductorOuter);
+ .$watch('ngModel.conductor.outer.start', updateConductorOuter);
conductorScope
- .$watch('conductor.outer.end', updateConductorOuter);
+ .$watch('ngModel.conductor.outer.end', updateConductorOuter);
conductorScope
- .$watch('conductor.inner.start', updateConductorInner);
+ .$watch('ngModel.conductor.inner.start', updateConductorInner);
conductorScope
- .$watch('conductor.inner.end', updateConductorInner);
+ .$watch('ngModel.conductor.inner.end', updateConductorInner);
+ conductorScope
+ .$watch('ngModel.domain', updateDomain);
repScope.$on('telemetry:view', updateConductorInner);
}
diff --git a/platform/features/conductor/src/TimeConductor.js b/platform/features/conductor/src/TimeConductor.js
index 3ce9c369ff..b8e07d051d 100644
--- a/platform/features/conductor/src/TimeConductor.js
+++ b/platform/features/conductor/src/TimeConductor.js
@@ -44,7 +44,7 @@ define(
this.inner = { start: start, end: end };
this.outer = { start: start, end: end };
this.domains = domains;
- this.domain = domains[0];
+ this.domain = domains[0].key;
}
/**
@@ -111,13 +111,15 @@ define(
* @returns {TelemetryDomain} the active telemetry domain
*/
TimeConductor.prototype.activeDomain = function (key) {
- var i;
+ function matchesKey(domain) {
+ return domain.key === key;
+ }
+
if (arguments.length > 0) {
- for (i = 0; i < this.domains.length; i += 1) {
- if (this.domains[i].key === key) {
- this.domain = this.domains[i];
- }
+ if (!this.domains.some(matchesKey)) {
+ throw new Error("Unknown domain " + key);
}
+ this.domain = key;
}
return this.domain;
};