mirror of
https://github.com/nasa/openmct.git
synced 2025-06-22 00:57:11 +00:00
* fix(#6391): refresh composition on treeItem open - On treeItem open, gets the latest composition from persistence - Composition was being refreshed, but only within the same instance (mutables) * test: regression tests for localStorage and couch --------- Co-authored-by: Scott Bell <scott@traclabs.com>
This commit is contained in:
@ -53,6 +53,52 @@ test.describe('Main Tree', () => {
|
|||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('Creating a child object on one tab and expanding its parent on the other shows the correct composition @2p', async ({ page, openmctConfig }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6391'
|
||||||
|
});
|
||||||
|
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
const page2 = await page.context().newPage();
|
||||||
|
|
||||||
|
// Both pages: Go to baseURL
|
||||||
|
await Promise.all([
|
||||||
|
page.goto('./', { waitUntil: 'networkidle' }),
|
||||||
|
page2.goto('./', { waitUntil: 'networkidle' })
|
||||||
|
]);
|
||||||
|
|
||||||
|
const page1Folder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
|
||||||
|
await expandTreePaneItemByName(page2, myItemsFolderName);
|
||||||
|
await assertTreeItemIsVisible(page2, page1Folder.name);
|
||||||
|
});
|
||||||
|
|
||||||
|
test('Creating a child object on one tab and expanding its parent on the other shows the correct composition @couchdb @2p', async ({ page, openmctConfig }) => {
|
||||||
|
test.info().annotations.push({
|
||||||
|
type: 'issue',
|
||||||
|
description: 'https://github.com/nasa/openmct/issues/6391'
|
||||||
|
});
|
||||||
|
|
||||||
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
const page2 = await page.context().newPage();
|
||||||
|
|
||||||
|
// Both pages: Go to baseURL
|
||||||
|
await Promise.all([
|
||||||
|
page.goto('./', { waitUntil: 'networkidle' }),
|
||||||
|
page2.goto('./', { waitUntil: 'networkidle' })
|
||||||
|
]);
|
||||||
|
|
||||||
|
const page1Folder = await createDomainObjectWithDefaults(page, {
|
||||||
|
type: 'Folder'
|
||||||
|
});
|
||||||
|
|
||||||
|
await expandTreePaneItemByName(page2, myItemsFolderName);
|
||||||
|
await assertTreeItemIsVisible(page2, page1Folder.name);
|
||||||
|
});
|
||||||
|
|
||||||
test('Renaming an object reorders the tree @unstable', async ({ page, openmctConfig }) => {
|
test('Renaming an object reorders the tree @unstable', async ({ page, openmctConfig }) => {
|
||||||
const { myItemsFolderName } = openmctConfig;
|
const { myItemsFolderName } = openmctConfig;
|
||||||
|
|
||||||
|
@ -304,8 +304,7 @@ export default {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// will need to listen for root composition changes as well
|
// will need to listen for root composition changes as well
|
||||||
|
this.treeItems = await this.loadAndBuildTreeItemsFor(root.identifier, []);
|
||||||
this.treeItems = await this.loadAndBuildTreeItemsFor(root, []);
|
|
||||||
},
|
},
|
||||||
treeItemAction(parentItem, type) {
|
treeItemAction(parentItem, type) {
|
||||||
if (type === 'close') {
|
if (type === 'close') {
|
||||||
@ -322,12 +321,12 @@ export default {
|
|||||||
this.$emit('tree-item-selection', item);
|
this.$emit('tree-item-selection', item);
|
||||||
},
|
},
|
||||||
async openTreeItem(parentItem) {
|
async openTreeItem(parentItem) {
|
||||||
let parentPath = parentItem.navigationPath;
|
const parentPath = parentItem.navigationPath;
|
||||||
|
|
||||||
this.startItemLoad(parentPath);
|
this.startItemLoad(parentPath);
|
||||||
// pass in abort signal when functional
|
// pass in abort signal when functional
|
||||||
let childrenItems = await this.loadAndBuildTreeItemsFor(parentItem.object, parentItem.objectPath);
|
const childrenItems = await this.loadAndBuildTreeItemsFor(parentItem.object.identifier, parentItem.objectPath);
|
||||||
let parentIndex = this.treeItems.indexOf(parentItem);
|
const parentIndex = this.treeItems.indexOf(parentItem);
|
||||||
|
|
||||||
// if it's not loading, it was aborted
|
// if it's not loading, it was aborted
|
||||||
if (!this.isItemLoading(parentPath) || parentIndex === -1) {
|
if (!this.isItemLoading(parentPath) || parentIndex === -1) {
|
||||||
@ -558,8 +557,10 @@ export default {
|
|||||||
// determine if any part of the parent's path includes a key value of mine; aka My Items
|
// determine if any part of the parent's path includes a key value of mine; aka My Items
|
||||||
return Boolean(parentObjectPath.find(path => path.identifier.key === 'mine'));
|
return Boolean(parentObjectPath.find(path => path.identifier.key === 'mine'));
|
||||||
},
|
},
|
||||||
async loadAndBuildTreeItemsFor(domainObject, parentObjectPath, abortSignal) {
|
async loadAndBuildTreeItemsFor(identifier, parentObjectPath, abortSignal) {
|
||||||
let collection = this.openmct.composition.get(domainObject);
|
const domainObject = await this.openmct.objects.get(identifier);
|
||||||
|
|
||||||
|
const collection = this.openmct.composition.get(domainObject);
|
||||||
let composition = await collection.load(abortSignal);
|
let composition = await collection.load(abortSignal);
|
||||||
|
|
||||||
if (SORT_MY_ITEMS_ALPH_ASC && this.isSortable(parentObjectPath)) {
|
if (SORT_MY_ITEMS_ALPH_ASC && this.isSortable(parentObjectPath)) {
|
||||||
|
Reference in New Issue
Block a user