diff --git a/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js b/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js index e62c65772a3..dcda7a192cf 100644 --- a/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js +++ b/e2e/tests/functional/plugins/plot/tagging.e2e.spec.js @@ -118,6 +118,35 @@ test.describe('Plot Tagging', () => { await basicTagsTests(page); }); + test('Plots use index to retrieve tags @couchdb @network', async ({ page }) => { + test.info().annotations.push({ + type: 'issue', + description: 'https://github.com/nasa/openmct/issues/8184' + }); + // Switch to real-time mode + await setRealTimeMode(page); + + const tagsRequestPromise = new Promise((resolve) => { + page.on('request', async (request) => { + const isTagsRequest = request.url().endsWith('by_keystring'); + if (isTagsRequest) { + const response = await request.response(); + resolve(response.status() === 200); + } + }); + }); + await createDomainObjectWithDefaults(page, { + type: 'Sine Wave Generator' + }); + + const pauseButton = page.getByLabel('Pause incoming real-time data'); + pauseButton.click(); + + const didUseIndexForTagsRequest = await tagsRequestPromise; + + expect(didUseIndexForTagsRequest).toBe(true); + }); + test('Tags work with Stacked Plots', async ({ page }) => { const stackedPlot = await createDomainObjectWithDefaults(page, { type: 'Stacked Plot' diff --git a/src/plugins/persistence/couch/CouchObjectProvider.js b/src/plugins/persistence/couch/CouchObjectProvider.js index b5e53848fd6..7862a5945ca 100644 --- a/src/plugins/persistence/couch/CouchObjectProvider.js +++ b/src/plugins/persistence/couch/CouchObjectProvider.js @@ -463,7 +463,6 @@ class CouchObjectProvider { { designDoc, viewName, keysToSearch, startKey, endKey, limit, objectIdField }, abortSignal ) { - let stringifiedKeys = JSON.stringify(keysToSearch); const url = `${this.url}/_design/${designDoc}/_view/${viewName}`; const requestBody = {}; let requestBodyString; @@ -485,7 +484,7 @@ class CouchObjectProvider { requestBodyString = requestBodyString.replace('$END_KEY', endKey); /* spell-checker: enable */ } else { - requestBody.keys = stringifiedKeys; + requestBody.keys = keysToSearch; requestBodyString = JSON.stringify(requestBody); } diff --git a/src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh b/src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh index 4fbc50d4ec6..dfb79cd0294 100644 --- a/src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh +++ b/src/plugins/persistence/couch/replace-localstorage-with-couchdb-indexhtml.sh @@ -1,3 +1,3 @@ #!/bin/bash -e -sed -i'.bak' -e 's/LocalStorage()/CouchDB("http:\/\/localhost:5984\/openmct")/g' index.html +sed -i'.bak' -e 's/LocalStorage()/CouchDB(\{url: "http:\/\/localhost:5984\/openmct", useDesignDocuments: true\})/g' index.html