Sends new style object to the object API for save when calling it from legacy persistence adapter (#3431)

Co-authored-by: Deep Tailor <deep.j.tailor@nasa.gov>
This commit is contained in:
Shefali Joshi 2020-10-07 16:44:20 -07:00 committed by GitHub
parent 6923f17645
commit a192d46c2b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 12 additions and 4 deletions

View File

@ -20,6 +20,8 @@
* at runtime from the About dialog for additional information.
*****************************************************************************/
import utils from 'objectUtils';
export default class LegacyPersistenceAdapter {
constructor(openmct) {
this.openmct = openmct;
@ -33,8 +35,13 @@ export default class LegacyPersistenceAdapter {
return Promise.resolve(Object.keys(this.openmct.objects.providers));
}
updateObject(legacyDomainObject) {
return this.openmct.objects.save(legacyDomainObject.useCapability('adapter'));
updateObject(space, key, legacyDomainObject) {
let object = utils.toNewFormat(legacyDomainObject, {
namespace: space,
key: key
});
return this.openmct.objects.save(object);
}
readObject(space, key) {

View File

@ -22,9 +22,10 @@
import CouchObjectProvider from './CouchObjectProvider';
const NAMESPACE = '';
const PERSISTENCE_SPACE = 'mct';
export default function CouchPlugin(url) {
return function install(openmct) {
openmct.objects.addProvider(NAMESPACE, new CouchObjectProvider(openmct, url, NAMESPACE));
openmct.objects.addProvider(PERSISTENCE_SPACE, new CouchObjectProvider(openmct, url, NAMESPACE));
};
}

View File

@ -38,7 +38,7 @@ describe('the plugin', () => {
beforeEach((done) => {
mockDomainObject = {
identifier: {
namespace: '',
namespace: 'mct',
key: 'some-value'
}
};