Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix couchdbsearchfolder and allow clocky reports #6770

Merged
merged 10 commits into from
Jul 13, 2023
19 changes: 12 additions & 7 deletions src/plugins/CouchDBSearchFolder/plugin.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,26 @@
export default function (folderName, couchPlugin, searchFilter) {
const DEFAULT_NAME = 'CouchDB Documents';

return function install(openmct) {
const couchProvider = couchPlugin.couchProvider;
//replace any non-letter/non-number with a hyphen
const couchSearchId = (folderName || DEFAULT_NAME).replace(/[^a-zA-Z0-9]/g, '-');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would there ever be a situation where folderName isn't passed in? seems unlikely if couchPlugin and searchFilter are expected?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Correct. But this was in case someone put in empty string or something.

const couchSearchName = `couch-search-${couchSearchId}`;

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({
identifier,
type: 'folder',
name: folderName || 'CouchDB Documents',
name: folderName || DEFAULT_NAME,
location: 'ROOT'
});
}
Expand All @@ -25,8 +30,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() {
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/CouchDBSearchFolder/pluginSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/viewLargeAction/viewLargeAction.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default class ViewLargeAction {

return (
childElement &&
!childElement.classList.contains('js-main-container') &&
!childElement?.classList.contains('js-main-container') &&
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there an issue for this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No there isn't an issue. I'm unsure why this issue happened or how to reproduce it too.

!this.openmct.router.isNavigatedObject(objectPath)
);
}
Expand Down
4 changes: 3 additions & 1 deletion src/ui/components/components.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@
import ObjectView from './ObjectView.vue';
import StackedPlot from '../../plugins/plot/stackedPlot/StackedPlot.vue';
import Plot from '../../plugins/plot/Plot.vue';
import WebPage from '../../plugins/webPage/components/WebPage.vue';

export default {
ObjectView,
StackedPlot,
Plot
Plot,
WebPage
};