mirror of
https://github.com/nasa/openmct.git
synced 2025-05-07 02:58:30 +00:00
Enable TC by default and hide
Set up TC so that it is always enabled and defaults to realtime mode. This allows us to have warp-like functionality without showing the TC interface, and simplifies a lot of tutorials. We can still reconfigure the TC by re-installing the plugin with different settings
This commit is contained in:
parent
48a603ece8
commit
5cd0516048
@ -39,6 +39,7 @@
|
|||||||
openmct.install(openmct.plugins.LocalStorage());
|
openmct.install(openmct.plugins.LocalStorage());
|
||||||
openmct.install(openmct.plugins.Espresso());
|
openmct.install(openmct.plugins.Espresso());
|
||||||
openmct.install(openmct.plugins.Generator());
|
openmct.install(openmct.plugins.Generator());
|
||||||
|
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||||
openmct.start();
|
openmct.start();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -84,5 +84,11 @@ define([
|
|||||||
return new Main().run(defaultRegistry);
|
return new Main().run(defaultRegistry);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// For now, install conductor by default
|
||||||
|
openmct.install(openmct.plugins.Conductor({
|
||||||
|
showConductor: false
|
||||||
|
}));
|
||||||
|
|
||||||
|
|
||||||
return openmct;
|
return openmct;
|
||||||
});
|
});
|
||||||
|
@ -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;
|
||||||
|
|
||||||
@ -60,10 +69,14 @@ define(
|
|||||||
this.validation = new TimeConductorValidation(this.conductor);
|
this.validation = new TimeConductorValidation(this.conductor);
|
||||||
this.formatService = formatService;
|
this.formatService = formatService;
|
||||||
|
|
||||||
|
//Check if the default mode defined is actually available
|
||||||
|
if (this.modes[DEFAULT_MODE] === undefined) {
|
||||||
|
DEFAULT_MODE = 'fixed';
|
||||||
|
}
|
||||||
|
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 +107,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 +154,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] &&
|
||||||
|
@ -130,8 +130,10 @@ define(['./TimeConductorController'], function (TimeConductorController) {
|
|||||||
mockLocation,
|
mockLocation,
|
||||||
{conductor: mockTimeConductor},
|
{conductor: mockTimeConductor},
|
||||||
mockConductorViewService,
|
mockConductorViewService,
|
||||||
mockTimeSystems,
|
mockFormatService,
|
||||||
mockFormatService
|
'fixed',
|
||||||
|
true
|
||||||
|
|
||||||
);
|
);
|
||||||
|
|
||||||
tsListener = getListener(mockTimeConductor.on, "timeSystem");
|
tsListener = getListener(mockTimeConductor.on, "timeSystem");
|
||||||
@ -244,7 +246,6 @@ define(['./TimeConductorController'], function (TimeConductorController) {
|
|||||||
var ts1Metadata;
|
var ts1Metadata;
|
||||||
var ts2Metadata;
|
var ts2Metadata;
|
||||||
var ts3Metadata;
|
var ts3Metadata;
|
||||||
var mockTimeSystemConstructors;
|
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mode = "realtime";
|
mode = "realtime";
|
||||||
@ -276,11 +277,7 @@ define(['./TimeConductorController'], function (TimeConductorController) {
|
|||||||
];
|
];
|
||||||
|
|
||||||
//Wrap in mock constructors
|
//Wrap in mock constructors
|
||||||
mockTimeSystemConstructors = mockTimeSystems.map(function (mockTimeSystem) {
|
mockConductorViewService.systems = mockTimeSystems;
|
||||||
return function () {
|
|
||||||
return mockTimeSystem;
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
controller = new TimeConductorController(
|
controller = new TimeConductorController(
|
||||||
mockScope,
|
mockScope,
|
||||||
@ -288,8 +285,9 @@ define(['./TimeConductorController'], function (TimeConductorController) {
|
|||||||
mockLocation,
|
mockLocation,
|
||||||
{conductor: mockTimeConductor},
|
{conductor: mockTimeConductor},
|
||||||
mockConductorViewService,
|
mockConductorViewService,
|
||||||
mockTimeSystemConstructors,
|
mockFormatService,
|
||||||
mockFormatService
|
"fixed",
|
||||||
|
true
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -434,12 +432,7 @@ define(['./TimeConductorController'], function (TimeConductorController) {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
mockTimeSystems.push(function () {
|
mockConductorViewService.systems = [timeSystem, otherTimeSystem];
|
||||||
return timeSystem;
|
|
||||||
});
|
|
||||||
mockTimeSystems.push(function () {
|
|
||||||
return otherTimeSystem;
|
|
||||||
});
|
|
||||||
|
|
||||||
urlBounds = {
|
urlBounds = {
|
||||||
start: 100,
|
start: 100,
|
||||||
@ -467,8 +460,9 @@ define(['./TimeConductorController'], function (TimeConductorController) {
|
|||||||
mockLocation,
|
mockLocation,
|
||||||
{conductor: mockTimeConductor},
|
{conductor: mockTimeConductor},
|
||||||
mockConductorViewService,
|
mockConductorViewService,
|
||||||
mockTimeSystems,
|
mockFormatService,
|
||||||
mockFormatService
|
"fixed",
|
||||||
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
spyOn(controller, "setMode");
|
spyOn(controller, "setMode");
|
||||||
|
@ -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) {
|
||||||
var now = Math.ceil(Date.now() / 1000) * 1000;
|
if (arguments.length > 0) {
|
||||||
var ONE_MINUTE = 60 * 1 * 1000;
|
this.defaultValues = defaults;
|
||||||
var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000;
|
}
|
||||||
|
|
||||||
return {
|
if (this.defaultValues === undefined) {
|
||||||
key: 'utc-default',
|
var now = Math.ceil(Date.now() / 1000) * 1000;
|
||||||
name: 'UTC time system defaults',
|
var ONE_MINUTE = 60 * 1 * 1000;
|
||||||
deltas: {start: FIFTEEN_MINUTES, end: 0},
|
var FIFTY_YEARS = 50 * 365 * 24 * 60 * 60 * 1000;
|
||||||
bounds: {start: now - FIFTEEN_MINUTES, end: now},
|
|
||||||
zoom: {min: FIFTY_YEARS, max: ONE_MINUTE}
|
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;
|
return UTCTimeSystem;
|
||||||
|
@ -55,6 +55,59 @@ define([
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var conductorInstalled = false;
|
||||||
|
|
||||||
|
plugins.Conductor = function (options) {
|
||||||
|
if (!options) {
|
||||||
|
options = {};
|
||||||
|
}
|
||||||
|
|
||||||
|
function applyDefaults(openmct, timeConductorViewService) {
|
||||||
|
var defaults = {};
|
||||||
|
var timeSystem = timeConductorViewService.systems.find(function (ts) {
|
||||||
|
return ts.metadata.key === options.defaultTimeSystem;
|
||||||
|
});
|
||||||
|
if (timeSystem !== undefined) {
|
||||||
|
defaults = timeSystem.defaults();
|
||||||
|
|
||||||
|
if (options.defaultTimespan !== undefined) {
|
||||||
|
defaults.deltas.start = options.defaultTimespan;
|
||||||
|
defaults.bounds.start = defaults.bounds.end - options.defaultTimespan;
|
||||||
|
timeSystem.defaults(defaults);
|
||||||
|
}
|
||||||
|
|
||||||
|
openmct.conductor.timeSystem(timeSystem, defaults.bounds);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return function (openmct) {
|
||||||
|
openmct.legacyExtension('constants', {
|
||||||
|
key: 'DEFAULT_TIMECONDUCTOR_MODE',
|
||||||
|
value: options.showConductor ? 'fixed' : 'realtime',
|
||||||
|
priority: conductorInstalled ? 'mandatory' : 'fallback'
|
||||||
|
});
|
||||||
|
if (options.showConductor !== undefined) {
|
||||||
|
openmct.legacyExtension('constants', {
|
||||||
|
key: 'SHOW_TIMECONDUCTOR',
|
||||||
|
value: options.showConductor,
|
||||||
|
priority: conductorInstalled ? 'mandatory' : 'fallback'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (options.defaultTimeSystem !== undefined || options.defaultTimespan !== undefined) {
|
||||||
|
openmct.legacyExtension('runs', {
|
||||||
|
implementation: applyDefaults,
|
||||||
|
depends: ["openmct", "timeConductorViewService"]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conductorInstalled) {
|
||||||
|
openmct.legacyRegistry.enable('platform/features/conductor/core');
|
||||||
|
openmct.legacyRegistry.enable('platform/features/conductor/compatibility');
|
||||||
|
}
|
||||||
|
conductorInstalled = true;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
plugins.CouchDB = function (url) {
|
plugins.CouchDB = function (url) {
|
||||||
return function (openmct) {
|
return function (openmct) {
|
||||||
if (url) {
|
if (url) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user