mirror of
https://github.com/nasa/openmct.git
synced 2024-12-29 17:38:53 +00:00
Make couch search folders unique roots
This commit is contained in:
parent
3b0e05ed14
commit
99f0f30be5
@ -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() {
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user