mirror of
https://github.com/nasa/openmct.git
synced 2025-06-30 20:49:19 +00:00
Compare commits
1 Commits
remove-ang
...
time-condu
Author | SHA1 | Date | |
---|---|---|---|
45d4e96049 |
@ -39,6 +39,14 @@
|
|||||||
openmct.install(openmct.plugins.myItems);
|
openmct.install(openmct.plugins.myItems);
|
||||||
openmct.install(openmct.plugins.localStorage);
|
openmct.install(openmct.plugins.localStorage);
|
||||||
openmct.install(openmct.plugins.espresso);
|
openmct.install(openmct.plugins.espresso);
|
||||||
|
|
||||||
|
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||||
|
openmct.install(openmct.plugins.Conductor({
|
||||||
|
defaultTimeSystem: 'utc',
|
||||||
|
defaultTimespan: 30 * 60 * 1000,
|
||||||
|
showConductor: false
|
||||||
|
}));
|
||||||
|
|
||||||
openmct.start();
|
openmct.start();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -70,8 +70,9 @@ define([
|
|||||||
"$location",
|
"$location",
|
||||||
"openmct",
|
"openmct",
|
||||||
"timeConductorViewService",
|
"timeConductorViewService",
|
||||||
"timeSystems[]",
|
"formatService",
|
||||||
"formatService"
|
"DEFAULT_TIMECONDUCTOR_MODE",
|
||||||
|
"SHOW_TIMECONDUCTOR",
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -150,6 +151,13 @@ define([
|
|||||||
"link": "https://github.com/d3/d3/blob/master/LICENSE"
|
"link": "https://github.com/d3/d3/blob/master/LICENSE"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
"constants": [
|
||||||
|
{
|
||||||
|
"key": "DEFAULT_TIMECONDUCTOR_MODE",
|
||||||
|
"value": "realtime",
|
||||||
|
"priority": "fallback"
|
||||||
|
}
|
||||||
|
],
|
||||||
"formats": [
|
"formats": [
|
||||||
{
|
{
|
||||||
"key": "number",
|
"key": "number",
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
<!-- Parent holder for time conductor. follow-mode | fixed-mode -->
|
<!-- Parent holder for time conductor. follow-mode | fixed-mode -->
|
||||||
<div ng-controller="TimeConductorController as tcController"
|
<div ng-controller="TimeConductorController as tcController"
|
||||||
class="holder grows flex-elem l-flex-row l-time-conductor {{modeModel.selectedKey}}-mode {{timeSystemModel.selected.metadata.key}}-time-system"
|
class="holder grows flex-elem l-flex-row l-time-conductor {{modeModel.selectedKey}}-mode {{timeSystemModel.selected.metadata.key}}-time-system"
|
||||||
ng-class="{'status-panning': tcController.panning}">
|
ng-class="{'status-panning': tcController.panning}" ng-show="showTimeConductor">
|
||||||
|
|
||||||
<div class="flex-elem holder time-conductor-icon">
|
<div class="flex-elem holder time-conductor-icon">
|
||||||
<div class="hand-little"></div>
|
<div class="hand-little"></div>
|
||||||
<div class="hand-big"></div>
|
<div class="hand-big"></div>
|
||||||
|
@ -40,7 +40,16 @@ define(
|
|||||||
* @memberof platform.features.conductor
|
* @memberof platform.features.conductor
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TimeConductorController($scope, $window, $location, openmct, conductorViewService, timeSystems, formatService) {
|
function TimeConductorController(
|
||||||
|
$scope,
|
||||||
|
$window,
|
||||||
|
$location,
|
||||||
|
openmct,
|
||||||
|
conductorViewService,
|
||||||
|
formatService,
|
||||||
|
DEFAULT_MODE,
|
||||||
|
SHOW_TIMECONDUCTOR
|
||||||
|
) {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
@ -59,11 +68,10 @@ define(
|
|||||||
this.modes = conductorViewService.availableModes();
|
this.modes = conductorViewService.availableModes();
|
||||||
this.validation = new TimeConductorValidation(this.conductor);
|
this.validation = new TimeConductorValidation(this.conductor);
|
||||||
this.formatService = formatService;
|
this.formatService = formatService;
|
||||||
|
this.DEFAULT_MODE = DEFAULT_MODE;
|
||||||
|
|
||||||
// Construct the provided time system definitions
|
// Construct the provided time system definitions
|
||||||
this.timeSystems = timeSystems.map(function (timeSystemConstructor) {
|
this.timeSystems = conductorViewService.systems;
|
||||||
return timeSystemConstructor();
|
|
||||||
});
|
|
||||||
|
|
||||||
this.initializeScope();
|
this.initializeScope();
|
||||||
var searchParams = JSON.parse(JSON.stringify(this.$location.search()));
|
var searchParams = JSON.parse(JSON.stringify(this.$location.search()));
|
||||||
@ -94,6 +102,8 @@ define(
|
|||||||
//Respond to any subsequent conductor changes
|
//Respond to any subsequent conductor changes
|
||||||
this.conductor.on('bounds', this.changeBounds);
|
this.conductor.on('bounds', this.changeBounds);
|
||||||
this.conductor.on('timeSystem', this.changeTimeSystem);
|
this.conductor.on('timeSystem', this.changeTimeSystem);
|
||||||
|
|
||||||
|
this.$scope.showTimeConductor = SHOW_TIMECONDUCTOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -139,7 +149,7 @@ define(
|
|||||||
//Set mode from url if changed
|
//Set mode from url if changed
|
||||||
if (searchParams[SEARCH.MODE] === undefined ||
|
if (searchParams[SEARCH.MODE] === undefined ||
|
||||||
searchParams[SEARCH.MODE] !== this.$scope.modeModel.selectedKey) {
|
searchParams[SEARCH.MODE] !== this.$scope.modeModel.selectedKey) {
|
||||||
this.setMode(searchParams[SEARCH.MODE] || "fixed");
|
this.setMode(searchParams[SEARCH.MODE] || this.DEFAULT_MODE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (searchParams[SEARCH.TIME_SYSTEM] &&
|
if (searchParams[SEARCH.TIME_SYSTEM] &&
|
||||||
|
@ -34,23 +34,7 @@ define([
|
|||||||
"implementation": UTCTimeSystem,
|
"implementation": UTCTimeSystem,
|
||||||
"depends": ["$timeout"]
|
"depends": ["$timeout"]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"runs": [
|
|
||||||
{
|
|
||||||
"implementation": function (openmct, $timeout) {
|
|
||||||
// Temporary shim to initialize the time conductor to
|
|
||||||
// something
|
|
||||||
if (!openmct.conductor.timeSystem()) {
|
|
||||||
var utcTimeSystem = new UTCTimeSystem($timeout);
|
|
||||||
|
|
||||||
openmct.conductor.timeSystem(utcTimeSystem, utcTimeSystem.defaults().bounds);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"depends": ["openmct", "$timeout"],
|
|
||||||
"priority": "fallback"
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -48,6 +48,7 @@ define([
|
|||||||
|
|
||||||
this.fmts = ['utc'];
|
this.fmts = ['utc'];
|
||||||
this.sources = [new LocalClock($timeout, DEFAULT_PERIOD)];
|
this.sources = [new LocalClock($timeout, DEFAULT_PERIOD)];
|
||||||
|
this.defaultValues = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
UTCTimeSystem.prototype = Object.create(TimeSystem.prototype);
|
UTCTimeSystem.prototype = Object.create(TimeSystem.prototype);
|
||||||
@ -64,18 +65,25 @@ define([
|
|||||||
return this.sources;
|
return this.sources;
|
||||||
};
|
};
|
||||||
|
|
||||||
UTCTimeSystem.prototype.defaults = function () {
|
UTCTimeSystem.prototype.defaults = function (defaults) {
|
||||||
|
if (arguments.length > 0){
|
||||||
|
this.defaultValues = defaults;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.defaultValues === undefined) {
|
||||||
var now = Math.ceil(Date.now() / 1000) * 1000;
|
var now = Math.ceil(Date.now() / 1000) * 1000;
|
||||||
var ONE_MINUTE = 60 * 1 * 1000;
|
var ONE_MINUTE = 60 * 1 * 1000;
|
||||||
var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000;
|
var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000;
|
||||||
|
|
||||||
return {
|
this.defaultValues = {
|
||||||
key: 'utc-default',
|
key: 'utc-default',
|
||||||
name: 'UTC time system defaults',
|
name: 'UTC time system defaults',
|
||||||
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
||||||
bounds: {start: now - FIFTEEN_MINUTES, end: now},
|
bounds: {start: now - FIFTEEN_MINUTES, end: now},
|
||||||
zoom: {min: FIFTY_YEARS, max: ONE_MINUTE}
|
zoom: {min: FIFTY_YEARS, max: ONE_MINUTE}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
return this.defaultValues;
|
||||||
};
|
};
|
||||||
|
|
||||||
return UTCTimeSystem;
|
return UTCTimeSystem;
|
||||||
|
@ -21,16 +21,19 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'lodash'
|
'lodash',
|
||||||
], function (_) {
|
'../../platform/features/conductor/utcTimeSystem/src/UTCTimeSystem'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
UTCTimeSystem
|
||||||
|
) {
|
||||||
var bundleMap = {
|
var bundleMap = {
|
||||||
couchDB: 'platform/persistence/couch',
|
couchDB: 'platform/persistence/couch',
|
||||||
elasticsearch: 'platform/persistence/elastic',
|
elasticsearch: 'platform/persistence/elastic',
|
||||||
espresso: 'platform/commonUI/themes/espresso',
|
espresso: 'platform/commonUI/themes/espresso',
|
||||||
localStorage: 'platform/persistence/local',
|
localStorage: 'platform/persistence/local',
|
||||||
myItems: 'platform/features/my-items',
|
myItems: 'platform/features/my-items',
|
||||||
snow: 'platform/commonUI/themes/snow',
|
snow: 'platform/commonUI/themes/snow'
|
||||||
utcTimeSystem: 'platform/features/conductor/utcTimeSystem'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
var plugins = _.mapValues(bundleMap, function (bundleName, pluginName) {
|
var plugins = _.mapValues(bundleMap, function (bundleName, pluginName) {
|
||||||
@ -39,6 +42,56 @@ define([
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
plugins.UTCTimeSystem = function () {
|
||||||
|
return function (openmct) {
|
||||||
|
openmct.legacyExtension("timeSystems", {
|
||||||
|
"implementation": UTCTimeSystem,
|
||||||
|
"depends": ["$timeout"]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
plugins.Conductor = function (options) {
|
||||||
|
if (!options) {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
return function (openmct) {
|
||||||
|
openmct.legacyExtension('constants', {
|
||||||
|
key: 'DEFAULT_TIMECONDUCTOR_MODE',
|
||||||
|
value: options.showConductor ? 'fixed' : 'realtime',
|
||||||
|
priority: 'mandatory'
|
||||||
|
});
|
||||||
|
openmct.legacyExtension('constants', {
|
||||||
|
key: 'SHOW_TIMECONDUCTOR',
|
||||||
|
value: options.showConductor,
|
||||||
|
priority: 'mandatory'
|
||||||
|
});
|
||||||
|
if (options.defaultTimeSystem !== undefined || options.defaultTimespan !== undefined) {
|
||||||
|
openmct.legacyExtension('runs', {
|
||||||
|
implementation: function (openmct, $timeout, timeConductorViewService) {
|
||||||
|
var timeSystem = timeConductorViewService.systems.find(function (ts) {
|
||||||
|
return ts.metadata.key === options.defaultTimeSystem;
|
||||||
|
});
|
||||||
|
if (options.defaultTimespan !== undefined && timeSystem !== undefined) {
|
||||||
|
var defaults = timeSystem.defaults();
|
||||||
|
defaults.deltas.start = options.defaultTimespan;
|
||||||
|
defaults.bounds.start = defaults.bounds.end - options.defaultTimespan;
|
||||||
|
timeSystem.defaults(defaults);
|
||||||
|
}
|
||||||
|
if (timeSystem!== undefined) {
|
||||||
|
openmct.conductor.timeSystem(timeSystem, defaults.bounds);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
depends: ["openmct", "$timeout", "timeConductorViewService"]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
openmct.legacyRegistry.enable('platform/features/conductor/core');
|
||||||
|
openmct.legacyRegistry.enable('platform/features/conductor/compatibility');
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
plugins.CouchDB = function (url) {
|
plugins.CouchDB = function (url) {
|
||||||
return function (openmct) {
|
return function (openmct) {
|
||||||
if (url) {
|
if (url) {
|
||||||
|
Reference in New Issue
Block a user