mirror of
https://github.com/nasa/openmct.git
synced 2025-07-01 21:01:11 +00:00
Compare commits
13 Commits
time-condu
...
new-tutori
Author | SHA1 | Date | |
---|---|---|---|
9553e0c64f | |||
da40f4c96e | |||
6fa5a31217 | |||
5bc7a701dc | |||
5cd0516048 | |||
48a603ece8 | |||
abfa56464a | |||
c1d6e21c3c | |||
3bd556a406 | |||
347fb6d882 | |||
b3cf7a5d93 | |||
b10fb4533e | |||
77d0134e2e |
@ -41,6 +41,10 @@ define([
|
|||||||
return domainObject.type === 'generator';
|
return domainObject.type === 'generator';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
GeneratorProvider.prototype.supportsRequest =
|
||||||
|
GeneratorProvider.prototype.supportsSubscribe =
|
||||||
|
GeneratorProvider.prototype.canProvideTelemetry;
|
||||||
|
|
||||||
GeneratorProvider.prototype.makeWorkerRequest = function (domainObject, request) {
|
GeneratorProvider.prototype.makeWorkerRequest = function (domainObject, request) {
|
||||||
var props = [
|
var props = [
|
||||||
'amplitude',
|
'amplitude',
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*global define,Promise*/
|
/*global define*/
|
||||||
|
|
||||||
define({
|
define({
|
||||||
START_TIME: Date.now() - 24 * 60 * 60 * 1000 // Now minus a day.
|
START_TIME: Date.now() - 24 * 60 * 60 * 1000 // Now minus a day.
|
@ -19,12 +19,11 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
/*global define,Promise*/
|
/*global define*/
|
||||||
|
|
||||||
define(
|
define(
|
||||||
['./SinewaveConstants', 'moment'],
|
['./SinewaveConstants', 'moment'],
|
||||||
function (SinewaveConstants, moment) {
|
function (SinewaveConstants, moment) {
|
||||||
"use strict";
|
|
||||||
|
|
||||||
var START_TIME = SinewaveConstants.START_TIME,
|
var START_TIME = SinewaveConstants.START_TIME,
|
||||||
FORMAT_REGEX = /^-?\d+:\d+:\d+$/,
|
FORMAT_REGEX = /^-?\d+:\d+:\d+$/,
|
@ -1,184 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* Open MCT, Copyright (c) 2014-2016, United States Government
|
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
|
||||||
* Administration. All rights reserved.
|
|
||||||
*
|
|
||||||
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* Open MCT includes source code licensed under additional open source
|
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
||||||
* this source code distribution or the Licensing information page available
|
|
||||||
* at runtime from the About dialog for additional information.
|
|
||||||
*****************************************************************************/
|
|
||||||
/*global define*/
|
|
||||||
|
|
||||||
define([
|
|
||||||
"./src/SinewaveTelemetryProvider",
|
|
||||||
"./src/SinewaveLimitCapability",
|
|
||||||
"./src/SinewaveDeltaFormat",
|
|
||||||
'legacyRegistry'
|
|
||||||
], function (
|
|
||||||
SinewaveTelemetryProvider,
|
|
||||||
SinewaveLimitCapability,
|
|
||||||
SinewaveDeltaFormat,
|
|
||||||
legacyRegistry
|
|
||||||
) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
legacyRegistry.register("example/generator", {
|
|
||||||
"name": "Sine Wave Generator",
|
|
||||||
"description": "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
|
|
||||||
"extensions": {
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"implementation": SinewaveTelemetryProvider,
|
|
||||||
"type": "provider",
|
|
||||||
"provides": "telemetryService",
|
|
||||||
"depends": [
|
|
||||||
"$q",
|
|
||||||
"$timeout"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"capabilities": [
|
|
||||||
{
|
|
||||||
"key": "limit",
|
|
||||||
"implementation": SinewaveLimitCapability
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"formats": [
|
|
||||||
{
|
|
||||||
"key": "example.delta",
|
|
||||||
"implementation": SinewaveDeltaFormat
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"constants": [
|
|
||||||
{
|
|
||||||
"key": "TIME_CONDUCTOR_DOMAINS",
|
|
||||||
"value": [
|
|
||||||
{
|
|
||||||
"key": "time",
|
|
||||||
"name": "Time"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "yesterday",
|
|
||||||
"name": "Yesterday"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "delta",
|
|
||||||
"name": "Delta"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"priority": -1
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"types": [
|
|
||||||
{
|
|
||||||
"key": "generator",
|
|
||||||
"name": "Sine Wave Generator",
|
|
||||||
"cssClass": "icon-telemetry",
|
|
||||||
"description": "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
|
|
||||||
"priority": 10,
|
|
||||||
"features": "creation",
|
|
||||||
"model": {
|
|
||||||
"telemetry": {
|
|
||||||
"period": 10,
|
|
||||||
"amplitude": 1,
|
|
||||||
"offset": 0,
|
|
||||||
"dataRateInHz": 1
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"telemetry": {
|
|
||||||
"source": "generator",
|
|
||||||
"domains": [
|
|
||||||
{
|
|
||||||
"key": "utc",
|
|
||||||
"name": "Time",
|
|
||||||
"format": "utc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "yesterday",
|
|
||||||
"name": "Yesterday",
|
|
||||||
"format": "utc"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "delta",
|
|
||||||
"name": "Delta",
|
|
||||||
"format": "example.delta"
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"ranges": [
|
|
||||||
{
|
|
||||||
"key": "sin",
|
|
||||||
"name": "Sine"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"key": "cos",
|
|
||||||
"name": "Cosine"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"properties": [
|
|
||||||
{
|
|
||||||
"name": "Period",
|
|
||||||
"control": "textfield",
|
|
||||||
"cssClass": "l-input-sm l-numeric",
|
|
||||||
"key": "period",
|
|
||||||
"required": true,
|
|
||||||
"property": [
|
|
||||||
"telemetry",
|
|
||||||
"period"
|
|
||||||
],
|
|
||||||
"pattern": "^\\d*(\\.\\d*)?$"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Amplitude",
|
|
||||||
"control": "textfield",
|
|
||||||
"cssClass": "l-input-sm l-numeric",
|
|
||||||
"key": "amplitude",
|
|
||||||
"required": true,
|
|
||||||
"property": [
|
|
||||||
"telemetry",
|
|
||||||
"amplitude"
|
|
||||||
],
|
|
||||||
"pattern": "^\\d*(\\.\\d*)?$"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Offset",
|
|
||||||
"control": "textfield",
|
|
||||||
"cssClass": "l-input-sm l-numeric",
|
|
||||||
"key": "offset",
|
|
||||||
"required": true,
|
|
||||||
"property": [
|
|
||||||
"telemetry",
|
|
||||||
"offset"
|
|
||||||
],
|
|
||||||
"pattern": "^\\d*(\\.\\d*)?$"
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"name": "Data Rate (hz)",
|
|
||||||
"control": "textfield",
|
|
||||||
"cssClass": "l-input-sm l-numeric",
|
|
||||||
"key": "dataRateInHz",
|
|
||||||
"required": true,
|
|
||||||
"property": [
|
|
||||||
"telemetry",
|
|
||||||
"dataRateInHz"
|
|
||||||
],
|
|
||||||
"pattern": "^\\d*(\\.\\d*)?$"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
171
example/generator/plugin.js
Normal file
171
example/generator/plugin.js
Normal file
@ -0,0 +1,171 @@
|
|||||||
|
/*****************************************************************************
|
||||||
|
* Open MCT, Copyright (c) 2014-2016, United States Government
|
||||||
|
* as represented by the Administrator of the National Aeronautics and Space
|
||||||
|
* Administration. All rights reserved.
|
||||||
|
*
|
||||||
|
* Open MCT is licensed under the Apache License, Version 2.0 (the
|
||||||
|
* "License"); you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0.
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
|
* License for the specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*
|
||||||
|
* Open MCT includes source code licensed under additional open source
|
||||||
|
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
||||||
|
* this source code distribution or the Licensing information page available
|
||||||
|
* at runtime from the About dialog for additional information.
|
||||||
|
*****************************************************************************/
|
||||||
|
/*global define*/
|
||||||
|
|
||||||
|
define([
|
||||||
|
"./GeneratorProvider",
|
||||||
|
"./SinewaveLimitCapability",
|
||||||
|
"./SinewaveDeltaFormat"
|
||||||
|
], function (
|
||||||
|
GeneratorProvider,
|
||||||
|
SinewaveLimitCapability,
|
||||||
|
SinewaveDeltaFormat
|
||||||
|
) {
|
||||||
|
|
||||||
|
var legacyExtensions = {
|
||||||
|
"capabilities": [
|
||||||
|
{
|
||||||
|
"key": "limit",
|
||||||
|
"implementation": SinewaveLimitCapability
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"formats": [
|
||||||
|
{
|
||||||
|
"key": "example.delta",
|
||||||
|
"implementation": SinewaveDeltaFormat
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"constants": [
|
||||||
|
{
|
||||||
|
"key": "TIME_CONDUCTOR_DOMAINS",
|
||||||
|
"value": [
|
||||||
|
{
|
||||||
|
"key": "time",
|
||||||
|
"name": "Time"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "yesterday",
|
||||||
|
"name": "Yesterday"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "delta",
|
||||||
|
"name": "Delta"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"priority": -1
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
|
||||||
|
return function(openmct){
|
||||||
|
//Register legacy extensions for things not yet supported by the new API
|
||||||
|
Object.keys(legacyExtensions).forEach(function (type){
|
||||||
|
var extensionsOfType = legacyExtensions[type];
|
||||||
|
extensionsOfType.forEach(function (extension) {
|
||||||
|
openmct.legacyExtension(type, extension)
|
||||||
|
})
|
||||||
|
});
|
||||||
|
openmct.types.addType("generator", {
|
||||||
|
label: "Sine Wave Generator",
|
||||||
|
description: "For development use. Generates example streaming telemetry data using a simple sine wave algorithm.",
|
||||||
|
cssClass: "icon-telemetry",
|
||||||
|
creatable: true,
|
||||||
|
form: [
|
||||||
|
{
|
||||||
|
name: "Period",
|
||||||
|
control: "textfield",
|
||||||
|
cssClass: "l-input-sm l-numeric",
|
||||||
|
key: "period",
|
||||||
|
required: true,
|
||||||
|
property: [
|
||||||
|
"telemetry",
|
||||||
|
"period"
|
||||||
|
],
|
||||||
|
pattern: "^\\d*(\\.\\d*)?$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Amplitude",
|
||||||
|
control: "textfield",
|
||||||
|
cssClass: "l-input-sm l-numeric",
|
||||||
|
key: "amplitude",
|
||||||
|
required: true,
|
||||||
|
property: [
|
||||||
|
"telemetry",
|
||||||
|
"amplitude"
|
||||||
|
],
|
||||||
|
pattern: "^\\d*(\\.\\d*)?$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Offset",
|
||||||
|
control: "textfield",
|
||||||
|
cssClass: "l-input-sm l-numeric",
|
||||||
|
key: "offset",
|
||||||
|
required: true,
|
||||||
|
property: [
|
||||||
|
"telemetry",
|
||||||
|
"offset"
|
||||||
|
],
|
||||||
|
pattern: "^\\d*(\\.\\d*)?$"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: "Data Rate (hz)",
|
||||||
|
control: "textfield",
|
||||||
|
cssClass: "l-input-sm l-numeric",
|
||||||
|
key: "dataRateInHz",
|
||||||
|
required: true,
|
||||||
|
property: [
|
||||||
|
"telemetry",
|
||||||
|
"dataRateInHz"
|
||||||
|
],
|
||||||
|
pattern: "^\\d*(\\.\\d*)?$"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
initialize: function (object) {
|
||||||
|
object.telemetry = {
|
||||||
|
period: 10,
|
||||||
|
amplitude: 1,
|
||||||
|
offset: 0,
|
||||||
|
dataRateInHz: 1,
|
||||||
|
domains: [
|
||||||
|
{
|
||||||
|
key: "utc",
|
||||||
|
name: "Time",
|
||||||
|
format: "utc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "yesterday",
|
||||||
|
name: "Yesterday",
|
||||||
|
format: "utc"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "delta",
|
||||||
|
name: "Delta",
|
||||||
|
format: "example.delta"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
ranges: [
|
||||||
|
{
|
||||||
|
key: "sin",
|
||||||
|
name: "Sine"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
key: "cos",
|
||||||
|
name: "Cosine"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
|
openmct.telemetry.addProvider(new GeneratorProvider());
|
||||||
|
};
|
||||||
|
|
||||||
|
});
|
22
index.html
22
index.html
@ -25,20 +25,32 @@
|
|||||||
<meta charset="utf-8">
|
<meta charset="utf-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
|
||||||
<title></title>
|
<title></title>
|
||||||
|
<script src="openmct-tutorial/lib/http.js">
|
||||||
|
</script>
|
||||||
<script src="bower_components/requirejs/require.js">
|
<script src="bower_components/requirejs/require.js">
|
||||||
</script>
|
</script>
|
||||||
|
<script src="openmct-tutorial/dictionary-plugin.js">
|
||||||
|
</script>
|
||||||
|
<script src="openmct-tutorial/realtime-telemetry-plugin.js">
|
||||||
|
</script>
|
||||||
|
<script src="openmct-tutorial/historical-telemetry-plugin.js">
|
||||||
|
</script>
|
||||||
<script>
|
<script>
|
||||||
require(['openmct'], function (openmct) {
|
require(['openmct'], function (openmct) {
|
||||||
[
|
[
|
||||||
'example/imagery',
|
'example/imagery',
|
||||||
'example/eventGenerator',
|
'example/eventGenerator'
|
||||||
'example/generator'
|
|
||||||
].forEach(
|
].forEach(
|
||||||
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
openmct.legacyRegistry.enable.bind(openmct.legacyRegistry)
|
||||||
);
|
);
|
||||||
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.Generator());
|
||||||
|
openmct.install(openmct.plugins.UTCTimeSystem());
|
||||||
|
openmct.install(DictionaryPlugin());
|
||||||
|
openmct.install(RealtimeTelemetryPlugin());
|
||||||
|
openmct.install(HistoricalTelemetryPlugin());
|
||||||
openmct.start();
|
openmct.start();
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
1
openmct-tutorial
Submodule
1
openmct-tutorial
Submodule
Submodule openmct-tutorial added at 7076a15d3a
@ -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;
|
||||||
});
|
});
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
@import "logo-and-bg";
|
@import "logo-and-bg";
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
|
|
||||||
@import "../../../../general/res/sass/_mixins";
|
@import "../../../../general/res/sass/_mixins";
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
|
|
||||||
@import "../../../../general/res/sass/_mixins";
|
@import "../../../../general/res/sass/_mixins";
|
||||||
|
@ -21,11 +21,9 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
"./src/ConductorTelemetryDecorator",
|
|
||||||
"./src/ConductorRepresenter",
|
"./src/ConductorRepresenter",
|
||||||
'legacyRegistry'
|
'legacyRegistry'
|
||||||
], function (
|
], function (
|
||||||
ConductorTelemetryDecorator,
|
|
||||||
ConductorRepresenter,
|
ConductorRepresenter,
|
||||||
legacyRegistry
|
legacyRegistry
|
||||||
) {
|
) {
|
||||||
@ -39,16 +37,6 @@ define([
|
|||||||
"openmct"
|
"openmct"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
],
|
|
||||||
"components": [
|
|
||||||
{
|
|
||||||
"type": "decorator",
|
|
||||||
"provides": "telemetryService",
|
|
||||||
"implementation": ConductorTelemetryDecorator,
|
|
||||||
"depends": [
|
|
||||||
"openmct"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -1,87 +0,0 @@
|
|||||||
/*****************************************************************************
|
|
||||||
* Open MCT Web, Copyright (c) 2014-2015, United States Government
|
|
||||||
* as represented by the Administrator of the National Aeronautics and Space
|
|
||||||
* Administration. All rights reserved.
|
|
||||||
*
|
|
||||||
* Open MCT Web is licensed under the Apache License, Version 2.0 (the
|
|
||||||
* "License"); you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0.
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
||||||
* License for the specific language governing permissions and limitations
|
|
||||||
* under the License.
|
|
||||||
*
|
|
||||||
* Open MCT Web includes source code licensed under additional open source
|
|
||||||
* licenses. See the Open Source Licenses file (LICENSES.md) included with
|
|
||||||
* this source code distribution or the Licensing information page available
|
|
||||||
* at runtime from the About dialog for additional information.
|
|
||||||
*****************************************************************************/
|
|
||||||
|
|
||||||
define(
|
|
||||||
function () {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Decorates the `telemetryService` such that requests are
|
|
||||||
* mediated by the time conductor. This is a modified version of the
|
|
||||||
* decorator used in the old TimeConductor that integrates with the
|
|
||||||
* new TimeConductor API.
|
|
||||||
*
|
|
||||||
* @constructor
|
|
||||||
* @memberof platform/features/conductor
|
|
||||||
* @implements {TelemetryService}
|
|
||||||
* @param {platform/features/conductor.TimeConductor} conductor
|
|
||||||
* the service which exposes the global time conductor
|
|
||||||
* @param {TelemetryService} telemetryService the decorated service
|
|
||||||
*/
|
|
||||||
function ConductorTelemetryDecorator(openmct, telemetryService) {
|
|
||||||
this.conductor = openmct.conductor;
|
|
||||||
this.telemetryService = telemetryService;
|
|
||||||
|
|
||||||
this.amendRequests = ConductorTelemetryDecorator.prototype.amendRequests.bind(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
function amendRequest(request, bounds, timeSystem) {
|
|
||||||
request = request || {};
|
|
||||||
request.start = bounds.start;
|
|
||||||
request.end = bounds.end;
|
|
||||||
request.domain = timeSystem.metadata.key;
|
|
||||||
|
|
||||||
return request;
|
|
||||||
}
|
|
||||||
|
|
||||||
ConductorTelemetryDecorator.prototype.amendRequests = function (requests) {
|
|
||||||
var bounds = this.conductor.bounds(),
|
|
||||||
timeSystem = this.conductor.timeSystem();
|
|
||||||
|
|
||||||
return (requests || []).map(function (request) {
|
|
||||||
return amendRequest(request, bounds, timeSystem);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
ConductorTelemetryDecorator.prototype.requestTelemetry = function (requests) {
|
|
||||||
return this.telemetryService
|
|
||||||
.requestTelemetry(this.amendRequests(requests));
|
|
||||||
};
|
|
||||||
|
|
||||||
ConductorTelemetryDecorator.prototype.subscribe = function (callback, requests) {
|
|
||||||
var unsubscribeFunc = this.telemetryService.subscribe(callback, this.amendRequests(requests)),
|
|
||||||
conductor = this.conductor,
|
|
||||||
self = this;
|
|
||||||
|
|
||||||
function amendRequests() {
|
|
||||||
return self.amendRequests(requests);
|
|
||||||
}
|
|
||||||
|
|
||||||
conductor.on('bounds', amendRequests);
|
|
||||||
return function () {
|
|
||||||
unsubscribeFunc();
|
|
||||||
conductor.off('bounds', amendRequests);
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
return ConductorTelemetryDecorator;
|
|
||||||
}
|
|
||||||
);
|
|
@ -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",
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
@import "../../../../../commonUI/general/res/sass/constants";
|
@import "../../../../../commonUI/general/res/sass/constants";
|
||||||
@import "../../../../../commonUI/general/res/sass/mixins";
|
@import "../../../../../commonUI/general/res/sass/mixins";
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
@import "../../../../../commonUI/general/res/sass/constants";
|
@import "../../../../../commonUI/general/res/sass/constants";
|
||||||
@import "../../../../../commonUI/general/res/sass/mixins";
|
@import "../../../../../commonUI/general/res/sass/mixins";
|
||||||
|
@ -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;
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
|
|
||||||
@import "../../../../commonUI/general/res/sass/constants";
|
@import "../../../../commonUI/general/res/sass/constants";
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
|
|
||||||
@import "../../../../commonUI/general/res/sass/constants";
|
@import "../../../../commonUI/general/res/sass/constants";
|
||||||
|
@ -19,6 +19,7 @@
|
|||||||
* this source code distribution or the Licensing information page available
|
* this source code distribution or the Licensing information page available
|
||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
$output-bourbon-deprecation-warnings: false;
|
||||||
@import "bourbon";
|
@import "bourbon";
|
||||||
|
|
||||||
@import "../../../../commonUI/general/res/sass/constants";
|
@import "../../../../commonUI/general/res/sass/constants";
|
||||||
|
@ -79,6 +79,7 @@ define([
|
|||||||
"key": "telemetry",
|
"key": "telemetry",
|
||||||
"implementation": TelemetryCapability,
|
"implementation": TelemetryCapability,
|
||||||
"depends": [
|
"depends": [
|
||||||
|
"openmct",
|
||||||
"$injector",
|
"$injector",
|
||||||
"$q",
|
"$q",
|
||||||
"$log"
|
"$log"
|
||||||
|
@ -24,8 +24,12 @@
|
|||||||
* Module defining TelemetryCapability. Created by vwoeltje on 11/12/14.
|
* Module defining TelemetryCapability. Created by vwoeltje on 11/12/14.
|
||||||
*/
|
*/
|
||||||
define(
|
define(
|
||||||
[],
|
[
|
||||||
function () {
|
'../../../src/api/objects/object-utils'
|
||||||
|
],
|
||||||
|
function (
|
||||||
|
objectUtils
|
||||||
|
) {
|
||||||
|
|
||||||
var ZERO = function () {
|
var ZERO = function () {
|
||||||
return 0;
|
return 0;
|
||||||
@ -103,7 +107,7 @@ define(
|
|||||||
* @implements {Capability}
|
* @implements {Capability}
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function TelemetryCapability($injector, $q, $log, domainObject) {
|
function TelemetryCapability(openmct, $injector, $q, $log, domainObject) {
|
||||||
// We could depend on telemetryService directly, but
|
// We could depend on telemetryService directly, but
|
||||||
// there isn't a platform implementation of this.
|
// there isn't a platform implementation of this.
|
||||||
this.initializeTelemetryService = function () {
|
this.initializeTelemetryService = function () {
|
||||||
@ -118,7 +122,7 @@ define(
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
this.openmct = openmct;
|
||||||
this.$q = $q;
|
this.$q = $q;
|
||||||
this.$log = $log;
|
this.$log = $log;
|
||||||
this.domainObject = domainObject;
|
this.domainObject = domainObject;
|
||||||
@ -135,7 +139,8 @@ define(
|
|||||||
type = domainObject.getCapability("type"),
|
type = domainObject.getCapability("type"),
|
||||||
typeRequest = (type && type.getDefinition().telemetry) || {},
|
typeRequest = (type && type.getDefinition().telemetry) || {},
|
||||||
modelTelemetry = domainObject.getModel().telemetry,
|
modelTelemetry = domainObject.getModel().telemetry,
|
||||||
fullRequest = Object.create(typeRequest);
|
fullRequest = Object.create(typeRequest),
|
||||||
|
bounds;
|
||||||
|
|
||||||
// Add properties from the telemetry field of this
|
// Add properties from the telemetry field of this
|
||||||
// specific domain object.
|
// specific domain object.
|
||||||
@ -156,10 +161,30 @@ define(
|
|||||||
fullRequest.key = domainObject.getId();
|
fullRequest.key = domainObject.getId();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (request.start === undefined && request.end === undefined) {
|
||||||
|
bounds = this.openmct.conductor.bounds();
|
||||||
|
fullRequest.start = bounds.start;
|
||||||
|
fullRequest.end = bounds.end;
|
||||||
|
}
|
||||||
|
|
||||||
return fullRequest;
|
return fullRequest;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
function asSeries(telemetry, defaultDomain, defaultRange) {
|
||||||
|
return {
|
||||||
|
getRangeValue: function (index, range) {
|
||||||
|
return telemetry[index][range || defaultRange];
|
||||||
|
},
|
||||||
|
getDomainValue: function (index, domain) {
|
||||||
|
return telemetry[index][domain || defaultDomain];
|
||||||
|
},
|
||||||
|
getPointCount: function () {
|
||||||
|
return telemetry.length;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request telemetry data for this specific domain object.
|
* Request telemetry data for this specific domain object.
|
||||||
* @param {TelemetryRequest} [request] parameters for this
|
* @param {TelemetryRequest} [request] parameters for this
|
||||||
@ -169,11 +194,21 @@ define(
|
|||||||
*/
|
*/
|
||||||
TelemetryCapability.prototype.requestData = function requestTelemetry(request) {
|
TelemetryCapability.prototype.requestData = function requestTelemetry(request) {
|
||||||
// Bring in any defaults from the object model
|
// Bring in any defaults from the object model
|
||||||
var fullRequest = this.buildRequest(request || {}),
|
var fullRequest = this.buildRequest(request || {});
|
||||||
source = fullRequest.source,
|
var source = fullRequest.source;
|
||||||
key = fullRequest.key,
|
var key = fullRequest.key;
|
||||||
telemetryService = this.telemetryService ||
|
var telemetryService = this.telemetryService ||
|
||||||
this.initializeTelemetryService(); // Lazy initialization
|
this.initializeTelemetryService(); // Lazy initialization
|
||||||
|
|
||||||
|
var domainObject = objectUtils.toNewFormat(this.domainObject.getModel(), this.domainObject.getId());
|
||||||
|
var telemetryAPI = this.openmct.telemetry;
|
||||||
|
|
||||||
|
var metadata = telemetryAPI.getMetadata(domainObject);
|
||||||
|
var defaultDomain = (metadata.valuesForHints(['domain'])[0] || {}).key;
|
||||||
|
var defaultRange = (metadata.valuesForHints(['range'])[0] || {}).key;
|
||||||
|
|
||||||
|
var isLegacyProvider = telemetryAPI.findRequestProvider(domainObject) ===
|
||||||
|
telemetryAPI.legacyProvider;
|
||||||
|
|
||||||
// Pull out the relevant field from the larger,
|
// Pull out the relevant field from the larger,
|
||||||
// structured response.
|
// structured response.
|
||||||
@ -187,11 +222,17 @@ define(
|
|||||||
return telemetryService.requestTelemetry([fullRequest]);
|
return telemetryService.requestTelemetry([fullRequest]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// If a telemetryService is not available,
|
if (isLegacyProvider) {
|
||||||
// getTelemetryService() should reject, and this should
|
// If a telemetryService is not available,
|
||||||
// bubble through subsequent then calls.
|
// getTelemetryService() should reject, and this should
|
||||||
return telemetryService &&
|
// bubble through subsequent then calls.
|
||||||
requestTelemetryFromService().then(getRelevantResponse);
|
return telemetryService &&
|
||||||
|
requestTelemetryFromService().then(getRelevantResponse);
|
||||||
|
} else {
|
||||||
|
return telemetryAPI.request(domainObject, fullRequest).then(function (telemetry) {
|
||||||
|
return asSeries(telemetry, defaultDomain, defaultRange);
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -217,12 +258,26 @@ define(
|
|||||||
* subscription request
|
* subscription request
|
||||||
*/
|
*/
|
||||||
TelemetryCapability.prototype.subscribe = function subscribe(callback, request) {
|
TelemetryCapability.prototype.subscribe = function subscribe(callback, request) {
|
||||||
var fullRequest = this.buildRequest(request || {}),
|
var fullRequest = this.buildRequest(request || {});
|
||||||
telemetryService = this.telemetryService ||
|
var telemetryService = this.telemetryService ||
|
||||||
this.initializeTelemetryService(); // Lazy initialization
|
this.initializeTelemetryService(); // Lazy initialization
|
||||||
|
|
||||||
|
var domainObject = objectUtils.toNewFormat(this.domainObject.getModel(), this.domainObject.getId());
|
||||||
|
var telemetryAPI = this.openmct.telemetry;
|
||||||
|
|
||||||
|
var metadata = telemetryAPI.getMetadata(domainObject);
|
||||||
|
var defaultDomain = (metadata.valuesForHints(['domain'])[0] || {}).key;
|
||||||
|
var defaultRange = (metadata.valuesForHints(['range'])[0] || {}).key;
|
||||||
|
|
||||||
|
var isLegacyProvider = telemetryAPI.findSubscriptionProvider(domainObject) ===
|
||||||
|
telemetryAPI.legacyProvider;
|
||||||
|
|
||||||
|
function update(telemetry) {
|
||||||
|
callback(asSeries([telemetry], defaultDomain, defaultRange));
|
||||||
|
}
|
||||||
|
|
||||||
// Unpack the relevant telemetry series
|
// Unpack the relevant telemetry series
|
||||||
function update(telemetries) {
|
function updateLegacy(telemetries) {
|
||||||
var source = fullRequest.source,
|
var source = fullRequest.source,
|
||||||
key = fullRequest.key,
|
key = fullRequest.key,
|
||||||
result = ((telemetries || {})[source] || {})[key];
|
result = ((telemetries || {})[source] || {})[key];
|
||||||
@ -231,8 +286,13 @@ define(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return telemetryService &&
|
// Avoid a loop here...
|
||||||
telemetryService.subscribe(update, [fullRequest]);
|
if (isLegacyProvider) {
|
||||||
|
return telemetryService &&
|
||||||
|
telemetryService.subscribe(updateLegacy, [fullRequest]);
|
||||||
|
} else {
|
||||||
|
return telemetryAPI.subscribe(domainObject, update, fullRequest);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,8 +32,9 @@ define(
|
|||||||
mockTelemetryService,
|
mockTelemetryService,
|
||||||
mockReject,
|
mockReject,
|
||||||
mockUnsubscribe,
|
mockUnsubscribe,
|
||||||
telemetry;
|
telemetry,
|
||||||
|
mockTelemetryAPI,
|
||||||
|
mockAPI;
|
||||||
|
|
||||||
function mockPromise(value) {
|
function mockPromise(value) {
|
||||||
return {
|
return {
|
||||||
@ -43,6 +44,9 @@ define(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function noop() {
|
||||||
|
}
|
||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
|
mockInjector = jasmine.createSpyObj("$injector", ["get"]);
|
||||||
mockQ = jasmine.createSpyObj("$q", ["when", "reject"]);
|
mockQ = jasmine.createSpyObj("$q", ["when", "reject"]);
|
||||||
@ -79,7 +83,33 @@ define(
|
|||||||
// Bubble up...
|
// Bubble up...
|
||||||
mockReject.then.andReturn(mockReject);
|
mockReject.then.andReturn(mockReject);
|
||||||
|
|
||||||
|
mockTelemetryAPI = jasmine.createSpyObj("telemetryAPI", [
|
||||||
|
"getMetadata",
|
||||||
|
"subscribe",
|
||||||
|
"request",
|
||||||
|
"findRequestProvider",
|
||||||
|
"findSubscriptionProvider"
|
||||||
|
]);
|
||||||
|
mockTelemetryAPI.getMetadata.andReturn({
|
||||||
|
valuesForHints: function () {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
mockAPI = {
|
||||||
|
telemetry: mockTelemetryAPI,
|
||||||
|
conductor: {
|
||||||
|
bounds: function () {
|
||||||
|
return {
|
||||||
|
start: 0,
|
||||||
|
end: 1
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
telemetry = new TelemetryCapability(
|
telemetry = new TelemetryCapability(
|
||||||
|
mockAPI,
|
||||||
mockInjector,
|
mockInjector,
|
||||||
mockQ,
|
mockQ,
|
||||||
mockLog,
|
mockLog,
|
||||||
@ -113,7 +143,6 @@ define(
|
|||||||
key: "testKey", // from model
|
key: "testKey", // from model
|
||||||
start: 42 // from argument
|
start: 42 // from argument
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it("provides an empty series when telemetry is missing", function () {
|
it("provides an empty series when telemetry is missing", function () {
|
||||||
@ -129,7 +158,9 @@ define(
|
|||||||
expect(telemetry.getMetadata()).toEqual({
|
expect(telemetry.getMetadata()).toEqual({
|
||||||
id: "testId", // from domain object
|
id: "testId", // from domain object
|
||||||
source: "testSource",
|
source: "testSource",
|
||||||
key: "testKey"
|
key: "testKey",
|
||||||
|
start: 0,
|
||||||
|
end: 1
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -143,7 +174,9 @@ define(
|
|||||||
expect(telemetry.getMetadata()).toEqual({
|
expect(telemetry.getMetadata()).toEqual({
|
||||||
id: "testId", // from domain object
|
id: "testId", // from domain object
|
||||||
source: "testSource", // from model
|
source: "testSource", // from model
|
||||||
key: "testId" // from domain object
|
key: "testId", // from domain object
|
||||||
|
start: 0,
|
||||||
|
end: 1
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -161,6 +194,57 @@ define(
|
|||||||
expect(mockLog.warn).toHaveBeenCalled();
|
expect(mockLog.warn).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it("if a new style telemetry source is available, use it", function () {
|
||||||
|
var mockProvider = {};
|
||||||
|
mockTelemetryAPI.findSubscriptionProvider.andReturn(mockProvider);
|
||||||
|
telemetry.subscribe(noop, {});
|
||||||
|
expect(mockTelemetryService.subscribe).not.toHaveBeenCalled();
|
||||||
|
expect(mockTelemetryAPI.subscribe).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("if a new style telemetry source is not available, revert to old API", function () {
|
||||||
|
mockTelemetryAPI.findSubscriptionProvider.andReturn(undefined);
|
||||||
|
telemetry.subscribe(noop, {});
|
||||||
|
expect(mockTelemetryAPI.subscribe).not.toHaveBeenCalled();
|
||||||
|
expect(mockTelemetryService.subscribe).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("Wraps telemetry returned from the new API as a telemetry series", function () {
|
||||||
|
var returnedTelemetry;
|
||||||
|
var mockTelemetry = [{
|
||||||
|
prop1: "val1",
|
||||||
|
prop2: "val2",
|
||||||
|
prop3: "val3"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
prop1: "val4",
|
||||||
|
prop2: "val5",
|
||||||
|
prop3: "val6"
|
||||||
|
}];
|
||||||
|
var mockProvider = {};
|
||||||
|
var dunzo = false;
|
||||||
|
|
||||||
|
mockTelemetryAPI.findRequestProvider.andReturn(mockProvider);
|
||||||
|
mockTelemetryAPI.request.andReturn(Promise.resolve(mockTelemetry));
|
||||||
|
|
||||||
|
telemetry.requestData({}).then(function (data) {
|
||||||
|
returnedTelemetry = data;
|
||||||
|
dunzo = true;
|
||||||
|
});
|
||||||
|
|
||||||
|
waitsFor(function () {
|
||||||
|
return dunzo;
|
||||||
|
});
|
||||||
|
|
||||||
|
runs(function () {
|
||||||
|
expect(returnedTelemetry.getPointCount).toBeDefined();
|
||||||
|
expect(returnedTelemetry.getDomainValue).toBeDefined();
|
||||||
|
expect(returnedTelemetry.getRangeValue).toBeDefined();
|
||||||
|
expect(returnedTelemetry.getPointCount()).toBe(2);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
it("allows subscriptions to updates", function () {
|
it("allows subscriptions to updates", function () {
|
||||||
var mockCallback = jasmine.createSpy("callback"),
|
var mockCallback = jasmine.createSpy("callback"),
|
||||||
subscription = telemetry.subscribe(mockCallback);
|
subscription = telemetry.subscribe(mockCallback);
|
||||||
@ -171,7 +255,9 @@ define(
|
|||||||
[{
|
[{
|
||||||
id: "testId", // from domain object
|
id: "testId", // from domain object
|
||||||
source: "testSource",
|
source: "testSource",
|
||||||
key: "testKey"
|
key: "testKey",
|
||||||
|
start: 0,
|
||||||
|
end: 1
|
||||||
}]
|
}]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -105,7 +105,6 @@ define([
|
|||||||
this.valueMetadatas = this.valueMetadatas.map(applyReasonableDefaults);
|
this.valueMetadatas = this.valueMetadatas.map(applyReasonableDefaults);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get value metadata for a single key.
|
* Get value metadata for a single key.
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +33,6 @@ define([
|
|||||||
'../example/export/bundle',
|
'../example/export/bundle',
|
||||||
'../example/extensions/bundle',
|
'../example/extensions/bundle',
|
||||||
'../example/forms/bundle',
|
'../example/forms/bundle',
|
||||||
'../example/generator/bundle',
|
|
||||||
'../example/identity/bundle',
|
'../example/identity/bundle',
|
||||||
'../example/imagery/bundle',
|
'../example/imagery/bundle',
|
||||||
'../example/mobile/bundle',
|
'../example/mobile/bundle',
|
||||||
|
@ -21,24 +21,93 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
define([
|
define([
|
||||||
'lodash'
|
'lodash',
|
||||||
], function (_) {
|
'../../platform/features/conductor/utcTimeSystem/src/UTCTimeSystem',
|
||||||
|
'../../example/generator/plugin'
|
||||||
|
], function (
|
||||||
|
_,
|
||||||
|
UTCTimeSystem,
|
||||||
|
GeneratorPlugin
|
||||||
|
) {
|
||||||
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) {
|
||||||
return function (openmct) {
|
return function pluginConstructor() {
|
||||||
openmct.legacyRegistry.enable(bundleName);
|
return function (openmct) {
|
||||||
|
openmct.legacyRegistry.enable(bundleName);
|
||||||
|
};
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
|
plugins.UTCTimeSystem = function () {
|
||||||
|
return function (openmct) {
|
||||||
|
openmct.legacyExtension("timeSystems", {
|
||||||
|
"implementation": UTCTimeSystem,
|
||||||
|
"depends": ["$timeout"]
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
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) {
|
||||||
@ -57,7 +126,7 @@ define([
|
|||||||
openmct.legacyRegistry.enable(bundleName);
|
openmct.legacyRegistry.enable(bundleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
openmct.legacyRegistry.enable(bundleMap.couchDB);
|
openmct.legacyRegistry.enable(bundleMap.CouchDB);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -79,9 +148,13 @@ define([
|
|||||||
openmct.legacyRegistry.enable(bundleName);
|
openmct.legacyRegistry.enable(bundleName);
|
||||||
}
|
}
|
||||||
|
|
||||||
openmct.legacyRegistry.enable(bundleMap.elasticsearch);
|
openmct.legacyRegistry.enable(bundleMap.Elasticsearch);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
plugins.Generator = function () {
|
||||||
|
return GeneratorPlugin;
|
||||||
|
};
|
||||||
|
|
||||||
return plugins;
|
return plugins;
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user