From 83ae812aebc7aea9fa2da45203801f4842098003 Mon Sep 17 00:00:00 2001 From: Rhys Date: Wed, 21 Feb 2024 10:12:40 -0500 Subject: [PATCH] fix(query-bar, schema): double space not applied from schema or query history COMPASS-6980 (#5471) --- package-lock.json | 44 +++++++++---------- packages/compass-aggregations/package.json | 2 +- .../match/match.spec.tsx | 2 +- packages/compass-crud/package.json | 2 +- .../src/components/bulk-delete-modal.spec.tsx | 2 +- .../src/components/bulk-update-modal.spec.tsx | 2 +- .../src/stores/crud-store.spec.ts | 2 +- .../tests/collection-documents-tab.test.ts | 10 ++--- packages/compass-import-export/package.json | 2 +- packages/compass-indexes/package.json | 2 +- packages/compass-query-bar/package.json | 2 +- .../src/stores/query-bar-reducer.spec.ts | 10 ++--- .../src/utils/format-query.spec.js | 18 ++++---- packages/compass-query-bar/src/utils/query.ts | 13 ++++-- .../compass-schema-validation/package.json | 2 +- .../src/components/value-bubble.tsx | 5 +++ packages/connection-form/package.json | 2 +- packages/databases-collections/package.json | 2 +- 18 files changed, 68 insertions(+), 56 deletions(-) diff --git a/package-lock.json b/package-lock.json index 921b6a83710..b0937c516cb 100644 --- a/package-lock.json +++ b/package-lock.json @@ -33046,9 +33046,9 @@ "integrity": "sha512-pCutlP/AU0hcJ/f1h2h3nmn79/gXrQo6088QvPCbdx7SBDkAeGPH4AYu28DgqZzFvsn5mtt2RUpsFicYhjaHow==" }, "node_modules/mongodb-query-parser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/mongodb-query-parser/-/mongodb-query-parser-4.0.2.tgz", - "integrity": "sha512-GajCLw8/Ut0mlIW1msU36Pvyg/FRc0LPyp8aNzfafzNrDwz2ZOJmwtmNAkckuXG3Iqnj0ZZOouhIo4E4rjXcBQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mongodb-query-parser/-/mongodb-query-parser-4.1.0.tgz", + "integrity": "sha512-/wX9p2fx1Il2kfJ9x8qcd7ER1JT4tqgdiVCNKlGM+U76SQ3oI8h2Yda8XDh7Oy6seXQntNTbjT3/Z5KI+bjIrw==", "dependencies": { "debug": "^4.3.4", "ejson-shell-parser": "^2.0.0", @@ -45803,7 +45803,7 @@ "mongodb-database-model": "^2.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "prettier": "^2.7.1", @@ -46404,7 +46404,7 @@ "mocha": "^10.2.0", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react": "^17.0.2", @@ -47456,7 +47456,7 @@ "mocha": "^10.2.0", "mongodb": "^6.3.0", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "papaparse": "^5.3.2", @@ -47621,7 +47621,7 @@ "lodash": "^4.17.21", "mocha": "^10.2.0", "mongodb": "^6.3.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "numeral": "^2.0.6", "nyc": "^15.1.0", "react": "^17.0.2", @@ -48103,7 +48103,7 @@ "mongodb": "^6.3.0", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "react": "^17.0.2", @@ -48347,7 +48347,7 @@ "mocha": "^10.2.0", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react-dom": "^17.0.2", @@ -49462,7 +49462,7 @@ "lodash": "^4.17.21", "mongodb-build-info": "^1.7.0", "mongodb-connection-string-url": "^2.6.0", - "mongodb-query-parser": "^4.0.2" + "mongodb-query-parser": "^4.1.0" }, "devDependencies": { "@mongodb-js/eslint-config-compass": "^1.0.15", @@ -49907,7 +49907,7 @@ "mongodb-database-model": "^2.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react-dom": "^17.0.2", @@ -59003,7 +59003,7 @@ "mongodb-database-model": "^2.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "prettier": "^2.7.1", @@ -59481,7 +59481,7 @@ "mongodb-data-service": "^22.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react": "^17.0.2", @@ -59522,7 +59522,7 @@ "mongodb-database-model": "^2.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react-dom": "^17.0.2", @@ -60107,7 +60107,7 @@ "mongodb": "^6.3.0", "mongodb-data-service": "^22.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "papaparse": "^5.3.2", @@ -60233,7 +60233,7 @@ "mocha": "^10.2.0", "mongodb": "^6.3.0", "mongodb-data-service": "^22.17.4", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "numeral": "^2.0.6", "nyc": "^15.1.0", "react": "^17.0.2", @@ -60530,7 +60530,7 @@ "mongodb-data-service": "^22.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-query-util": "^2.1.7", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", @@ -60737,7 +60737,7 @@ "mongodb-data-service": "^22.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react-dom": "^17.0.2", @@ -61838,7 +61838,7 @@ "mongodb-build-info": "^1.7.0", "mongodb-connection-string-url": "^2.6.0", "mongodb-data-service": "^22.17.4", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prettier": "^2.7.1", "react": "^17.0.2", @@ -85745,9 +85745,9 @@ "integrity": "sha512-pCutlP/AU0hcJ/f1h2h3nmn79/gXrQo6088QvPCbdx7SBDkAeGPH4AYu28DgqZzFvsn5mtt2RUpsFicYhjaHow==" }, "mongodb-query-parser": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/mongodb-query-parser/-/mongodb-query-parser-4.0.2.tgz", - "integrity": "sha512-GajCLw8/Ut0mlIW1msU36Pvyg/FRc0LPyp8aNzfafzNrDwz2ZOJmwtmNAkckuXG3Iqnj0ZZOouhIo4E4rjXcBQ==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/mongodb-query-parser/-/mongodb-query-parser-4.1.0.tgz", + "integrity": "sha512-/wX9p2fx1Il2kfJ9x8qcd7ER1JT4tqgdiVCNKlGM+U76SQ3oI8h2Yda8XDh7Oy6seXQntNTbjT3/Z5KI+bjIrw==", "requires": { "debug": "^4.3.4", "ejson-shell-parser": "^2.0.0", diff --git a/packages/compass-aggregations/package.json b/packages/compass-aggregations/package.json index e4004c2d5c2..26ef33e0c38 100644 --- a/packages/compass-aggregations/package.json +++ b/packages/compass-aggregations/package.json @@ -89,7 +89,7 @@ "mongodb-database-model": "^2.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "prettier": "^2.7.1", diff --git a/packages/compass-aggregations/src/components/aggregation-side-panel/stage-wizard-use-cases/match/match.spec.tsx b/packages/compass-aggregations/src/components/aggregation-side-panel/stage-wizard-use-cases/match/match.spec.tsx index c011ce1fac9..29b98363e86 100644 --- a/packages/compass-aggregations/src/components/aggregation-side-panel/stage-wizard-use-cases/match/match.spec.tsx +++ b/packages/compass-aggregations/src/components/aggregation-side-panel/stage-wizard-use-cases/match/match.spec.tsx @@ -593,7 +593,7 @@ describe('match', function () { const onChangeSpy = Sinon.spy(); render(); setComboboxValue(new RegExp(SINGLE_SELECT_LABEL, 'i'), 'name'); - expect(onChangeSpy.lastCall.args).deep.equal(["{\n name: ''\n}", null]); + expect(onChangeSpy.lastCall.args).deep.equal(["{\n name: ''\n}", null]); }); it('should call onChange with an error if there was an error during the conversion to stage', function () { diff --git a/packages/compass-crud/package.json b/packages/compass-crud/package.json index 037a11148c3..d5ee86310a0 100644 --- a/packages/compass-crud/package.json +++ b/packages/compass-crud/package.json @@ -100,7 +100,7 @@ "mocha": "^10.2.0", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react": "^17.0.2", diff --git a/packages/compass-crud/src/components/bulk-delete-modal.spec.tsx b/packages/compass-crud/src/components/bulk-delete-modal.spec.tsx index 130b61fc6ba..42e0355ddeb 100644 --- a/packages/compass-crud/src/components/bulk-delete-modal.spec.tsx +++ b/packages/compass-crud/src/components/bulk-delete-modal.spec.tsx @@ -70,7 +70,7 @@ describe('BulkDeleteModal Component', function () { it('shows the provided query', function () { renderBulkDeleteModal({ filter: { a: 1 } }); expect(screen.getByTestId('readonly-filter').textContent).to.equal( - '{\n a: 1\n}' + '{\n a: 1\n}' ); }); diff --git a/packages/compass-crud/src/components/bulk-update-modal.spec.tsx b/packages/compass-crud/src/components/bulk-update-modal.spec.tsx index 44794245d45..cf2a2751e46 100644 --- a/packages/compass-crud/src/components/bulk-update-modal.spec.tsx +++ b/packages/compass-crud/src/components/bulk-update-modal.spec.tsx @@ -52,7 +52,7 @@ describe('BulkUpdateModal Component', function () { // filter expect(screen.getByTestId('readonly-filter').textContent).to.equal( - '{\n a: 1\n}' + '{\n a: 1\n}' ); // update diff --git a/packages/compass-crud/src/stores/crud-store.spec.ts b/packages/compass-crud/src/stores/crud-store.spec.ts index f87b9b0f5ab..de16add8fd7 100644 --- a/packages/compass-crud/src/stores/crud-store.spec.ts +++ b/packages/compass-crud/src/stores/crud-store.spec.ts @@ -1051,7 +1051,7 @@ describe('store', function () { 'open-query-export-to-language', (options, exportMode) => { expect(exportMode).to.equal('Delete Query'); - expect(options).to.deep.equal({ filter: '{\n query: 1\n}' }); + expect(options).to.deep.equal({ filter: '{\n query: 1\n}' }); done(); } diff --git a/packages/compass-e2e-tests/tests/collection-documents-tab.test.ts b/packages/compass-e2e-tests/tests/collection-documents-tab.test.ts index 6f739c06943..b1453b85133 100644 --- a/packages/compass-e2e-tests/tests/collection-documents-tab.test.ts +++ b/packages/compass-e2e-tests/tests/collection-documents-tab.test.ts @@ -165,7 +165,7 @@ describe('Collection documents tab', function () { }); const queries = await getRecentQueries(browser, true); - expect(queries).to.deep.include.members([{ Filter: '{\n i: 5\n}' }]); + expect(queries).to.deep.include.members([{ Filter: '{\n i: 5\n}' }]); }); it('supports advanced find operations', async function () { @@ -197,11 +197,11 @@ describe('Collection documents tab', function () { const queries = await getRecentQueries(browser, true); expect(queries).to.deep.include.members([ { - Filter: '{\n i: {\n $gt: 5\n }\n}', + Filter: '{\n i: {\n $gt: 5\n }\n}', Limit: '50', - Project: '{\n _id: 0\n}', + Project: '{\n _id: 0\n}', Skip: '5', - Sort: '{\n i: -1\n}', + Sort: '{\n i: -1\n}', }, ]); }); @@ -244,7 +244,7 @@ describe('Collection documents tab', function () { const queries = await getRecentQueries(browser, true); expect(queries).to.deep.include.members([ { - Filter: "{\n $where: 'function() { return sleep(10000) || true; }'\n}", + Filter: "{\n $where: 'function() { return sleep(10000) || true; }'\n}", }, ]); }); diff --git a/packages/compass-import-export/package.json b/packages/compass-import-export/package.json index 47a78360358..7052b7303ed 100644 --- a/packages/compass-import-export/package.json +++ b/packages/compass-import-export/package.json @@ -112,7 +112,7 @@ "mocha": "^10.2.0", "mongodb": "^6.3.0", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "papaparse": "^5.3.2", diff --git a/packages/compass-indexes/package.json b/packages/compass-indexes/package.json index 5e97ce77f50..1639ad4de67 100644 --- a/packages/compass-indexes/package.json +++ b/packages/compass-indexes/package.json @@ -87,7 +87,7 @@ "lodash": "^4.17.21", "mocha": "^10.2.0", "mongodb": "^6.3.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "numeral": "^2.0.6", "nyc": "^15.1.0", "react": "^17.0.2", diff --git a/packages/compass-query-bar/package.json b/packages/compass-query-bar/package.json index 5da206d9fa0..d83df8f501c 100644 --- a/packages/compass-query-bar/package.json +++ b/packages/compass-query-bar/package.json @@ -91,7 +91,7 @@ "mongodb": "^6.3.0", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "mongodb-schema": "^12.1.0", "nyc": "^15.1.0", "react": "^17.0.2", diff --git a/packages/compass-query-bar/src/stores/query-bar-reducer.spec.ts b/packages/compass-query-bar/src/stores/query-bar-reducer.spec.ts index 500f722fbe5..773a46c539d 100644 --- a/packages/compass-query-bar/src/stores/query-bar-reducer.spec.ts +++ b/packages/compass-query-bar/src/stores/query-bar-reducer.spec.ts @@ -109,15 +109,15 @@ describe('queryBarReducer', function () { expect(getField('filter')) .to.have.property('value') .deep.eq({ _id: '123' }); - expect(getField('filter')).to.have.property('string', "{_id: '123'}"); + expect(getField('filter')).to.have.property('string', '{ _id: "123" }'); expect(getField('filter')).to.have.property('valid', true); expect(getField('project')).to.have.property('value').deep.eq({ _id: 1 }); - expect(getField('project')).to.have.property('string', '{_id: 1}'); + expect(getField('project')).to.have.property('string', '{ _id: 1 }'); expect(getField('project')).to.have.property('valid', true); expect(getField('sort')).to.have.property('value').deep.eq({ _id: -1 }); - expect(getField('sort')).to.have.property('string', '{_id: -1}'); + expect(getField('sort')).to.have.property('string', '{ _id: -1 }'); expect(getField('sort')).to.have.property('valid', true); expect(getField('skip')).to.have.property( @@ -217,7 +217,7 @@ describe('queryBarReducer', function () { .deep.eq(newQuery.filter); expect(store.getState().queryBar).to.have.nested.property( 'fields.filter.string', - '{_id: 2}' + '{ _id: 2 }' ); expect(store.getState().queryBar) @@ -225,7 +225,7 @@ describe('queryBarReducer', function () { .deep.eq(newQuery.sort); expect(store.getState().queryBar).to.have.nested.property( 'fields.sort.string', - '{_id: -1}' + '{ _id: -1 }' ); }); }); diff --git a/packages/compass-query-bar/src/utils/format-query.spec.js b/packages/compass-query-bar/src/utils/format-query.spec.js index dcdffa9866d..057deb5c7ac 100644 --- a/packages/compass-query-bar/src/utils/format-query.spec.js +++ b/packages/compass-query-bar/src/utils/format-query.spec.js @@ -13,7 +13,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has an ObjectId', function () { const value = new bson.ObjectId(); const filter = { _id: value }; - const expected = `{\n _id: ObjectId('${value.toHexString()}')\n}`; + const expected = `{\n _id: ObjectId('${value.toHexString()}')\n}`; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -23,7 +23,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a date', function () { const value = new Date(); const filter = { field: value }; - const expected = `{\n field: ISODate('${value.toISOString()}')\n}`; + const expected = `{\n field: ISODate('${value.toISOString()}')\n}`; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -33,7 +33,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a binary', function () { const value = bson.Binary.createFromBase64('xxxx'); const filter = { field: value }; - const expected = `{\n field: BinData(0, '${value.buffer.toString( + const expected = `{\n field: BinData(0, '${value.buffer.toString( 'base64' )}')\n}`; @@ -45,7 +45,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a MaxKey', function () { const value = new bson.MaxKey(); const filter = { field: value }; - const expected = '{\n field: MaxKey()\n}'; + const expected = '{\n field: MaxKey()\n}'; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -55,7 +55,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a MinKey', function () { const value = new bson.MinKey(); const filter = { field: value }; - const expected = '{\n field: MinKey()\n}'; + const expected = '{\n field: MinKey()\n}'; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -65,7 +65,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a Decimal128', function () { const value = new bson.Decimal128('0.00'); const filter = { field: value }; - const expected = "{\n field: NumberDecimal('0.00')\n}"; + const expected = "{\n field: NumberDecimal('0.00')\n}"; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -75,7 +75,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a Long', function () { const value = bson.Long.fromNumber(1); const filter = { field: value }; - const expected = '{\n field: NumberLong(1)\n}'; + const expected = '{\n field: NumberLong(1)\n}'; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -85,7 +85,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a Regexp', function () { const value = /test/i; const filter = { field: value }; - const expected = '{\n field: RegExp("test", \'i\')\n}'; + const expected = '{\n field: RegExp("test", \'i\')\n}'; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); @@ -95,7 +95,7 @@ describe('formatQuery [Utils]', function () { describe('when the property has a Timestamp', function () { const value = new bson.Timestamp({ t: 1000, i: 0 }); const filter = { field: value }; - const expected = '{\n field: Timestamp({ t: 1000, i: 0 })\n}'; + const expected = '{\n field: Timestamp({ t: 1000, i: 0 })\n}'; it('returns the shell syntax string', function () { expect(formatQuery(filter)).to.equal(expected); diff --git a/packages/compass-query-bar/src/utils/query.ts b/packages/compass-query-bar/src/utils/query.ts index 3057ad96cd1..59bf4c98b87 100644 --- a/packages/compass-query-bar/src/utils/query.ts +++ b/packages/compass-query-bar/src/utils/query.ts @@ -1,6 +1,8 @@ -import { stringify, validate } from 'mongodb-query-parser'; +import { toJSString, validate } from 'mongodb-query-parser'; import type { UserPreferences } from 'compass-preferences-model'; import { isEqual } from 'lodash'; +import { prettify } from '@mongodb-js/compass-editor'; + import { DEFAULT_FIELD_VALUES, DEFAULT_QUERY_VALUES, @@ -89,8 +91,13 @@ export function mapQueryToFormFields( if (!isQueryProperty(key)) { return null; } - const valueAsString = - typeof _value === 'undefined' ? '' : stringify(_value) || ''; + let valueAsString = + typeof _value === 'undefined' ? '' : toJSString(_value, 0) || ''; + + valueAsString = prettify(valueAsString, 'javascript-expression', { + trailingComma: 'none', + }); + const value = validateField(key, valueAsString, preferences); const valid: boolean = value !== false; if (onlyValid && !valid) { diff --git a/packages/compass-schema-validation/package.json b/packages/compass-schema-validation/package.json index e6e35e17a77..b8a9452aadc 100644 --- a/packages/compass-schema-validation/package.json +++ b/packages/compass-schema-validation/package.json @@ -87,7 +87,7 @@ "mocha": "^10.2.0", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react-dom": "^17.0.2", diff --git a/packages/compass-schema/src/components/value-bubble.tsx b/packages/compass-schema/src/components/value-bubble.tsx index 580c99bf38a..5fee0c0bf3c 100644 --- a/packages/compass-schema/src/components/value-bubble.tsx +++ b/packages/compass-schema/src/components/value-bubble.tsx @@ -26,6 +26,10 @@ const valueBubbleValueStyles = css({ }, }); +const valueBubblePreWrapStyles = css({ + whiteSpace: 'pre-wrap', +}); + const valueBubbleDarkModeValueStyles = css({ backgroundColor: palette.gray.dark2, color: palette.gray.light3, @@ -95,6 +99,7 @@ function ValueBubble({ fieldName, queryValue, value }: ValueBubbleProps) { } ${extractedStringValue} ${isValueInQuery ? 'from' : 'to'} query`} className={cx( valueBubbleValueStyles, + isString(value) && valueBubblePreWrapStyles, darkMode && valueBubbleDarkModeValueStyles, isValueInQuery && valueBubbleValueSelectedStyles )} diff --git a/packages/connection-form/package.json b/packages/connection-form/package.json index 418b75c606d..faa5411dea2 100644 --- a/packages/connection-form/package.json +++ b/packages/connection-form/package.json @@ -59,7 +59,7 @@ "lodash": "^4.17.21", "mongodb-build-info": "^1.7.0", "mongodb-connection-string-url": "^2.6.0", - "mongodb-query-parser": "^4.0.2" + "mongodb-query-parser": "^4.1.0" }, "devDependencies": { "@mongodb-js/eslint-config-compass": "^1.0.15", diff --git a/packages/databases-collections/package.json b/packages/databases-collections/package.json index 0fed6254993..f3d6c3f037a 100644 --- a/packages/databases-collections/package.json +++ b/packages/databases-collections/package.json @@ -77,7 +77,7 @@ "mongodb-database-model": "^2.17.4", "mongodb-instance-model": "^12.17.4", "mongodb-ns": "^2.4.0", - "mongodb-query-parser": "^4.0.2", + "mongodb-query-parser": "^4.1.0", "nyc": "^15.1.0", "prop-types": "^15.7.2", "react-dom": "^17.0.2",