Fix couchdbsearchfolder and allow clocky reports (#6770)

* Fix CouchDBSearchFolder plugin to have unique identifiers.
Allow ttt-reports to be viewed as web pages

* Remove ttt-report type from WebPage view provider. This is being moved to the viper-openmct repo instead

* Adds check for classList

* Add WebPage to the components list

* Remove uuid and use the folder name as the identifier instead

* Remove focused test

---------

Co-authored-by: John Hill <john.c.hill@nasa.gov>
Co-authored-by: Jamie V <jamie.j.vigliotta@nasa.gov>
This commit is contained in:
Shefali Joshi 2023-07-13 12:50:52 -07:00 committed by GitHub
parent 5031010a00
commit 795d7a7ec7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 11 deletions

View File

@ -1,21 +1,26 @@
export default function (folderName, couchPlugin, searchFilter) { export default function (folderName, couchPlugin, searchFilter) {
const DEFAULT_NAME = 'CouchDB Documents';
return function install(openmct) { return function install(openmct) {
const couchProvider = couchPlugin.couchProvider; const couchProvider = couchPlugin.couchProvider;
//replace any non-letter/non-number with a hyphen
const couchSearchId = (folderName || DEFAULT_NAME).replace(/[^a-zA-Z0-9]/g, '-');
const couchSearchName = `couch-search-${couchSearchId}`;
openmct.objects.addRoot({ openmct.objects.addRoot({
namespace: 'couch-search', namespace: couchSearchName,
key: 'couch-search' key: couchSearchName
}); });
openmct.objects.addProvider('couch-search', { openmct.objects.addProvider(couchSearchName, {
get(identifier) { get(identifier) {
if (identifier.key !== 'couch-search') { if (identifier.key !== couchSearchName) {
return undefined; return undefined;
} else { } else {
return Promise.resolve({ return Promise.resolve({
identifier, identifier,
type: 'folder', type: 'folder',
name: folderName || 'CouchDB Documents', name: folderName || DEFAULT_NAME,
location: 'ROOT' location: 'ROOT'
}); });
} }
@ -25,8 +30,8 @@ export default function (folderName, couchPlugin, searchFilter) {
openmct.composition.addProvider({ openmct.composition.addProvider({
appliesTo(domainObject) { appliesTo(domainObject) {
return ( return (
domainObject.identifier.namespace === 'couch-search' && domainObject.identifier.namespace === couchSearchName &&
domainObject.identifier.key === 'couch-search' domainObject.identifier.key === couchSearchName
); );
}, },
load() { load() {

View File

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

View File

@ -54,7 +54,7 @@ export default class ViewLargeAction {
return ( return (
childElement && childElement &&
!childElement.classList.contains('js-main-container') && !childElement?.classList.contains('js-main-container') &&
!this.openmct.router.isNavigatedObject(objectPath) !this.openmct.router.isNavigatedObject(objectPath)
); );
} }

View File

@ -23,9 +23,11 @@
import ObjectView from './ObjectView.vue'; import ObjectView from './ObjectView.vue';
import StackedPlot from '../../plugins/plot/stackedPlot/StackedPlot.vue'; import StackedPlot from '../../plugins/plot/stackedPlot/StackedPlot.vue';
import Plot from '../../plugins/plot/Plot.vue'; import Plot from '../../plugins/plot/Plot.vue';
import WebPage from '../../plugins/webPage/components/WebPage.vue';
export default { export default {
ObjectView, ObjectView,
StackedPlot, StackedPlot,
Plot Plot,
WebPage
}; };