Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Derived Telemetry Prototype #7815

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
4316003
skeleton for comps
scottbell Jul 25, 2024
6c74e84
more scaffolding
scottbell Jul 29, 2024
f5d7a33
more drafts
scottbell Jul 30, 2024
0dd0442
add comps manager
scottbell Aug 1, 2024
ff81454
worker ready
scottbell Aug 2, 2024
74c3a95
telemetry is null for some reason
scottbell Aug 2, 2024
ce5e435
can add two sin waves
scottbell Aug 2, 2024
69db534
adding works
scottbell Aug 2, 2024
90a24b3
exact values enabled
scottbell Aug 5, 2024
37d222f
subscriptions work
scottbell Aug 6, 2024
55c8609
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Aug 8, 2024
a94c752
slowing adding gui
scottbell Aug 8, 2024
0113ec0
fix plots
scottbell Aug 12, 2024
a0a2ead
rudimentary expression editor
scottbell Aug 12, 2024
e5719fc
correctly persist
scottbell Aug 13, 2024
0326e38
parameters
scottbell Aug 13, 2024
413338d
can take arbitrary expressions
scottbell Aug 13, 2024
f174515
styles and timing for loading worker
scottbell Aug 14, 2024
9e3e739
ui works kinda
scottbell Aug 14, 2024
dcc8938
need to figure out ranger
scottbell Aug 14, 2024
87dc272
works with time
scottbell Aug 15, 2024
df3ca84
timesystem works
scottbell Aug 15, 2024
484a81b
get rid of batch for now
scottbell Aug 15, 2024
446c811
gui still leaking data
scottbell Aug 15, 2024
aa8750e
memory conserved
scottbell Aug 15, 2024
4d546fb
styles
scottbell Aug 16, 2024
d6c8bee
Merge remote-tracking branch 'origin/master' into telemetry-comps
scottbell Aug 19, 2024
d7d7913
fix initial load
scottbell Aug 19, 2024
d4b2986
expression validator
scottbell Aug 19, 2024
a9d63b9
fix test data
scottbell Aug 20, 2024
e4dcda8
do not persist
scottbell Aug 20, 2024
58568b8
persist after adding
scottbell Aug 20, 2024
d96c3fc
fix editing issues
scottbell Aug 21, 2024
28ec13a
mutate when parameters or expression changes
scottbell Aug 22, 2024
386c3b4
implement output format
scottbell Sep 3, 2024
5af6413
implement output format
scottbell Sep 3, 2024
1c68c7e
be consistent with output key
scottbell Sep 3, 2024
5894363
add icons and fix errant telemetry
scottbell Sep 4, 2024
40a95cf
lint
scottbell Sep 4, 2024
ccc12de
lint
scottbell Sep 4, 2024
3ad21ee
use key instead of name
scottbell Sep 4, 2024
4260cc3
Style enhancements for Derived Telemetry object
charlesh88 Sep 4, 2024
cce3008
Style enhancements for Derived Telemetry object
charlesh88 Sep 4, 2024
2793da4
Enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
1d686c2
Style enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
f8ceaa5
Merge branch 'telemetry-comps' of github.com:nasa/openmct into teleme…
charlesh88 Sep 5, 2024
e1f50fe
Enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
eac4676
do not apply test data when edit mode changes to false
scottbell Sep 5, 2024
02cf701
Revert "do not apply test data when edit mode changes to false"
scottbell Sep 5, 2024
9aeb454
trying this again without blowing away the very pretty styling
scottbell Sep 5, 2024
fb8730c
clean up composition effects
scottbell Sep 5, 2024
06e916e
allow deleting of parameters
scottbell Sep 5, 2024
1996e66
can chain and plot derived data
scottbell Sep 5, 2024
dde0d1a
can delete properly
scottbell Sep 5, 2024
cde34e3
Enhancements for Derived Telemetry object
charlesh88 Sep 5, 2024
fdcece8
Merge branch 'telemetry-comps' of github.com:nasa/openmct into teleme…
charlesh88 Sep 5, 2024
80d8bab
handle arrays and add skeleton tests
scottbell Sep 5, 2024
1615c36
Merge branch 'telemetry-comps' of github.com:nasa/openmct into teleme…
charlesh88 Sep 5, 2024
59461d6
Enhancements for Derived Telemetry object
charlesh88 Sep 6, 2024
1b186d7
add tests
scottbell Sep 6, 2024
b251fde
ensure output format propagates
scottbell Sep 6, 2024
89e18d4
add output format test
scottbell Sep 6, 2024
dd57d78
add some basic object path label tests
scottbell Sep 7, 2024
8b4eed9
good job code scanner. changing to or condition
scottbell Sep 9, 2024
60e07e6
refactor aria labeling
scottbell Sep 10, 2024
e02217a
Merge branch 'master' into telemetry-comps
scottbell Sep 10, 2024
c1a361d
Merge branch 'master' into telemetry-comps
scottbell Sep 11, 2024
ee612a6
resolve conflicts
scottbell Sep 17, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,8 @@
"countup",
"darkmatter",
"Undeletes",
"SSSZ"
"SSSZ",
"LOCF"
],
"dictionaries": ["npm", "softwareTerms", "node", "html", "css", "bash", "en_US", "en-gb", "misc"],
"ignorePaths": [
Expand Down
3 changes: 2 additions & 1 deletion .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const config = {
__OPENMCT_VERSION__: 'readonly',
__OPENMCT_BUILD_DATE__: 'readonly',
__OPENMCT_REVISION__: 'readonly',
__OPENMCT_BUILD_BRANCH__: 'readonly'
__OPENMCT_BUILD_BRANCH__: 'readonly',
__OPENMCT_ROOT_RELATIVE__: 'readonly'
},
plugins: ['prettier', 'unicorn', 'simple-import-sort'],
extends: [
Expand Down
4 changes: 3 additions & 1 deletion .webpack/webpack.common.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const config = {
generatorWorker: './example/generator/generatorWorker.js',
couchDBChangesFeed: './src/plugins/persistence/couch/CouchChangesFeed.js',
inMemorySearchWorker: './src/api/objects/InMemorySearchWorker.js',
compsMathWorker: './src/plugins/comps/CompsMathWorker.js',
espressoTheme: './src/plugins/themes/espresso-theme.scss',
snowTheme: './src/plugins/themes/snow-theme.scss',
darkmatterTheme: './src/plugins/themes/darkmatter-theme.scss'
Expand Down Expand Up @@ -89,7 +90,8 @@ const config = {
__OPENMCT_REVISION__: `'${gitRevision}'`,
__OPENMCT_BUILD_BRANCH__: `'${gitBranch}'`,
__VUE_OPTIONS_API__: true, // enable/disable Options API support, default: true
__VUE_PROD_DEVTOOLS__: false // enable/disable devtools support in production, default: false
__VUE_PROD_DEVTOOLS__: false, // enable/disable devtools support in production, default: false
__VUE_PROD_HYDRATION_MISMATCH_DETAILS__: false, // enable/disable hydration mismatch details in production, default: false
}),
new VueLoaderPlugin(),
new CopyWebpackPlugin({
Expand Down
110 changes: 110 additions & 0 deletions e2e/tests/functional/plugins/comps/comps.e2e.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2024, 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 {
createDomainObjectWithDefaults,
createExampleTelemetryObject,
setRealTimeMode
} from '../../../../appActions.js';
import { expect, test } from '../../../../pluginFixtures.js';

test.describe('Comps', () => {
test.beforeEach(async ({ page }) => {
// Open a browser, navigate to the main page, and wait until all networkevents to resolve
await page.goto('./', { waitUntil: 'domcontentloaded' });
});

test('Basic Functionality Works', async ({ page, openmctConfig }) => {
const folder = await createDomainObjectWithDefaults(page, {
type: 'Folder'
});

// Create the comps with defaults
const comp = await createDomainObjectWithDefaults(page, {
type: 'Derived Telemetry',
parent: folder.uuid
});

const telemetryObject = await createExampleTelemetryObject(page, comp.uuid);

// Check that expressions can be edited
await page.goto(comp.url);
await page.getByLabel('Edit Object').click();
await page.getByPlaceholder('Enter an expression').fill('a*2');
await page.getByText('Current Output').click();
await expect(page.getByText('Expression valid')).toBeVisible();

// Check that expressions are marked invalid
await page.getByLabel('Reference Name Input for a').fill('b');
await page.getByText('Current Output').click();
await expect(page.getByText('Invalid: Undefined symbol a')).toBeVisible();

// Check that test data works
await page.getByPlaceholder('Enter an expression').fill('b*2');
await page.getByLabel('Reference Test Value for b').fill('5');
await page.getByLabel('Apply Test Data').click();
let testValue = await page.getByLabel('Current Output Value').textContent();
expect(testValue).toBe('10');

// Check that real data works
await page.getByLabel('Apply Test Data').click();
await setRealTimeMode(page);
testValue = await page.getByLabel('Current Output Value').textContent();
expect(testValue).not.toBe('10');
// should be a number
expect(parseFloat(testValue)).not.toBeNaN();

// Check that object path is correct
const { myItemsFolderName } = openmctConfig;
let objectPath = await page.getByLabel(`${telemetryObject.name} Object Path`).textContent();
const expectedObjectPath = `/${myItemsFolderName}/${folder.name}/${comp.name}/${telemetryObject.name}`;
expect(objectPath).toBe(expectedObjectPath);

// Check that the comps are saved
await page.getByLabel('Save').click();
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
const expression = await page.getByLabel('Expression', { exact: true }).textContent();
expect(expression).toBe('b*2');

// Check that object path is still correct after save
objectPath = await page.getByLabel(`${telemetryObject.name} Object Path`).textContent();
expect(objectPath).toBe(expectedObjectPath);

// Check that comps work after being saved
testValue = await page.getByLabel('Current Output Value').textContent();
expect(testValue).not.toBe('10');
// should be a number
expect(parseFloat(testValue)).not.toBeNaN();

// Check that output format can be changed
await page.getByLabel('Edit Object').click();
await page.getByRole('tab', { name: 'Config' }).click();
await page.getByLabel('Output Format').click();
await page.getByLabel('Output Format').fill('%d');
await page.getByRole('tab', { name: 'Config' }).click();
// Ensure we only have one digit
await expect(page.getByLabel('Current Output Value')).toHaveText(/^-1$|^0$|^1$/);
// And that it persists post save
await page.getByLabel('Save').click();
await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click();
await expect(page.getByLabel('Current Output Value')).toHaveText(/^-1$|^0$|^1$/);
});
});
101 changes: 101 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"location-bar": "3.0.1",
"lodash": "4.17.21",
"marked": "12.0.0",
"mathjs": "13.1.1",
"mini-css-extract-plugin": "2.7.6",
"moment": "2.30.1",
"moment-duration-format": "2.3.2",
Expand Down
1 change: 1 addition & 0 deletions src/MCT.js
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export class MCT extends EventEmitter {
this.install(this.plugins.UserIndicator());
this.install(this.plugins.Gauge());
this.install(this.plugins.InspectorViews());
this.install(this.plugins.Comps());
}
/**
* Set path to where assets are hosted. This should be the path to main.js.
Expand Down
9 changes: 9 additions & 0 deletions src/api/telemetry/TelemetryAPI.js
Original file line number Diff line number Diff line change
Expand Up @@ -684,6 +684,15 @@ export default class TelemetryAPI {
return this.metadataCache.get(domainObject);
}

/**
* Remove a domain object from the telemetry metadata cache.
* @param {import('openmct').DomainObject} domainObject
*/

removeMetadataFromCache(domainObject) {
this.metadataCache.delete(domainObject);
}

/**
* Get a value formatter for a given valueMetadata.
*
Expand Down
Loading
Loading