Make couch search folders unique roots

This commit is contained in:
Shefali 2023-06-29 07:57:08 -07:00
parent 3b0e05ed14
commit 99f0f30be5
2 changed files with 9 additions and 8 deletions

View File

@ -1,15 +1,16 @@
export default function (folderName, couchPlugin, searchFilter) {
return function install(openmct) {
const couchProvider = couchPlugin.couchProvider;
const couchSearchName = `couch-search-${folderName || 'CouchDB Documents'}`;
openmct.objects.addRoot({
namespace: 'couch-search',
key: 'couch-search'
namespace: couchSearchName,
key: couchSearchName
});
openmct.objects.addProvider('couch-search', {
openmct.objects.addProvider(couchSearchName, {
get(identifier) {
if (identifier.key !== 'couch-search') {
if (identifier.key !== couchSearchName) {
return undefined;
} else {
return Promise.resolve({
@ -25,8 +26,8 @@ export default function (folderName, couchPlugin, searchFilter) {
openmct.composition.addProvider({
appliesTo(domainObject) {
return (
domainObject.identifier.namespace === 'couch-search' &&
domainObject.identifier.key === 'couch-search'
domainObject.identifier.namespace === couchSearchName &&
domainObject.identifier.key === couchSearchName
);
},
load() {

View File

@ -25,8 +25,8 @@ import CouchDBSearchFolderPlugin from './plugin';
describe('the plugin', function () {
let identifier = {
namespace: 'couch-search',
key: 'couch-search'
namespace: 'couch-search-CouchDB Documents',
key: 'couch-search-CouchDB Documents'
};
let testPath = '/test/db';
let openmct;