mirror of
https://github.com/nasa/openmct.git
synced 2025-06-23 09:25:29 +00:00
Legacy and new object providers work together (#3461)
* Strip mct namespace from ids when getting models from cache * Revert PersistenceCapability to use legacy code Enforce empty namespace for LegacyPersistenceAdapter for new object providers * Reverts change to caching provider * CouchObject provider is registered with the mct space. When saving objects via the persistence capability use the mct space to find the couchdb object provider
This commit is contained in:
@ -129,13 +129,6 @@ define([
|
||||
|
||||
ObjectServiceProvider.prototype.get = function (key) {
|
||||
let keyString = utils.makeKeyString(key);
|
||||
const space = this.getSpace(keyString);
|
||||
|
||||
let identifier = utils.parseKeyString(keyString);
|
||||
// We assign to the space for legacy persistence providers since they register themselves using a defaultSpace.
|
||||
// This is the way to make everyone happy.
|
||||
identifier.namespace = space;
|
||||
keyString = utils.makeKeyString(identifier);
|
||||
|
||||
return this.objectService.getObjects([keyString])
|
||||
.then(function (results) {
|
||||
|
@ -86,7 +86,10 @@ export default class CouchObjectProvider {
|
||||
this.objectQueue[key] = new CouchObjectQueue(undefined, response[REV]);
|
||||
}
|
||||
|
||||
this.objectQueue[key].updateRevision(response[REV]);
|
||||
//Sometimes CouchDB returns the old rev which fetching the object if there is a document update in progress
|
||||
if (!this.objectQueue[key].pending) {
|
||||
this.objectQueue[key].updateRevision(response[REV]);
|
||||
}
|
||||
|
||||
return object;
|
||||
} else {
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
import CouchObjectProvider from './CouchObjectProvider';
|
||||
const NAMESPACE = '';
|
||||
const PERSISTENCE_SPACE = '';
|
||||
const PERSISTENCE_SPACE = 'mct';
|
||||
|
||||
export default function CouchPlugin(url) {
|
||||
return function install(openmct) {
|
||||
|
@ -31,19 +31,18 @@ describe('the plugin', () => {
|
||||
let element;
|
||||
let child;
|
||||
let provider;
|
||||
let testSpace = 'testSpace';
|
||||
let testPath = '/test/db';
|
||||
let mockDomainObject;
|
||||
|
||||
beforeEach((done) => {
|
||||
mockDomainObject = {
|
||||
identifier: {
|
||||
namespace: '',
|
||||
namespace: 'mct',
|
||||
key: 'some-value'
|
||||
}
|
||||
};
|
||||
openmct = createOpenMct(false);
|
||||
openmct.install(new CouchPlugin(testSpace, testPath));
|
||||
openmct.install(new CouchPlugin(testPath));
|
||||
|
||||
element = document.createElement('div');
|
||||
child = document.createElement('div');
|
||||
|
Reference in New Issue
Block a user