mirror of
https://github.com/nasa/openmct.git
synced 2025-05-11 04:52:57 +00:00
Filter values as a string not an object (#7448)
* Push the value of a property to the activity as a string if it is not undefined. * Add documentation for sourceMap filterMetadata * Allow . for filtering. Check for null values
This commit is contained in:
parent
82fa4c1597
commit
0aceb4b590
@ -30,6 +30,7 @@
|
|||||||
* @property {string} end The end time property of the activity
|
* @property {string} end The end time property of the activity
|
||||||
* @property {string} id The unique id of the activity. This is required to allow setting activity states
|
* @property {string} id The unique id of the activity. This is required to allow setting activity states
|
||||||
* @property {object} displayProperties a list of key: value pairs that specifies which properties of the activity should be displayed when it is selected. Ex. {'location': 'Location', 'metadata.length_in_meters', 'Length (meters)'}
|
* @property {object} displayProperties a list of key: value pairs that specifies which properties of the activity should be displayed when it is selected. Ex. {'location': 'Location', 'metadata.length_in_meters', 'Length (meters)'}
|
||||||
|
* @property {object} filterMetadata a list of strings that specifies which properties of the activity be included for filtering. Ex. {'description','properties.length_in_meters'}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import _ from 'lodash';
|
import _ from 'lodash';
|
||||||
@ -62,9 +63,9 @@ export function getValidatedData(domainObject) {
|
|||||||
groupActivity.filterMetadataValues = [];
|
groupActivity.filterMetadataValues = [];
|
||||||
sourceMap.filterMetadata.forEach((property) => {
|
sourceMap.filterMetadata.forEach((property) => {
|
||||||
const value = _.get(activity, property);
|
const value = _.get(activity, property);
|
||||||
groupActivity.filterMetadataValues.push({
|
if (value !== undefined && value !== null) {
|
||||||
value
|
groupActivity.filterMetadataValues.push(value);
|
||||||
});
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ export default {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
const regex = new RegExp(/^([a-zA-Z0-9_\-\s,])+$/g);
|
const regex = new RegExp(/^([a-zA-Z0-9_.\-\s,])+$/g);
|
||||||
|
|
||||||
return regex.test(value);
|
return regex.test(value);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user