diff --git a/.cspell.json b/.cspell.json index 7769756a3d..9afde5db7c 100644 --- a/.cspell.json +++ b/.cspell.json @@ -493,7 +493,7 @@ "WCAG", "stackedplot", "Andale", - "unnnormalized", + "unnormalized", "checksnapshots", "specced", "composables", diff --git a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js index 7a6c2a5808..54c76aae97 100644 --- a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js @@ -63,6 +63,66 @@ test.describe('Overlay Plot', () => { await expect(seriesColorSwatch).toHaveCSS('background-color', 'rgb(255, 166, 61)'); }); + test('Plot legend expands by default', async ({ page }) => { + test.info().annotations.push({ + type: 'issue', + description: 'https://github.com/nasa/openmct/issues/7403' + }); + const overlayPlot = await createDomainObjectWithDefaults(page, { + type: 'Overlay Plot' + }); + + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + parent: overlayPlot.uuid + }); + + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + parent: overlayPlot.uuid + }); + + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + parent: overlayPlot.uuid + }); + + await page.goto(overlayPlot.url); + + await page.getByRole('tab', { name: 'Config' }).click(); + + // Assert that the legend is collapsed by default + await expect(page.getByLabel('Plot Legend Collapsed')).toBeVisible(); + await expect(page.getByLabel('Plot Legend Expanded')).toBeHidden(); + await expect(page.getByLabel('Expand by Default')).toHaveText('No'); + + expect(await page.getByLabel('Plot Legend Item').count()).toBe(3); + + // Change the legend to expand by default + await page.getByLabel('Edit Object').click(); + await page.getByLabel('Expand By Default').check(); + await page.getByLabel('Save').click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + // Assert that the legend is now open + await expect(page.getByLabel('Plot Legend Collapsed')).toBeHidden(); + await expect(page.getByLabel('Plot Legend Expanded')).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Name' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Value' })).toBeVisible(); + await expect(page.getByLabel('Expand by Default')).toHaveText('Yes'); + await expect(page.getByLabel('Plot Legend Item')).toHaveCount(3); + + // Assert that the legend is expanded on page load + await page.reload(); + await expect(page.getByLabel('Plot Legend Collapsed')).toBeHidden(); + await expect(page.getByLabel('Plot Legend Expanded')).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Name' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Timestamp' })).toBeVisible(); + await expect(page.getByRole('cell', { name: 'Value' })).toBeVisible(); + await expect(page.getByLabel('Expand by Default')).toHaveText('Yes'); + await expect(page.getByLabel('Plot Legend Item')).toHaveCount(3); + }); + test('Limit lines persist when series is moved to another Y Axis and on refresh', async ({ page }) => { diff --git a/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js b/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js index 81458e8154..3cffb3b28c 100644 --- a/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js @@ -257,6 +257,56 @@ test.describe('Stacked Plot', () => { await assertAggregateLegendIsVisible(page); }); + + test('can toggle between aggregate and per child legends', async ({ page }) => { + // make some an overlay plot + const overlayPlot = await createDomainObjectWithDefaults(page, { + type: 'Overlay Plot', + parent: stackedPlot.uuid + }); + + // make some SWGs for the overlay plot + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + parent: overlayPlot.uuid + }); + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator', + parent: overlayPlot.uuid + }); + + await page.goto(stackedPlot.url); + await page.getByLabel('Edit Object').click(); + await page.getByRole('tab', { name: 'Config' }).click(); + await page.getByLabel('Inspector Views').getByRole('checkbox').uncheck(); + await page.getByLabel('Expand By Default').check(); + await page.getByLabel('Save').click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + await expect(page.getByLabel('Plot Legend Expanded')).toHaveCount(1); + await expect(page.getByLabel('Plot Legend Item')).toHaveCount(5); + + // reload and ensure the legend is still expanded + await page.reload(); + await expect(page.getByLabel('Plot Legend Expanded')).toHaveCount(1); + await expect(page.getByLabel('Plot Legend Item')).toHaveCount(5); + + // change to collapsed by default + await page.getByLabel('Edit Object').click(); + await page.getByLabel('Expand By Default').uncheck(); + await page.getByLabel('Save').click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + await expect(page.getByLabel('Plot Legend Collapsed')).toHaveCount(1); + await expect(page.getByLabel('Plot Legend Item')).toHaveCount(5); + + // change it to individual legends + await page.getByLabel('Edit Object').click(); + await page.getByRole('tab', { name: 'Config' }).click(); + await page.getByLabel('Show Legends For Children').check(); + await page.getByLabel('Save').click(); + await page.getByRole('listitem', { name: 'Save and Finish Editing' }).click(); + await expect(page.getByLabel('Plot Legend Collapsed')).toHaveCount(4); + await expect(page.getByLabel('Plot Legend Item')).toHaveCount(5); + }); }); /** diff --git a/src/plugins/persistence/couch/plugin.js b/src/plugins/persistence/couch/plugin.js index a1c7f6c661..09f5c7306f 100644 --- a/src/plugins/persistence/couch/plugin.js +++ b/src/plugins/persistence/couch/plugin.js @@ -28,9 +28,9 @@ const DEFAULT_NAMESPACE = ''; const LEGACY_SPACE = 'mct'; export default function CouchPlugin(options) { - function normalizeOptions(unnnormalizedOptions) { + function normalizeOptions(unnormalizedOptions) { const normalizedOptions = {}; - if (typeof unnnormalizedOptions === 'string') { + if (typeof unnormalizedOptions === 'string') { normalizedOptions.databases = [ { url: options, @@ -41,19 +41,19 @@ export default function CouchPlugin(options) { indicator: true } ]; - } else if (!unnnormalizedOptions.databases) { + } else if (!unnormalizedOptions.databases) { normalizedOptions.databases = [ { - url: unnnormalizedOptions.url, + url: unnormalizedOptions.url, namespace: DEFAULT_NAMESPACE, additionalNamespaces: [LEGACY_SPACE], readOnly: false, - useDesignDocuments: unnnormalizedOptions.useDesignDocuments, + useDesignDocuments: unnormalizedOptions.useDesignDocuments, indicator: true } ]; } else { - normalizedOptions.databases = unnnormalizedOptions.databases; + normalizedOptions.databases = unnormalizedOptions.databases; } // final sanity check, ensure we have all options diff --git a/src/plugins/plot/configuration/XAxisModel.js b/src/plugins/plot/configuration/XAxisModel.js index e1811ff15a..ff1b2b088b 100644 --- a/src/plugins/plot/configuration/XAxisModel.js +++ b/src/plugins/plot/configuration/XAxisModel.js @@ -94,7 +94,7 @@ export default class XAxisModel extends Model { */ defaultModel(options) { const bounds = options.openmct.time.bounds(); - const timeSystem = options.openmct.time.timeSystem(); + const timeSystem = options.openmct.time.getTimeSystem(); const format = options.openmct.telemetry.getFormatter(timeSystem.timeFormat); /** @type {XAxisModelType} */ diff --git a/src/plugins/plot/inspector/PlotOptionsBrowse.vue b/src/plugins/plot/inspector/PlotOptionsBrowse.vue index 2f17db9417..68fe0e9462 100644 --- a/src/plugins/plot/inspector/PlotOptionsBrowse.vue +++ b/src/plugins/plot/inspector/PlotOptionsBrowse.vue @@ -79,7 +79,7 @@