Rewrite local storage (#4583)

* Reimplementation of Local Storage provider

* Added tests

* Remove identifierService mocks from all test specs

* Do not persist identifiers in couch

* Constant rename

* Fix broken test

* Clean up mock window functions

* Updated copyright notice

* Fixed bug in in-memory search indexer
This commit is contained in:
Andrew Henry
2021-12-17 12:14:35 -08:00
committed by GitHub
parent fd0e89ca05
commit 2d64813a4f
22 changed files with 281 additions and 507 deletions

View File

@@ -43,9 +43,6 @@ function ObjectAPI(typeRegistry, openmct) {
this.providers = {};
this.rootRegistry = new RootRegistry();
this.inMemorySearchProvider = new InMemorySearchProvider(openmct);
this.injectIdentifierService = function () {
this.identifierService = this.openmct.$injector.get("identifierService");
};
this.rootProvider = new RootObjectProvider(this.rootRegistry);
this.cache = {};
@@ -66,33 +63,17 @@ ObjectAPI.prototype.supersecretSetFallbackProvider = function (p) {
this.fallbackProvider = p;
};
/**
* @private
*/
ObjectAPI.prototype.getIdentifierService = function () {
// Lazily acquire identifier service
if (!this.identifierService) {
this.injectIdentifierService();
}
return this.identifierService;
};
/**
* Retrieve the provider for a given identifier.
* @private
*/
ObjectAPI.prototype.getProvider = function (identifier) {
//handles the '' vs 'mct' namespace issue
const keyString = utils.makeKeyString(identifier);
const identifierService = this.getIdentifierService();
const namespace = identifierService.parse(keyString).getSpace();
if (identifier.key === 'ROOT') {
return this.rootProvider;
}
return this.providers[namespace] || this.fallbackProvider;
return this.providers[identifier.namespace] || this.fallbackProvider;
};
/**