mirror of
https://github.com/nasa/openmct.git
synced 2025-06-02 23:50:49 +00:00
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:
parent
6923f17645
commit
a192d46c2b
@ -20,6 +20,8 @@
|
|||||||
* at runtime from the About dialog for additional information.
|
* at runtime from the About dialog for additional information.
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
|
|
||||||
|
import utils from 'objectUtils';
|
||||||
|
|
||||||
export default class LegacyPersistenceAdapter {
|
export default class LegacyPersistenceAdapter {
|
||||||
constructor(openmct) {
|
constructor(openmct) {
|
||||||
this.openmct = openmct;
|
this.openmct = openmct;
|
||||||
@ -33,8 +35,13 @@ export default class LegacyPersistenceAdapter {
|
|||||||
return Promise.resolve(Object.keys(this.openmct.objects.providers));
|
return Promise.resolve(Object.keys(this.openmct.objects.providers));
|
||||||
}
|
}
|
||||||
|
|
||||||
updateObject(legacyDomainObject) {
|
updateObject(space, key, legacyDomainObject) {
|
||||||
return this.openmct.objects.save(legacyDomainObject.useCapability('adapter'));
|
let object = utils.toNewFormat(legacyDomainObject, {
|
||||||
|
namespace: space,
|
||||||
|
key: key
|
||||||
|
});
|
||||||
|
|
||||||
|
return this.openmct.objects.save(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
readObject(space, key) {
|
readObject(space, key) {
|
||||||
|
@ -22,9 +22,10 @@
|
|||||||
|
|
||||||
import CouchObjectProvider from './CouchObjectProvider';
|
import CouchObjectProvider from './CouchObjectProvider';
|
||||||
const NAMESPACE = '';
|
const NAMESPACE = '';
|
||||||
|
const PERSISTENCE_SPACE = 'mct';
|
||||||
|
|
||||||
export default function CouchPlugin(url) {
|
export default function CouchPlugin(url) {
|
||||||
return function install(openmct) {
|
return function install(openmct) {
|
||||||
openmct.objects.addProvider(NAMESPACE, new CouchObjectProvider(openmct, url, NAMESPACE));
|
openmct.objects.addProvider(PERSISTENCE_SPACE, new CouchObjectProvider(openmct, url, NAMESPACE));
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -38,7 +38,7 @@ describe('the plugin', () => {
|
|||||||
beforeEach((done) => {
|
beforeEach((done) => {
|
||||||
mockDomainObject = {
|
mockDomainObject = {
|
||||||
identifier: {
|
identifier: {
|
||||||
namespace: '',
|
namespace: 'mct',
|
||||||
key: 'some-value'
|
key: 'some-value'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user