mirror of
https://github.com/nasa/openmct.git
synced 2025-06-19 07:38:15 +00:00
Add source maps to map plan properties to expected properties (#4933)
This commit is contained in:
@ -21,6 +21,7 @@
|
|||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
export function getValidatedPlan(domainObject) {
|
export function getValidatedPlan(domainObject) {
|
||||||
|
let sourceMap = domainObject.sourceMap;
|
||||||
let body = domainObject.selectFile.body;
|
let body = domainObject.selectFile.body;
|
||||||
let json = {};
|
let json = {};
|
||||||
if (typeof body === 'string') {
|
if (typeof body === 'string') {
|
||||||
@ -33,5 +34,33 @@ export function getValidatedPlan(domainObject) {
|
|||||||
json = body;
|
json = body;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (sourceMap !== undefined && sourceMap.activities !== undefined && sourceMap.groupId !== undefined) {
|
||||||
|
let mappedJson = {};
|
||||||
|
json[sourceMap.activities].forEach((activity) => {
|
||||||
|
if (activity[sourceMap.groupId]) {
|
||||||
|
const groupIdKey = activity[sourceMap.groupId];
|
||||||
|
let groupActivity = {
|
||||||
|
...activity
|
||||||
|
};
|
||||||
|
|
||||||
|
if (sourceMap.start) {
|
||||||
|
groupActivity.start = activity[sourceMap.start];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (sourceMap.end) {
|
||||||
|
groupActivity.end = activity[sourceMap.end];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!mappedJson[groupIdKey]) {
|
||||||
|
mappedJson[groupIdKey] = [];
|
||||||
|
}
|
||||||
|
|
||||||
|
mappedJson[groupIdKey].push(groupActivity);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
return mappedJson;
|
||||||
|
} else {
|
||||||
return json;
|
return json;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Reference in New Issue
Block a user