Compare commits

..

18 Commits

Author SHA1 Message Date
16c15ccf3e removing testing units 2020-08-05 11:56:35 -07:00
a010be5718 fix linting errors 2020-07-31 13:04:41 -07:00
2b89c61911 Merge branch 'master' into adding-units 2020-07-31 12:48:46 -07:00
0d478d5dfc making hasUnits computed value more clear 2020-07-30 17:48:32 -07:00
2a9b431c50 WIP: cleaning up hasUnits computed in sets 2020-07-30 15:55:41 -07:00
756e7e5372 making plot series name with unit a dynamic function 2020-07-30 15:38:32 -07:00
3f2ad2be0c PR updates 2020-07-29 11:05:28 -07:00
72f7ec1481 removing checkforunits function 2020-07-24 10:51:52 -07:00
5e21f98309 Merge branch 'master' into adding-units
Merg'n master
2020-07-24 10:41:17 -07:00
26069dac79 final changes from PR comments 2020-07-24 10:11:46 -07:00
68eb5e6286 pr edits 2020-07-17 15:10:17 -07:00
d2b9a7754f linting 2020-07-15 16:35:55 -07:00
70125afa9d reworked logic for add/remove unit detection 2020-07-15 16:12:24 -07:00
551364ad8c fixing implementation for telemetry view items in display layout 2020-07-15 14:45:03 -07:00
7f7518bb9d added units to plots and plot legends 2020-07-15 10:47:03 -07:00
8c8a14af7b added unit column hiding in telemetry tables, added units to lad tables and sets 2020-07-14 13:20:42 -07:00
3735a85c69 Merge branch 'master' into adding-units
Merg'n main branch
2020-07-14 10:25:39 -07:00
d7c266d70f unit coluns in telem tables, need to add config options for those columns 2020-07-13 14:24:51 -07:00
9 changed files with 63 additions and 442 deletions

View File

@ -41,7 +41,6 @@ define([
{
key: "sin",
name: "Sine",
unit: "Hz",
formatString: '%0.2f',
hints: {
range: 1
@ -50,7 +49,6 @@ define([
{
key: "cos",
name: "Cosine",
unit: "deg",
formatString: '%0.2f',
hints: {
range: 2

View File

@ -422,7 +422,7 @@ describe('the plugin', function () {
"telemetry": "any",
"operation": "isStale",
"input": [
"0.2"
"1"
],
"metadata": "dataReceived"
}
@ -481,12 +481,12 @@ describe('the plugin', function () {
utc: undefined
});
done();
}, 300);
}, 1500);
});
it('should not evaluate as stale when telemetry is received in the allotted time', (done) => {
const date = Date.now();
conditionSetDomainObject.configuration.conditionCollection[0].configuration.criteria[0].input = ["0.4"];
conditionSetDomainObject.configuration.conditionCollection[0].configuration.criteria[0].input = ["2"];
let conditionMgr = new ConditionManager(conditionSetDomainObject, openmct);
conditionMgr.on('conditionSetResultUpdated', mockListener);
conditionMgr.telemetryObjects = {
@ -507,7 +507,7 @@ describe('the plugin', function () {
utc: undefined
});
done();
}, 300);
}, 1500);
});
});
});

View File

@ -550,11 +550,7 @@ define(['lodash'], function (_) {
function unitsOnly(items) {
let results = items.filter((item) => {
let currentItem = item[0];
let metadata = openmct.telemetry.getMetadata(currentItem.context.item);
if (!metadata) {
return false;
}
let metadata = this.openmct.telemetry.getMetadata(currentItem.context.item);
let hasUnits = metadata
.valueMetadatas
.filter((metadatum) => metadatum.unit)

View File

@ -1,350 +0,0 @@
/*****************************************************************************
* 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.
*****************************************************************************/
import { createOpenMct, resetApplicationState } from 'utils/testing';
import DisplayLayoutPlugin from './plugin';
describe('the plugin', function () {
let element;
let child;
let openmct;
let displayLayoutDefinition;
beforeAll(() => {
resetApplicationState(openmct);
});
beforeEach((done) => {
openmct = createOpenMct();
openmct.install(new DisplayLayoutPlugin({
showAsView: []
}));
displayLayoutDefinition = openmct.types.get('layout');
element = document.createElement('div');
child = document.createElement('div');
element.appendChild(child);
openmct.on('start', done);
openmct.startHeadless();
});
afterEach(() => {
resetApplicationState(openmct);
});
it('defines a display layout object type with the correct key', () => {
expect(displayLayoutDefinition.definition.name).toEqual('Display Layout');
});
it('provides a view', () => {
const testViewObject = {
id: 'test-object',
type: 'layout',
configuration: {
items: [
{
'identifier': {
'namespace': '',
'key': '55122607-e65e-44d5-9c9d-9c31a914ca89'
},
'x': 8,
'y': 3,
'width': 10,
'height': 5,
'displayMode': 'all',
'value': 'sin',
'stroke': '',
'fill': '',
'color': '',
'size': '13px',
'type': 'telemetry-view',
'id': 'deb9f839-80ad-4ccf-a152-5c763ceb7d7e'
}
],
layoutGrid: [10, 10]
}
};
const applicableViews = openmct.objectViews.get(testViewObject);
let displayLayoutViewProvider = applicableViews.find((viewProvider) => viewProvider.key === 'layout.view');
expect(displayLayoutViewProvider).toBeDefined();
});
describe('the alpha numeric format view', () => {
let displayLayoutItem;
let telemetryItem;
let selection;
beforeEach(() => {
displayLayoutItem = {
'composition': [
],
'configuration': {
'items': [
{
'identifier': {
'namespace': '',
'key': '55122607-e65e-44d5-9c9d-9c31a914ca89'
},
'x': 8,
'y': 3,
'width': 10,
'height': 5,
'displayMode': 'all',
'value': 'sin',
'stroke': '',
'fill': '',
'color': '',
'size': '13px',
'type': 'telemetry-view',
'id': 'deb9f839-80ad-4ccf-a152-5c763ceb7d7e'
}
],
'layoutGrid': [
10,
10
]
},
'name': 'Display Layout',
'type': 'layout',
'identifier': {
'namespace': '',
'key': 'c5e636c1-6771-4c9c-b933-8665cab189b3'
}
};
telemetryItem = {
'telemetry': {
'period': 5,
'amplitude': 5,
'offset': 5,
'dataRateInHz': 5,
'phase': 5,
'randomness': 0
},
'name': 'Sine Wave Generator',
'type': 'generator',
'modified': 1592851063871,
'location': 'mine',
'persisted': 1592851063871,
'id': '55122607-e65e-44d5-9c9d-9c31a914ca89',
'identifier': {
'namespace': '',
'key': '55122607-e65e-44d5-9c9d-9c31a914ca89'
}
};
selection = [
[{
context: {
'layoutItem': displayLayoutItem.configuration.items[0],
'item': telemetryItem,
'index': 1
}
},
{
context: {
'item': displayLayoutItem,
'supportsMultiSelect': true
}
}]
];
});
it('provides an alphanumeric format view', () => {
const displayLayoutAlphaNumFormatView = openmct.inspectorViews.get(selection);
expect(displayLayoutAlphaNumFormatView.length).toBeDefined();
});
});
describe('the toolbar', () => {
let displayLayoutItem;
let selection;
beforeEach(() => {
displayLayoutItem = {
'composition': [
],
'configuration': {
'items': [
{
'fill': '#717171',
'stroke': '',
'x': 1,
'y': 1,
'width': 10,
'height': 5,
'type': 'box-view',
'id': '89b88746-d325-487b-aec4-11b79afff9e8'
},
{
'x': 18,
'y': 9,
'x2': 23,
'y2': 4,
'stroke': '#717171',
'type': 'line-view',
'id': '57d49a28-7863-43bd-9593-6570758916f0'
},
{
'identifier': {
'namespace': '',
'key': '55122607-e65e-44d5-9c9d-9c31a914ca89'
},
'x': 8,
'y': 3,
'width': 10,
'height': 5,
'displayMode': 'all',
'value': 'sin',
'stroke': '',
'fill': '',
'color': '',
'size': '13px',
'type': 'telemetry-view',
'id': 'deb9f839-80ad-4ccf-a152-5c763ceb7d7e'
},
{
'width': 32,
'height': 18,
'x': 78,
'y': 8,
'identifier': {
'namespace': '',
'key': 'bdeb91ab-3a7e-4a71-9dd2-39d73644e136'
},
'hasFrame': true,
'type': 'subobject-view',
'id': 'c0ff485a-344c-4e70-8d83-a9d9998a69fc'
}
],
'layoutGrid': [
10,
10
]
},
'name': 'Display Layout',
'type': 'layout',
'identifier': {
'namespace': '',
'key': 'c5e636c1-6771-4c9c-b933-8665cab189b3'
}
};
selection = [
[{
context: {
'layoutItem': displayLayoutItem.configuration.items[1],
'index': 1
}
},
{
context: {
'item': displayLayoutItem,
'supportsMultiSelect': true
}
}],
[{
context: {
'layoutItem': displayLayoutItem.configuration.items[0],
'index': 0
}
},
{
context: {
item: displayLayoutItem,
'supportsMultiSelect': true
}
}],
[{
context: {
'layoutItem': displayLayoutItem.configuration.items[2],
'item': displayLayoutItem.configuration.items[2],
'index': 2
}
},
{
context: {
item: displayLayoutItem,
'supportsMultiSelect': true
}
}],
[{
context: {
'item': {
'composition': [
{
'namespace': '',
'key': '55122607-e65e-44d5-9c9d-9c31a914ca89'
}
],
'configuration': {
'series': [
{
'identifier': {
'namespace': '',
'key': '55122607-e65e-44d5-9c9d-9c31a914ca89'
}
}
],
'yAxis': {
},
'xAxis': {
}
},
'name': 'Unnamed Overlay Plot',
'type': 'telemetry.plot.overlay',
'modified': 1594142141929,
'location': 'mine',
'identifier': {
'namespace': '',
'key': 'bdeb91ab-3a7e-4a71-9dd2-39d73644e136'
},
'persisted': 1594142141929
},
'layoutItem': displayLayoutItem.configuration.items[3],
'index': 3
}
},
{
context: {
item: displayLayoutItem,
'supportsMultiSelect': true
}
}]
];
});
it('provides controls including separators', () => {
const displayLayoutToolbar = openmct.toolbars.get(selection);
expect(displayLayoutToolbar.length).toBe(9);
});
});
});

View File

@ -117,7 +117,7 @@
title="Deselect All"
@click="unmarkAllRows()"
>
<span class="c-button__label">{{ `Deselect ${marking.disableMultiSelect ? '' : 'All'}` }} </span>
<span class="c-button__label">Deselect All</span>
</button>
<slot name="buttons"></slot>
@ -303,7 +303,6 @@ export default {
default() {
return {
enable: false,
disableMultiSelect: false,
useAlternateControlBar: false,
rowName: '',
rowNamePlural: ""
@ -788,11 +787,6 @@ export default {
this.$set(markedRow, 'marked', true);
this.pause();
if (this.marking.disableMultiSelect) {
this.unmarkAllRows();
insertMethod = 'push';
}
this.markedRows[insertMethod](markedRow);
},
unmarkAllRows(skipUnpause) {
@ -806,7 +800,7 @@ export default {
return;
}
if (!this.markedRows.length || this.marking.disableMultiSelect) {
if (!this.markedRows.length) {
this.markRow(rowIndex);
} else {
if (this.markedRows.length > 1) {

View File

@ -143,7 +143,7 @@
<ConductorHistory
v-if="isFixed"
class="c-conductor__history-select"
:bounds="bounds"
:bounds="openmct.time.bounds()"
:time-system="timeSystem"
/>
</div>
@ -190,10 +190,6 @@ export default {
start: offsets && durationFormatter.format(Math.abs(offsets.start)),
end: offsets && durationFormatter.format(Math.abs(offsets.end))
},
bounds: {
start: bounds.start,
end: bounds.end
},
formattedBounds: {
start: timeFormatter.format(bounds.start),
end: timeFormatter.format(bounds.end)
@ -214,7 +210,7 @@ export default {
document.addEventListener('keydown', this.handleKeyDown);
document.addEventListener('keyup', this.handleKeyUp);
this.setTimeSystem(JSON.parse(JSON.stringify(this.openmct.time.timeSystem())));
this.openmct.time.on('bounds', this.handleNewBounds);
this.openmct.time.on('bounds', this.setViewFromBounds);
this.openmct.time.on('timeSystem', this.setTimeSystem);
this.openmct.time.on('clock', this.setViewFromClock);
this.openmct.time.on('clockOffsets', this.setViewFromOffsets);
@ -224,13 +220,6 @@ export default {
document.removeEventListener('keyup', this.handleKeyUp);
},
methods: {
handleNewBounds(bounds) {
this.setBounds(bounds);
this.setViewFromBounds(bounds);
},
setBounds(bounds) {
this.bounds = bounds;
},
handleKeyDown(event) {
if (event.key === 'Alt') {
this.altPressed = true;
@ -257,13 +246,10 @@ export default {
this.formattedBounds.end = this.timeFormatter.format(bounds.end);
},
endZoom(bounds) {
const _bounds = bounds ? bounds : this.openmct.time.bounds();
this.isZooming = false;
if (bounds) {
this.handleNewBounds(bounds);
} else {
this.setViewFromBounds(this.bounds);
}
this.openmct.time.bounds(_bounds);
},
setTimeSystem(timeSystem) {
this.timeSystem = timeSystem;

View File

@ -207,7 +207,7 @@ export default {
this.$emit('panAxis', panBounds);
},
endPan() {
const panBounds = this.isChangingViewBounds()
const panBounds = this.dragStartX && this.dragX && this.dragStartX !== this.dragX
? this.getPanBounds()
: undefined;
this.$emit('endPan', panBounds);
@ -251,14 +251,16 @@ export default {
});
},
endZoom() {
let zoomBounds;
if (this.isChangingViewBounds()) {
const zoomRange = this.getZoomRange();
zoomBounds = {
const zoomRange = this.dragStartX && this.dragX && this.dragStartX !== this.dragX
? this.getZoomRange()
: undefined;
const zoomBounds = zoomRange
? {
start: this.scaleToBounds(zoomRange.start),
end: this.scaleToBounds(zoomRange.end)
};
}
}
: this.openmct.time.bounds();
this.zoomStyle = {};
this.$emit('endZoom', zoomBounds);
@ -288,9 +290,6 @@ export default {
return bounds.start + offset;
},
isChangingViewBounds() {
return this.dragStartX && this.dragX && this.dragStartX !== this.dragX;
},
resize() {
if (this.$refs.axisHolder.clientWidth !== this.width) {
this.setAxisDimensions();

View File

@ -84,12 +84,7 @@ export default {
},
data() {
return {
/**
* previous bounds entries available for easy re-use
* @history array of timespans
* @timespans {start, end} number representing timestamp
*/
history: this.getHistoryFromLocalStorage(),
history: {}, // contains arrays of timespans {start, end}, array key is time system key
presets: []
};
},
@ -116,20 +111,22 @@ export default {
this.addTimespan();
},
deep: true
},
history: {
handler() {
this.persistHistoryToLocalStorage();
},
deep: true
}
},
mounted() {
this.initializeHistoryIfNoHistory();
this.getHistoryFromLocalStorage();
},
methods: {
getHistoryFromLocalStorage() {
const localStorageHistory = localStorage.getItem(LOCAL_STORAGE_HISTORY_KEY);
const history = localStorageHistory ? JSON.parse(localStorageHistory) : undefined;
return history;
},
initializeHistoryIfNoHistory() {
if (!this.history) {
if (localStorage.getItem(LOCAL_STORAGE_HISTORY_KEY)) {
this.history = JSON.parse(localStorage.getItem(LOCAL_STORAGE_HISTORY_KEY));
} else {
this.history = {};
this.persistHistoryToLocalStorage();
}
@ -160,8 +157,6 @@ export default {
currentHistory.unshift(timespan);
this.history[key] = currentHistory;
this.persistHistoryToLocalStorage();
},
selectTimespan(timespan) {
this.openmct.time.bounds(timespan);

View File

@ -13,7 +13,7 @@
<div class="c-super-menu__menu">
<ul>
<li
v-for="(item, index) in sortedItems()"
v-for="(item, index) in sortedItems"
:key="index"
:class="item.class"
:title="item.title"
@ -44,11 +44,42 @@ import objectUtils from 'objectUtils';
export default {
inject: ['openmct'],
data: function () {
let items = [];
this.openmct.types.listKeys().forEach(key => {
let menuItem = this.openmct.types.get(key).definition;
if (menuItem.creatable) {
let menuItemTemplate = {
key: key,
name: menuItem.name,
class: menuItem.cssClass,
title: menuItem.description
};
items.push(menuItemTemplate);
}
});
return {
items: items,
selectedMenuItem: {},
opened: false
};
},
computed: {
sortedItems() {
return this.items.slice().sort((a, b) => {
if (a.name < b.name) {
return -1;
} else if (a.name > b.name) {
return 1;
} else {
return 0;
}
});
}
},
destroyed() {
document.removeEventListener('click', this.close);
},
@ -101,34 +132,6 @@ export default {
let oldModel = objectUtils.toOldFormat(domainObject);
return this.openmct.$injector.get('instantiate')(oldModel, keyString);
},
sortedItems() {
// TODO: optimize to add event on change 'this.openmct.types'
let items = [];
this.openmct.types.listKeys().forEach(key => {
let menuItem = this.openmct.types.get(key).definition;
if (menuItem.creatable) {
let menuItemTemplate = {
key: key,
name: menuItem.name,
class: menuItem.cssClass,
title: menuItem.description
};
items.push(menuItemTemplate);
}
});
return items.slice().sort((a, b) => {
if (a.name < b.name) {
return -1;
} else if (a.name > b.name) {
return 1;
} else {
return 0;
}
});
}
}
};