Compare commits

..

59 Commits

Author SHA1 Message Date
Jamie V
2f4b38a061 Merge branch 'master' into user-attribution 2022-10-21 16:54:08 -07:00
Jamie V
d402162aed Merge branch 'user-attribution' of http://github.com/nasa/openmct into user-attribution
Merge'n
2022-10-21 16:47:35 -07:00
Jamie V
9e450892a7 updating incorrect use of edit and transaction in our appActions for testing 2022-10-21 16:47:05 -07:00
David Tsay
feba5f6d3b use full identifier instead of key (#5891) 2022-10-21 16:45:52 -07:00
tobiasbrown
4357d35f4a Centre and wrap Condition Widget label (#5886)
* [ConditionWidget] Center label text

Addresses #5799

* [ConditionWidget] Wrap label text

Addresses #5799

* [ConditionWidget] Add padding to label

Addresses #5799

* [ConditionWidget] Use interiorMargin value for padding

Addresses #5799
2022-10-21 16:35:59 -07:00
Andrew Henry
b06aaa7761 Merge branch 'master' into user-attribution 2022-10-21 16:00:58 -07:00
Jamie V
880547e9c0 updating docs for object api "startTransaction" 2022-10-21 15:32:16 -07:00
Jamie V
62bfa44f79 updating remove action to hold the transaction and disregard edit state when handling transactions, also updated object api to return transaction when starting and ignore edit state when determining if transaction is active 2022-10-21 15:26:27 -07:00
Jesse Mazzella
5041f80e5b Update version to 2.1.2-SNAPSHOT (#5897) 2022-10-21 12:16:46 -07:00
Andrew Henry
f59270c6b0 Merge branch 'master' into user-attribution 2022-10-21 11:47:52 -07:00
Scott Bell
9e23f79bc8 Add time context to telemetry requests (#5887)
* add time context to telemetry requests

* change to empty array

* refactor telemetry api to use time context

* removed unused function

* add tests

* add test, rename function

* make function public
2022-10-21 20:25:24 +02:00
Scott Bell
bd1e869f6a fix timing issue (#5896) 2022-10-21 20:19:41 +02:00
dependabot[bot]
e4a36532e7 Bump @types/lodash from 4.14.178 to 4.14.186 (#5892) 2022-10-19 20:40:30 +00:00
dependabot[bot]
2bc2316613 Bump @types/jasmine from 4.0.1 to 4.3.0 (#5893) 2022-10-19 13:34:44 -07:00
John Hill
2fa36b2176 Delete lighthouse.yml (#5885) 2022-10-18 16:10:09 -07:00
Jamie V
42aee096d2 Merge branch 'master' into user-attribution 2022-10-18 14:22:35 -07:00
Jamie V
033a45d600 fixing api test not waiting for save 2022-10-18 14:20:59 -07:00
John Hill
efa38d779e Remove two types from package and pin others (#5883)
* Update package.json

* Update package.json

Co-authored-by: Jesse Mazzella <ozyx@users.noreply.github.com>
2022-10-18 21:17:30 +00:00
Jamie V
6c5510f385 cleaned up objectAPI save, adding transactions for remove action to prevent stale object retrieval, created a private mutation method to be used in object api that does not trigger save 2022-10-18 14:02:13 -07:00
dependabot[bot]
951cc6ec0d Bump eslint-plugin-vue from 9.3.0 to 9.6.0 (#5837)
Bumps [eslint-plugin-vue](https://github.com/vuejs/eslint-plugin-vue) from 9.3.0 to 9.6.0.
- [Release notes](https://github.com/vuejs/eslint-plugin-vue/releases)
- [Commits](https://github.com/vuejs/eslint-plugin-vue/compare/v9.3.0...v9.6.0)

---
updated-dependencies:
- dependency-name: eslint-plugin-vue
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-10-18 16:31:01 +00:00
dependabot[bot]
ef4b8a9934 Bump @percy/cli from 1.10.3 to 1.11.0 (#5846) 2022-10-17 17:52:11 -07:00
Shefali Joshi
c14b48917e Plan documentation (#5871)
* Plan documentation
2022-10-13 20:04:51 -07:00
dependabot[bot]
26165d0a99 Bump eslint from 8.24.0 to 8.25.0 (#5861)
Bumps [eslint](https://github.com/eslint/eslint) from 8.24.0 to 8.25.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v8.24.0...v8.25.0)

---
updated-dependencies:
- dependency-name: eslint
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jesse Mazzella <ozyx@users.noreply.github.com>
2022-10-13 16:53:05 +00:00
Jamie V
b2fabb9f00 WIP debug 2022-10-13 09:24:54 -07:00
Jamie V
b91176c331 WIP for testing purposes 2022-10-11 12:45:02 -07:00
John Hill
f7cf3f72c2 Add playwright-core to dependabot ignore list (#5863) 2022-10-10 15:35:40 -07:00
Shefali Joshi
cb8e09c9f9 Master 2.1.1 (#5858)
* Update version

* Don't delete annotations if there aren't any (#5829)

* don't delete annotations if there aren't any

* add test and align playwright-test

* align core with test

* added annotation describing test

* Add `aria-label` for time conductor history button (#5830)

* [Overlay Plot] Inspector series and legend sync fix (#5835)

* fixed overlay plots to react to series removals correctly, added alias visual to elements pool aliased items

* Keep transaction open on failed editor save (#5840)

* do not end a transaction on a failed editor save
* add unit tests for successful editor save and unsuccessful editor save

* If no matching tags, do not attempt tag search (#5839)

* do not attempt search if no matching tags

* fix timing on test

* commit again in hopes that github will run checks

* add back null tag check

* add some better documentation to tests

Co-authored-by: Andrew Henry <akhenry@gmail.com>

* Update version for  master

Co-authored-by: Scott Bell <scott@traclabs.com>
Co-authored-by: Jesse Mazzella <ozyx@users.noreply.github.com>
Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov>
Co-authored-by: David Tsay <3614296+davetsay@users.noreply.github.com>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2022-10-08 09:04:38 -07:00
Michael Rogers
026eb86f5f 4417 fix codeql issues (#5793)
* Add release to codeql and queries to match lgtm

* Add lgtm config file

* Custom codeQL config to ignore app.js

* Custom config for lgtm

* Remove query filter for lgtm

* Updated the security test docs

* Remove lgtm.yml and delete app.js references

* Update codeql-config.yml

Co-authored-by: Alize Nguyen <alizenguyen@gmail.com>
Co-authored-by: Andrew Henry <akhenry@gmail.com>
2022-10-07 16:30:09 +00:00
Jesse Mazzella
866859a937 [CouchDB] Re-establish feed connection if EventSource is closed due to error (#5845)
* Re-establish feed connection if EventSource is closed due to error

* Use keepAlive timer

* Get rid of magic numbers and add comment
2022-10-06 21:41:38 +02:00
Jesse Mazzella
afc54f41f6 Publish example layouts json (#5842) 2022-10-05 14:17:36 -07:00
Andrew Henry
4decb1ed00 Merge branch 'master' into user-attribution 2022-10-03 11:08:43 -07:00
Jamie V
fb0ea03378 Merge branch 'release/2.1.1' into user-attribution 2022-09-30 16:57:18 -07:00
Jamie V
89e5891192 Merge branch 'master' into user-attribution 2022-09-30 13:33:04 -07:00
Shefali
1c00f1a731 Update version 2022-09-30 13:29:38 -07:00
Jamie V
bd0217498e removing async on mutate 2022-09-30 12:52:51 -07:00
Jamie V
d9181e5c4c updating remove action to wait for save before navigationg 2022-09-30 12:48:35 -07:00
Jamie V
b7ed6619d2 updating plan properties inspector test to account for new fields added in this update 2022-09-30 11:57:42 -07:00
Jamie V
212fa16f59 Merge branch 'user-attribution' of http://github.com/nasa/openmct into user-attribution
Merge'n master
2022-09-30 11:40:02 -07:00
Jamie V
1a8d35fd0c thank you ANDREW! finally found the issue in a failing test, updated object api tests to wait on async save before checking results 2022-09-30 11:39:32 -07:00
Jamie V
caa27dbda2 addressing PR comments and adding restricted notebook type to synchronized objects array 2022-09-30 10:45:38 -07:00
Jamie V
4e48ce3872 Merge branch 'master' into user-attribution 2022-09-30 10:41:08 -07:00
Andrew Henry
b8be778b5a Merge branch 'master' into user-attribution 2022-09-30 08:37:14 -07:00
Jamie V
69a89037ab Merge branch 'user-attribution' of http://github.com/nasa/openmct into user-attribution
Merg'n latest changes
2022-09-27 10:30:31 -07:00
Jamie V
04f5684fa8 WIP 2022-09-27 10:29:59 -07:00
Jamie V
f05eb58f13 Merge branch 'master' into user-attribution 2022-09-26 13:33:21 -07:00
Jamie V
3d9f175234 added a test for created timestamp 2022-09-26 13:20:35 -07:00
Jamie V
f5ec58acf4 adding created date to object creation 2022-09-26 13:16:00 -07:00
Jamie V
50c7e99bd3 pulling user info each time 2022-09-20 15:29:09 -07:00
Jamie V
888b7fcf90 Merge branch 'master' into user-attribution 2022-09-20 14:01:59 -07:00
Jamie V
f72daa7ce1 Merge branch 'master' into user-attribution 2022-09-16 09:48:42 -07:00
Jamie V
aea942ff73 Merge branch 'master' into user-attribution 2022-09-12 17:39:35 -07:00
Jamie V
7304a31fc3 Merge branch 'master' into user-attribution 2022-09-12 12:46:42 -07:00
Jamie V
d93da11129 cleaner test description 2022-09-12 12:45:25 -07:00
Jamie V
f0b2936229 added tests to object api spec for user attribution 2022-09-12 12:43:42 -07:00
Jamie V
fc9663804b update inspector spec to include modified by and created by fields 2022-09-12 12:20:09 -07:00
Jamie V
2e917aedfd removing space 2022-09-12 12:04:12 -07:00
Jamie V
b3820fbf46 Merge branch 'master' into user-attribution 2022-09-09 13:53:37 -07:00
Jamie V
0b7ea7cb1b current implementation of user attribution 2022-09-08 20:05:44 -07:00
Jamie V
f430505f88 initial changes adding modified and created by fields to domain objects and updating properties inspector 2022-09-08 14:19:17 -07:00
40 changed files with 2981 additions and 434 deletions

1
.github/codeql/codeql-config.yml vendored Normal file
View File

@@ -0,0 +1 @@
name: 'Custom CodeQL config'

View File

@@ -13,14 +13,12 @@ updates:
- "pr:daveit"
- "pr:platform"
ignore:
#We have to source the container which is not detected by Dependabot
- dependency-name: "@playwright/test"
#Lots of noise in these type patch releases.
- dependency-name: "@babel/eslint-parser"
- dependency-name: "@playwright/test" #We have to source the playwright container which is not detected by Dependabot
- dependency-name: "playwright-core" #We have to source the playwright container which is not detected by Dependabot
- dependency-name: "@babel/eslint-parser" #Lots of noise in these type patch releases.
update-types: ["version-update:semver-patch"]
- dependency-name: "eslint-plugin-vue" #Lots of noise in these type patch releases.
update-types: ["version-update:semver-patch"]
- dependency-name: "eslint-plugin-vue"
update-types: ["version-update:semver-patch"]
- package-ecosystem: "github-actions"
directory: "/"
schedule:

View File

@@ -1,11 +1,10 @@
name: "CodeQL"
name: 'CodeQL'
on:
push:
branches: [ master ]
branches: [master, 'release/*']
pull_request:
branches: [ master ]
branches: [master, 'release/*']
paths-ignore:
- '**/*Spec.js'
- '**/*.md'
@@ -27,17 +26,19 @@ jobs:
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: Checkout repository
uses: actions/checkout@v3
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: javascript
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
config-file: ./.github/codeql/codeql-config.yml
languages: javascript
queries: security-and-quality
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Autobuild
uses: github/codeql-action/autobuild@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2

View File

@@ -1,98 +0,0 @@
name: lighthouse
on:
workflow_dispatch:
inputs:
version:
description: 'Which branch do you want to test?' # Limited to branch for now
required: false
default: 'master'
pull_request:
types:
- labeled
jobs:
lighthouse-pr:
if: ${{ github.event.label.name == 'pr:lighthouse' }}
runs-on: ubuntu-latest
steps:
- name: Checkout Master for Baseline
uses: actions/checkout@v3
with:
ref: master #explicitly checkout master for baseline
- name: Install Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
- name: npm install with lighthouse cli
run: npm install && npm install -g @lhci/cli
- name: Run lhci against master to generate baseline and ignore exit codes
run: lhci autorun || true
- name: Perform clean checkout of PR
uses: actions/checkout@v3
with:
clean: true
- name: Install Node version which is compatible with PR
uses: actions/setup-node@v3
- name: npm install with lighthouse cli
run: npm install && npm install -g @lhci/cli
- name: Run lhci with PR
run: lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
lighthouse-nightly:
if: ${{ github.event.schedule }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Install Node 16
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache node modules
uses: actions/cache@v2
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
- name: npm install with lighthouse cli
run: npm install && npm install -g @lhci/cli
- name: Run lhci against master to generate baseline
run: lhci autorun
env:
LHCI_GITHUB_APP_TOKEN: ${{ secrets.LHCI_GITHUB_APP_TOKEN }}
lighthouse-dispatch:
if: ${{ github.event.workflow_dispatch }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.inputs.version }}
- name: Install Node 14
uses: actions/setup-node@v3
with:
node-version: '16'
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package.json') }}
- name: npm install with lighthouse cli
run: npm install && npm install -g @lhci/cli
- name: Run lhci against master to generate baseline
run: lhci autorun

View File

@@ -100,7 +100,7 @@ To run the performance tests:
The test suite is configured to all tests localed in `e2e/tests/` ending in `*.e2e.spec.js`. For more about the e2e test suite, please see the [README](./e2e/README.md)
### Security Tests
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/) and our overall security report is available on [LGTM](https://lgtm.com/projects/g/nasa/openmct/)
Each commit is analyzed for known security vulnerabilities using [CodeQL](https://codeql.github.com/docs/codeql-language-guides/codeql-library-for-javascript/) and our overall security report is available on [LGTM](https://lgtm.com/projects/g/nasa/openmct/). The list of CWE coverage items is avaiable in the [CodeQL docs](https://codeql.github.com/codeql-query-help/javascript-cwe/). The CodeQL workflow is specified in the [CodeQL analysis file](./.github/workflows/codeql-analysis.yml) and the custom [CodeQL config](./.github/codeql/codeql-config.yml).
### Test Reporting and Code Coverage

View File

@@ -225,15 +225,14 @@ async function getHashUrlToDomainObject(page, uuid) {
}
/**
* Utilizes the OpenMCT API to detect if the given object has an active transaction (is in Edit mode).
* Utilizes the OpenMCT API to detect if the UI is in Edit mode.
* @private
* @param {import('@playwright/test').Page} page
* @param {string | import('../src/api/objects/ObjectAPI').Identifier} identifier
* @return {Promise<boolean>} true if the object has an active transaction, false otherwise
* @return {Promise<boolean>} true if the Open MCT is in Edit Mode
*/
async function _isInEditMode(page, identifier) {
// eslint-disable-next-line no-return-await
return await page.evaluate((objectIdentifier) => window.openmct.objects.isTransactionActive(objectIdentifier), identifier);
return await page.evaluate(() => window.openmct.editor.isEditing());
}
/**

File diff suppressed because one or more lines are too long

View File

@@ -27,7 +27,7 @@ This test suite is dedicated to tests which verify the basic operations surround
const { test, expect } = require('../../../../baseFixtures');
const { createDomainObjectWithDefaults } = require('../../../../appActions');
test.describe('Notebook Network Request Inspection @couchdb', () => {
test.describe('Notebook Tests with CouchDB @couchdb', () => {
let testNotebook;
test.beforeEach(async ({ page }) => {
//Navigate to baseURL
@@ -221,6 +221,45 @@ test.describe('Notebook Network Request Inspection @couchdb', () => {
expect(filterNonFetchRequests(addingNotebookElementsRequests).length).toBeLessThanOrEqual(4);
});
test('Search tests', async ({ page }) => {
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/akhenry/openmct-yamcs/issues/69'
});
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
await page.locator('[aria-label="Notebook Entry Input"]').click();
await page.locator('[aria-label="Notebook Entry Input"]').fill(`First Entry`);
await page.locator('[aria-label="Notebook Entry Input"]').press('Enter');
// Add three tags
await page.hover(`button:has-text("Add Tag")`);
await page.locator(`button:has-text("Add Tag")`).click();
await page.locator('[placeholder="Type to select tag"]').click();
await page.locator('[aria-label="Autocomplete Options"] >> text=Science').click();
await page.waitForSelector('[aria-label="Tag"]:has-text("Science")');
await page.hover(`button:has-text("Add Tag")`);
await page.locator(`button:has-text("Add Tag")`).click();
await page.locator('[placeholder="Type to select tag"]').click();
await page.locator('[aria-label="Autocomplete Options"] >> text=Drilling').click();
await page.waitForSelector('[aria-label="Tag"]:has-text("Drilling")');
await page.hover(`button:has-text("Add Tag")`);
await page.locator(`button:has-text("Add Tag")`).click();
await page.locator('[placeholder="Type to select tag"]').click();
await page.locator('[aria-label="Autocomplete Options"] >> text=Driving').click();
await page.waitForSelector('[aria-label="Tag"]:has-text("Driving")');
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Sc');
await expect(page.locator('[aria-label="Search Result"]').first()).toContainText("Science");
await expect(page.locator('[aria-label="Search Result"]').first()).not.toContainText("Driving");
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
await expect(page.locator('text=No results found')).toBeVisible();
});
});
// Try to reduce indeterminism of browser requests by only returning fetch requests.

View File

@@ -39,7 +39,7 @@ async function createNotebookAndEntry(page, iterations = 1) {
createDomainObjectWithDefaults(page, { type: 'Notebook' });
for (let iteration = 0; iteration < iterations; iteration++) {
// Click text=To start a new entry, click here or drag and drop any object
// Create an entry
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
const entryLocator = `[aria-label="Notebook Entry Input"] >> nth = ${iteration}`;
await page.locator(entryLocator).click();
@@ -116,7 +116,7 @@ test.describe('Tagging in Notebooks @addInit', () => {
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').click();
await page.locator('[aria-label="OpenMCT Search"] input[type="search"]').fill('Xq');
await expect(page.locator('[aria-label="Search Result"]')).toBeHidden();
await expect(page.locator('text=No results found')).toBeVisible();
});
test('Can delete tags', async ({ page }) => {
@@ -133,6 +133,27 @@ test.describe('Tagging in Notebooks @addInit', () => {
await expect(page.locator('[aria-label="Search Result"]')).not.toContainText("Driving");
});
test('Can delete entries without tags', async ({ page }) => {
test.info().annotations.push({
type: 'issue',
description: 'https://github.com/nasa/openmct/issues/5823'
});
await createNotebookEntryAndTags(page);
await page.locator('text=To start a new entry, click here or drag and drop any object').click();
const entryLocator = `[aria-label="Notebook Entry Input"] >> nth = 1`;
await page.locator(entryLocator).click();
await page.locator(entryLocator).fill(`An entry without tags`);
await page.locator('[aria-label="Notebook Entry Input"] >> nth=1').press('Enter');
await page.hover('[aria-label="Notebook Entry Input"] >> nth=1');
await page.locator('button[title="Delete this entry"]').last().click();
await expect(page.locator('text=This action will permanently delete this entry. Do you wish to continue?')).toBeVisible();
await page.locator('button:has-text("Ok")').click();
await expect(page.locator('text=This action will permanently delete this entry. Do you wish to continue?')).toBeHidden();
});
test('Can delete objects with tags and neither return in search', async ({ page }) => {
await createNotebookEntryAndTags(page);
// Delete Notebook

View File

@@ -1,18 +1,15 @@
{
"name": "openmct",
"version": "2.1.1-SNAPSHOT",
"version": "2.1.2-SNAPSHOT",
"description": "The Open MCT core platform",
"devDependencies": {
"@babel/eslint-parser": "7.18.9",
"@braintree/sanitize-url": "6.0.0",
"@percy/cli": "1.10.3",
"@percy/cli": "1.11.0",
"@percy/playwright": "1.0.4",
"@playwright/test": "1.25.2",
"@types/eventemitter3": "^1.0.0",
"@types/jasmine": "^4.0.1",
"@types/karma": "^6.3.2",
"@types/lodash": "^4.14.178",
"@types/mocha": "^9.1.0",
"@types/jasmine": "4.3.0",
"@types/lodash": "4.14.186",
"babel-loader": "8.2.5",
"babel-plugin-istanbul": "6.1.1",
"codecov": "3.8.3",
@@ -22,10 +19,10 @@
"d3-axis": "3.0.0",
"d3-scale": "3.3.0",
"d3-selection": "3.0.0",
"eslint": "8.24.0",
"eslint": "8.25.0",
"eslint-plugin-compat": "4.0.2",
"eslint-plugin-playwright": "0.11.2",
"eslint-plugin-vue": "9.3.0",
"eslint-plugin-vue": "9.6.0",
"eslint-plugin-you-dont-need-lodash-underscore": "6.12.0",
"eventemitter3": "1.2.0",
"file-saver": "2.0.5",
@@ -51,7 +48,7 @@
"moment-timezone": "0.5.37",
"nyc": "15.1.0",
"painterro": "1.2.78",
"playwright-core": "1.26.1",
"playwright-core": "1.25.2",
"plotly.js-basic-dist": "2.14.0",
"plotly.js-gl2d-dist": "2.14.0",
"printj": "1.3.1",

80
src/api/EditorSpec.js Normal file
View File

@@ -0,0 +1,80 @@
/*****************************************************************************
* Open MCT, Copyright (c) 2014-2022, 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';
describe('The Editor API', () => {
let openmct;
beforeEach((done) => {
openmct = createOpenMct();
openmct.on('start', done);
spyOn(openmct.objects, 'endTransaction');
openmct.startHeadless();
});
afterEach(() => {
return resetApplicationState(openmct);
});
it('opens a transaction on edit', () => {
expect(
openmct.objects.isTransactionActive()
).toBeFalse();
openmct.editor.edit();
expect(
openmct.objects.isTransactionActive()
).toBeTrue();
});
it('closes an open transaction on successful save', async () => {
spyOn(openmct.objects, 'getActiveTransaction')
.and.returnValue({
commit: () => Promise.resolve(true)
});
openmct.editor.edit();
await openmct.editor.save();
expect(
openmct.objects.endTransaction
).toHaveBeenCalled();
});
it('does not close an open transaction on failed save', async () => {
spyOn(openmct.objects, 'getActiveTransaction')
.and.returnValue({
commit: () => Promise.reject()
});
openmct.editor.edit();
await openmct.editor.save().catch(() => {});
expect(
openmct.objects.endTransaction
).not.toHaveBeenCalled();
});
});

View File

@@ -346,6 +346,10 @@ export default class AnnotationAPI extends EventEmitter {
*/
async searchForTags(query, abortController) {
const matchingTagKeys = this.#getMatchingTags(query);
if (!matchingTagKeys.length) {
return [];
}
const searchResults = (await Promise.all(this.openmct.objects.search(matchingTagKeys, abortController, this.openmct.objects.SEARCH_TYPES.TAGS))).flat();
const filteredDeletedResults = searchResults.filter((result) => {
return !(result._deleted);

View File

@@ -94,7 +94,6 @@ describe("The Annotation API", () => {
openmct.startHeadless();
});
afterEach(async () => {
openmct.objects.providers = {};
await resetApplicationState(openmct);
});
it("is defined", () => {
@@ -185,5 +184,10 @@ describe("The Annotation API", () => {
expect(results).toBeDefined();
expect(results.length).toEqual(1);
});
it("returns no tags for empty search", async () => {
const results = await openmct.annotation.searchForTags('q');
expect(results).toBeDefined();
expect(results.length).toEqual(0);
});
});
});

View File

@@ -96,7 +96,7 @@ export default class ObjectAPI {
this.cache = {};
this.interceptorRegistry = new InterceptorRegistry();
this.SYNCHRONIZED_OBJECT_TYPES = ['notebook', 'plan', 'annotation'];
this.SYNCHRONIZED_OBJECT_TYPES = ['notebook', 'restricted-notebook', 'plan', 'annotation'];
this.errors = {
Conflict: ConflictError
@@ -204,13 +204,13 @@ export default class ObjectAPI {
}
identifier = utils.parseKeyString(identifier);
let dirtyObject;
if (this.isTransactionActive()) {
dirtyObject = this.transaction.getDirtyObject(identifier);
}
if (dirtyObject) {
return Promise.resolve(dirtyObject);
if (this.isTransactionActive()) {
let dirtyObject = this.transaction.getDirtyObject(identifier);
if (dirtyObject) {
return Promise.resolve(dirtyObject);
}
}
const provider = this.getProvider(identifier);
@@ -354,10 +354,8 @@ export default class ObjectAPI {
* @returns {Promise} a promise which will resolve when the domain object
* has been saved, or be rejected if it cannot be saved
*/
save(domainObject) {
let provider = this.getProvider(domainObject.identifier);
let savedResolve;
let savedReject;
async save(domainObject) {
const provider = this.getProvider(domainObject.identifier);
let result;
if (!this.isPersistable(domainObject.identifier)) {
@@ -366,27 +364,37 @@ export default class ObjectAPI {
result = Promise.resolve(true);
} else {
const persistedTime = Date.now();
if (domainObject.persisted === undefined) {
result = new Promise((resolve, reject) => {
savedResolve = resolve;
savedReject = reject;
});
domainObject.persisted = persistedTime;
const newObjectPromise = provider.create(domainObject);
if (newObjectPromise) {
newObjectPromise.then(response => {
this.mutate(domainObject, 'persisted', persistedTime);
savedResolve(response);
}).catch((error) => {
savedReject(error);
});
} else {
result = Promise.reject(`[ObjectAPI][save] Object provider returned ${newObjectPromise} when creating new object.`);
}
const username = await this.#getCurrentUsername();
const isNewObject = domainObject.persisted === undefined;
let savedResolve;
let savedReject;
let savedObjectPromise;
result = new Promise((resolve, reject) => {
savedResolve = resolve;
savedReject = reject;
});
this.#mutate(domainObject, 'persisted', persistedTime);
this.#mutate(domainObject, 'modifiedBy', username);
if (isNewObject) {
this.#mutate(domainObject, 'created', persistedTime);
this.#mutate(domainObject, 'createdBy', username);
savedObjectPromise = provider.create(domainObject);
} else {
domainObject.persisted = persistedTime;
this.mutate(domainObject, 'persisted', persistedTime);
result = provider.update(domainObject);
savedObjectPromise = provider.update(domainObject);
}
if (savedObjectPromise) {
savedObjectPromise.then(response => {
savedResolve(response);
}).catch((error) => {
savedReject(error);
});
} else {
result = Promise.reject(`[ObjectAPI][save] Object provider returned ${savedObjectPromise} when ${isNewObject ? 'creating new' : 'updating'} object.`);
}
}
@@ -399,8 +407,21 @@ export default class ObjectAPI {
});
}
async #getCurrentUsername() {
const user = await this.openmct.user.getCurrentUser();
let username;
if (user !== undefined) {
username = user.getName();
}
return username;
}
/**
* After entering into edit mode, creates a new instance of Transaction to keep track of changes in Objects
*
* @returns {Transaction} a new Transaction that was just created
*/
startTransaction() {
if (this.isTransactionActive()) {
@@ -408,6 +429,8 @@ export default class ObjectAPI {
}
this.transaction = new Transaction(this);
return this.transaction;
}
/**
@@ -480,14 +503,16 @@ export default class ObjectAPI {
}
/**
* Modify a domain object.
* Modify a domain object. Internal to ObjectAPI, won't call save after.
* @private
*
* @param {module:openmct.DomainObject} object the object to mutate
* @param {string} path the property to modify
* @param {*} value the new value for this property
* @method mutate
* @memberof module:openmct.ObjectAPI#
*/
mutate(domainObject, path, value) {
#mutate(domainObject, path, value) {
if (!this.supportsMutation(domainObject.identifier)) {
throw `Error: Attempted to mutate immutable object ${domainObject.name}`;
}
@@ -508,6 +533,18 @@ export default class ObjectAPI {
//Destroy temporary mutable object
this.destroyMutable(mutableDomainObject);
}
}
/**
* Modify a domain object and save.
* @param {module:openmct.DomainObject} object the object to mutate
* @param {string} path the property to modify
* @param {*} value the new value for this property
* @method mutate
* @memberof module:openmct.ObjectAPI#
*/
mutate(domainObject, path, value) {
this.#mutate(domainObject, path, value);
if (this.isTransactionActive()) {
this.transaction.add(domainObject);
@@ -684,7 +721,7 @@ export default class ObjectAPI {
}
isTransactionActive() {
return Boolean(this.transaction && this.openmct.editor.isEditing());
return this.transaction !== undefined && this.transaction !== null;
}
#hasAlreadyBeenPersisted(domainObject) {

View File

@@ -8,13 +8,27 @@ describe("The Object API", () => {
let mockDomainObject;
const TEST_NAMESPACE = "test-namespace";
const TEST_KEY = "test-key";
const USERNAME = 'Joan Q Public';
const FIFTEEN_MINUTES = 15 * 60 * 1000;
beforeEach((done) => {
typeRegistry = jasmine.createSpyObj('typeRegistry', [
'get'
]);
const userProvider = {
isLoggedIn() {
return true;
},
getCurrentUser() {
return Promise.resolve({
getName() {
return USERNAME;
}
});
}
};
openmct = createOpenMct();
openmct.user.setProvider(userProvider);
objectAPI = openmct.objects;
openmct.editor = {};
@@ -63,19 +77,34 @@ describe("The Object API", () => {
mockProvider.update.and.returnValue(Promise.resolve(true));
objectAPI.addProvider(TEST_NAMESPACE, mockProvider);
});
it("Calls 'create' on provider if object is new", () => {
objectAPI.save(mockDomainObject);
it("Adds a 'created' timestamp to new objects", async () => {
await objectAPI.save(mockDomainObject);
expect(mockDomainObject.created).not.toBeUndefined();
});
it("Calls 'create' on provider if object is new", async () => {
await objectAPI.save(mockDomainObject);
expect(mockProvider.create).toHaveBeenCalled();
expect(mockProvider.update).not.toHaveBeenCalled();
});
it("Calls 'update' on provider if object is not new", () => {
it("Calls 'update' on provider if object is not new", async () => {
mockDomainObject.persisted = Date.now() - FIFTEEN_MINUTES;
mockDomainObject.modified = Date.now();
objectAPI.save(mockDomainObject);
await objectAPI.save(mockDomainObject);
expect(mockProvider.create).not.toHaveBeenCalled();
expect(mockProvider.update).toHaveBeenCalled();
});
it("Sets the current user for 'createdBy' on new objects", async () => {
await objectAPI.save(mockDomainObject);
expect(mockDomainObject.createdBy).toBe(USERNAME);
});
it("Sets the current user for 'modifedBy' on existing objects", async () => {
mockDomainObject.persisted = Date.now() - FIFTEEN_MINUTES;
mockDomainObject.modified = Date.now();
await objectAPI.save(mockDomainObject);
expect(mockDomainObject.modifiedBy).toBe(USERNAME);
});
it("Does not persist if the object is unchanged", () => {
mockDomainObject.persisted =

View File

@@ -27,7 +27,6 @@ import TelemetryMetadataManager from './TelemetryMetadataManager';
import TelemetryValueFormatter from './TelemetryValueFormatter';
import DefaultMetadataProvider from './DefaultMetadataProvider';
import objectUtils from 'objectUtils';
import _ from 'lodash';
export default class TelemetryAPI {
@@ -73,7 +72,7 @@ export default class TelemetryAPI {
* @returns {boolean} true if the object is a telemetry object.
*/
isTelemetryObject(domainObject) {
return Boolean(this.findMetadataProvider(domainObject));
return Boolean(this.#findMetadataProvider(domainObject));
}
/**
@@ -87,7 +86,7 @@ export default class TelemetryAPI {
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
*/
canProvideTelemetry(domainObject) {
return Boolean(this.findSubscriptionProvider(domainObject))
return Boolean(this.#findSubscriptionProvider(domainObject))
|| Boolean(this.findRequestProvider(domainObject));
}
@@ -120,7 +119,7 @@ export default class TelemetryAPI {
/**
* @private
*/
findSubscriptionProvider() {
#findSubscriptionProvider() {
const args = Array.prototype.slice.apply(arguments);
function supportsDomainObject(provider) {
return provider.supportsSubscribe.apply(provider, args);
@@ -130,9 +129,10 @@ export default class TelemetryAPI {
}
/**
* @private
* Returns a telemetry request provider that supports
* a given domain object and options.
*/
findRequestProvider(domainObject) {
findRequestProvider() {
const args = Array.prototype.slice.apply(arguments);
function supportsDomainObject(provider) {
return provider.supportsRequest.apply(provider, args);
@@ -144,7 +144,7 @@ export default class TelemetryAPI {
/**
* @private
*/
findMetadataProvider(domainObject) {
#findMetadataProvider(domainObject) {
return this.metadataProviders.filter(function (p) {
return p.supportsMetadata(domainObject);
})[0];
@@ -153,7 +153,7 @@ export default class TelemetryAPI {
/**
* @private
*/
findLimitEvaluator(domainObject) {
#findLimitEvaluator(domainObject) {
return this.limitProviders.filter(function (p) {
return p.supportsLimits(domainObject);
})[0];
@@ -161,6 +161,7 @@ export default class TelemetryAPI {
/**
* @private
* Though used in TelemetryCollection as well
*/
standardizeRequestOptions(options) {
if (!Object.prototype.hasOwnProperty.call(options, 'start')) {
@@ -174,6 +175,10 @@ export default class TelemetryAPI {
if (!Object.prototype.hasOwnProperty.call(options, 'domain')) {
options.domain = this.openmct.time.timeSystem().key;
}
if (!Object.prototype.hasOwnProperty.call(options, 'timeContext')) {
options.timeContext = this.openmct.time;
}
}
/**
@@ -241,7 +246,7 @@ export default class TelemetryAPI {
/**
* Request historical telemetry for a domain object.
* The `options` argument allows you to specify filters
* (start, end, etc.), sort order, and strategies for retrieving
* (start, end, etc.), sort order, time context, and strategies for retrieving
* telemetry (aggregation, latest available, etc.).
*
* @method request
@@ -255,7 +260,7 @@ export default class TelemetryAPI {
*/
async request(domainObject) {
if (this.noRequestProviderForAllObjects) {
return Promise.resolve([]);
return [];
}
if (arguments.length === 1) {
@@ -273,22 +278,24 @@ export default class TelemetryAPI {
if (!provider) {
this.requestAbortControllers.delete(abortController);
return this.handleMissingRequestProvider(domainObject);
return this.#handleMissingRequestProvider(domainObject);
}
arguments[1] = await this.applyRequestInterceptors(domainObject, arguments[1]);
try {
const telemetry = await provider.request(...arguments);
return provider.request.apply(provider, arguments)
.catch((rejected) => {
if (rejected.name !== 'AbortError') {
this.openmct.notifications.error('Error requesting telemetry data, see console for details');
console.error(rejected);
}
return telemetry;
} catch (error) {
if (error.name !== 'AbortError') {
this.openmct.notifications.error('Error requesting telemetry data, see console for details');
console.error(error);
}
return Promise.reject(rejected);
}).finally(() => {
this.requestAbortControllers.delete(abortController);
});
throw new Error(error);
} finally {
this.requestAbortControllers.delete(abortController);
}
}
/**
@@ -306,7 +313,7 @@ export default class TelemetryAPI {
* the subscription
*/
subscribe(domainObject, callback, options) {
const provider = this.findSubscriptionProvider(domainObject);
const provider = this.#findSubscriptionProvider(domainObject);
if (!this.subscribeCache) {
this.subscribeCache = {};
@@ -353,7 +360,7 @@ export default class TelemetryAPI {
*/
getMetadata(domainObject) {
if (!this.metadataCache.has(domainObject)) {
const metadataProvider = this.findMetadataProvider(domainObject);
const metadataProvider = this.#findMetadataProvider(domainObject);
if (!metadataProvider) {
return;
}
@@ -369,33 +376,6 @@ export default class TelemetryAPI {
return this.metadataCache.get(domainObject);
}
/**
* Return an array of valueMetadatas that are common to all supplied
* telemetry objects and match the requested hints.
*
*/
commonValuesForHints(metadatas, hints) {
const options = metadatas.map(function (metadata) {
const values = metadata.valuesForHints(hints);
return _.keyBy(values, 'key');
}).reduce(function (a, b) {
const results = {};
Object.keys(a).forEach(function (key) {
if (Object.prototype.hasOwnProperty.call(b, key)) {
results[key] = a[key];
}
});
return results;
});
const sortKeys = hints.map(function (h) {
return 'hints.' + h;
});
return _.sortBy(options, sortKeys);
}
/**
* Get a value formatter for a given valueMetadata.
*
@@ -450,7 +430,7 @@ export default class TelemetryAPI {
*
* @returns Promise
*/
handleMissingRequestProvider(domainObject) {
#handleMissingRequestProvider(domainObject) {
this.noRequestProviderForAllObjects = this.requestProviders.every(requestProvider => {
const supportsRequest = requestProvider.supportsRequest.apply(requestProvider, arguments);
const hasRequestProvider = Object.prototype.hasOwnProperty.call(requestProvider, 'request') && typeof requestProvider.request === 'function';
@@ -540,7 +520,7 @@ export default class TelemetryAPI {
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
*/
getLimitEvaluator(domainObject) {
const provider = this.findLimitEvaluator(domainObject);
const provider = this.#findLimitEvaluator(domainObject);
if (!provider) {
return {
evaluate: function () {}
@@ -578,7 +558,7 @@ export default class TelemetryAPI {
* @memberof module:openmct.TelemetryAPI~TelemetryProvider#
*/
getLimits(domainObject) {
const provider = this.findLimitEvaluator(domainObject);
const provider = this.#findLimitEvaluator(domainObject);
if (!provider || !provider.getLimits) {
return {
limits: function () {

View File

@@ -23,11 +23,11 @@ import { createOpenMct, resetApplicationState } from 'utils/testing';
import TelemetryAPI from './TelemetryAPI';
import TelemetryCollection from './TelemetryCollection';
describe('Telemetry API', function () {
describe('Telemetry API', () => {
let openmct;
let telemetryAPI;
beforeEach(function () {
beforeEach(() => {
openmct = {
time: jasmine.createSpyObj('timeAPI', [
'timeSystem',
@@ -47,11 +47,11 @@ describe('Telemetry API', function () {
});
describe('telemetry providers', function () {
describe('telemetry providers', () => {
let telemetryProvider;
let domainObject;
beforeEach(function () {
beforeEach(() => {
telemetryProvider = jasmine.createSpyObj('telemetryProvider', [
'supportsSubscribe',
'subscribe',
@@ -73,19 +73,16 @@ describe('Telemetry API', function () {
};
});
it('provides consistent results without providers', function (done) {
it('provides consistent results without providers', async () => {
const unsubscribe = telemetryAPI.subscribe(domainObject);
expect(unsubscribe).toEqual(jasmine.any(Function));
telemetryAPI.request(domainObject)
.then((data) => {
expect(data).toEqual([]);
})
.finally(done);
const data = await telemetryAPI.request(domainObject);
expect(data).toEqual([]);
});
it('skips providers that do not match', function (done) {
it('skips providers that do not match', async () => {
telemetryProvider.supportsSubscribe.and.returnValue(false);
telemetryProvider.supportsRequest.and.returnValue(false);
telemetryProvider.request.and.returnValue(Promise.resolve([]));
@@ -98,14 +95,13 @@ describe('Telemetry API', function () {
expect(telemetryProvider.subscribe).not.toHaveBeenCalled();
expect(unsubscribe).toEqual(jasmine.any(Function));
telemetryAPI.request(domainObject).then((response) => {
expect(telemetryProvider.supportsRequest)
.toHaveBeenCalledWith(domainObject, jasmine.any(Object));
expect(telemetryProvider.request).not.toHaveBeenCalled();
}).finally(done);
await telemetryAPI.request(domainObject);
expect(telemetryProvider.supportsRequest)
.toHaveBeenCalledWith(domainObject, jasmine.any(Object));
expect(telemetryProvider.request).not.toHaveBeenCalled();
});
it('sends subscribe calls to matching providers', function () {
it('sends subscribe calls to matching providers', () => {
const unsubFunc = jasmine.createSpy('unsubscribe');
telemetryProvider.subscribe.and.returnValue(unsubFunc);
telemetryProvider.supportsSubscribe.and.returnValue(true);
@@ -133,7 +129,7 @@ describe('Telemetry API', function () {
expect(callback).not.toHaveBeenCalledWith('otherValue');
});
it('subscribes once per object', function () {
it('subscribes once per object', () => {
const unsubFunc = jasmine.createSpy('unsubscribe');
telemetryProvider.subscribe.and.returnValue(unsubFunc);
telemetryProvider.supportsSubscribe.and.returnValue(true);
@@ -164,7 +160,7 @@ describe('Telemetry API', function () {
expect(callbacktwo).not.toHaveBeenCalledWith('anotherValue');
});
it('only deletes subscription cache when there are no more subscribers', function () {
it('only deletes subscription cache when there are no more subscribers', () => {
const unsubFunc = jasmine.createSpy('unsubscribe');
telemetryProvider.subscribe.and.returnValue(unsubFunc);
telemetryProvider.supportsSubscribe.and.returnValue(true);
@@ -187,7 +183,7 @@ describe('Telemetry API', function () {
unsubscribeThree();
});
it('does subscribe/unsubscribe', function () {
it('does subscribe/unsubscribe', () => {
const unsubFunc = jasmine.createSpy('unsubscribe');
telemetryProvider.subscribe.and.returnValue(unsubFunc);
telemetryProvider.supportsSubscribe.and.returnValue(true);
@@ -203,7 +199,7 @@ describe('Telemetry API', function () {
unsubscribe();
});
it('subscribes for different object', function () {
it('subscribes for different object', () => {
const unsubFuncs = [];
const notifiers = [];
telemetryProvider.supportsSubscribe.and.returnValue(true);
@@ -243,120 +239,120 @@ describe('Telemetry API', function () {
expect(unsubFuncs[1]).toHaveBeenCalled();
});
it('sends requests to matching providers', function (done) {
it('sends requests to matching providers', async () => {
const telemPromise = Promise.resolve([]);
telemetryProvider.supportsRequest.and.returnValue(true);
telemetryProvider.request.and.returnValue(telemPromise);
telemetryAPI.addProvider(telemetryProvider);
telemetryAPI.request(domainObject).then(() => {
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
domainObject,
jasmine.any(Object)
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
domainObject,
jasmine.any(Object)
);
}).finally(done);
await telemetryAPI.request(domainObject);
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
domainObject,
jasmine.any(Object)
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
domainObject,
jasmine.any(Object)
);
});
it('generates default request options', function (done) {
it('generates default request options', async () => {
telemetryProvider.supportsRequest.and.returnValue(true);
telemetryProvider.request.and.returnValue(Promise.resolve([]));
telemetryAPI.addProvider(telemetryProvider);
telemetryAPI.request(domainObject).then(() => {
const { signal } = new AbortController();
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system'
}
);
await telemetryAPI.request(domainObject);
const { signal } = new AbortController();
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system',
timeContext: jasmine.any(Object)
}
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system'
}
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system',
timeContext: jasmine.any(Object)
}
);
telemetryProvider.supportsRequest.calls.reset();
telemetryProvider.request.calls.reset();
telemetryProvider.supportsRequest.calls.reset();
telemetryProvider.request.calls.reset();
telemetryAPI.request(domainObject, {}).then(() => {
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system'
}
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system'
}
);
});
}).finally(done);
await telemetryAPI.request(domainObject, {});
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system',
timeContext: jasmine.any(Object)
}
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
jasmine.any(Object),
{
signal,
start: 0,
end: 1,
domain: 'system',
timeContext: jasmine.any(Object)
}
);
});
it('do not overwrite existing request options', function (done) {
it('do not overwrite existing request options', async () => {
telemetryProvider.supportsRequest.and.returnValue(true);
telemetryProvider.request.and.returnValue(Promise.resolve([]));
telemetryAPI.addProvider(telemetryProvider);
telemetryAPI.request(domainObject, {
await telemetryAPI.request(domainObject, {
start: 20,
end: 30,
domain: 'someDomain'
}).then(() => {
const { signal } = new AbortController();
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
jasmine.any(Object),
{
start: 20,
end: 30,
domain: 'someDomain',
signal
}
);
});
const { signal } = new AbortController();
expect(telemetryProvider.supportsRequest).toHaveBeenCalledWith(
jasmine.any(Object),
{
start: 20,
end: 30,
domain: 'someDomain',
signal,
timeContext: jasmine.any(Object)
}
);
expect(telemetryProvider.request).toHaveBeenCalledWith(
jasmine.any(Object),
{
start: 20,
end: 30,
domain: 'someDomain',
signal
}
);
}).finally(done);
expect(telemetryProvider.request).toHaveBeenCalledWith(
jasmine.any(Object),
{
start: 20,
end: 30,
domain: 'someDomain',
signal,
timeContext: jasmine.any(Object)
}
);
});
});
describe('metadata', function () {
describe('metadata', () => {
let mockMetadata = {};
let mockObjectType = {
definition: {}
};
beforeEach(function () {
beforeEach(() => {
telemetryAPI.addProvider({
key: 'mockMetadataProvider',
supportsMetadata() {
@@ -369,7 +365,7 @@ describe('Telemetry API', function () {
openmct.types.get.and.returnValue(mockObjectType);
});
it('respects explicit priority', function () {
it('respects explicit priority', () => {
mockMetadata.values = [
{
key: "name",
@@ -408,7 +404,7 @@ describe('Telemetry API', function () {
expect(value.hints.priority).toBe(index + 1);
});
});
it('if no explicit priority, defaults to order defined', function () {
it('if no explicit priority, defaults to order defined', () => {
mockMetadata.values = [
{
key: "name",
@@ -435,7 +431,7 @@ describe('Telemetry API', function () {
expect(value.key).toBe(mockMetadata.values[index].key);
});
});
it('respects domain priority', function () {
it('respects domain priority', () => {
mockMetadata.values = [
{
key: "name",
@@ -477,7 +473,7 @@ describe('Telemetry API', function () {
expect(values[0].key).toBe('timestamp-local');
expect(values[1].key).toBe('timestamp-utc');
});
it('respects range priority', function () {
it('respects range priority', () => {
mockMetadata.values = [
{
key: "name",
@@ -519,7 +515,7 @@ describe('Telemetry API', function () {
expect(values[0].key).toBe('cos');
expect(values[1].key).toBe('sin');
});
it('respects priority and domain ordering', function () {
it('respects priority and domain ordering', () => {
mockMetadata.values = [
{
key: "id",
@@ -588,7 +584,7 @@ describe('Telemetry API', function () {
definition: {}
};
beforeEach(function () {
beforeEach(() => {
openmct.telemetry = telemetryAPI;
telemetryAPI.addProvider({
key: 'mockMetadataProvider',
@@ -644,16 +640,14 @@ describe('Telemetery', () => {
return resetApplicationState(openmct);
});
it('should not abort request without navigation', function (done) {
it('should not abort request without navigation', async () => {
telemetryAPI.addProvider(telemetryProvider);
telemetryAPI.request({}).finally(() => {
expect(watchedSignal.aborted).toBe(false);
done();
});
await telemetryAPI.request({});
expect(watchedSignal.aborted).toBe(false);
});
it('should abort request on navigation', function (done) {
it('should abort request on navigation', (done) => {
telemetryAPI.addProvider(telemetryProvider);
telemetryAPI.request({}).finally(() => {

View File

@@ -229,6 +229,25 @@ describe("The Time API", function () {
expect(api.clock()).toBeUndefined();
});
it('Provides a default time context', () => {
const timeContext = api.getContextForView([]);
expect(timeContext).not.toBe(null);
});
it("Without a clock, is in fixed time mode", () => {
const timeContext = api.getContextForView([]);
expect(timeContext.isRealTime()).toBe(false);
});
it("Provided a clock, is in real-time mode", () => {
const timeContext = api.getContextForView([]);
timeContext.clock('mts', {
start: 0,
end: 1
});
expect(timeContext.isRealTime()).toBe(true);
});
});
it("on tick, observes offsets, and indicates tick in bounds callback", function () {

View File

@@ -362,6 +362,18 @@ class TimeContext extends EventEmitter {
this.boundsVal = newBounds;
this.emit('bounds', this.boundsVal, true);
}
/**
* Checks if this time context is in real-time mode or not.
* @returns {boolean} true if this context is in real-time mode, false if not
*/
isRealTime() {
if (this.clock()) {
return true;
}
return false;
}
}
export default TimeContext;

View File

@@ -114,6 +114,8 @@ export default {
this.formats = this.openmct.telemetry.getFormatMap(this.metadata);
this.keyString = this.openmct.objects.makeKeyString(this.domainObject.identifier);
this.timeContext = this.openmct.time.getContextForView(this.objectPath);
this.limitEvaluator = this.openmct
.telemetry
.limitEvaluator(this.domainObject);
@@ -134,7 +136,8 @@ export default {
this.telemetryCollection = this.openmct.telemetry.requestCollection(this.domainObject, {
size: 1,
strategy: 'latest'
strategy: 'latest',
timeContext: this.timeContext
});
this.telemetryCollection.on('add', this.setLatestValues);
this.telemetryCollection.on('clear', this.resetValues);

View File

@@ -30,6 +30,12 @@
padding: $interiorMarginLg $interiorMarginLg * 2;
}
.c-condition-widget__label {
padding: $interiorMargin;
text-align: center;
white-space: normal;
}
a.c-condition-widget {
// Widget is conditionally made into a <a> when URL property has been defined
cursor: pointer !important;

View File

@@ -282,12 +282,15 @@ export default {
this.limitEvaluator = this.openmct.telemetry.limitEvaluator(this.domainObject);
this.formats = this.openmct.telemetry.getFormatMap(this.metadata);
this.timeContext = this.openmct.time.getContextForView(this.objectPath);
const valueMetadata = this.metadata ? this.metadata.value(this.item.value) : {};
this.customStringformatter = this.openmct.telemetry.customStringFormatter(valueMetadata, this.item.format);
this.telemetryCollection = this.openmct.telemetry.requestCollection(this.domainObject, {
size: 1,
strategy: 'latest'
strategy: 'latest',
timeContext: this.timeContext
});
this.telemetryCollection.on('add', this.setLatestValues);
this.telemetryCollection.on('clear', this.refreshData);

View File

@@ -107,7 +107,7 @@ export default class CreateAction extends PropertiesAction {
}
const url = '#/browse/' + objectPath
.map(object => object && this.openmct.objects.makeKeyString(object.identifier.key))
.map(object => object && this.openmct.objects.makeKeyString(object.identifier))
.reverse()
.join('/');

View File

@@ -515,7 +515,9 @@ export default {
});
},
removeAnnotations(entryId) {
this.openmct.annotation.deleteAnnotations(this.notebookAnnotations[entryId]);
if (this.notebookAnnotations[entryId]) {
this.openmct.annotation.deleteAnnotations(this.notebookAnnotations[entryId]);
}
},
checkEntryPos(entry) {
const entryPos = getEntryPosById(entry.id, this.domainObject, this.selectedSection, this.selectedPage);

View File

@@ -2,6 +2,9 @@
const connections = [];
let connected = false;
let couchEventSource;
let changesFeedUrl;
const keepAliveTime = 20 * 1000;
let keepAliveTimer;
const controller = new AbortController();
self.onconnect = function (e) {
@@ -35,7 +38,8 @@
return;
}
self.listenForChanges(event.data.url);
changesFeedUrl = event.data.url;
self.listenForChanges();
}
};
@@ -63,17 +67,28 @@
});
};
self.listenForChanges = function (url) {
console.debug('⇿ Opening CouchDB change feed connection ⇿');
self.listenForChanges = function () {
if (keepAliveTimer) {
clearTimeout(keepAliveTimer);
}
couchEventSource = new EventSource(url);
couchEventSource.onerror = self.onerror;
couchEventSource.onopen = self.onopen;
/**
* Once the connection has been opened, poll every 20 seconds to see if the EventSource has closed unexpectedly.
* If it has, attempt to reconnect.
*/
keepAliveTimer = setTimeout(self.listenForChanges, keepAliveTime);
// start listening for events
couchEventSource.addEventListener('message', self.onCouchMessage);
connected = true;
console.debug('⇿ Opened connection ⇿');
if (!couchEventSource || couchEventSource.readyState === EventSource.CLOSED) {
console.debug('⇿ Opening CouchDB change feed connection ⇿');
couchEventSource = new EventSource(changesFeedUrl);
couchEventSource.onerror = self.onerror;
couchEventSource.onopen = self.onopen;
// start listening for events
couchEventSource.addEventListener('message', self.onCouchMessage);
connected = true;
console.debug('⇿ Opened connection ⇿');
}
};
self.updateCouchStateIndicator = function () {

View File

@@ -90,6 +90,10 @@ class CouchSearchProvider {
}
searchForTags(tagsArray, abortSignal) {
if (!tagsArray || !tagsArray.length) {
return [];
}
const filter = {
"selector": {
"$and": [

117
src/plugins/plan/README.md Normal file
View File

@@ -0,0 +1,117 @@
# Plan view and domain objects
Plans provide a view for a list of activities grouped by categories.
## Plan category and activity JSON format
The JSON format for a plan consists of categories/groups and a list of activities for each category.
Activity properties include:
* name: Name of the activity
* start: Timestamps in milliseconds
* end: Timestamps in milliseconds
* type: Matches the name of the category it is in
* color: Background color for the activity
* textColor: Color of the name text for the activity
* The format of the json file is as follows:
```json
{
"TEST_GROUP": [{
"name": "Event 1 with a really long name",
"start": 1665323197000,
"end": 1665344921000,
"type": "TEST_GROUP",
"color": "orange",
"textColor": "white"
}],
"GROUP_2": [{
"name": "Event 2",
"start": 1665409597000,
"end": 1665456252000,
"type": "GROUP_2",
"color": "red",
"textColor": "white"
}]
}
```
## Plans using JSON file uploads
Plan domain objects can be created by uploading a JSON file with the format above to render categories and activities.
## Using Domain Objects directly
If uploading a JSON is not desired, it is possible to visualize domain objects of type 'plan'.
The standard model is as follows:
```javascript
{
identifier: {
namespace: ""
key: "test-plan"
}
name:"A plan object",
type:"plan",
location:"ROOT",
selectFile: {
body: {
SOME_CATEGORY: [{
name: "An activity",
start: 1665323197000,
end: 1665323197100,
type: "SOME_CATEGORY"
}
],
ANOTHER_CATEGORY: [{
name: "An activity",
start: 1665323197000,
end: 1665323197100,
type: "ANOTHER_CATEGORY"
}
]
}
}
}
```
If your data has non-standard keys for `start, end, type and activities` properties, use the `sourceMap` property mapping.
```javascript
{
identifier: {
namespace: ""
key: "another-test-plan"
}
name:"Another plan object",
type:"plan",
location:"ROOT",
sourceMap: {
start: 'start_time',
end: 'end_time',
activities: 'items',
groupId: 'category'
},
selectFile: {
body: {
items: [
{
name: "An activity",
start_time: 1665323197000,
end_time: 1665323197100,
category: "SOME_CATEGORY"
},
{
name: "Another activity",
start_time: 1665323198000,
end_time: 1665323198100,
category: "ANOTHER_CATEGORY"
}
]
}
}
}
```
## Rendering categories and activities:
The algorithm to render categories and activities on a canvas is as follows:
* Each category gets a swimlane.
* Activities within a category are rendered within it's swimlane.
* Render each activity on a given row if it's duration+label do not overlap (start/end times) with an existing activity on that row.
* Move to the next available row within a swimlane if there is overlap
* Labels for a given activity will be rendered within it's duration slot if it fits in that rectangular space.
* Labels that do not fit within an activity's duration slot are rendered outside, to the right of the duration slot.

View File

@@ -264,7 +264,7 @@ describe('the plugin', function () {
it('provides an inspector view with the version information if available', () => {
componentObject = component.$root.$children[0];
const propertiesEls = componentObject.$el.querySelectorAll('.c-inspect-properties__row');
expect(propertiesEls.length).toEqual(4);
expect(propertiesEls.length).toEqual(6);
const found = Array.from(propertiesEls).some((propertyEl) => {
return (propertyEl.children[0].innerHTML.trim() === 'Version'
&& propertyEl.children[1].innerHTML.trim() === 'v1');

View File

@@ -442,7 +442,8 @@ export default {
});
},
removeSeries(plotSeries) {
removeSeries(plotSeries, index) {
this.seriesModels.splice(index, 1);
this.checkSameRangeValue();
this.stopListening(plotSeries);
},

View File

@@ -382,7 +382,7 @@ export default {
makeLimitLines(series) {
this.clearLimitLines(series);
if (!series.get('limitLines')) {
if (!series || !series.get('limitLines')) {
return;
}

View File

@@ -102,8 +102,8 @@ export default class Collection extends Model {
throw new Error('model not found in collection.');
}
this.emit('remove', model, index);
this.models.splice(index, 1);
this.emit('remove', model, index);
}
destroy(model) {

View File

@@ -151,16 +151,6 @@ export default class PlotSeries extends Model {
this.limitEvaluator = this.openmct.telemetry.limitEvaluator(options.domainObject);
this.limitDefinition = this.openmct.telemetry.limitDefinition(options.domainObject);
this.limits = [];
this.limitDefinition.limits().then(response => {
this.limits = [];
if (response) {
this.limits = response;
}
this.emit('limits', this);
});
this.openmct.time.on('bounds', this.updateLimits);
this.removeMutationListener = this.openmct.objects.observe(
this.domainObject,
@@ -176,15 +166,6 @@ export default class PlotSeries extends Model {
this.emit('limitBounds', bounds);
}
locateOldObject(oldStyleParent) {
return oldStyleParent.useCapability('composition')
.then(function (children) {
this.oldObject = children
.filter(function (child) {
return child.getId() === this.keyString;
}, this)[0];
}.bind(this));
}
/**
* Fetch historical data and establish a realtime subscription. Returns
* a promise that is resolved when all connections have been successfully
@@ -192,7 +173,7 @@ export default class PlotSeries extends Model {
*
* @returns {Promise}
*/
fetch(options) {
async fetch(options) {
let strategy;
if (this.model.interpolate !== 'none') {
@@ -217,23 +198,19 @@ export default class PlotSeries extends Model {
);
}
/* eslint-disable you-dont-need-lodash-underscore/concat */
return this.openmct
.telemetry
.request(this.domainObject, options)
.then((points) => {
const data = this.getSeriesData();
const newPoints = _(data)
.concat(points)
.sortBy(this.getXVal)
.uniq(true, point => [this.getXVal(point), this.getYVal(point)].join())
.value();
this.reset(newPoints);
})
.catch((error) => {
console.warn('Error fetching data', error);
});
/* eslint-enable you-dont-need-lodash-underscore/concat */
try {
const points = await this.openmct.telemetry.request(this.domainObject, options);
const data = this.getSeriesData();
// eslint-disable-next-line you-dont-need-lodash-underscore/concat
const newPoints = _(data)
.concat(points)
.sortBy(this.getXVal)
.uniq(true, point => [this.getXVal(point), this.getYVal(point)].join())
.value();
this.reset(newPoints);
} catch (error) {
console.warn('Error fetching data', error);
}
}
updateName(name) {
@@ -334,16 +311,19 @@ export default class PlotSeries extends Model {
* Override this to implement plot series loading functionality. Must return
* a promise that is resolved when loading is completed.
*
* @private
* @returns {Promise}
*/
load(options) {
return this.fetch(options)
.then(function (res) {
this.emit('load');
async load(options) {
await this.fetch(options);
this.emit('load');
const limitsResponse = await this.limitDefinition.limits();
this.limits = [];
if (limitsResponse) {
this.limits = limitsResponse;
}
return res;
}.bind(this));
this.emit('limits', this);
this.emit('change:limitLines', this);
}
/**

View File

@@ -19,8 +19,12 @@
* this source code distribution or the Licensing information page available
* at runtime from the About dialog for additional information.
*****************************************************************************/
export default class RemoveAction {
#transaction;
constructor(openmct) {
this.name = 'Remove';
this.key = 'remove';
this.description = 'Remove this object from its containing object.';
@@ -29,17 +33,25 @@ export default class RemoveAction {
this.priority = 1;
this.openmct = openmct;
this.removeFromComposition = this.removeFromComposition.bind(this); // for access to private transaction variable
}
invoke(objectPath) {
async invoke(objectPath) {
let object = objectPath[0];
let parent = objectPath[1];
this.showConfirmDialog(object).then(() => {
this.removeFromComposition(parent, object);
if (this.inNavigationPath(object)) {
this.navigateTo(objectPath.slice(1));
}
}).catch(() => {});
try {
await this.showConfirmDialog(object);
} catch (error) {
return; // form canceled, exit invoke
}
await this.removeFromComposition(parent, object);
if (this.inNavigationPath(object)) {
this.navigateTo(objectPath.slice(1));
}
}
showConfirmDialog(object) {
@@ -81,20 +93,21 @@ export default class RemoveAction {
this.openmct.router.navigate('#/browse/' + urlPath);
}
removeFromComposition(parent, child) {
let composition = parent.composition.filter(id =>
!this.openmct.objects.areIdsEqual(id, child.identifier)
);
async removeFromComposition(parent, child) {
this.startTransaction();
this.openmct.objects.mutate(parent, 'composition', composition);
const composition = this.openmct.composition.get(parent);
composition.remove(child);
if (!this.isAlias(child, parent)) {
this.openmct.objects.mutate(child, 'location', null);
}
if (this.inNavigationPath(child) && this.openmct.editor.isEditing()) {
this.openmct.editor.save();
}
if (!this.isAlias(child, parent)) {
this.openmct.objects.mutate(child, 'location', null);
}
await this.saveTransaction();
}
isAlias(child, parent) {
@@ -132,4 +145,23 @@ export default class RemoveAction {
&& parentType.definition.creatable
&& Array.isArray(parent.composition);
}
startTransaction() {
if (!this.openmct.objects.isTransactionActive()) {
this.#transaction = this.openmct.objects.startTransaction();
}
}
saveTransaction() {
if (!this.#transaction) {
return;
}
return this.#transaction.commit()
.catch(error => {
throw error;
}).finally(() => {
this.openmct.objects.endTransaction();
});
}
}

View File

@@ -26,6 +26,7 @@
>
<div class="c-menu-button c-ctrl-wrapper c-ctrl-wrapper--menus-left">
<button
aria-label="Time Conductor History"
class="c-button--menu c-history-button icon-history"
@click.prevent.stop="showHistoryMenu"
>

View File

@@ -145,10 +145,10 @@ export default {
const annotationsToDelete = this.annotations.filter((annotation) => {
return annotation.tags.includes(tagToRemove);
});
const result = await this.openmct.annotation.deleteAnnotations(annotationsToDelete);
this.$emit('tags-updated', annotationsToDelete);
return result;
if (annotationsToDelete) {
await this.openmct.annotation.deleteAnnotations(annotationsToDelete);
this.$emit('tags-updated', annotationsToDelete);
}
},
async tagAdded(newTag) {
// Either undelete an annotation, or create one (1) new annotation

View File

@@ -33,7 +33,8 @@
class="c-tree__item c-elements-pool__item"
:class="{
'is-context-clicked': contextClickActive,
'hover': hover
'hover': hover,
'is-alias': isAlias
}"
>
<span
@@ -55,6 +56,7 @@ export default {
components: {
ObjectLabel
},
inject: ['openmct'],
props: {
index: {
type: Number,
@@ -82,9 +84,12 @@ export default {
}
},
data() {
const isAlias = this.elementObject.location !== this.openmct.objects.makeKeyString(this.parentObject.identifier);
return {
contextClickActive: false,
hover: false
hover: false,
isAlias
};
},
methods: {

View File

@@ -38,6 +38,8 @@ describe('the inspector', () => {
folderItem = {
name: 'folder',
type: 'folder',
createdBy: 'John Q',
modifiedBy: 'Public',
id: 'mock-folder-key',
identifier: {
namespace: '',
@@ -74,6 +76,8 @@ describe('the inspector', () => {
const [
title,
type,
createdBy,
modifiedBy,
notes,
timestamp
] = details;
@@ -87,6 +91,14 @@ describe('the inspector', () => {
.toEqual('Type');
expect(type.value.toLowerCase())
.toEqual(folderItem.type);
expect(createdBy.name)
.toEqual('Created By');
expect(createdBy.value)
.toEqual(folderItem.createdBy);
expect(modifiedBy.name)
.toEqual('Modified By');
expect(modifiedBy.value)
.toEqual(folderItem.modifiedBy);
expect(notes.value)
.toEqual('This object should have some notes');

View File

@@ -90,10 +90,13 @@ export default {
return;
}
const UNKNOWN_USER = 'Unknown';
const title = this.domainObject.name;
const typeName = this.type ? this.type.definition.name : `Unknown: ${this.domainObject.type}`;
const timestampLabel = this.domainObject.modified ? 'Modified' : 'Created';
const timestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
const createdTimestamp = this.domainObject.created;
const createdBy = this.domainObject.createdBy ? this.domainObject.createdBy : UNKNOWN_USER;
const modifiedBy = this.domainObject.modifiedBy ? this.domainObject.modifiedBy : UNKNOWN_USER;
const modifiedTimestamp = this.domainObject.modified ? this.domainObject.modified : this.domainObject.created;
const notes = this.domainObject.notes;
const version = this.domainObject.version;
@@ -105,6 +108,14 @@ export default {
{
name: 'Type',
value: typeName
},
{
name: 'Created By',
value: createdBy
},
{
name: 'Modified By',
value: modifiedBy
}
];
@@ -115,15 +126,28 @@ export default {
});
}
if (timestamp !== undefined) {
const formattedTimestamp = Moment.utc(timestamp)
if (createdTimestamp !== undefined) {
const formattedCreatedTimestamp = Moment.utc(createdTimestamp)
.format('YYYY-MM-DD[\n]HH:mm:ss')
+ ' UTC';
details.push(
{
name: timestampLabel,
value: formattedTimestamp
name: 'Created',
value: formattedCreatedTimestamp
}
);
}
if (modifiedTimestamp !== undefined) {
const formattedModifiedTimestamp = Moment.utc(modifiedTimestamp)
.format('YYYY-MM-DD[\n]HH:mm:ss')
+ ' UTC';
details.push(
{
name: 'Modified',
value: formattedModifiedTimestamp
}
);
}

View File

@@ -8,6 +8,15 @@
margin-top: $interiorMargin;
}
&__item {
&.is-alias {
// Object is an alias to an original.
[class*='__type-icon'] {
@include isAlias();
}
}
}
&__search {
flex: 0 0 auto;
}

View File

@@ -232,6 +232,8 @@ describe("GrandSearch", () => {
it("should render an object search result if new object added", async () => {
const composition = openmct.composition.get(mockFolderObject);
composition.add(mockNewObject);
// after adding, need to wait a beat for the folder to be indexed
await Vue.nextTick();
await grandSearchComponent.$children[0].searchEverything('apple');
await Vue.nextTick();
const searchResults = document.querySelectorAll('[aria-label="New Apple Test Folder folder result"]');
@@ -271,6 +273,13 @@ describe("GrandSearch", () => {
expect(annotationResults[1].innerText).toContain('Driving');
});
it("should render no annotation search results if no match", async () => {
await grandSearchComponent.$children[0].searchEverything('Qbert');
await Vue.nextTick();
const annotationResults = document.querySelectorAll('[aria-label="Search Result"]');
expect(annotationResults.length).toBe(0);
});
it("should preview object search results in edit mode if object clicked", async () => {
await grandSearchComponent.$children[0].searchEverything('Folder');
grandSearchComponent._provided.openmct.router.path = [mockDisplayLayout];