mirror of
https://github.com/nasa/openmct.git
synced 2025-06-25 10:44:21 +00:00
Compare commits
1 Commits
vue-table-
...
time-condu
Author | SHA1 | Date | |
---|---|---|---|
45d4e96049 |
@ -39,6 +39,14 @@
|
||||
openmct.install(openmct.plugins.myItems);
|
||||
openmct.install(openmct.plugins.localStorage);
|
||||
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();
|
||||
});
|
||||
</script>
|
||||
|
@ -70,8 +70,9 @@ define([
|
||||
"$location",
|
||||
"openmct",
|
||||
"timeConductorViewService",
|
||||
"timeSystems[]",
|
||||
"formatService"
|
||||
"formatService",
|
||||
"DEFAULT_TIMECONDUCTOR_MODE",
|
||||
"SHOW_TIMECONDUCTOR",
|
||||
]
|
||||
},
|
||||
{
|
||||
@ -150,6 +151,13 @@ define([
|
||||
"link": "https://github.com/d3/d3/blob/master/LICENSE"
|
||||
}
|
||||
],
|
||||
"constants": [
|
||||
{
|
||||
"key": "DEFAULT_TIMECONDUCTOR_MODE",
|
||||
"value": "realtime",
|
||||
"priority": "fallback"
|
||||
}
|
||||
],
|
||||
"formats": [
|
||||
{
|
||||
"key": "number",
|
||||
|
@ -1,8 +1,7 @@
|
||||
<!-- Parent holder for time conductor. follow-mode | fixed-mode -->
|
||||
<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"
|
||||
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="hand-little"></div>
|
||||
<div class="hand-big"></div>
|
||||
|
@ -40,7 +40,16 @@ define(
|
||||
* @memberof platform.features.conductor
|
||||
* @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;
|
||||
|
||||
@ -59,11 +68,10 @@ define(
|
||||
this.modes = conductorViewService.availableModes();
|
||||
this.validation = new TimeConductorValidation(this.conductor);
|
||||
this.formatService = formatService;
|
||||
this.DEFAULT_MODE = DEFAULT_MODE;
|
||||
|
||||
// Construct the provided time system definitions
|
||||
this.timeSystems = timeSystems.map(function (timeSystemConstructor) {
|
||||
return timeSystemConstructor();
|
||||
});
|
||||
this.timeSystems = conductorViewService.systems;
|
||||
|
||||
this.initializeScope();
|
||||
var searchParams = JSON.parse(JSON.stringify(this.$location.search()));
|
||||
@ -94,6 +102,8 @@ define(
|
||||
//Respond to any subsequent conductor changes
|
||||
this.conductor.on('bounds', this.changeBounds);
|
||||
this.conductor.on('timeSystem', this.changeTimeSystem);
|
||||
|
||||
this.$scope.showTimeConductor = SHOW_TIMECONDUCTOR;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -139,7 +149,7 @@ define(
|
||||
//Set mode from url if changed
|
||||
if (searchParams[SEARCH.MODE] === undefined ||
|
||||
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] &&
|
||||
|
@ -34,23 +34,7 @@ define([
|
||||
"implementation": UTCTimeSystem,
|
||||
"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.sources = [new LocalClock($timeout, DEFAULT_PERIOD)];
|
||||
this.defaultValues = undefined;
|
||||
}
|
||||
|
||||
UTCTimeSystem.prototype = Object.create(TimeSystem.prototype);
|
||||
@ -64,18 +65,25 @@ define([
|
||||
return this.sources;
|
||||
};
|
||||
|
||||
UTCTimeSystem.prototype.defaults = function () {
|
||||
var now = Math.ceil(Date.now() / 1000) * 1000;
|
||||
var ONE_MINUTE = 60 * 1 * 1000;
|
||||
var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000;
|
||||
UTCTimeSystem.prototype.defaults = function (defaults) {
|
||||
if (arguments.length > 0){
|
||||
this.defaultValues = defaults;
|
||||
}
|
||||
|
||||
return {
|
||||
key: 'utc-default',
|
||||
name: 'UTC time system defaults',
|
||||
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
||||
bounds: {start: now - FIFTEEN_MINUTES, end: now},
|
||||
zoom: {min: FIFTY_YEARS, max: ONE_MINUTE}
|
||||
};
|
||||
if (this.defaultValues === undefined) {
|
||||
var now = Math.ceil(Date.now() / 1000) * 1000;
|
||||
var ONE_MINUTE = 60 * 1 * 1000;
|
||||
var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000;
|
||||
|
||||
this.defaultValues = {
|
||||
key: 'utc-default',
|
||||
name: 'UTC time system defaults',
|
||||
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
||||
bounds: {start: now - FIFTEEN_MINUTES, end: now},
|
||||
zoom: {min: FIFTY_YEARS, max: ONE_MINUTE}
|
||||
}
|
||||
}
|
||||
return this.defaultValues;
|
||||
};
|
||||
|
||||
return UTCTimeSystem;
|
||||
|
@ -21,16 +21,19 @@
|
||||
*****************************************************************************/
|
||||
|
||||
define([
|
||||
'lodash'
|
||||
], function (_) {
|
||||
'lodash',
|
||||
'../../platform/features/conductor/utcTimeSystem/src/UTCTimeSystem'
|
||||
], function (
|
||||
_,
|
||||
UTCTimeSystem
|
||||
) {
|
||||
var bundleMap = {
|
||||
couchDB: 'platform/persistence/couch',
|
||||
elasticsearch: 'platform/persistence/elastic',
|
||||
espresso: 'platform/commonUI/themes/espresso',
|
||||
localStorage: 'platform/persistence/local',
|
||||
myItems: 'platform/features/my-items',
|
||||
snow: 'platform/commonUI/themes/snow',
|
||||
utcTimeSystem: 'platform/features/conductor/utcTimeSystem'
|
||||
snow: 'platform/commonUI/themes/snow'
|
||||
};
|
||||
|
||||
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) {
|
||||
return function (openmct) {
|
||||
if (url) {
|
||||
|
Reference in New Issue
Block a user