From ba5ed27e7446aca8df1062cd39b6843b592e1d18 Mon Sep 17 00:00:00 2001 From: Jesse Mazzella Date: Wed, 25 Jan 2023 11:18:26 -0800 Subject: [PATCH] fix: skip if no yAxisId exists on persistedConfig (#6188) --- .../displayLayout/displayLayout.e2e.spec.js | 10 ++-- .../flexibleLayout/flexibleLayout.e2e.spec.js | 46 ++++++++++++------- .../plot/configuration/SeriesCollection.js | 4 ++ 3 files changed, 37 insertions(+), 23 deletions(-) diff --git a/e2e/tests/functional/plugins/displayLayout/displayLayout.e2e.spec.js b/e2e/tests/functional/plugins/displayLayout/displayLayout.e2e.spec.js index a3fcc5342e..e9c157bbf7 100644 --- a/e2e/tests/functional/plugins/displayLayout/displayLayout.e2e.spec.js +++ b/e2e/tests/functional/plugins/displayLayout/displayLayout.e2e.spec.js @@ -32,8 +32,7 @@ test.describe('Display Layout', () => { // Create Sine Wave Generator sineWaveObject = await createDomainObjectWithDefaults(page, { - type: 'Sine Wave Generator', - name: "Test Sine Wave Generator" + type: 'Sine Wave Generator' }); }); test('alpha-numeric widget telemetry value exactly matches latest telemetry value received in real time', async ({ page }) => { @@ -131,7 +130,7 @@ test.describe('Display Layout', () => { await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click(); // Bring up context menu and remove - await page.locator('.c-tree__item.is-alias .c-tree__item__name:text("Test Sine Wave Generator")').first().click({ button: 'right' }); + await sineWaveGeneratorTreeItem.nth(1).click({ button: 'right' }); await page.locator('li[role="menuitem"]:has-text("Remove")').click(); await page.locator('button:has-text("OK")').click(); @@ -146,8 +145,7 @@ test.describe('Display Layout', () => { }); // Create a Display Layout const displayLayout = await createDomainObjectWithDefaults(page, { - type: 'Display Layout', - name: "Test Display Layout" + type: 'Display Layout' }); // Edit Display Layout await page.locator('[title="Edit"]').click(); @@ -173,7 +171,7 @@ test.describe('Display Layout', () => { await page.goto(sineWaveObject.url); // Bring up context menu and remove - await page.locator('.c-tree__item.is-alias .c-tree__item__name:text("Test Sine Wave Generator")').click({ button: 'right' }); + await sineWaveGeneratorTreeItem.first().click({ button: 'right' }); await page.locator('li[role="menuitem"]:has-text("Remove")').click(); await page.locator('button:has-text("OK")').click(); diff --git a/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js b/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js index b6949e4fc7..4e28185ece 100644 --- a/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js +++ b/e2e/tests/functional/plugins/flexibleLayout/flexibleLayout.e2e.spec.js @@ -25,26 +25,31 @@ const { createDomainObjectWithDefaults } = require('../../../../appActions'); test.describe('Flexible Layout', () => { let sineWaveObject; + let clockObject; test.beforeEach(async ({ page }) => { await page.goto('./', { waitUntil: 'networkidle' }); // Create Sine Wave Generator sineWaveObject = await createDomainObjectWithDefaults(page, { - type: 'Sine Wave Generator', - name: "Test Sine Wave Generator" + type: 'Sine Wave Generator' }); // Create Clock Object - await createDomainObjectWithDefaults(page, { - type: 'Clock', - name: "Test Clock" + clockObject = await createDomainObjectWithDefaults(page, { + type: 'Clock' }); }); test('panes have the appropriate draggable attribute while in Edit and Browse modes', async ({ page }) => { + const treePane = page.locator('#tree-pane'); + const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { + name: new RegExp(sineWaveObject.name) + }); + const clockTreeItem = treePane.getByRole('treeitem', { + name: new RegExp(clockObject.name) + }); // Create a Flexible Layout await createDomainObjectWithDefaults(page, { - type: 'Flexible Layout', - name: "Test Flexible Layout" + type: 'Flexible Layout' }); // Edit Flexible Layout await page.locator('[title="Edit"]').click(); @@ -52,8 +57,8 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click(); // Add the Sine Wave Generator and Clock to the Flexible Layout - await page.dragAndDrop('text=Test Sine Wave Generator', '.c-fl__container.is-empty'); - await page.dragAndDrop('text=Test Clock', '.c-fl__container.is-empty'); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); + await clockTreeItem.dragTo(page.locator('.c-fl__container.is-empty')); // Check that panes can be dragged while Flexible Layout is in Edit mode let dragWrapper = page.locator('.c-fl-container__frames-holder .c-fl-frame__drag-wrapper').first(); await expect(dragWrapper).toHaveAttribute('draggable', 'true'); @@ -65,10 +70,13 @@ test.describe('Flexible Layout', () => { await expect(dragWrapper).toHaveAttribute('draggable', 'false'); }); test('items in a flexible layout can be removed with object tree context menu when viewing the flexible layout', async ({ page }) => { + const treePane = page.locator('#tree-pane'); + const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { + name: new RegExp(sineWaveObject.name) + }); // Create a Display Layout await createDomainObjectWithDefaults(page, { - type: 'Flexible Layout', - name: "Test Flexible Layout" + type: 'Flexible Layout' }); // Edit Flexible Layout await page.locator('[title="Edit"]').click(); @@ -76,7 +84,7 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').first().click(); // Add the Sine Wave Generator to the Flexible Layout and save changes - await page.dragAndDrop('text=Test Sine Wave Generator', '.c-fl__container.is-empty'); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); await page.locator('button[title="Save"]').click(); await page.locator('text=Save and Finish Editing').click(); @@ -86,7 +94,7 @@ test.describe('Flexible Layout', () => { await page.locator('.c-tree__item.is-navigated-object .c-disclosure-triangle').click(); // Bring up context menu and remove - await page.locator('.c-tree__item.is-alias .c-tree__item__name:text("Test Sine Wave Generator")').first().click({ button: 'right' }); + await sineWaveGeneratorTreeItem.first().click({ button: 'right' }); await page.locator('li[role="menuitem"]:has-text("Remove")').click(); await page.locator('button:has-text("OK")').click(); @@ -98,10 +106,14 @@ test.describe('Flexible Layout', () => { type: 'issue', description: 'https://github.com/nasa/openmct/issues/3117' }); + const treePane = page.locator('#tree-pane'); + const sineWaveGeneratorTreeItem = treePane.getByRole('treeitem', { + name: new RegExp(sineWaveObject.name) + }); + // Create a Flexible Layout const flexibleLayout = await createDomainObjectWithDefaults(page, { - type: 'Flexible Layout', - name: "Test Flexible Layout" + type: 'Flexible Layout' }); // Edit Flexible Layout await page.locator('[title="Edit"]').click(); @@ -109,7 +121,7 @@ test.describe('Flexible Layout', () => { // Expand the 'My Items' folder in the left tree await page.locator('.c-tree__item__view-control.c-disclosure-triangle').click(); // Add the Sine Wave Generator to the Flexible Layout and save changes - await page.dragAndDrop('text=Test Sine Wave Generator', '.c-fl__container.is-empty'); + await sineWaveGeneratorTreeItem.dragTo(page.locator('.c-fl__container.is-empty').first()); await page.locator('button[title="Save"]').click(); await page.locator('text=Save and Finish Editing').click(); @@ -122,7 +134,7 @@ test.describe('Flexible Layout', () => { await page.goto(sineWaveObject.url); // Bring up context menu and remove - await page.locator('.c-tree__item.is-alias .c-tree__item__name:text("Test Sine Wave Generator")').click({ button: 'right' }); + await sineWaveGeneratorTreeItem.first().click({ button: 'right' }); await page.locator('li[role="menuitem"]:has-text("Remove")').click(); await page.locator('button:has-text("OK")').click(); diff --git a/src/plugins/plot/configuration/SeriesCollection.js b/src/plugins/plot/configuration/SeriesCollection.js index 7f8c2a318a..17ade9ffc9 100644 --- a/src/plugins/plot/configuration/SeriesCollection.js +++ b/src/plugins/plot/configuration/SeriesCollection.js @@ -56,6 +56,10 @@ export default class SeriesCollection extends Collection { const series = this.byIdentifier(seriesConfig.identifier); if (series) { series.persistedConfig = seriesConfig; + if (!series.persistedConfig.yAxisId) { + return; + } + if (series.get('yAxisId') !== series.persistedConfig.yAxisId) { series.set('yAxisId', series.persistedConfig.yAxisId); }