Skip to content

Commit

Permalink
Merge branch 'main' into dismiss-getstarted-card
Browse files Browse the repository at this point in the history
  • Loading branch information
Hailong-am authored Nov 21, 2024
2 parents 723c5d4 + c928aec commit e63fcfb
Show file tree
Hide file tree
Showing 64 changed files with 1,569 additions and 300 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/build_and_test_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ jobs:
JOB: ci${{ matrix.group }}
CACHE_DIR: ciGroup${{ matrix.group }}

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-artifacts-ci${{ matrix.group }}
Expand Down Expand Up @@ -393,7 +393,7 @@ jobs:
id: plugin-ftr-tests
run: node scripts/functional_tests.js --config test/plugin_functional/config.ts

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: failure-artifacts-plugin-functional-${{ matrix.os }}
Expand Down Expand Up @@ -506,7 +506,7 @@ jobs:
- name: Build `${{ matrix.name }}`
run: yarn ${{ matrix.script }} --release

- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: success()
with:
name: ${{ matrix.suffix }}-${{ env.VERSION }}
Expand Down Expand Up @@ -595,7 +595,7 @@ jobs:
run: |
./bwctest.sh -s false -o ${{ env.OPENSEARCH_URL }} -d ${{ steps.download.outputs.download-path }}/opensearch-dashboards-${{ env.VERSION }}-linux-x64.tar.gz
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: ${{ failure() && steps.verify-opensearch-exists.outputs.version-exists == 'true' }}
with:
name: ${{ matrix.version }}-test-failures
Expand Down
26 changes: 13 additions & 13 deletions .github/workflows/cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -265,50 +265,50 @@ jobs:

# Screenshots are only captured on failure, will change this once we do visual regression tests
- name: Upload FT repo screenshots
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: failure() && matrix.test_location == 'ftr'
with:
name: ftr-cypress-screenshots
name: ftr-cypress-screenshots-${{ matrix.group }}
path: ${{ env.FTR_PATH }}/cypress/screenshots
retention-days: 1

- name: Upload FT repo videos
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always() && matrix.test_location == 'ftr'
with:
name: ftr-cypress-videos
name: ftr-cypress-videos-${{ matrix.group }}
path: ${{ env.FTR_PATH }}/cypress/videos
retention-days: 1

- name: Upload FT repo results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always() && matrix.test_location == 'ftr'
with:
name: ftr-cypress-results
name: ftr-cypress-results-${{ matrix.group }}
path: ${{ env.FTR_PATH }}/cypress/results
retention-days: 1

- name: Upload Dashboards screenshots
if: failure() && matrix.test_location == 'source'
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: dashboards-cypress-screenshots
name: dashboards-cypress-screenshots-${{ matrix.group }}
path: cypress/screenshots
retention-days: 1

- name: Upload Dashboards repo videos
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always() && matrix.test_location == 'source'
with:
name: dashboards-cypress-videos
name: dashboards-cypress-videos-${{ matrix.group }}
path: cypress/videos
retention-days: 1

- name: Upload Dashboards repo results
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
if: always() && matrix.test_location == 'source'
with:
name: dashboards-cypress-results
name: dashboards-cypress-results-${{ matrix.group }}
path: cypress/results
retention-days: 1

Expand Down Expand Up @@ -346,6 +346,6 @@ jobs:
'${{ env.SPEC }}'
```
#### Link to results:
#### Link to results:
${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
edit-mode: replace
16 changes: 8 additions & 8 deletions .github/workflows/release_cypress_workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ jobs:
CI: 1
# avoid warnings like "tput: No value for $TERM and no -T specified"
TERM: xterm
name: Run cypress tests (osd:ciGroup${{ matrix.spec_group }}) ${{ inputs.UNIQUE_ID}}
name: Run cypress tests (osd:ciGroup${{ matrix.spec_group }}) ${{ inputs.UNIQUE_ID}}
steps:
- name: Checkout code
uses: actions/checkout@v2
Expand Down Expand Up @@ -130,30 +130,30 @@ jobs:
mkdir -p $CWD/${{ env.OPENSEARCH_DIR }}
source ${{ env.OSD_PATH }}/scripts/common/utils.sh
open_artifact $CWD/${{ env.OPENSEARCH_DIR }} ${{ env.OPENSEARCH }}
- name: Download and extract OpenSearch Dashboards artifacts
run: |
CWD=$(pwd)
mkdir -p $CWD/${{ env.DASHBOARDS_DIR }}
source ${{ env.OSD_PATH }}/scripts/common/utils.sh
open_artifact $CWD/${{ env.DASHBOARDS_DIR }} ${{ env.DASHBOARDS }}
- name: Run Cypress tests
- name: Run Cypress tests
run: |
chown -R 1000:1000 `pwd`
su `id -un 1000` -c "source ${{ env.OSD_PATH }}/scripts/cypress_tests.sh && run_dashboards_cypress_tests"
# Screenshots are only captured on failures
- uses: actions/upload-artifact@v3
- uses: actions/upload-artifact@v4
if: failure()
with:
name: release-osd-cypress-screenshots
name: release-osd-cypress-screenshots-${{ matrix.spec_group }}
path: ${{ env.OSD_PATH }}/cypress/screenshots
retention-days: 1
- uses: actions/upload-artifact@v3

- uses: actions/upload-artifact@v4
if: always()
with:
name: release-osd-cypress-videos
name: release-osd-cypress-videos-${{ matrix.spec_group }}
path: ${{ env.OSD_PATH }}/cypress/videos
retention-days: 1
2 changes: 2 additions & 0 deletions changelogs/fragments/8839.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix a typo while inspecting values for large numerals in OSD and the JS client ([#8839](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8839))
2 changes: 2 additions & 0 deletions changelogs/fragments/8848.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Fix template queries loading and update getSampleQuery interface ([#8848](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8848))
3 changes: 3 additions & 0 deletions changelogs/fragments/8851.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
feat:
- Add framework to show banner at the top in discover results canvas ([#8851](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8851))
- Show indexed views in dataset selector ([#8851](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8851))
2 changes: 2 additions & 0 deletions changelogs/fragments/8855.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Upgrade actions/upload-artifact to v4 ([#8855](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8855))
2 changes: 2 additions & 0 deletions changelogs/fragments/8857.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- [Workspace][Bug] Fix inspect page url error. ([#8857](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8857))
2 changes: 2 additions & 0 deletions changelogs/fragments/8863.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Keep previous query result if current query result in error ([#8863](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8863))
2 changes: 2 additions & 0 deletions changelogs/fragments/8866.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Hide Date Picker for Unsupported Types ([#8866](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8866))
2 changes: 2 additions & 0 deletions changelogs/fragments/8867.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Add max height and scroll to error message body ([#8867](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8867))
2 changes: 2 additions & 0 deletions changelogs/fragments/8871.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Search on page load out of sync state when clicking submit. ([#8871](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8871))
2 changes: 2 additions & 0 deletions changelogs/fragments/8882.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
security:
- [CVE-2024-21538] Bump `cross-spawn` from 6.0.5 and 7.0.3 to 7.0.5 ([#8882](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8882))
2 changes: 2 additions & 0 deletions changelogs/fragments/8883.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Retain currently selected dataset when opening saved query without dataset info ([#8883](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8883))
2 changes: 2 additions & 0 deletions changelogs/fragments/8885.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
doc:
- Fix OpenAPI documentation ([#8885](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8885))
2 changes: 2 additions & 0 deletions changelogs/fragments/8896.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
feat:
- Added framework to get default query string using dataset and language combination ([#8896](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8896))
2 changes: 2 additions & 0 deletions changelogs/fragments/8899.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Only support copy action for query templates ([#8899](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8899))
2 changes: 2 additions & 0 deletions changelogs/fragments/8902.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
fix:
- Removed extra parameter ([#8902](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/8902))
4 changes: 2 additions & 2 deletions docs/openapi/saved_objects/saved_objects.yml
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ paths:
schema:
type: object
/api/saved_objects/_bulk_update:
post:
put:
tags:
- saved objects
summary: Bulk update saved objects
Expand Down Expand Up @@ -489,7 +489,7 @@ paths:
schema:
type: object
/api/saved_objects/_bulk_get:
get:
post:
tags:
- saved objects
summary: Bulk get saved objects
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,7 @@
"**/cpy/globby": "^10.0.1",
"**/d3-color": "^3.1.0",
"**/elasticsearch/agentkeepalive": "^4.5.0",
"**/eslint/cross-spawn": "^7.0.5",
"**/es5-ext": "^0.10.63",
"**/fetch-mock/path-to-regexp": "^3.3.0",
"**/follow-redirects": "^1.15.4",
Expand Down
84 changes: 81 additions & 3 deletions packages/osd-std/src/json.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import JSON11 from 'json11';
import { stringify, parse } from './json';

describe('json', () => {
Expand Down Expand Up @@ -90,9 +91,55 @@ describe('json', () => {
expect(stringify(input, replacer, 2)).toEqual(JSON.stringify(input, replacer, 2));
});

it('can handle long numerals while parsing', () => {
const longPositive = BigInt(Number.MAX_SAFE_INTEGER) * 2n;
const longNegative = BigInt(Number.MIN_SAFE_INTEGER) * 2n;
it('can handle positive long numerals while parsing', () => {
const longPositiveA = BigInt(Number.MAX_SAFE_INTEGER) * 2n;
const longPositiveB = BigInt(Number.MAX_SAFE_INTEGER) * 2n + 1n;
const text =
`{` +
// The space before and after the values, and the lack of spaces before comma are intentional
`"\\":${longPositiveA}": "[ ${longPositiveB.toString()}, ${longPositiveA.toString()} ]", ` +
`"positive": ${longPositiveA.toString()}, ` +
`"array": [ ${longPositiveB.toString()}, ${longPositiveA.toString()} ], ` +
`"negative": ${longPositiveB.toString()},` +
`"number": 102931203123987` +
`}`;

const result = parse(text);
expect(result.positive).toBe(longPositiveA);
expect(result.negative).toBe(longPositiveB);
expect(result.array).toEqual([longPositiveB, longPositiveA]);
expect(result['":' + longPositiveA]).toBe(
`[ ${longPositiveB.toString()}, ${longPositiveA.toString()} ]`
);
expect(result.number).toBe(102931203123987);
});

it('can handle negative long numerals while parsing', () => {
const longNegativeA = BigInt(Number.MIN_SAFE_INTEGER) * 2n;
const longNegativeB = BigInt(Number.MIN_SAFE_INTEGER) * 2n - 1n;
const text =
`{` +
// The space before and after the values, and the lack of spaces before comma are intentional
`"\\":${longNegativeA}": "[ ${longNegativeB.toString()}, ${longNegativeA.toString()} ]", ` +
`"positive": ${longNegativeA.toString()}, ` +
`"array": [ ${longNegativeB.toString()}, ${longNegativeA.toString()} ], ` +
`"negative": ${longNegativeB.toString()},` +
`"number": 102931203123987` +
`}`;

const result = parse(text);
expect(result.positive).toBe(longNegativeA);
expect(result.negative).toBe(longNegativeB);
expect(result.array).toEqual([longNegativeB, longNegativeA]);
expect(result['":' + longNegativeA]).toBe(
`[ ${longNegativeB.toString()}, ${longNegativeA.toString()} ]`
);
expect(result.number).toBe(102931203123987);
});

it('can handle mixed long numerals while parsing', () => {
const longPositive = BigInt(Number.MAX_SAFE_INTEGER) * 2n + 1n;
const longNegative = BigInt(Number.MIN_SAFE_INTEGER) * 2n - 1n;
const text =
`{` +
// The space before and after the values, and the lack of spaces before comma are intentional
Expand All @@ -113,6 +160,37 @@ describe('json', () => {
expect(result.number).toBe(102931203123987);
});

it('does not use JSON11 when not needed', () => {
const spyParse = jest.spyOn(JSON11, 'parse');

const longPositive = BigInt(Number.MAX_SAFE_INTEGER) * 2n + 1n;
const longNegative = BigInt(Number.MIN_SAFE_INTEGER) * 2n - 1n;
const text =
`{` +
`"\\":${longPositive}": "[ ${longNegative.toString()}, ${longPositive.toString()} ]", ` +
`"number": 102931203123987` +
`}`;
parse(text);

expect(spyParse).not.toHaveBeenCalled();
});

it('uses JSON11 when dealing with long numerals', () => {
const spyParse = jest.spyOn(JSON11, 'parse');

const longPositive = BigInt(Number.MAX_SAFE_INTEGER) * 2n + 1n;
const longNegative = BigInt(Number.MIN_SAFE_INTEGER) * 2n - 1n;
const text =
`{` +
`"\\":${longPositive}": "[ ${longNegative.toString()}, ${longPositive.toString()} ]", ` +
`"positive": ${longPositive.toString()}, ` +
`"number": 102931203123987` +
`}`;
parse(text);

expect(spyParse).toHaveBeenCalled();
});

it('can handle BigInt values while stringifying', () => {
const longPositive = BigInt(Number.MAX_SAFE_INTEGER) * 2n;
const longNegative = BigInt(Number.MIN_SAFE_INTEGER) * 2n;
Expand Down
2 changes: 1 addition & 1 deletion packages/osd-std/src/json.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const parse = (
numeralsAreNumbers &&
typeof val === 'number' &&
isFinite(val) &&
(val < Number.MAX_SAFE_INTEGER || val > Number.MAX_SAFE_INTEGER)
(val < Number.MIN_SAFE_INTEGER || val > Number.MAX_SAFE_INTEGER)
) {
numeralsAreNumbers = false;
}
Expand Down
9 changes: 9 additions & 0 deletions scripts/postinstall.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,15 @@ const run = async () => {
},
])
);
//ToDo: Remove when opensearch-js is released to include https://github.com/opensearch-project/opensearch-js/pull/889
promises.push(
patchFile('node_modules/@opensearch-project/opensearch/lib/Serializer.js', [
{
from: 'val < Number.MAX_SAFE_INTEGER',
to: 'val < Number.MIN_SAFE_INTEGER',
},
])
);

await Promise.all(promises);
};
Expand Down
Loading

0 comments on commit e63fcfb

Please sign in to comment.