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:
Shefali Joshi 2024-02-05 10:38:37 -08:00 committed by GitHub
parent 82fa4c1597
commit 0aceb4b590
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 5 additions and 4 deletions

View File

@ -30,6 +30,7 @@
* @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 {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';
@ -62,9 +63,9 @@ export function getValidatedData(domainObject) {
groupActivity.filterMetadataValues = [];
sourceMap.filterMetadata.forEach((property) => {
const value = _.get(activity, property);
groupActivity.filterMetadataValues.push({
value
});
if (value !== undefined && value !== null) {
groupActivity.filterMetadataValues.push(value);
}
});
}

View File

@ -150,7 +150,7 @@ export default {
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);
}