From 02dd94efb92c43b4ee7d6409ca48789cd4352fe6 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Thu, 1 Feb 2024 15:44:24 +0100 Subject: [PATCH 1/8] expanded legend showing, but malformed --- .cspell.json | 2 +- src/plugins/persistence/couch/plugin.js | 12 ++++++------ src/plugins/plot/configuration/XAxisModel.js | 2 +- src/plugins/plot/inspector/PlotOptionsItem.vue | 3 ++- src/plugins/plot/legend/PlotLegend.vue | 12 ++++++++++-- src/styles/_legacy-plots.scss | 7 ------- 6 files changed, 20 insertions(+), 18 deletions(-) diff --git a/.cspell.json b/.cspell.json index 5ae5a0df545..bab64544039 100644 --- a/.cspell.json +++ b/.cspell.json @@ -493,7 +493,7 @@ "WCAG", "stackedplot", "Andale", - "unnnormalized", + "unnormalized", "checksnapshots", "specced", "countup" diff --git a/src/plugins/persistence/couch/plugin.js b/src/plugins/persistence/couch/plugin.js index a1c7f6c6610..09f5c7306f9 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 e1811ff15ad..ff1b2b088bf 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/PlotOptionsItem.vue b/src/plugins/plot/inspector/PlotOptionsItem.vue index c4b9ae00a57..ecfac6c35e9 100644 --- a/src/plugins/plot/inspector/PlotOptionsItem.vue +++ b/src/plugins/plot/inspector/PlotOptionsItem.vue @@ -132,7 +132,8 @@ export default { }, data() { return { - expanded: false + expanded: false, + status: null }; }, computed: { diff --git a/src/plugins/plot/legend/PlotLegend.vue b/src/plugins/plot/legend/PlotLegend.vue index 91ef69903d5..b1ba7c0f63b 100644 --- a/src/plugins/plot/legend/PlotLegend.vue +++ b/src/plugins/plot/legend/PlotLegend.vue @@ -35,7 +35,11 @@
-
+
-
+
Date: Thu, 1 Feb 2024 19:12:57 +0100 Subject: [PATCH 2/8] fix legends --- src/plugins/plot/inspector/PlotOptionsBrowse.vue | 3 +-- src/plugins/plot/legend/PlotLegend.vue | 1 + 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/plot/inspector/PlotOptionsBrowse.vue b/src/plugins/plot/inspector/PlotOptionsBrowse.vue index 2f17db94175..cb38d023a43 100644 --- a/src/plugins/plot/inspector/PlotOptionsBrowse.vue +++ b/src/plugins/plot/inspector/PlotOptionsBrowse.vue @@ -174,9 +174,8 @@ export default { if (!this.isStackedPlotObject) { this.initYAxesConfiguration(); this.registerListeners(); - } else { - this.initLegendConfiguration(); } + this.initLegendConfiguration(); this.loaded = true; }, diff --git a/src/plugins/plot/legend/PlotLegend.vue b/src/plugins/plot/legend/PlotLegend.vue index b1ba7c0f63b..c3b683f8665 100644 --- a/src/plugins/plot/legend/PlotLegend.vue +++ b/src/plugins/plot/legend/PlotLegend.vue @@ -158,6 +158,7 @@ export default { mounted() { this.loaded = true; this.isLegendExpanded = this.legend.get('expanded') === true; + this.$emit('expanded', this.isLegendExpanded); this.updatePosition(); }, beforeUnmount() { From 576c0ecd178b4301fa18b92bc2aa37e70a9fddc7 Mon Sep 17 00:00:00 2001 From: Scott Bell Date: Thu, 1 Feb 2024 19:46:52 +0100 Subject: [PATCH 3/8] add e2e test and aria labels for controls --- .../plugins/plot/overlayPlot.e2e.spec.js | 41 +++++++++++++++++++ .../plot/inspector/PlotOptionsBrowse.vue | 4 +- .../plot/inspector/forms/LegendForm.vue | 7 +++- src/plugins/plot/legend/PlotLegend.vue | 2 + 4 files changed, 52 insertions(+), 2 deletions(-) diff --git a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js index 7a6c2a58089..a28e35ee6d9 100644 --- a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js @@ -63,6 +63,47 @@ 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 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(); + let expandDefaultValue = await page.getByLabel('Expand by Default').textContent(); + expect(expandDefaultValue).toBe('No'); + + // 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(); + await page.reload(); + + // Assert that the legend is expanded on page load + 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(); + expandDefaultValue = await page.getByLabel('Expand by Default').textContent(); + expect(expandDefaultValue).toBe('Yes'); + }); + test('Limit lines persist when series is moved to another Y Axis and on refresh', async ({ page }) => { diff --git a/src/plugins/plot/inspector/PlotOptionsBrowse.vue b/src/plugins/plot/inspector/PlotOptionsBrowse.vue index cb38d023a43..3edf2a3f754 100644 --- a/src/plugins/plot/inspector/PlotOptionsBrowse.vue +++ b/src/plugins/plot/inspector/PlotOptionsBrowse.vue @@ -98,7 +98,9 @@
Expand by Default
-
{{ expandByDefault ? 'Yes' : 'No' }}
+
+ {{ expandByDefault ? 'Yes' : 'No' }} +
  • diff --git a/src/plugins/plot/inspector/forms/LegendForm.vue b/src/plugins/plot/inspector/forms/LegendForm.vue index 92c4070e919..a662aa9ecf6 100644 --- a/src/plugins/plot/inspector/forms/LegendForm.vue +++ b/src/plugins/plot/inspector/forms/LegendForm.vue @@ -64,7 +64,12 @@ Expand by default
    - +
  • diff --git a/src/plugins/plot/legend/PlotLegend.vue b/src/plugins/plot/legend/PlotLegend.vue index c3b683f8665..bfdcbc41282 100644 --- a/src/plugins/plot/legend/PlotLegend.vue +++ b/src/plugins/plot/legend/PlotLegend.vue @@ -38,6 +38,7 @@
    Date: Fri, 2 Feb 2024 10:45:40 +0100 Subject: [PATCH 4/8] fix tests --- .../functional/plugins/plot/overlayPlot.e2e.spec.js | 13 +++++++++++++ src/plugins/plot/inspector/forms/SeriesForm.vue | 3 ++- src/plugins/plot/legend/PlotLegendItemCollapsed.vue | 1 + src/plugins/plot/legend/PlotLegendItemExpanded.vue | 1 + src/plugins/plot/pluginSpec.js | 3 ++- src/plugins/plot/stackedPlot/pluginSpec.js | 4 +++- 6 files changed, 22 insertions(+), 3 deletions(-) diff --git a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js index a28e35ee6d9..0884f75916d 100644 --- a/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/overlayPlot.e2e.spec.js @@ -77,6 +77,16 @@ test.describe('Overlay Plot', () => { 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(); @@ -87,6 +97,8 @@ test.describe('Overlay Plot', () => { let expandDefaultValue = await page.getByLabel('Expand by Default').textContent(); expect(expandDefaultValue).toBe('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(); @@ -102,6 +114,7 @@ test.describe('Overlay Plot', () => { await expect(page.getByRole('cell', { name: 'Value' })).toBeVisible(); expandDefaultValue = await page.getByLabel('Expand by Default').textContent(); expect(expandDefaultValue).toBe('Yes'); + expect(await page.getByLabel('Plot Legend Item').count()).toBe(3); }); test('Limit lines persist when series is moved to another Y Axis and on refresh', async ({ diff --git a/src/plugins/plot/inspector/forms/SeriesForm.vue b/src/plugins/plot/inspector/forms/SeriesForm.vue index 47707cab9ff..031116c5ae6 100644 --- a/src/plugins/plot/inspector/forms/SeriesForm.vue +++ b/src/plugins/plot/inspector/forms/SeriesForm.vue @@ -157,7 +157,8 @@ export default { limitLines: this.series.get('limitLines'), markerSize: this.series.get('markerSize'), validation: {}, - swatchActive: false + swatchActive: false, + status: null }; }, computed: { diff --git a/src/plugins/plot/legend/PlotLegendItemCollapsed.vue b/src/plugins/plot/legend/PlotLegendItemCollapsed.vue index ccb3cf20982..b1a45f60060 100644 --- a/src/plugins/plot/legend/PlotLegendItemCollapsed.vue +++ b/src/plugins/plot/legend/PlotLegendItemCollapsed.vue @@ -22,6 +22,7 @@