Compare commits

...

117 Commits

Author SHA1 Message Date
Joel McKinnon
a1d1301542 added unsubscribe, subscribeTo methods 2020-05-26 10:35:41 -07:00
Joel McKinnon
aef8589872 Merge branch 'master' of https://github.com/nasa/openmct into joel/plot-test 2020-05-22 13:35:58 -07:00
Joel McKinnon
38f3e60884 added dynamic layout for fixed, local clock 2020-05-22 13:35:47 -07:00
Joel McKinnon
331c086a60 implemented Plotly.relayout to set x-axis correctly for local clock 2020-05-21 16:45:21 -07:00
Joel McKinnon
0890ebfd0f added back if in updateData 2020-05-21 12:57:14 -07:00
Nikhil Mandlik
1547ea5cf7 small changes 2020-05-21 12:29:04 -07:00
Joel McKinnon
b1551478e4 refactor of refreshData 2020-05-21 12:03:53 -07:00
Joel McKinnon
213c469758 debugging local clock issues 2020-05-21 11:44:32 -07:00
Joel McKinnon
03ac43d306 added some comments 2020-05-20 18:17:29 -07:00
Joel McKinnon
f3de6f2548 Merge branch 'joel/plot-test' of https://github.com/nasa/openmct into joel/plot-test 2020-05-20 15:48:44 -07:00
Joel McKinnon
62dfb7d8f9 added requestHistory 2020-05-20 15:48:01 -07:00
Joel McKinnon
0a33cbeea2 resolve merge conflict 2020-05-20 09:32:59 -07:00
Jamie Vigliotta
4908d5afb0 Merge branch 'lad-testing' of https://github.com/nasa/openmct into lad-testing
merging in master I believe.
2020-05-19 12:42:55 -07:00
Jamie Vigliotta
aa4bf5eaf6 updates from PR Review, making new lad set tests pending for the time being #3044 2020-05-19 12:39:31 -07:00
Shefali Joshi
4eb4cbfffc Merge pull request #3020 from nasa/updated-checklists
Add details about pull requests to contributing guide
2020-05-19 09:30:05 -07:00
Shefali Joshi
eda01abcbc Merge branch 'master' into updated-checklists 2020-05-18 12:12:26 -07:00
David Tsay
694b8f4666 provide format for name metadata (#3054) 2020-05-18 11:40:05 -07:00
Joel McKinnon
4e4031e700 added listeners and bounds methods 2020-05-18 11:37:24 -07:00
Shefali Joshi
46a20bb76d Merge branch 'master' into lad-testing 2020-05-18 11:03:49 -07:00
Jamie Vigliotta
1d482f318e working on adding render tests for lad table sets 2020-05-15 15:34:03 -07:00
Joel McKinnon
6826b579a6 WIP... 2020-05-15 15:32:53 -07:00
David Tsay
bbb271a678 clarify value hints (#2673)
remove confusing comments regarding domain - input and range - output
2020-05-15 14:48:25 -07:00
Deep Tailor
fec1438806 dont emit a viewport change event when marquee doesnt happen (#3036)
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2020-05-15 14:35:13 -07:00
Nikhil
28f19ec310 [Notebook] Clicking on an embed in a notebook entry does not result in bounds change #3034 (#3042) 2020-05-14 14:56:41 -07:00
Jamie Vigliotta
3d4c721232 removing fdescribe 2020-05-14 13:30:13 -07:00
Jamie Vigliotta
190d34c939 added composition tests for lad table set as well 2020-05-14 13:22:12 -07:00
Jamie Vigliotta
47bc0e9793 pushing final version of tests for PR 2020-05-14 10:38:38 -07:00
Joel McKinnon
35115aaa50 WIP: adding bounds functions 2020-05-13 16:32:03 -07:00
Shefali Joshi
f934454c25 Fixes computation of result when telemetry is not used by an object (#3040)
* Resolves issue #30307
Don't compute the result of a condition if telemetry datum is not being used by that condition

* Adds tests for condition results
2020-05-13 14:30:45 -07:00
Joel McKinnon
b252051c83 add, remove multiple traces, remove hover effects 2020-05-13 11:20:35 -07:00
Jamie Vigliotta
4ca1181eb6 Merge branch 'lad-bounds-listener' into lad-testing
mergin in other lad changes.
2020-05-13 09:32:31 -07:00
Andrew Henry
eb49ffae02 Update CONTRIBUTING.md 2020-05-13 09:21:00 -07:00
Andrew Henry
5751012872 Update CONTRIBUTING.md 2020-05-13 09:20:03 -07:00
Jamie Vigliotta
f973f42729 random error fixed for testing, was a system setup issue 2020-05-12 15:05:29 -07:00
Joel McKinnon
4788561631 WIP 2020-05-12 15:04:05 -07:00
Jamie Vigliotta
e8699d54d5 issue with javascript heap error for tests 2020-05-12 14:19:06 -07:00
Jamie Vigliotta
14bc49451b removed "existingTimestamp" variable, it is now stored in instance "timestamp" variable 2020-05-12 13:12:53 -07:00
Jamie Vigliotta
dd2e8c0460 removing console logs for the moment 2020-05-12 11:58:01 -07:00
Jamie Vigliotta
031753a9a8 still some pending, but all these are successful 2020-05-12 10:23:41 -07:00
Jamie Vigliotta
8edae5f02c Merge branch 'master' into lad-testing
Merging master
.
2020-05-12 10:09:15 -07:00
Jamie Vigliotta
7ed3de01b9 commit before merge master 2020-05-12 10:08:01 -07:00
Andrew Henry
aa041e04cf Merge remote-tracking branch 'origin/update-contributing-guidelines' into updated-checklists 2020-05-11 17:13:53 -07:00
Andrew Henry
79d5d9c4d0 Update CONTRIBUTING.md 2020-05-11 16:15:17 -07:00
Andrew Henry
b5bfdc4418 Update CONTRIBUTING.md 2020-05-11 15:56:49 -07:00
Andrew Henry
59730c60ec Update CONTRIBUTING.md 2020-05-11 15:54:25 -07:00
Jamie Vigliotta
4a1931f594 Merge branch 'lad-bounds-listener' into lad-testing
Merging lad bounds listener updates in for lad testing..
2020-05-11 11:20:31 -07:00
Jamie Vigliotta
f174dcc2f6 Merge branch 'ladtable-composition-policy' into lad-testing
Merging in new ES6 module style for lad plugin..
2020-05-11 11:18:37 -07:00
Joel McKinnon
0c741c67f8 import RemoveAction 2020-05-11 09:59:41 -07:00
Jamie Vigliotta
85da5e43b3 moved formatedTimestamp to a computed value to utilize caching 2020-05-08 16:24:58 -07:00
Joel McKinnon
d26e45f636 add code to set Y-axis and plot multiple telemetry types 2020-05-08 13:50:56 -07:00
Jamie Vigliotta
0bd6814097 fixed case sensitive file name error 2020-05-08 12:13:28 -07:00
Jamie Vigliotta
4e7410b4bf trying to fix circle ci missing LADTable.vue error 2020-05-08 12:09:04 -07:00
Jamie Vigliotta
436550adba converted LADTable to es6 module 2020-05-08 11:52:37 -07:00
Jamie Vigliotta
f6b1be0486 Merge branch 'ladtable-composition-policy' of https://github.com/nasa/openmct into ladtable-composition-policy
forgot to pull first
.
2020-05-07 18:35:37 -07:00
Jamie Vigliotta
eca12201c7 switching over toe es6 module 2020-05-07 18:35:25 -07:00
Jamie Vigliotta
68ff69664b added a phew more tests 2020-05-07 16:23:37 -07:00
Joel McKinnon
51fbb9cee6 Merge branch 'master' into joel/plot-test 2020-05-07 14:55:07 -07:00
Joel McKinnon
437156e04c changed mode and type, dropped old data as data extends 2020-05-07 14:45:34 -07:00
Joel McKinnon
d244ee622a rendering a plotly plot from SWG 2020-05-07 13:00:54 -07:00
Deep Tailor
043d6aa9c3 extend traces on subscribe 2020-05-07 12:23:32 -07:00
Deep Tailor
ecfab8f7f3 add subscribe 2020-05-07 12:00:39 -07:00
Deep Tailor
05c38c37aa working historical 2020-05-07 11:37:01 -07:00
Joel McKinnon
ce78925119 wip: added telemetry provider 2020-05-07 10:45:15 -07:00
Jamie Vigliotta
b30018c315 added mock objects and mock telemetry to testTools 2020-05-06 13:48:17 -07:00
Joel McKinnon
26aca0f433 working on viewProvider 2020-05-06 11:31:17 -07:00
Andrew Henry
eb5eb7d540 Un-focused test 2020-05-06 10:55:06 -07:00
Andrew Henry
609a47c62c Fixed failing test 2020-05-06 10:36:15 -07:00
Joel McKinnon
41259bbd40 added hardcoded test plot 2020-05-05 16:00:48 -07:00
Joel McKinnon
580640ff47 basic plotly plugin structure 2020-05-05 12:50:55 -07:00
Jamie Vigliotta
688a03c8ac added composition, working on table views 2020-05-04 11:09:19 -07:00
Jamie Vigliotta
4f12f41685 added composition policy testing 2020-05-01 15:20:08 -07:00
Joel McKinnon
a4aec5d492 Merge branch 'master' of https://github.com/nasa/openmct 2020-05-01 10:46:57 -07:00
Joel McKinnon
00b3f3ac0b Merge branch 'master' of https://github.com/nasa/openmct 2020-05-01 09:25:44 -07:00
Jamie Vigliotta
189882afc8 first "it" in, working on the next 2020-04-30 10:36:44 -07:00
Joel McKinnon
c185f77a15 Merge branch 'master' of https://github.com/nasa/openmct 2020-04-29 16:52:05 -07:00
Andrew Henry
2b3541a323 Merge branch 'master' into lad-bounds-listener 2020-04-29 12:43:20 -07:00
Jamie Vigliotta
7c9a140481 plugin spec for lad tables 2020-04-29 11:27:56 -07:00
Jamie Vigliotta
5e9b313ee9 Merge branch 'ladtable-composition-policy' into lad-testing
merging lad branches for unit testing
.
2020-04-29 10:46:06 -07:00
Jamie Vigliotta
c64db6c07d Revert "Merge branch 'lad-conductor-response' into lad-testing"
This reverts commit 9e2751acf7, reversing
changes made to 51fb72dc04.

not what I wanted apparently#
2020-04-29 10:45:21 -07:00
Jamie Vigliotta
9e2751acf7 Merge branch 'lad-conductor-response' into lad-testing
Merging all lad branches for lad unit testing
.
2020-04-29 10:20:34 -07:00
Jamie Vigliotta
51fb72dc04 updates from PR review 2020-04-28 17:02:04 -07:00
Andrew Henry
d51052ab46 Merge branch 'master' into ladtable-composition-policy 2020-04-28 16:44:21 -07:00
Joel McKinnon
0dff431f4a Merge branch 'master' of https://github.com/nasa/openmct 2020-04-27 12:02:12 -07:00
Jamie Vigliotta
f62010fb99 added parsing for timestamps, removed currentData variable as it was not needed, moved tick check to bounds listener 2020-04-24 12:48:34 -07:00
Joel McKinnon
61d238a097 Merge branch 'master' of https://github.com/nasa/openmct 2020-04-23 16:30:01 -07:00
Jamie Vigliotta
ba4ef43673 linting and removing console logs 2020-04-23 15:50:49 -07:00
Jamie Vigliotta
f6c16b7483 added a check for lad table sets, child can only be lad table 2020-04-23 15:17:07 -07:00
Jamie Vigliotta
58e63e649f added LAD Table composition policy 2020-04-23 13:33:32 -07:00
Jamie Vigliotta
7a04aea90e removing console log 2020-04-17 16:45:24 -07:00
Jamie Vigliotta
0bb475327c added matadatum with key === name to be ignored as well when selecting value to show 2020-04-17 16:44:18 -07:00
Jamie Vigliotta
c474b998f0 added a backup if the object does not have a range hint (ex. images) 2020-04-17 16:22:03 -07:00
Joel McKinnon
f9deb80350 Merge branch 'master' of https://github.com/nasa/openmct 2020-04-16 15:01:42 -07:00
Jamie Vigliotta
a02d421093 added bounds listener, moved history request to function, checking for race conditions 2020-04-16 12:19:20 -07:00
Jamie Vigliotta
9026099fd2 added bounds listener, moved history request to function, checking for race conditions 2020-04-16 11:51:48 -07:00
Jamie Vigliotta
295ccea195 cleaned up subscription and bounds listener, added timesystem listener 2020-04-14 12:33:34 -07:00
Joel McKinnon
021d730814 resolve merge conflicts 2020-04-13 09:05:43 -07:00
David Tsay
ae62b15abf Merge branch 'fix-default-output' of github.com:nasa/openmct into fix-default-output 2020-04-10 15:44:42 -07:00
David Tsay
ba41c1a30e fix unit tests 2020-04-10 15:43:48 -07:00
Andrew Henry
b9a85d9c4d Merge branch 'master' into fix-default-output 2020-04-10 15:34:10 -07:00
David Tsay
80eab8bad1 fix telemetrycriterion and unit testing 2020-04-10 15:26:18 -07:00
Andrew Henry
b2d8d640ae Merge branch 'master' into fix-default-output 2020-04-10 15:23:10 -07:00
Andrew Henry
56e6fa66c2 Merge branch 'master' into fix-default-output 2020-04-10 15:13:36 -07:00
David Tsay
9fa4707c82 Merge branch 'master' into fix-default-output 2020-04-10 13:04:14 -07:00
David Tsay
7e2cfa36de AllTelemetryCriterion extends TelemetryCriterion 2020-04-10 12:17:55 -07:00
David Tsay
aaa60a1545 scope function names 2020-04-10 11:28:13 -07:00
David Tsay
717231fed2 use current timesystem to compare latest 2020-04-10 11:20:51 -07:00
David Tsay
7fb2bc9729 tie in requests and eliminate unused code 2020-04-10 10:42:31 -07:00
David Tsay
addeb635e9 refactor all/any telemetry criterion to use new evaluator 2020-04-10 09:48:31 -07:00
David Tsay
608d63a7b0 telemetry criterion stores its own result 2020-04-10 09:00:39 -07:00
David Tsay
10679e5f4f remove commented code 2020-04-10 00:12:55 -07:00
David Tsay
38b8f03b1a linting 2020-04-09 21:03:56 -07:00
David Tsay
779a42c28c remove unused listeners, events, and helpers 2020-04-09 18:14:19 -07:00
David Tsay
80c2504768 get results directly instead of using events 2020-04-09 17:54:47 -07:00
David Tsay
80359e3f16 remove generating timestamp for telemetry data 2020-04-09 16:20:16 -07:00
Joshi
66aa4f099f Remove unused code 2020-04-09 15:22:35 -07:00
Joshi
aa6c6cb88b Removes timestamp based evalutation from conditionManager 2020-04-09 15:21:25 -07:00
Joshi
4e5cc840d7 Ensures that results for a specific datapoint are evaluated atomically. 2020-04-09 12:10:29 -07:00
24 changed files with 1173 additions and 174 deletions

4
API.md
View File

@@ -427,8 +427,8 @@ Each telemetry value description has an object defining hints. Keys in this thi
Known hints:
* `domain`: Indicates that the value represents the "input" of a datum. Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
* `range`: Indicates that the value is the "output" of a datum. Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
* `domain`: Values with a `domain` hint will be used for the x-axis of a plot, and tables will render columns for these values first.
* `range`: Values with a `range` hint will be used as the y-axis on a plot, and tables will render columns for these values after the `domain` values.
* `image`: Indicates that the value may be interpreted as the URL to an image file, in which case appropriate views will be made available.
##### The Time Conductor and Telemetry

View File

@@ -119,6 +119,9 @@ Additionally:
* Every __author__ must include testing instructions. These instructions should identify the areas of code affected, and some minimal test steps. If addressing a bug, reproduction steps should be included, if they were not included in the original issue. If reproduction steps were included on the original issue, and are sufficient, refer to them.
* A pull request that closes an issue should say so in the description. Including the text “Closes #1234” will cause the linked issue to be automatically closed when the pull request is merged. This is the responsibility of the pull requests __author__.
* When a pull request is merged, and the corresponding issue closed, the __reviewer__ must add the tag “unverified” to the original issue. This will indicate that although the issue is closed, it has not been tested yet.
* Every PR must have two reviewers assigned, though only one approval is necessary for merge.
* Changes to API require approval by a senior developer.
* When creating a PR, it is the author's responsibility to apply any priority label from the issue to the PR as well. This helps with prioritization.
## Standards
@@ -298,6 +301,7 @@ checklist).
2. Unit tests included and/or updated with changes?
3. Command line build passes?
4. Changes have been smoke-tested?
5. Testing instructions included?
### Reviewer Checklist
@@ -305,3 +309,4 @@ checklist).
2. Appropriate unit tests included?
3. Code style and in-line documentation are appropriate?
4. Commit messages meet standards?
5. Has associated issue been labelled `unverified`? (only applicable if this PR closes the issue)

View File

@@ -50,7 +50,8 @@ define([
values: [
{
key: "name",
name: "Name"
name: "Name",
format: "string"
},
{
key: "utc",

View File

@@ -2,7 +2,9 @@
"name": "openmct",
"version": "1.0.0-snapshot",
"description": "The Open MCT core platform",
"dependencies": {},
"dependencies": {
"plotly.js-dist": "^1.54.1"
},
"devDependencies": {
"angular": "1.7.9",
"angular-route": "1.4.14",

View File

@@ -252,6 +252,7 @@ define([
// Plugin's that are installed by default
this.install(this.plugins.Plot());
this.install(this.plugins.PlotlyPlot());
this.install(this.plugins.TelemetryTable());
this.install(PreviewPlugin.default());
this.install(LegacyIndicatorsPlugin());

View File

@@ -0,0 +1,39 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2020, 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.
*****************************************************************************/
export default class LADTableCompositionPolicy {
constructor(openmct) {
this.openmct = openmct;
return this.allow.bind(this);
}
allow(parent, child) {
if(parent.type === 'LadTable') {
return this.openmct.telemetry.isTelemetryObject(child);
} else if(parent.type === 'LadTableSet') {
return child.type === 'LadTable';
}
return true;
}
}

View File

@@ -19,53 +19,46 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import LadTableSet from './components/LadTableSet.vue';
import Vue from 'vue';
define([
'./components/LadTableSet.vue',
'vue'
], function (
LadTableSet,
Vue
) {
function LADTableSetViewProvider(openmct) {
return {
key: 'LadTableSet',
name: 'LAD Table Set',
cssClass: 'icon-tabular-lad-set',
canView: function (domainObject) {
return domainObject.type === 'LadTableSet';
},
canEdit: function (domainObject) {
return domainObject.type === 'LadTableSet';
},
view: function (domainObject, objectPath) {
let component;
export default function LADTableSetViewProvider(openmct) {
return {
key: 'LadTableSet',
name: 'LAD Table Set',
cssClass: 'icon-tabular-lad-set',
canView: function (domainObject) {
return domainObject.type === 'LadTableSet';
},
canEdit: function (domainObject) {
return domainObject.type === 'LadTableSet';
},
view: function (domainObject, objectPath) {
let component;
return {
show: function (element) {
component = new Vue({
el: element,
components: {
LadTableSet: LadTableSet.default
},
provide: {
openmct,
domainObject,
objectPath
},
template: '<lad-table-set></lad-table-set>'
});
},
destroy: function (element) {
component.$destroy();
component = undefined;
}
};
},
priority: function () {
return 1;
}
};
}
return LADTableSetViewProvider;
});
return {
show: function (element) {
component = new Vue({
el: element,
components: {
LadTableSet: LadTableSet
},
provide: {
openmct,
domainObject,
objectPath
},
template: '<lad-table-set></lad-table-set>'
});
},
destroy: function (element) {
component.$destroy();
component = undefined;
}
};
},
priority: function () {
return 1;
}
};
}

View File

@@ -19,53 +19,46 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import LadTable from './components/LADTable.vue';
import Vue from 'vue';
define([
'./components/LADTable.vue',
'vue'
], function (
LadTableComponent,
Vue
) {
function LADTableViewProvider(openmct) {
return {
key: 'LadTable',
name: 'LAD Table',
cssClass: 'icon-tabular-lad',
canView: function (domainObject) {
return domainObject.type === 'LadTable';
},
canEdit: function (domainObject) {
return domainObject.type === 'LadTable';
},
view: function (domainObject, objectPath) {
let component;
export default function LADTableViewProvider(openmct) {
return {
key: 'LadTable',
name: 'LAD Table',
cssClass: 'icon-tabular-lad',
canView: function (domainObject) {
return domainObject.type === 'LadTable';
},
canEdit: function (domainObject) {
return domainObject.type === 'LadTable';
},
view: function (domainObject, objectPath) {
let component;
return {
show: function (element) {
component = new Vue({
el: element,
components: {
LadTableComponent: LadTableComponent.default
},
provide: {
openmct,
domainObject,
objectPath
},
template: '<lad-table-component></lad-table-component>'
});
},
destroy: function (element) {
component.$destroy();
component = undefined;
}
};
},
priority: function () {
return 1;
}
};
}
return LADTableViewProvider;
});
return {
show: function (element) {
component = new Vue({
el: element,
components: {
LadTableComponent: LadTable
},
provide: {
openmct,
domainObject,
objectPath
},
template: '<lad-table-component></lad-table-component>'
});
},
destroy: function (element) {
component.$destroy();
component = undefined;
}
};
},
priority: function () {
return 1;
}
};
}

View File

@@ -1,6 +1,6 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, United States Government
* Open MCT, Copyright (c) 2014-2020, United States Government
* as represented by the Administrator of the National Aeronautics and Space
* Administration. All rights reserved.
*
@@ -24,10 +24,8 @@
<template>
<tr @contextmenu.prevent="showContextMenu">
<td>{{ name }}</td>
<td>{{ timestamp }}</td>
<td :class="valueClass">
{{ value }}
</td>
<td>{{ formattedTimestamp }}</td>
<td :class="valueClass">{{ value }}</td>
</tr>
</template>
@@ -58,10 +56,16 @@ export default {
currentObjectPath
}
},
computed: {
formattedTimestamp() {
return this.timestamp !== '---' ? this.formats[this.timestampKey].format(this.timestamp) : this.timestamp;
}
},
mounted() {
this.metadata = this.openmct.telemetry.getMetadata(this.domainObject);
this.formats = this.openmct.telemetry.getFormatMap(this.metadata);
this.keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
this.bounds = this.openmct.time.bounds();
this.limitEvaluator = this.openmct
.telemetry
@@ -76,6 +80,7 @@ export default {
);
this.openmct.time.on('timeSystem', this.updateTimeSystem);
this.openmct.time.on('bounds', this.updateBounds);
this.timestampKey = this.openmct.time.timeSystem().key;
@@ -89,43 +94,64 @@ export default {
.telemetry
.subscribe(this.domainObject, this.updateValues);
this.openmct
.telemetry
.request(this.domainObject, {strategy: 'latest'})
.then((array) => this.updateValues(array[array.length - 1]));
this.requestHistory();
},
destroyed() {
this.stopWatchingMutation();
this.unsubscribe();
this.openmct.off('timeSystem', this.updateTimeSystem);
this.openmct.time.off('timeSystem', this.updateTimeSystem);
this.openmct.time.off('bounds', this.updateBounds);
},
methods: {
updateValues(datum) {
this.timestamp = this.formats[this.timestampKey].format(datum);
this.value = this.formats[this.valueKey].format(datum);
let newTimestamp = this.formats[this.timestampKey].parse(datum),
shouldUpdate = this.timestamp === '---' || newTimestamp >= this.timestamp,
limit;
var limit = this.limitEvaluator.evaluate(datum, this.valueMetadata);
if (limit) {
this.valueClass = limit.cssClass;
} else {
this.valueClass = '';
if(!this.inBounds(newTimestamp)) {
return;
}
if(shouldUpdate) {
this.timestamp = this.formats[this.timestampKey].parse(datum);
this.value = this.formats[this.valueKey].format(datum);
limit = this.limitEvaluator.evaluate(datum, this.valueMetadata);
if (limit) {
this.valueClass = limit.cssClass;
} else {
this.valueClass = '';
}
}
},
requestHistory() {
this.timestamp = '---';
this.openmct
.telemetry
.request(this.domainObject, {
start: this.bounds.start,
end: this.bounds.end,
strategy: 'latest'
})
.then((data) => this.updateValues(data[data.length - 1]));
},
updateName(name) {
this.name = name;
},
updateBounds(bounds, isTick) {
this.bounds = bounds;
if(!isTick) {
this.requestHistory();
}
},
inBounds(timestamp) {
return timestamp >= this.bounds.start && timestamp <= this.bounds.end;
},
updateTimeSystem(timeSystem) {
this.value = '---';
this.timestamp = '---';
this.valueClass = '';
this.timestampKey = timeSystem.key;
this.openmct
.telemetry
.request(this.domainObject, {strategy: 'latest'})
.then((array) => this.updateValues(array[array.length - 1]));
},
showContextMenu(event) {
this.openmct.contextMenu._showContextMenuForObjectPath(this.currentObjectPath, event.x, event.y, CONTEXT_MENU_ACTIONS);

View File

@@ -88,4 +88,3 @@ export default {
}
}
</script>

View File

@@ -19,38 +19,36 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
import LADTableViewProvider from './LADTableViewProvider';
import LADTableSetViewProvider from './LADTableSetViewProvider';
import LADTableCompositionPolicy from './LADTableCompositionPolicy';
define([
'./LADTableViewProvider',
'./LADTableSetViewProvider'
], function (
LADTableViewProvider,
LADTableSetViewProvider
) {
return function plugin() {
return function install(openmct) {
openmct.objectViews.addProvider(new LADTableViewProvider(openmct));
openmct.objectViews.addProvider(new LADTableSetViewProvider(openmct));
export default function plugin() {
return function install(openmct) {
openmct.types.addType('LadTable', {
name: "LAD Table",
creatable: true,
description: "A Latest Available Data tabular view in which each row displays the values for one or more contained telemetry objects.",
cssClass: 'icon-tabular-lad',
initialize(domainObject) {
domainObject.composition = [];
}
});
openmct.objectViews.addProvider(new LADTableViewProvider(openmct));
openmct.objectViews.addProvider(new LADTableSetViewProvider(openmct));
openmct.types.addType('LadTableSet', {
name: "LAD Table Set",
creatable: true,
description: "A Latest Available Data tabular view in which each row displays the values for one or more contained telemetry objects.",
cssClass: 'icon-tabular-lad-set',
initialize(domainObject) {
domainObject.composition = [];
}
});
};
openmct.types.addType('LadTable', {
name: "LAD Table",
creatable: true,
description: "A Latest Available Data tabular view in which each row displays the values for one or more contained telemetry objects.",
cssClass: 'icon-tabular-lad',
initialize(domainObject) {
domainObject.composition = [];
}
});
openmct.types.addType('LadTableSet', {
name: "LAD Table Set",
creatable: true,
description: "A Latest Available Data tabular view in which each row displays the values for one or more contained telemetry objects.",
cssClass: 'icon-tabular-lad-set',
initialize(domainObject) {
domainObject.composition = [];
}
});
openmct.composition.addPolicy(new LADTableCompositionPolicy(openmct));
};
});
}

View File

@@ -0,0 +1,356 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2018, 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.
*****************************************************************************/
import LadPlugin from './plugin.js';
import Vue from 'vue';
import {
createOpenMct,
getMockObjects,
getMockTelemetry,
getLatestTelemetry
} from 'testTools';
let openmct,
ladPlugin,
parent,
child;
let selectors = {};
selectors.ladTableClass = '.c-table.c-lad-table';
selectors.ladTableBodyRows = selectors.ladTableClass + ' tbody tr';
selectors.ladTableBodyRowsFirstData = selectors.ladTableBodyRows + ' td:first-child';
selectors.ladTableBodyRowsSecondtData = selectors.ladTableBodyRows + ' td:nth-child(2)';
selectors.ladTableBodyRowsThirdData = selectors.ladTableBodyRows + ' td:nth-child(3)';
selectors.ladTableFirstBodyRow = selectors.ladTableClass + ' tbody tr:first-child';
selectors.ladTableFirstRowFirstData = selectors.ladTableBodyRows + ' td:first-child';
selectors.ladTableFirstRowSecondData = selectors.ladTableBodyRows + ' td:nth-child(2)';
selectors.ladTableFirstRowThirdData = selectors.ladTableBodyRows + ' td:nth-child(3)';
selectors.ladTableSetTableHeaders = selectors.ladTableClass + ' .c-table__group-header';
function utcTimeFormat(value) {
return new Date(value).toISOString().replace('T', ' ')
}
describe("The LAD Table", () => {
const ladTableKey = 'LadTable';
let telemetryCount = 3,
timeFormat = 'utc',
mockTelemetry = getMockTelemetry({ count: telemetryCount, format: timeFormat }),
mockObj = getMockObjects({
objectKeyStrings: ['ladTable', 'telemetry'],
format: timeFormat
}),
bounds = {
start: 0,
end: 4
};
// add telemetry object as composition in lad table
mockObj.ladTable.composition.push(mockObj.telemetry.identifier);
// this setups up the app
beforeEach((done) => {
const appHolder = document.createElement('div');
appHolder.style.width = '640px';
appHolder.style.height = '480px';
openmct = createOpenMct();
parent = document.createElement('div');
child = document.createElement('div');
parent.appendChild(child);
spyOn(openmct.telemetry, 'request').and.returnValue(Promise.resolve([]));
ladPlugin = new LadPlugin();
openmct.install(ladPlugin);
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
openmct.time.bounds({ start: bounds.start, end: bounds.end });
openmct.on('start', done);
openmct.start(appHolder);
});
it("should provide a table view only for lad table objects", () => {
let applicableViews = openmct.objectViews.get(mockObj.ladTable),
ladTableView = applicableViews.find(
(viewProvider) => viewProvider.key === ladTableKey
);
expect(applicableViews.length).toEqual(1);
expect(ladTableView).toBeDefined();
});
describe('composition', () => {
let ladTableCompositionCollection;
beforeEach(() => {
ladTableCompositionCollection = openmct.composition.get(mockObj.ladTable);
ladTableCompositionCollection.load();
});
it("should accept telemetry producing objects", () => {
expect(() => {
ladTableCompositionCollection.add(mockObj.telemetry);
}).not.toThrow();
});
it("should reject non-telemtry producing objects", () => {
expect(()=> {
ladTableCompositionCollection.add(mockObj.ladTable);
}).toThrow();
});
});
describe("table view", () => {
let applicableViews,
ladTableViewProvider,
ladTableView,
anotherTelemetryObj = getMockObjects({
objectKeyStrings: ['telemetry'],
overwrite: {
telemetry: {
name: "New Telemetry Object",
identifier: { namespace: "", key: "another-telemetry-object" }
}
}
}).telemetry;
// add another telemetry object as composition in lad table to test multi rows
mockObj.ladTable.composition.push(anotherTelemetryObj.identifier);
beforeEach(async () => {
let telemetryRequestResolve,
telemetryObjectResolve,
anotherTelemetryObjectResolve;
let telemetryRequestPromise = new Promise((resolve) => {
telemetryRequestResolve = resolve;
}),
telemetryObjectPromise = new Promise((resolve) => {
telemetryObjectResolve = resolve;
}),
anotherTelemetryObjectPromise = new Promise((resolve) => {
anotherTelemetryObjectResolve = resolve;
})
openmct.telemetry.request.and.callFake(() => {
telemetryRequestResolve(mockTelemetry);
return telemetryRequestPromise;
});
openmct.objects.get.and.callFake((obj) => {
if(obj.key === 'telemetry-object') {
telemetryObjectResolve(mockObj.telemetry);
return telemetryObjectPromise;
} else {
anotherTelemetryObjectResolve(anotherTelemetryObj);
return anotherTelemetryObjectPromise;
}
});
openmct.time.bounds({ start: bounds.start, end: bounds.end });
applicableViews = openmct.objectViews.get(mockObj.ladTable);
ladTableViewProvider = applicableViews.find((viewProvider) => viewProvider.key === ladTableKey);
ladTableView = ladTableViewProvider.view(mockObj.ladTable, [mockObj.ladTable]);
ladTableView.show(child, true);
await Promise.all([telemetryRequestPromise, telemetryObjectPromise, anotherTelemetryObjectPromise]);
return await Vue.nextTick();
});
it("should show one row per object in the composition", () => {
const rowCount = parent.querySelectorAll(selectors.ladTableBodyRows).length;
expect(rowCount).toBe(mockObj.ladTable.composition.length);
});
it("should show the most recent datum from the telemetry producing object", async () => {
const latestDatum = getLatestTelemetry(mockTelemetry, { timeFormat });
const expectedDate = utcTimeFormat(latestDatum[timeFormat]);
await Vue.nextTick();
const latestDate = parent.querySelector(selectors.ladTableFirstRowSecondData).innerText;
expect(latestDate).toBe(expectedDate);
});
it("should show the name provided for the the telemetry producing object", () => {
const rowName = parent.querySelector(selectors.ladTableFirstRowFirstData).innerText,
expectedName = mockObj.telemetry.name;
expect(rowName).toBe(expectedName);
});
it("should show the correct values for the datum based on domain and range hints", async () => {
const range = mockObj.telemetry.telemetry.values.find((val) => {
return val.hints && val.hints.range !== undefined;
}).key;
const domain = mockObj.telemetry.telemetry.values.find((val) => {
return val.hints && val.hints.domain !== undefined;
}).key;
const mostRecentTelemetry = getLatestTelemetry(mockTelemetry, { timeFormat });
const rangeValue = mostRecentTelemetry[range];
const domainValue = utcTimeFormat(mostRecentTelemetry[domain]);
await Vue.nextTick();
const actualDomainValue = parent.querySelector(selectors.ladTableFirstRowSecondData).innerText;
const actualRangeValue = parent.querySelector(selectors.ladTableFirstRowThirdData).innerText;
expect(actualRangeValue).toBe(rangeValue);
expect(actualDomainValue).toBe(domainValue);
});
});
});
describe("The LAD Table Set", () => {
const ladTableSetKey = 'LadTableSet';
let telemetryCount = 3,
timeFormat = 'utc',
mockTelemetry = getMockTelemetry({ count: telemetryCount, format: timeFormat }),
mockObj = getMockObjects({
objectKeyStrings: ['ladTable', 'ladTableSet', 'telemetry']
}),
bounds = {
start: 0,
end: 4
};
// add mock telemetry to lad table and lad table to lad table set (composition)
mockObj.ladTable.composition.push(mockObj.telemetry.identifier);
mockObj.ladTableSet.composition.push(mockObj.ladTable.identifier);
beforeEach((done) => {
const appHolder = document.createElement('div');
appHolder.style.width = '640px';
appHolder.style.height = '480px';
openmct = createOpenMct();
parent = document.createElement('div');
child = document.createElement('div');
parent.appendChild(child);
spyOn(openmct.telemetry, 'request').and.returnValue(Promise.resolve([]));
ladPlugin = new LadPlugin();
openmct.install(ladPlugin);
spyOn(openmct.objects, 'get').and.returnValue(Promise.resolve({}));
openmct.time.bounds({ start: bounds.start, end: bounds.end });
openmct.on('start', done);
openmct.start(appHolder);
});
it("should provide a lad table set view only for lad table set objects", () => {
let applicableViews = openmct.objectViews.get(mockObj.ladTableSet),
ladTableSetView = applicableViews.find(
(viewProvider) => viewProvider.key === ladTableSetKey
);
expect(applicableViews.length).toEqual(1);
expect(ladTableSetView).toBeDefined();
});
describe('composition', () => {
let ladTableSetCompositionCollection;
beforeEach(() => {
ladTableSetCompositionCollection = openmct.composition.get(mockObj.ladTableSet);
ladTableSetCompositionCollection.load();
});
it("should accept lad table objects", () => {
expect(() => {
ladTableSetCompositionCollection.add(mockObj.ladTable);
}).not.toThrow();
});
it("should reject non lad table objects", () => {
expect(()=> {
ladTableSetCompositionCollection.add(mockObj.telemetry);
}).toThrow();
});
});
describe("table view", () => {
let applicableViews,
ladTableSetViewProvider,
ladTableSetView,
otherObj = getMockObjects({
objectKeyStrings: ['ladTable'],
overwrite: {
ladTable: {
name: "New LAD Table Object",
identifier: { namespace: "", key: "another-lad-object" }
}
}
});
// add another lad table (with telemetry object) object to the lad table set for multi row test
otherObj.ladTable.composition.push(mockObj.telemetry.identifier);
mockObj.ladTableSet.composition.push(otherObj.ladTable.identifier);
beforeEach(async () => {
let telemetryRequestResolve,
ladObjectResolve,
anotherLadObjectResolve;
let telemetryRequestPromise = new Promise((resolve) => {
telemetryRequestResolve = resolve;
}),
ladObjectPromise = new Promise((resolve) => {
ladObjectResolve = resolve;
}),
anotherLadObjectPromise = new Promise((resolve) => {
anotherLadObjectResolve = resolve;
})
openmct.telemetry.request.and.callFake(() => {
telemetryRequestResolve(mockTelemetry);
return telemetryRequestPromise;
});
openmct.objects.get.and.callFake((obj) => {
if(obj.key === 'lad-object') {
ladObjectResolve(mockObj.ladObject);
return ladObjectPromise;
} else if(obj.key === 'another-lad-object') {
anotherLadObjectResolve(otherObj.ladObject);
return anotherLadObjectPromise;
}
return Promise.resolve({});
});
openmct.time.bounds({ start: bounds.start, end: bounds.end });
applicableViews = openmct.objectViews.get(mockObj.ladTableSet);
ladTableSetViewProvider = applicableViews.find((viewProvider) => viewProvider.key === ladTableSetKey);
ladTableSetView = ladTableSetViewProvider.view(mockObj.ladTableSet, [mockObj.ladTableSet]);
ladTableSetView.show(child, true);
await Promise.all([telemetryRequestPromise, ladObjectPromise, anotherLadObjectPromise]);
return await Vue.nextTick();
});
it("should show one row per lad table object in the composition", () => {
const rowCount = parent.querySelectorAll(selectors.ladTableSetTableHeaders).length;
expect(rowCount).toBe(mockObj.ladTableSet.composition.length);
pending();
});
});
});

View File

@@ -70,15 +70,18 @@ export default class ConditionClass extends EventEmitter {
return;
}
this.criteria.forEach(criterion => {
if (this.isAnyOrAllTelemetry(criterion)) {
criterion.getResult(datum, this.conditionManager.telemetryObjects);
} else {
criterion.getResult(datum);
}
});
if (this.isTelemetryUsed(datum.id)) {
this.result = evaluateResults(this.criteria.map(criterion => criterion.result), this.trigger);
this.criteria.forEach(criterion => {
if (this.isAnyOrAllTelemetry(criterion)) {
criterion.getResult(datum, this.conditionManager.telemetryObjects);
} else {
criterion.getResult(datum);
}
});
this.result = evaluateResults(this.criteria.map(criterion => criterion.result), this.trigger);
}
}
isAnyOrAllTelemetry(criterion) {

View File

@@ -57,6 +57,7 @@ export default class ConditionManager extends EventEmitter {
endpoint,
this.telemetryReceived.bind(this, endpoint)
);
// TODO check if this is needed
this.updateConditionTelemetry();
}

View File

@@ -47,17 +47,24 @@ describe("The condition", function () {
name: "Test Object",
telemetry: {
values: [{
key: "some-key",
name: "Some attribute",
key: "value",
name: "Value",
hints: {
range: 2
}
},
{
key: "utc",
name: "Time",
format: "utc",
hints: {
domain: 1
}
}, {
key: "some-other-key",
name: "Another attribute",
hints: {
range: 1
}
key: "testSource",
source: "value",
name: "Test",
format: "string"
}]
}
};
@@ -136,4 +143,38 @@ describe("The condition", function () {
expect(result).toBeTrue();
expect(conditionObj.criteria.length).toEqual(0);
});
it("gets the result of a condition when new telemetry data is received", function () {
conditionObj.getResult({
value: '0',
utc: 'Hi',
id: testTelemetryObject.identifier.key
});
expect(conditionObj.result).toBeTrue();
});
it("gets the result of a condition when new telemetry data is received", function () {
conditionObj.getResult({
value: '1',
utc: 'Hi',
id: testTelemetryObject.identifier.key
});
expect(conditionObj.result).toBeFalse();
});
it("keeps the old result new telemetry data is not used by it", function () {
conditionObj.getResult({
value: '0',
utc: 'Hi',
id: testTelemetryObject.identifier.key
});
expect(conditionObj.result).toBeTrue();
conditionObj.getResult({
value: '1',
utc: 'Hi',
id: '1234'
});
expect(conditionObj.result).toBeTrue();
});
});

View File

@@ -172,6 +172,7 @@ export default {
&& this.embed.bounds.end !== bounds.end;
const isFixedTimespanMode = !this.openmct.time.clock();
this.openmct.time.stopClock();
window.location.href = link;
let message = '';

View File

@@ -325,7 +325,7 @@ define([
} else {
// A history entry is created by startMarquee, need to remove
// if marquee zoom doesn't occur.
this.back();
this.plotHistory.pop();
}
this.$scope.rectangles = [];
this.marquee = undefined;

View File

@@ -0,0 +1,72 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2019, 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.
*****************************************************************************/
import PlotlyViewLayout from './components/PlotlyViewLayout.vue';
import Vue from 'vue';
export default function PlotlyViewProvider(openmct) {
return {
key: 'plotlyPlot',
name: 'Plotly Plot',
cssClass: 'icon-plot-overlay',
canView: function (domainObject) {
return domainObject.type === 'plotlyPlot';
},
canEdit: function (domainObject) {
return domainObject.type === 'plotlyPlot';
},
view: function (domainObject) {
let component;
return {
show: function (element, isEditing) {
component = new Vue({
provide: {
openmct,
domainObject
},
el: element,
components: {
PlotlyViewLayout
},
data() {
return {
isEditing
}
},
template: '<plotly-view-layout :isEditing="isEditing"></plotly-view-layout>'
});
},
onEditModeChange: function (isEditing) {
component.isEditing = isEditing;
},
destroy: function (element) {
component.$destroy();
component = undefined;
}
};
},
priority: function () {
return 1;
}
};
}

View File

@@ -0,0 +1,221 @@
<template>
<div class="l-view-section"></div>
</template>
<script>
import Plotly from 'plotly.js-dist';
import moment from 'moment'
export default {
inject: ['openmct', 'domainObject'],
data: function () {
return {
telemetryObjects: [],
bounds: this.openmct.time.bounds(),
timeRange: 0,
plotData: {},
subscriptions: {}
}
},
mounted() {
this.plotElement = document.querySelector('.l-view-section');
this.composition = this.openmct.composition.get(this.domainObject);
this.composition.on('add', this.addTelemetry);
this.composition.on('remove', this.removeTelemetry);
this.composition.load();
this.openmct.time.on('bounds', this.refreshData);
this.openmct.time.on('clock', this.changeClock);
},
destroyed() {
this.unsubscribe();
},
methods: {
changeClock() {
if (this.openmct.time.clock()) {
Plotly.purge(this.plotElement);
this.telemetryObjects.forEach((telemetryObject, index) => {
this.subscribeTo(telemetryObject, index);
});
}
},
addTelemetry(telemetryObject) {
this.telemetryObjects.push(telemetryObject);
const index = this.telemetryObjects.findIndex(obj => obj === telemetryObject);
this.requestHistory(telemetryObject, index, true);
this.subscribeTo(telemetryObject, index);
},
subscribeTo(telemetryObject, index) {
let keyString = this.openmct.objects.makeKeyString(telemetryObject.identifier);
this.subscriptions[keyString] = this.openmct.telemetry.subscribe(telemetryObject, (datum) => {
//Check that telemetry object has not been removed since telemetry was requested.
if (!this.telemetryObjects.includes(telemetryObject)) {
return;
}
const length = this.plotData[telemetryObject.identifier.key].x.length;
this.updateData(datum, index, length);
});
},
unsubscribe(keyString) {
this.subscriptions[keyString]();
delete this.subscriptions[keyString];
},
refreshData(bounds, isTick) {
this.bounds = bounds;
this.telemetryObjects.forEach((telemetryObject, index) => {
if(!isTick) {
this.requestHistory(telemetryObject, index, false);
} else {
if (this.timeRange === 0 || this.timeRange !== this.bounds.end - this.bounds.start) {
this.timeRange = this.bounds.end - this.bounds.start;
this.requestHistory(telemetryObject, index, false);
}
}
});
},
requestHistory(telemetryObject, index, isAdd) {
this.openmct
.telemetry
.request(telemetryObject, {
start: this.bounds.start,
end: this.bounds.end
})
.then((telemetryData) => {
this.addTrace(telemetryData, telemetryObject, index, isAdd);
});
},
getLayout(telemetryObject, isFixed) {
return {
hovermode: 'compare',
hoverdistance: -1,
autosize: "true",
showlegend: false,
font: {
family: "'Helvetica Neue', Helvetica, Arial, sans-serif",
size: "12px",
color: "#666"
},
xaxis: { // hardcoded as UTC for now
title: 'UTC',
zeroline: false,
range: isFixed ? 'undefined' : [
this.formatDatumX({utc: this.bounds.start}),
this.formatDatumX({utc: this.bounds.start})
]
},
yaxis: {
title: this.getYAxisLabel(telemetryObject),
zeroline: false
},
margin: {
l: 40,
r: 10,
b: 40,
t: 10
},
paper_bgcolor: 'transparent',
plot_bgcolor: 'transparent'
}
},
removeTelemetry(identifier) {
let keyString = this.openmct.objects.makeKeyString(identifier);
this.unsubscribe(keyString);
this.telemetryObjects = this.telemetryObjects.filter((object) => !_.eq(identifier, object.identifier));
if (!this.domainObject.composition.length) {
Plotly.purge(this.plotElement);
} else {
Plotly.deleteTraces(this.plotElement, this.domainObject.composition.length);
}
},
getYAxisLabel(telemetryObject) {
this.setYAxisProp(telemetryObject);
const valueMetadatas = this.openmct.telemetry.getMetadata(telemetryObject).values();
const index = valueMetadatas.findIndex(value => value.key === this.yAxisProp);
const yLabel = valueMetadatas[index].name;
return yLabel;
},
setYAxisProp(telemetryObject) {
if (telemetryObject.type === 'generator') {
this.yAxisProp = 'sin';
} else if (telemetryObject.type === 'example.state-generator') {
this.yAxisProp = 'state';
} else if (telemetryObject.type === 'conditionSet') {
this.yAxisProp = 'output';
}
},
formatDatumX(datum) {
let timestamp = moment.utc(datum.utc).format('YYYY-MM-DDTHH:mm:ss[Z]');
return timestamp;
},
formatDatumY(datum) {
return datum.sin;
},
addTrace(telemetryData, telemetryObject, index, isAdd) {
let x = [];
let y = [];
const colors = ['red', 'green', 'blue'];
telemetryData.forEach((datum) => {
x.push(this.formatDatumX(datum));
y.push(this.formatDatumY(datum));
})
let traceData = [{ // trace configuration
x,
y,
type: 'scattergl',
mode: 'lines+markers',
line: {
color: colors[index], // to set new color for each trace
shape: 'linear'
}
}];
this.plotData[telemetryObject.identifier.key] = traceData[0];
if (!this.plotElement.childNodes.length) { // not traces yet, so create new plot
Plotly.newPlot(
this.plotElement,
traceData,
this.getLayout(telemetryObject, true),
{
displayModeBar: false, // turns off hover-activated toolbar
staticPlot: true // turns off hover effects on datapoints
}
);
} else {
if (isAdd) { // add a new trace to existing plot
Plotly.addTraces(this.plotElement, traceData);
} else { // update existing trace with new data (bounds change)
Plotly.react(this.plotElement, Object.values(this.plotData), this.getLayout(telemetryObject, false));
}
}
},
updateData(datum, index, length) {
// plot all datapoints within bounds
if (datum.utc <= this.bounds.end && this.openmct.time.clock()) {
Plotly.extendTraces(
this.plotElement,
{
x: [[this.formatDatumX(datum)]],
y: [[this.formatDatumY(datum)]]
},
[index], // apply changes to particular trace
length // set the fixed number of points (will drop points from beginning as new points are added)
);
let newRange = {
'xaxis.range': [this.formatDatumX({utc: this.bounds.start}),this.formatDatumX({utc: this.bounds.end})]
};
Plotly.relayout(this.plotElement, newRange);
}
}
}
}
</script>

View File

@@ -0,0 +1,2 @@
.plot svg {
}

View File

@@ -0,0 +1,18 @@
import PlotlyViewProvider from './PlotlyViewProvider.js';
export default function () {
return function install(openmct) {
openmct.objectViews.addProvider(new PlotlyViewProvider(openmct));
openmct.types.addType('plotlyPlot', {
name: "Plotly Plot",
description: "Simple plot rendered by plotly.js",
creatable: true,
cssClass: 'icon-plot-overlay',
initialize: function (domainObject) {
domainObject.composition = [];
domainObject.telemetry = {};
}
});
};
}

View File

@@ -34,6 +34,7 @@ define([
'./URLIndicatorPlugin/URLIndicatorPlugin',
'./telemetryMean/plugin',
'./plot/plugin',
'./plotlyPlot/plugin',
'./telemetryTable/plugin',
'./staticRootPlugin/plugin',
'./notebook/plugin',
@@ -66,6 +67,7 @@ define([
URLIndicatorPlugin,
TelemetryMean,
PlotPlugin,
PlotlyPlotPlugin,
TelemetryTablePlugin,
StaticRootPlugin,
Notebook,
@@ -171,8 +173,8 @@ define([
plugins.ExampleImagery = ExampleImagery;
plugins.ImageryPlugin = ImageryPlugin;
plugins.Plot = PlotPlugin;
plugins.PlotlyPlot = PlotlyPlotPlugin.default;
plugins.TelemetryTable = TelemetryTablePlugin;
plugins.SummaryWidget = SummaryWidget;
plugins.TelemetryMean = TelemetryMean;
plugins.URLIndicator = URLIndicatorPlugin;
@@ -181,7 +183,7 @@ define([
plugins.FolderView = FolderView;
plugins.Tabs = Tabs;
plugins.FlexibleLayout = FlexibleLayout;
plugins.LADTable = LADTable;
plugins.LADTable = LADTable.default;
plugins.Filters = Filters;
plugins.ObjectMigration = ObjectMigration.default;
plugins.GoToOriginalAction = GoToOriginalAction.default;

View File

@@ -18,6 +18,7 @@
@import "../plugins/folderView/components/list-item.scss";
@import "../plugins/folderView/components/list-view.scss";
@import "../plugins/imagery/components/imagery-view-layout.scss";
@import "../plugins/plotlyPlot/components/plotly.scss";
@import "../plugins/telemetryTable/components/table-row.scss";
@import "../plugins/telemetryTable/components/telemetry-filter-indicator.scss";
@import "../plugins/tabs/components/tabs.scss";

View File

@@ -1,4 +1,6 @@
import MCT from 'MCT';
let nativeFunctions = [],
mockObjects = setMockObjects();
export function createOpenMct() {
const openmct = new MCT();
@@ -16,3 +18,225 @@ export function createMouseEvent(eventName) {
view: window
});
}
export const spyOnBuiltins = (functionNames, object = window) => {
functionNames.forEach(functionName => {
if (nativeFunctions[functionName]) {
throw `Builtin spy function already defined for ${functionName}`;
}
nativeFunctions.push({functionName, object, nativeFunction: object[functionName]});
spyOn(object, functionName);
});
};
export const clearBuiltinSpies = () => {
nativeFunctions.forEach(clearBuiltinSpy);
nativeFunctions = [];
};
function clearBuiltinSpy(funcDefinition) {
funcDefinition.object[funcDefinition.functionName] = funcDefinition.nativeFunction;
}
export const getLatestTelemetry = (telemetry = [], opts = {}) => {
let latest = [],
timeFormat = opts.timeFormat || 'utc';
if(telemetry.length) {
latest = telemetry.reduce((prev, cur) => {
return prev[timeFormat] > cur[timeFormat] ? prev : cur;
});
}
return latest;
};
// EXAMPLE:
// getMockObjects({
// name: 'Jamie Telemetry',
// keys: ['test','other','yeah','sup'],
// format: 'local',
// telemetryConfig: {
// hints: {
// test: {
// domain: 1
// },
// other: {
// range: 2
// }
// }
// }
// })
export const getMockObjects = (opts = {}) => {
opts.type = opts.type || 'default';
if(opts.objectKeyStrings && !Array.isArray(opts.objectKeyStrings)) {
throw `"getMockObjects" optional parameter "objectKeyStrings" must be an array of string object keys`;
}
let requestedMocks = {};
if (!opts.objectKeyStrings) {
requestedMocks = copyObj(mockObjects[opts.type]);
} else {
opts.objectKeyStrings.forEach(objKey => {
if(mockObjects[opts.type] && mockObjects[opts.type][objKey]) {
requestedMocks[objKey] = copyObj(mockObjects[opts.type][objKey]);
} else {
throw `No mock object for object key "${objKey}" of type "${opts.type}"`;
}
});
}
// build out custom telemetry mappings if necessary
if(requestedMocks.telemetry && opts.telemetryConfig) {
let keys = opts.telemetryConfig.keys,
format = opts.telemetryConfig.format || 'utc',
hints = opts.telemetryConfig.hints,
values;
// if utc, keep default
if(format === 'utc') {
// save for later if new keys
if(keys) {
format = requestedMocks.telemetry
.telemetry.values.find((vals) => vals.key === 'utc');
}
} else {
format = {
key: format,
name: "Time",
format: format === 'local' ? 'local-format' : format,
hints: {
domain: 1
}
}
}
if(keys) {
values = keys.map((key) => ({ key, name: key + ' attribute' }));
values.push(format); // add time format back in
} else {
values = requestedMocks.telemetry.telemetry.values;
}
if(hints) {
for(let val of values) {
if(hints[val.key]) {
val.hints = hints[val.key];
}
}
}
requestedMocks.telemetry.telemetry.values = values;
}
// overwrite any field keys
if(opts.overwrite) {
for(let mock in requestedMocks) {
if(opts.overwrite[mock]) {
for(let key in opts.overwrite[mock]) {
if (Object.prototype.hasOwnProperty.call(opts.overwrite[mock], key)) {
requestedMocks[mock][key] = opts.overwrite[mock][key];
}
}
}
}
}
return requestedMocks;
}
// EXAMPLE:
// getMockTelemetry({
// name: 'My Telemetry',
// keys: ['test','other','yeah','sup'],
// count: 8,
// format: 'local'
// })
export const getMockTelemetry = (opts = {}) => {
let count = opts.count || 2,
format = opts.format || 'utc',
name = opts.name || 'Mock Telemetry Datum',
keyCount = 2,
keys = false,
telemetry = [];
if(opts.keys && Array.isArray(opts.keys)) {
keyCount = opts.keys.length;
keys = opts.keys;
} else if(opts.keyCount) {
keyCount = opts.keyCount;
}
for(let i = 1; i < count + 1; i++) {
let datum = {
[format]: i,
name
}
for(let k = 1; k < keyCount + 1; k++) {
let key = keys ? keys[k - 1] : 'some-key-' + k,
value = keys ? keys[k - 1] + ' value ' + i : 'some value ' + i + '-' + k;
datum[key] = value;
}
telemetry.push(datum);
}
return telemetry;
}
// copy objects a bit more easily
function copyObj(obj) {
return JSON.parse(JSON.stringify(obj));
}
// add any other necessary types to this mockObjects object
function setMockObjects() {
return {
default: {
ladTable: {
identifier: { namespace: "", key: "lad-object"},
type: 'LadTable',
composition: []
},
ladTableSet: {
identifier: { namespace: "", key: "lad-set-object"},
type: 'LadTableSet',
composition: []
},
telemetry: {
identifier: { namespace: "", key: "telemetry-object"},
type: "test-telemetry-object",
name: "Test Telemetry Object",
telemetry: {
values: [{
key: "name",
name: "Name",
format: "string"
},{
key: "utc",
name: "Time",
format: "utc",
hints: {
domain: 1
}
},{
name: "Some attribute 1",
key: "some-key-1",
hints: {
range: 1
}
}, {
name: "Some attribute 2",
key: "some-key-2"
}]
}
}
},
otherType: {
example: {}
}
}
}