mirror of
https://github.com/nasa/openmct.git
synced 2024-12-20 21:53:08 +00:00
Use key to retrieve default
This commit is contained in:
parent
af7954c5a1
commit
46e644e6dc
@ -67,23 +67,14 @@ define([
|
||||
return this._tickSources;
|
||||
};
|
||||
|
||||
LocalTimeSystem.prototype.defaults = function () {
|
||||
LocalTimeSystem.prototype.defaults = function (key) {
|
||||
var now = Math.ceil(Date.now() / 1000) * 1000;
|
||||
return [
|
||||
{
|
||||
key: 'local-default',
|
||||
name: 'Local 12 hour time system defaults',
|
||||
mode: 'fixed',
|
||||
bounds: {start: now - ONE_HOUR, end: now}
|
||||
},
|
||||
{
|
||||
key: 'local-default',
|
||||
name: 'Local 12 hour time system defaults',
|
||||
mode: 'follow',
|
||||
deltas: {start: THIRTY_MINUTES, end: 0},
|
||||
bounds: {start: now - THIRTY_MINUTES, end: now}
|
||||
}
|
||||
];
|
||||
return {
|
||||
key: 'local-default',
|
||||
name: 'Local 12 hour time system defaults',
|
||||
deltas: {start: THIRTY_MINUTES, end: 0},
|
||||
bounds: {start: now - THIRTY_MINUTES, end: now}
|
||||
};
|
||||
};
|
||||
|
||||
return LocalTimeSystem;
|
||||
|
@ -206,7 +206,7 @@ define(
|
||||
return source.type() === sourceType;
|
||||
})[0];
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Change the selected Time Conductor mode. This will call destroy
|
||||
* and initialization functions on the relevant modes, setting
|
||||
|
@ -43,16 +43,6 @@ define(
|
||||
this.conductor.follow(false);
|
||||
};
|
||||
|
||||
FixedMode.prototype.defaults = function () {
|
||||
var timeSystem = this.timeSystem();
|
||||
|
||||
if (timeSystem){
|
||||
return timeSystem.defaults().filter(function (d) {
|
||||
return d.mode === 'fixed';
|
||||
})[0];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Defines behavior to occur when selected time system changes. In
|
||||
* this case, sets default bounds on the time conductor.
|
||||
|
@ -77,16 +77,6 @@ define(
|
||||
return this._tickSource;
|
||||
};
|
||||
|
||||
FollowMode.prototype.defaults = function () {
|
||||
var timeSystem = this.timeSystem();
|
||||
|
||||
if (timeSystem){
|
||||
return timeSystem.defaults().filter(function (d) {
|
||||
return d.mode === 'follow';
|
||||
})[0];
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* On time system change, default the bounds values in the time
|
||||
* conductor, using the deltas associated with this mode.
|
||||
|
@ -63,7 +63,12 @@ define(
|
||||
};
|
||||
|
||||
TimeConductorMode.prototype.defaults = function () {
|
||||
throw new Error("Not implemented");
|
||||
var timeSystem = this.timeSystem(),
|
||||
key = this.key();
|
||||
|
||||
if (timeSystem) {
|
||||
return timeSystem.defaults(key);
|
||||
}
|
||||
};
|
||||
|
||||
TimeConductorMode.prototype.destroy = function () {
|
||||
|
@ -64,23 +64,14 @@ define([
|
||||
return this._tickSources;
|
||||
};
|
||||
|
||||
UTCTimeSystem.prototype.defaults = function () {
|
||||
UTCTimeSystem.prototype.defaults = function (key) {
|
||||
var now = Math.ceil(Date.now() / 1000) * 1000;
|
||||
return [
|
||||
{
|
||||
key: 'utc-default',
|
||||
name: 'UTC time system defaults',
|
||||
mode: 'follow',
|
||||
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
||||
bounds: {start: now - FIFTEEN_MINUTES, end: now}
|
||||
},
|
||||
{
|
||||
key: 'utc-default',
|
||||
name: 'UTC time system defaults',
|
||||
mode: 'fixed',
|
||||
bounds: {start: now - FIFTEEN_MINUTES, end: now}
|
||||
}
|
||||
];
|
||||
return {
|
||||
key: 'utc-default',
|
||||
name: 'UTC time system defaults',
|
||||
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
||||
bounds: {start: now - FIFTEEN_MINUTES, end: now}
|
||||
};
|
||||
};
|
||||
|
||||
return UTCTimeSystem;
|
||||
|
Loading…
Reference in New Issue
Block a user