Skip to content

Commit d3e8669

Browse files
authored
Merge branch 'master' into batch-persistence-for-fun-and-profit
2 parents ec9fd7c + d08ea62 commit d3e8669

File tree

15 files changed

+246
-69
lines changed

15 files changed

+246
-69
lines changed

.github/workflows/e2e-couchdb.yml

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ jobs:
4949
- name: Run CouchDB Tests and publish to deploysentinel
5050
env:
5151
DEPLOYSENTINEL_API_KEY: ${{ secrets.DEPLOYSENTINEL_API_KEY }}
52+
COMMIT_INFO_SHA: ${{github.event.pull_request.head.sha }}
5253
run: npm run test:e2e:couchdb
5354

5455
- name: Publish Results to Codecov.io

e2e/tests/framework/baseFixtures.e2e.spec.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,8 @@ relates to how we've extended it (i.e. ./e2e/baseFixtures.js) and assumptions ma
2929
const { test } = require('../../baseFixtures.js');
3030

3131
test.describe('baseFixtures tests', () => {
32-
test('Verify that tests fail if console.error is thrown', async ({ page }) => {
32+
//Skip this test for now https://github.com/nasa/openmct/issues/6785
33+
test.fixme('Verify that tests fail if console.error is thrown', async ({ page }) => {
3334
test.fail();
3435
//Go to baseURL
3536
await page.goto('./', { waitUntil: 'domcontentloaded' });

e2e/tests/functional/plugins/plot/stackedPlot.e2e.spec.js

+46-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,11 @@ necessarily be used for reference when writing new tests in this area.
2626
*/
2727

2828
const { test, expect } = require('../../../../pluginFixtures');
29-
const { createDomainObjectWithDefaults, selectInspectorTab } = require('../../../../appActions');
29+
const {
30+
createDomainObjectWithDefaults,
31+
selectInspectorTab,
32+
waitForPlotsToRender
33+
} = require('../../../../appActions');
3034

3135
test.describe('Stacked Plot', () => {
3236
let stackedPlot;
@@ -227,4 +231,45 @@ test.describe('Stacked Plot', () => {
227231
page.locator('[aria-label="Plot Series Properties"] .c-object-label')
228232
).toContainText(swgC.name);
229233
});
234+
235+
test('the legend toggles between aggregate and per child', async ({ page }) => {
236+
await page.goto(stackedPlot.url);
237+
238+
// Go into edit mode
239+
await page.click('button[title="Edit"]');
240+
241+
await selectInspectorTab(page, 'Config');
242+
243+
let legendProperties = await page.locator('[aria-label="Legend Properties"]');
244+
await legendProperties.locator('[title="Display legends per sub plot."]~div input').uncheck();
245+
246+
await assertAggregateLegendIsVisible(page);
247+
248+
// Save (exit edit mode)
249+
await page.locator('button[title="Save"]').click();
250+
await page.locator('li[title="Save and Finish Editing"]').click();
251+
252+
await assertAggregateLegendIsVisible(page);
253+
254+
await page.reload();
255+
256+
await assertAggregateLegendIsVisible(page);
257+
});
230258
});
259+
260+
/**
261+
* Asserts that aggregate stacked plot legend is visible
262+
* @param {import('@playwright/test').Page} page
263+
*/
264+
async function assertAggregateLegendIsVisible(page) {
265+
// Wait for plot series data to load
266+
await waitForPlotsToRender(page);
267+
// Wait for plot legend to be shown
268+
await page.waitForSelector('.js-stacked-plot-legend', { state: 'attached' });
269+
// There should be 3 legend items
270+
expect(
271+
await page
272+
.locator('.js-stacked-plot-legend .c-plot-legend__wrapper div.plot-legend-item')
273+
.count()
274+
).toBe(3);
275+
}

src/plugins/plot/MctPlot.vue

+2-1
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
<mct-chart
7878
:rectangles="rectangles"
7979
:highlights="highlights"
80+
:show-limit-line-labels="limitLineLabels"
8081
:annotated-points="annotatedPoints"
8182
:annotation-selections="annotationSelections"
8283
:hidden-y-axis-ids="hiddenYAxisIds"
@@ -231,7 +232,7 @@ export default {
231232
limitLineLabels: {
232233
type: Object,
233234
default() {
234-
return {};
235+
return undefined;
235236
}
236237
},
237238
colorPalette: {

src/plugins/plot/Plot.vue

+75-7
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,23 @@
3333
/>
3434
<mct-plot
3535
:class="[plotLegendExpandedStateClass, plotLegendPositionClass]"
36-
:init-grid-lines="gridLines"
36+
:init-grid-lines="gridLinesProp"
3737
:init-cursor-guide="cursorGuide"
3838
:options="options"
39-
:limit-line-labels="limitLineLabels"
39+
:limit-line-labels="limitLineLabelsProp"
40+
:parent-y-tick-width="parentYTickWidth"
41+
:color-palette="colorPalette"
4042
@loadingUpdated="loadingUpdated"
4143
@statusUpdated="setStatus"
4244
@configLoaded="updateReady"
4345
@lockHighlightPoint="lockHighlightPointUpdated"
4446
@highlights="highlightsUpdated"
47+
@plotYTickWidth="onYTickWidthChange"
48+
@cursorGuide="onCursorGuideChange"
49+
@gridLines="onGridLinesChange"
4550
>
4651
<plot-legend
47-
v-if="configReady"
52+
v-if="configReady && hideLegend === false"
4853
:cursor-locked="lockHighlightPoint"
4954
:highlights="highlights"
5055
@legendHoverChanged="legendHoverChanged"
@@ -79,14 +84,50 @@ export default {
7984
compact: false
8085
};
8186
}
87+
},
88+
gridLines: {
89+
type: Boolean,
90+
default() {
91+
return true;
92+
}
93+
},
94+
cursorGuide: {
95+
type: Boolean,
96+
default() {
97+
return false;
98+
}
99+
},
100+
parentLimitLineLabels: {
101+
type: Object,
102+
default() {
103+
return undefined;
104+
}
105+
},
106+
colorPalette: {
107+
type: Object,
108+
default() {
109+
return undefined;
110+
}
111+
},
112+
parentYTickWidth: {
113+
type: Object,
114+
default() {
115+
return {
116+
leftTickWidth: 0,
117+
rightTickWidth: 0,
118+
hasMultipleLeftAxes: false
119+
};
120+
}
121+
},
122+
hideLegend: {
123+
type: Boolean,
124+
default() {
125+
return false;
126+
}
82127
}
83128
},
84129
data() {
85130
return {
86-
//Don't think we need this as it appears to be stacked plot specific
87-
// hideExportButtons: false
88-
cursorGuide: false,
89-
gridLines: !this.options.compact,
90131
loading: false,
91132
status: '',
92133
staleObjects: [],
@@ -99,6 +140,12 @@ export default {
99140
};
100141
},
101142
computed: {
143+
limitLineLabelsProp() {
144+
return this.parentLimitLineLabels ?? this.limitLineLabels;
145+
},
146+
gridLinesProp() {
147+
return this.gridLines ?? !this.options.compact;
148+
},
102149
staleClass() {
103150
if (this.staleObjects.length !== 0) {
104151
return 'is-stale';
@@ -117,6 +164,14 @@ export default {
117164
}
118165
}
119166
},
167+
watch: {
168+
gridLines(newGridLines) {
169+
this.gridLines = newGridLines;
170+
},
171+
cursorGuide(newCursorGuide) {
172+
this.cursorGuide = newCursorGuide;
173+
}
174+
},
120175
mounted() {
121176
eventHelpers.extend(this);
122177
this.imageExporter = new ImageExporter(this.openmct);
@@ -188,6 +243,7 @@ export default {
188243
},
189244
loadingUpdated(loading) {
190245
this.loading = loading;
246+
this.$emit('loadingUpdated', ...arguments);
191247
},
192248
destroy() {
193249
if (this.stalenessSubscription) {
@@ -223,9 +279,11 @@ export default {
223279
},
224280
lockHighlightPointUpdated(data) {
225281
this.lockHighlightPoint = data;
282+
this.$emit('lockHighlightPoint', ...arguments);
226283
},
227284
highlightsUpdated(data) {
228285
this.highlights = data;
286+
this.$emit('highlights', ...arguments);
229287
},
230288
legendHoverChanged(data) {
231289
this.limitLineLabels = data;
@@ -238,6 +296,16 @@ export default {
238296
},
239297
updateReady(ready) {
240298
this.configReady = ready;
299+
this.$emit('configLoaded', ...arguments);
300+
},
301+
onYTickWidthChange() {
302+
this.$emit('plotYTickWidth', ...arguments);
303+
},
304+
onCursorGuideChange() {
305+
this.$emit('cursorGuide', ...arguments);
306+
},
307+
onGridLinesChange() {
308+
this.$emit('gridLines', ...arguments);
241309
}
242310
}
243311
};

src/plugins/plot/chart/MctChart.vue

+2-2
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ export default {
114114
showLimitLineLabels: {
115115
type: Object,
116116
default() {
117-
return {};
117+
return undefined;
118118
}
119119
},
120120
hiddenYAxisIds: {
@@ -725,7 +725,7 @@ export default {
725725
});
726726
},
727727
showLabels(seriesKey) {
728-
return this.showLimitLineLabels.seriesKey && this.showLimitLineLabels.seriesKey === seriesKey;
728+
return this.showLimitLineLabels?.seriesKey === seriesKey;
729729
},
730730
getLimitElement(limit) {
731731
let point = {

src/plugins/plot/configuration/LegendModel.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,8 @@ export default class LegendModel extends Model {
5555
showValueWhenExpanded: true,
5656
showMaximumWhenExpanded: true,
5757
showMinimumWhenExpanded: true,
58-
showUnitsWhenExpanded: true
58+
showUnitsWhenExpanded: true,
59+
showLegendsForChildren: true
5960
};
6061
}
6162
}

src/plugins/plot/inspector/PlotOptionsBrowse.vue

+8
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,12 @@
7373
<div v-if="isStackedPlotObject || !isNestedWithinAStackedPlot" class="grid-properties">
7474
<ul class="l-inspector-part js-legend-properties">
7575
<h2 class="--first" title="Legend settings for this object">Legend</h2>
76+
<li v-if="isStackedPlotObject" class="grid-row">
77+
<div class="grid-cell label" title="Display legends per sub plot.">
78+
Show legend per plot
79+
</div>
80+
<div class="grid-cell value">{{ showLegendsForChildren ? 'Yes' : 'No' }}</div>
81+
</li>
7682
<li class="grid-row">
7783
<div
7884
class="grid-cell label"
@@ -139,6 +145,7 @@ export default {
139145
showMinimumWhenExpanded: '',
140146
showMaximumWhenExpanded: '',
141147
showUnitsWhenExpanded: '',
148+
showLegendsForChildren: '',
142149
loaded: false,
143150
plotSeries: [],
144151
yAxes: []
@@ -218,6 +225,7 @@ export default {
218225
this.showMinimumWhenExpanded = this.config.legend.get('showMinimumWhenExpanded');
219226
this.showMaximumWhenExpanded = this.config.legend.get('showMaximumWhenExpanded');
220227
this.showUnitsWhenExpanded = this.config.legend.get('showUnitsWhenExpanded');
228+
this.showLegendsForChildren = this.config.legend.get('showLegendsForChildren');
221229
}
222230
},
223231
getConfig() {

src/plugins/plot/inspector/PlotOptionsEdit.vue

+5-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@
3535
:y-axis="config.yAxis"
3636
@seriesUpdated="updateSeriesConfigForObject"
3737
/>
38-
<ul v-if="isStackedPlotObject || !isStackedPlotNestedObject" class="l-inspector-part">
38+
<ul
39+
v-if="isStackedPlotObject || !isStackedPlotNestedObject"
40+
class="l-inspector-part"
41+
aria-label="Legend Properties"
42+
>
3943
<h2 class="--first" title="Legend options">Legend</h2>
4044
<legend-form class="grid-properties" :legend="config.legend" />
4145
</ul>

src/plugins/plot/inspector/forms/LegendForm.vue

+26-1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@
2121
-->
2222
<template>
2323
<div>
24+
<li v-if="isStackedPlotObject" class="grid-row">
25+
<div class="grid-cell label" title="Display legends per sub plot.">Show legend per plot</div>
26+
<div class="grid-cell value">
27+
<input
28+
v-model="showLegendsForChildren"
29+
type="checkbox"
30+
@change="updateForm('showLegendsForChildren')"
31+
/>
32+
</div>
33+
</li>
2434
<li class="grid-row">
2535
<div
2636
class="grid-cell label"
@@ -128,7 +138,7 @@ import { coerce, objectPath, validate } from './formUtil';
128138
import _ from 'lodash';
129139

130140
export default {
131-
inject: ['openmct', 'domainObject'],
141+
inject: ['openmct', 'domainObject', 'path'],
132142
props: {
133143
legend: {
134144
type: Object,
@@ -148,9 +158,18 @@ export default {
148158
showMinimumWhenExpanded: '',
149159
showMaximumWhenExpanded: '',
150160
showUnitsWhenExpanded: '',
161+
showLegendsForChildren: '',
151162
validation: {}
152163
};
153164
},
165+
computed: {
166+
isStackedPlotObject() {
167+
return this.path.find(
168+
(pathObject, pathObjIndex) =>
169+
pathObjIndex === 0 && pathObject?.type === 'telemetry.plot.stacked'
170+
);
171+
}
172+
},
154173
mounted() {
155174
this.initialize();
156175
this.initFormValues();
@@ -200,6 +219,11 @@ export default {
200219
modelProp: 'showUnitsWhenExpanded',
201220
coerce: Boolean,
202221
objectPath: 'configuration.legend.showUnitsWhenExpanded'
222+
},
223+
{
224+
modelProp: 'showLegendsForChildren',
225+
coerce: Boolean,
226+
objectPath: 'configuration.legend.showLegendsForChildren'
203227
}
204228
];
205229
},
@@ -213,6 +237,7 @@ export default {
213237
this.showMinimumWhenExpanded = this.legend.get('showMinimumWhenExpanded');
214238
this.showMaximumWhenExpanded = this.legend.get('showMaximumWhenExpanded');
215239
this.showUnitsWhenExpanded = this.legend.get('showUnitsWhenExpanded');
240+
this.showLegendsForChildren = this.legend.get('showLegendsForChildren');
216241
},
217242
updateForm(formKey) {
218243
const newVal = this[formKey];

src/plugins/plot/legend/PlotLegendItemCollapsed.vue

+8-3
Original file line numberDiff line numberDiff line change
@@ -181,9 +181,14 @@ export default {
181181
},
182182
toggleHover(hover) {
183183
this.hover = hover;
184-
this.$emit('legendHoverChanged', {
185-
seriesKey: this.hover ? this.seriesObject.keyString : ''
186-
});
184+
this.$emit(
185+
'legendHoverChanged',
186+
this.hover
187+
? {
188+
seriesKey: this.seriesObject.keyString
189+
}
190+
: undefined
191+
);
187192
}
188193
}
189194
};

0 commit comments

Comments
 (0)