diff --git a/src/plugins/objectMigration/Migrations.js b/src/plugins/objectMigration/Migrations.js index 4407ac3495..cc035096b6 100644 --- a/src/plugins/objectMigration/Migrations.js +++ b/src/plugins/objectMigration/Migrations.js @@ -64,35 +64,45 @@ define([ Object.keys(panels).forEach(key => { let panel = panels[key]; let domainObject = childObjects[key]; + let identifier = undefined; if (isTelemetry(domainObject)) { - items.push({ - width: panel.dimensions[0], - height: panel.dimensions[1], - x: panel.position[0], - y: panel.position[1], - identifier: domainObject.identifier, - id: uuid(), - type: 'telemetry-view', - displayMode: 'all', - value: openmct.telemetry.getMetadata(domainObject).getDefaultDisplayValue(), - stroke: "transparent", - fill: "", - color: "", - size: "13px" - }); - } else { - items.push({ - width: panel.dimensions[0], - height: panel.dimensions[1], - x: panel.position[0], - y: panel.position[1], - identifier: domainObject.identifier, - id: uuid(), - type: 'subobject-view', - hasFrame: panel.hasFrame + // If object is a telemetry point, convert it to a plot and + // replace the object in migratedObject composition with the plot. + identifier = { + key: uuid(), + namespace: migratedObject.identifier.namespace + }; + let plotObject = { + identifier: identifier, + location: domainObject.location, + name: domainObject.name, + type: "telemetry.plot.overlay" + }; + let plotType = openmct.types.get('telemetry.plot.overlay'); + plotType.definition.initialize(plotObject); + plotObject.composition.push(domainObject.identifier); + openmct.objects.mutate(plotObject, 'persisted', Date.now()); + + let keyString = openmct.objects.makeKeyString(domainObject.identifier); + let clonedComposition = Object.assign([], migratedObject.composition); + clonedComposition.forEach((identifier, index) => { + if (openmct.objects.makeKeyString(identifier) === keyString) { + migratedObject.composition[index] = plotObject.identifier; + } }); } + + items.push({ + width: panel.dimensions[0], + height: panel.dimensions[1], + x: panel.position[0], + y: panel.position[1], + identifier: identifier || domainObject.identifier, + id: uuid(), + type: 'subobject-view', + hasFrame: panel.hasFrame + }); }); migratedObject.configuration.items = items;