Compare commits
5 Commits
de-reactif
...
plot-legen
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e7b481660 | ||
|
|
2335794202 | ||
|
|
9fa2c0e804 | ||
|
|
9d89bdd6d3 | ||
|
|
ed9ca2829b |
@@ -56,7 +56,7 @@ test.beforeEach(async ({ context }) => {
|
||||
|
||||
test('Visual - Restricted Notebook is visually correct @addInit', async ({ page }) => {
|
||||
// eslint-disable-next-line no-undef
|
||||
await page.addInitScript({ path: path.join(__dirname, '../plugins/notebook', './addRestrictedNotebook.js') });
|
||||
await page.addInitScript({ path: path.join(__dirname, '../plugins/notebook', './addInitRestrictedNotebook.js') });
|
||||
//Go to baseURL
|
||||
await page.goto('/', { waitUntil: 'networkidle' });
|
||||
//Click the Create button
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
-->
|
||||
<template>
|
||||
<div
|
||||
v-if="loaded"
|
||||
class="c-plot-legend gl-plot-legend"
|
||||
:class="{
|
||||
'hover-on-plot': !!highlights.length,
|
||||
@@ -53,7 +54,7 @@
|
||||
:key="`seriesObject.keyString-${seriesIndex}`"
|
||||
:highlights="highlights"
|
||||
:value-to-show-when-collapsed="legend.get('valueToShowWhenCollapsed')"
|
||||
:series-object="seriesObject"
|
||||
:series-object-ids="seriesObject"
|
||||
@legendHoverChanged="legendHoverChanged"
|
||||
/>
|
||||
</div>
|
||||
@@ -97,9 +98,8 @@
|
||||
<plot-legend-item-expanded
|
||||
v-for="(seriesObject, seriesIndex) in series"
|
||||
:key="`seriesObject.keyString-${seriesIndex}`"
|
||||
:series-object="seriesObject"
|
||||
:series-object-ids="seriesObject"
|
||||
:highlights="highlights"
|
||||
:legend="legend"
|
||||
@legendHoverChanged="legendHoverChanged"
|
||||
/>
|
||||
</tbody>
|
||||
@@ -111,6 +111,7 @@
|
||||
<script>
|
||||
import PlotLegendItemCollapsed from "./PlotLegendItemCollapsed.vue";
|
||||
import PlotLegendItemExpanded from "./PlotLegendItemExpanded.vue";
|
||||
import configStore from "@/plugins/plot/configuration/ConfigStore";
|
||||
export default {
|
||||
components: {
|
||||
PlotLegendItemExpanded,
|
||||
@@ -135,40 +136,51 @@ export default {
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
type: Object,
|
||||
default() {
|
||||
return {};
|
||||
}
|
||||
}
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
isLegendExpanded: this.legend.get('expanded') === true
|
||||
loaded: false,
|
||||
isLegendExpanded: false
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
showUnitsWhenExpanded() {
|
||||
return this.legend.get('showUnitsWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showUnitsWhenExpanded') === true;
|
||||
},
|
||||
showMinimumWhenExpanded() {
|
||||
return this.legend.get('showMinimumWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showMinimumWhenExpanded') === true;
|
||||
},
|
||||
showMaximumWhenExpanded() {
|
||||
return this.legend.get('showMaximumWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showMaximumWhenExpanded') === true;
|
||||
},
|
||||
showValueWhenExpanded() {
|
||||
return this.legend.get('showValueWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showValueWhenExpanded') === true;
|
||||
},
|
||||
showTimestampWhenExpanded() {
|
||||
return this.legend.get('showTimestampWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showTimestampWhenExpanded') === true;
|
||||
},
|
||||
isLegendHidden() {
|
||||
return this.legend.get('hideLegendWhenSmall') === true;
|
||||
return this.legend && this.legend.get('hideLegendWhenSmall') === true;
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const configId = this.openmct.objects.makeKeyString(this.domainObject.identifier);
|
||||
this.config = this.getConfig(configId);
|
||||
if (!this.config) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.legend = this.config.legend;
|
||||
this.isLegendExpanded = this.legend.get('expanded') === true;
|
||||
this.loaded = true;
|
||||
},
|
||||
methods: {
|
||||
getConfig(configId) {
|
||||
let config = configStore.get(configId);
|
||||
|
||||
return config;
|
||||
},
|
||||
expandLegend() {
|
||||
this.isLegendExpanded = !this.isLegendExpanded;
|
||||
this.legend.set('expanded', this.isLegendExpanded);
|
||||
|
||||
@@ -54,6 +54,8 @@
|
||||
<script>
|
||||
|
||||
import {getLimitClass} from "@/plugins/plot/chart/limitUtil";
|
||||
import configStore from "@/plugins/plot/configuration/ConfigStore";
|
||||
import PlotConfigurationModel from "@/plugins/plot/configuration/PlotConfigurationModel";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
@@ -61,7 +63,7 @@ export default {
|
||||
type: String,
|
||||
required: true
|
||||
},
|
||||
seriesObject: {
|
||||
seriesObjectIds: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default() {
|
||||
@@ -103,9 +105,27 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const configId = this.seriesObjectIds.configId;
|
||||
this.config = this.getConfig(configId);
|
||||
if (!this.config) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.seriesObject = this.getSeriesFromConfig();
|
||||
this.initialize();
|
||||
},
|
||||
methods: {
|
||||
getConfig(configId) {
|
||||
let config = configStore.get(configId);
|
||||
|
||||
return config;
|
||||
},
|
||||
getSeriesFromConfig() {
|
||||
const keyString = this.seriesObjectIds.keyString;
|
||||
const series = this.config.series.models.find(seriesModel => seriesModel.keyString === keyString);
|
||||
|
||||
return series;
|
||||
},
|
||||
initialize(highlightedObject) {
|
||||
const seriesObject = highlightedObject ? highlightedObject.series : this.seriesObject;
|
||||
this.isMissing = seriesObject.domainObject.status === 'missing';
|
||||
|
||||
@@ -80,10 +80,11 @@
|
||||
|
||||
<script>
|
||||
import {getLimitClass} from "@/plugins/plot/chart/limitUtil";
|
||||
import configStore from "@/plugins/plot/configuration/ConfigStore";
|
||||
|
||||
export default {
|
||||
props: {
|
||||
seriesObject: {
|
||||
seriesObjectIds: {
|
||||
type: Object,
|
||||
required: true,
|
||||
default() {
|
||||
@@ -95,10 +96,6 @@ export default {
|
||||
default() {
|
||||
return [];
|
||||
}
|
||||
},
|
||||
legend: {
|
||||
type: Object,
|
||||
required: true
|
||||
}
|
||||
},
|
||||
data() {
|
||||
@@ -116,19 +113,19 @@ export default {
|
||||
},
|
||||
computed: {
|
||||
showUnitsWhenExpanded() {
|
||||
return this.legend.get('showUnitsWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showUnitsWhenExpanded') === true;
|
||||
},
|
||||
showMinimumWhenExpanded() {
|
||||
return this.legend.get('showMinimumWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showMinimumWhenExpanded') === true;
|
||||
},
|
||||
showMaximumWhenExpanded() {
|
||||
return this.legend.get('showMaximumWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showMaximumWhenExpanded') === true;
|
||||
},
|
||||
showValueWhenExpanded() {
|
||||
return this.legend.get('showValueWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showValueWhenExpanded') === true;
|
||||
},
|
||||
showTimestampWhenExpanded() {
|
||||
return this.legend.get('showTimestampWhenExpanded') === true;
|
||||
return this.legend && this.legend.get('showTimestampWhenExpanded') === true;
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -140,9 +137,28 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
const configId = this.seriesObjectIds.configId;
|
||||
this.config = this.getConfig(configId);
|
||||
if (!this.config) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.seriesObject = this.getSeriesFromConfig();
|
||||
this.legend = this.config.legend;
|
||||
this.initialize();
|
||||
},
|
||||
methods: {
|
||||
getConfig(configId) {
|
||||
let config = configStore.get(configId);
|
||||
|
||||
return config;
|
||||
},
|
||||
getSeriesFromConfig() {
|
||||
const keyString = this.seriesObjectIds.keyString;
|
||||
const series = this.config.series.models.find(seriesModel => seriesModel.keyString === keyString);
|
||||
|
||||
return series;
|
||||
},
|
||||
initialize(highlightedObject) {
|
||||
const seriesObject = highlightedObject ? highlightedObject.series : this.seriesObject;
|
||||
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
:cursor-locked="!!lockHighlightPoint"
|
||||
:series="seriesModels"
|
||||
:highlights="highlights"
|
||||
:legend="legend"
|
||||
@legendHoverChanged="legendHoverChanged"
|
||||
/>
|
||||
<div class="l-view-section">
|
||||
@@ -245,14 +244,18 @@ export default {
|
||||
},
|
||||
registerSeriesListeners(configId) {
|
||||
this.seriesConfig[configId] = this.getConfig(configId);
|
||||
this.listenTo(this.seriesConfig[configId].series, 'add', this.addSeries, this);
|
||||
this.listenTo(this.seriesConfig[configId].series, 'add', this.addSeries.bind(this, configId), this);
|
||||
this.listenTo(this.seriesConfig[configId].series, 'remove', this.removeSeries, this);
|
||||
|
||||
this.seriesConfig[configId].series.models.forEach(this.addSeries, this);
|
||||
this.seriesConfig[configId].series.models.forEach(this.addSeries.bind(this, configId), this);
|
||||
},
|
||||
addSeries(series) {
|
||||
addSeries(configId, series) {
|
||||
const index = this.seriesModels.length;
|
||||
this.$set(this.seriesModels, index, series);
|
||||
const seriesModelItem = {
|
||||
keyString: series.keyString,
|
||||
configId
|
||||
};
|
||||
this.$set(this.seriesModels, index, seriesModelItem);
|
||||
},
|
||||
removeSeries(plotSeries) {
|
||||
const index = this.seriesModels.findIndex(seriesModel => this.openmct.objects.areIdsEqual(seriesModel.identifier, plotSeries.identifier));
|
||||
|
||||
@@ -106,6 +106,9 @@ export default {
|
||||
if (this.component) {
|
||||
this.component.$destroy();
|
||||
}
|
||||
|
||||
const configId = this.openmct.objects.makeKeyString(this.childObject.identifier);
|
||||
configStore.deleteStore(configId);
|
||||
},
|
||||
methods: {
|
||||
updateComponentProp(prop, value) {
|
||||
|
||||
@@ -78,7 +78,7 @@ class StaticModelProvider {
|
||||
}
|
||||
|
||||
parseTreeLeaf(leafKey, leafValue, idMap, namespace) {
|
||||
if (!leafValue) {
|
||||
if (leafValue === null || leafValue === undefined) {
|
||||
return leafValue;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user