mirror of
https://github.com/nasa/openmct.git
synced 2025-03-22 03:55:31 +00:00
Allow endpoints with a single enum metadata value in Bar/Line graphs (#5443)
* If there is only 1 metadata value, set yKey to none. Also, fix bug for determining the name of a metadata value * Update tests for enum metadata values Co-authored-by: John Hill <john.c.hill@nasa.gov> Co-authored-by: Andrew Henry <akhenry@gmail.com>
This commit is contained in:
parent
9d89bdd6d3
commit
a09db30b32
@ -281,11 +281,11 @@ export default {
|
||||
this.xKeyOptions.push(
|
||||
metadataValues.reduce((previousValue, currentValue) => {
|
||||
return {
|
||||
name: `${previousValue.name}, ${currentValue.name}`,
|
||||
name: previousValue?.name ? `${previousValue.name}, ${currentValue.name}` : `${currentValue.name}`,
|
||||
value: currentValue.key,
|
||||
isArrayValue: currentValue.isArrayValue
|
||||
};
|
||||
})
|
||||
}, {name: ''})
|
||||
);
|
||||
}
|
||||
|
||||
@ -336,6 +336,8 @@ export default {
|
||||
|
||||
return option;
|
||||
});
|
||||
} else if (this.xKey !== undefined && this.domainObject.configuration.axes.yKey === undefined) {
|
||||
this.domainObject.configuration.axes.yKey = 'none';
|
||||
}
|
||||
|
||||
this.xKeyOptions = this.xKeyOptions.map((option, index) => {
|
||||
|
@ -367,19 +367,26 @@ describe("the plugin", function () {
|
||||
type: "test-object",
|
||||
name: "Test Object",
|
||||
telemetry: {
|
||||
values: [{
|
||||
key: "some-key",
|
||||
name: "Some attribute",
|
||||
hints: {
|
||||
domain: 1
|
||||
}
|
||||
}, {
|
||||
key: "some-other-key",
|
||||
name: "Another attribute",
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
}]
|
||||
values: [
|
||||
{
|
||||
key: "some-key",
|
||||
source: "some-key",
|
||||
name: "Some attribute",
|
||||
format: "enum",
|
||||
enumerations: [
|
||||
{
|
||||
value: 0,
|
||||
string: "OFF"
|
||||
},
|
||||
{
|
||||
value: 1,
|
||||
string: "ON"
|
||||
}
|
||||
],
|
||||
hints: {
|
||||
range: 1
|
||||
}
|
||||
}]
|
||||
}
|
||||
};
|
||||
const composition = openmct.composition.get(parent);
|
||||
|
Loading…
x
Reference in New Issue
Block a user