Skip to content

Commit

Permalink
Backport 2.x to main (opensearch-project#25)
Browse files Browse the repository at this point in the history
* Remove odfe bwc test (opensearch-project#408) (opensearch-project#409)

* removed odfe bwc test

Signed-off-by: Shenoy Pratik <[email protected]>

* removed bwc test from workflows

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit 556b5fb)

Co-authored-by: Shenoy Pratik <[email protected]>

* Remove odfe bwc test (opensearch-project#408)

* removed odfe bwc test

Signed-off-by: Shenoy Pratik <[email protected]>

* removed bwc test from workflows

Signed-off-by: Shenoy Pratik <[email protected]>
(cherry picked from commit 556b5fb)

* Bump version 2.2.0

Signed-off-by: vamsi-amazon <[email protected]>

* Bump version 2.2.0 (opensearch-project#413)

Signed-off-by: vamsi-amazon <[email protected]>
(cherry picked from commit c91534a67503e6c61ef6e1f53e852bb937f9fc14)

Co-authored-by: vamsi-amazon <[email protected]>

* [2.x] Restrict chromium requests (opensearch-project#435)

* Fix regex validation, detect iframe, embed, object tags

Signed-off-by: Joshua Li <[email protected]>

* Disallow redirection to non-localhost urls

Signed-off-by: Joshua Li <[email protected]>

* Disallow connection to non-allowlisted urls

Signed-off-by: Joshua Li <[email protected]>

* Disable JIT

Signed-off-by: Joshua Li <[email protected]>

* Fix workflow

Signed-off-by: Joshua Li <[email protected]>

* Try to fix CI

Signed-off-by: Joshua Li <[email protected]>

* Fix localstorage logic

Signed-off-by: Joshua Li <[email protected]>

Signed-off-by: Joshua Li <[email protected]>

* [2.2] Restrict chromium requests (opensearch-project#431)

* Fix regex validation, detect iframe, embed, object tags

Signed-off-by: Joshua Li <[email protected]>

* Disallow redirection to non-localhost urls

Signed-off-by: Joshua Li <[email protected]>

* Disallow connection to non-allowlisted urls

Signed-off-by: Joshua Li <[email protected]>

* Disable JIT

Signed-off-by: Joshua Li <[email protected]>

* Fix workflow

Signed-off-by: Joshua Li <[email protected]>

* Try to fix CI

Signed-off-by: Joshua Li <[email protected]>

* Fix localstorage logic

Signed-off-by: Joshua Li <[email protected]>

Signed-off-by: Joshua Li <[email protected]>

* Increment version to 2.2.1-SNAPSHOT

Signed-off-by: opensearch-ci-bot <[email protected]>

* Increment version to 2.3.0-SNAPSHOT

Signed-off-by: opensearch-ci-bot <[email protected]>

* [2.x] Upgrade puppeteer (opensearch-project#489)

* upgrade puppeteer & change report timeout

Signed-off-by: Rupal Mahajan <[email protected]>

* Change timeout

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Bump verison 2.4.0 (opensearch-project#499)

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* feat: enable windows and macos build (opensearch-project#504) (opensearch-project#511)

Signed-off-by: Derek Ho <[email protected]>

* Update version for jsdom, terser and jsoup (opensearch-project#515)

Signed-off-by: Rupal Mahajan <[email protected]>

* Upgrade minimatch, moment (opensearch-project#513)

Signed-off-by: Rupal Mahajan <[email protected]>

* Add loader-utils to resolutions (opensearch-project#525)

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Bump loader-utils from 2.0.3 to 2.0.4 in /dashboards-reports (opensearch-project#539) (opensearch-project#541)

Bumps [loader-utils](https://github.com/webpack/loader-utils) from 2.0.3 to 2.0.4.
- [Release notes](https://github.com/webpack/loader-utils/releases)
- [Changelog](https://github.com/webpack/loader-utils/blob/v2.0.4/CHANGELOG.md)
- [Commits](webpack/loader-utils@v2.0.3...v2.0.4)

---
updated-dependencies:
- dependency-name: loader-utils
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
(cherry picked from commit 69805c4)

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* update qs 6.5.3 (#545)

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Use advanced settings for leading wildcards in query for csv reports (#549)

* Fetch allowLeadingWildcards from config

Signed-off-by: Rupal Mahajan <[email protected]>

* Fix tests

Signed-off-by: Rupal Mahajan <[email protected]>

* nit

Signed-off-by: Rupal Mahajan <[email protected]>

* add default value for allowLeadingWildCards

Co-authored-by: Joshua Li <[email protected]>
Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>
Co-authored-by: Joshua Li <[email protected]>

* Increment version to 2.5.0-SNAPSHOT (opensearch-project#528)

Signed-off-by: opensearch-ci-bot <[email protected]>

Signed-off-by: opensearch-ci-bot <[email protected]>
Co-authored-by: opensearch-ci-bot <[email protected]>

* [1.x] Upgrade decode-uri-component (#558) (#560)

* upgrade loader-utils for CVE-2022-37601

Signed-off-by: Rupal Mahajan <[email protected]>

* Update async for CVE-2021-43138

Signed-off-by: Rupal Mahajan <[email protected]>

* Fix cross-fetch for CVE-2022-1365

Signed-off-by: Rupal Mahajan <[email protected]>

* Fix for CVE-2022-37599, CVE-2022-37603

Signed-off-by: Rupal Mahajan <[email protected]>

* Update terser for CVE-2022-25858

Signed-off-by: Rupal Mahajan <[email protected]>

* Update minimatch for CVE-2022-3517

Signed-off-by: Rupal Mahajan <[email protected]>

* Update moment for CVE-2022-24785

Signed-off-by: Rupal Mahajan <[email protected]>

* Update jsdom for CVE-2021-20066

Signed-off-by: Rupal Mahajan <[email protected]>

* Update execa for GMS-2020-2

Signed-off-by: Rupal Mahajan <[email protected]>

* Update qs for CVE-2022-24999

Signed-off-by: Rupal Mahajan <[email protected]>

* Update moment for CVE-2022-31129

Signed-off-by: Rupal Mahajan <[email protected]>

* Update decode-uri-component for CVE-2022-38900

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>
(cherry picked from commit 3393615)

Co-authored-by: Rupal Mahajan <[email protected]>

* Fix windows and macos CI (#569) (#571)

* Update windows & mac CI for reo name change

Signed-off-by: Rupal Mahajan <[email protected]>

* Fix linux build

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>
(cherry picked from commit 08ff77b)

Co-authored-by: Rupal Mahajan <[email protected]>

* Remove jackson-databind and jackson-annotations (#587)

* Remove jackson-databind and jackson-annotations dependencies

Signed-off-by: Rupal Mahajan <[email protected]>

* resolve dompurify conflicting dependencies

Signed-off-by: Rupal Mahajan <[email protected]>

* fix build

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Update 2.x to be same as Reporting Repo (opensearch-project#2)

* Use front-end report generation instead of chromium (#586)

* Increment version to 2.4.1-SNAPSHOT (opensearch-project#540)

Signed-off-by: opensearch-ci-bot <[email protected]>

Signed-off-by: opensearch-ci-bot <[email protected]>
Co-authored-by: opensearch-ci-bot <[email protected]>

* --wip--

Signed-off-by: Joshua Li <[email protected]>

* Add initial implementation of client reporting generation

Signed-off-by: Joshua Li <[email protected]>

* Fix url with basepath

Signed-off-by: Joshua Li <[email protected]>

* Update header footer height

Signed-off-by: Joshua Li <[email protected]>

* Update dialog text to not close dialog

Signed-off-by: Joshua Li <[email protected]>

* Remove console.log

Signed-off-by: Joshua Li <[email protected]>

* Remove unused components

Signed-off-by: Joshua Li <[email protected]>

* Remove chromium references

Signed-off-by: Joshua Li <[email protected]>

* Add report generation error handling

Signed-off-by: Joshua Li <[email protected]>

* Minor refactors

Signed-off-by: Joshua Li <[email protected]>

* Add postinstall patch to support safari for html2canvas

Signed-off-by: Joshua Li <[email protected]>

* Add dompurify

Signed-off-by: Joshua Li <[email protected]>

* Fix build error

Signed-off-by: Joshua Li <[email protected]>

* Remove chromium from CI

Signed-off-by: Joshua Li <[email protected]>

* Update CI artifact name

Signed-off-by: Joshua Li <[email protected]>

Signed-off-by: opensearch-ci-bot <[email protected]>
Signed-off-by: Joshua Li <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: opensearch-ci-bot <[email protected]>

* Fix workflow

Signed-off-by: Rupal Mahajan <[email protected]>

* Fix build artifact name in workflow

Signed-off-by: Rupal Mahajan <[email protected]>

* Add missing bracket

Signed-off-by: Rupal Mahajan <[email protected]>

* Change nick-invision to nick-fields to fix worklfow actions

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: opensearch-ci-bot <[email protected]>
Signed-off-by: Joshua Li <[email protected]>
Signed-off-by: Rupal Mahajan <[email protected]>
Co-authored-by: Joshua Li <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: opensearch-ci-bot <[email protected]>

* [Backport 2.x] Add necessary files opensearch-project#4 (opensearch-project#6)

* Add necessary files (opensearch-project#4)

* Add docs

Signed-off-by: Rupal Mahajan <[email protected]>

* Update docs to repo name change

Signed-off-by: Rupal Mahajan <[email protected]>

* Updated MAINTAINERS.md to match recommended opensearch-project format.

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Remove chromium related info from readme

Signed-off-by: Rupal Mahajan <[email protected]>

* nit: remove troubleshooting section

Signed-off-by: Rupal Mahajan <[email protected]>

* nit: missed font dependencies under troubleshooting

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Upgrade json5 and glob-parent (opensearch-project#17)

* upgrade json5 for CVE-2022-46175

Signed-off-by: Rupal Mahajan <[email protected]>

* Upgrade glob-parent to v6.0.2 for CVE-2021-35065

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>

* Update dev doc for new repo (opensearch-project#18) (opensearch-project#20)

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: Rupal Mahajan <[email protected]>
(cherry picked from commit 7bb7e2b)

Co-authored-by: Rupal Mahajan <[email protected]>

* fix plugin version in package.json

Signed-off-by: Rupal Mahajan <[email protected]>

* nit: missed deleting visualReportHelper in merge

Signed-off-by: Rupal Mahajan <[email protected]>

Signed-off-by: vamsi-amazon <[email protected]>
Signed-off-by: Joshua Li <[email protected]>
Signed-off-by: opensearch-ci-bot <[email protected]>
Signed-off-by: Eric Wei <[email protected]>
Signed-off-by: Rupal Mahajan <[email protected]>
Signed-off-by: Derek Ho <[email protected]>
Co-authored-by: opensearch-trigger-bot[bot] <98922864+opensearch-trigger-bot[bot]@users.noreply.github.com>
Co-authored-by: Shenoy Pratik <[email protected]>
Co-authored-by: vamsi-amazon <[email protected]>
Co-authored-by: Joshua Li <[email protected]>
Co-authored-by: opensearch-ci-bot <[email protected]>
Co-authored-by: Prudhvi Godithi <[email protected]>
Co-authored-by: Eric Wei <[email protected]>
Co-authored-by: Derek Ho <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
10 people authored Jan 10, 2023
1 parent 7bb7e2b commit df8b413
Show file tree
Hide file tree
Showing 33 changed files with 2,760 additions and 1,008 deletions.
89 changes: 17 additions & 72 deletions .github/workflows/dashboards-reports-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,6 @@ jobs:
with:
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

- name: Add Chromium Binary to Reporting for Testing
run: |
sudo apt update
sudo apt install -y libnss3-dev fonts-liberation libfontconfig1
wget https://github.com/opendistro-for-elasticsearch/kibana-reports/releases/download/chromium-1.12.0.0/chromium-linux-x64.zip
unzip chromium-linux-x64.zip
rm chromium-linux-x64.zip
- name: OpenSearch Dashboards Plugin Bootstrap
uses: nick-fields/retry@v1
with:
Expand All @@ -66,33 +59,13 @@ jobs:
- name: Build Artifact
run: |
yarn build
cd build
mkdir -p ./{linux-x64,linux-arm64}/opensearch-dashboards/${{ env.PLUGIN_NAME }}
cp ./${{ env.PLUGIN_NAME }}-*.zip ./linux-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-x64.zip
cp ./${{ env.PLUGIN_NAME }}-*.zip ./linux-arm64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-arm64.zip
cd linux-x64
wget https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-linux-x64.zip
unzip chromium-linux-x64.zip -d ./opensearch-dashboards/${{ env.PLUGIN_NAME }}
zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./opensearch-dashboards
mv ./${{ env.ARTIFACT_NAME }}-*.zip ..
cd ..
cd linux-arm64
wget https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-linux-arm64.zip
unzip chromium-linux-arm64.zip -d ./opensearch-dashboards/${{ env.PLUGIN_NAME }}
zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./opensearch-dashboards
mv ./${{ env.ARTIFACT_NAME }}-*.zip ..
cd ..
- name: Upload Artifact For Linux x64
uses: actions/upload-artifact@v1
with:
name: dashboards-reports-linux-x64
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-x64.zip
mv ./build/*.zip ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact For Linux arm64
- name: Upload Artifact For Linux
uses: actions/upload-artifact@v1
with:
name: dashboards-reports-linux-arm64
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-linux-arm64.zip
name: dashboards-reports-linux
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip

windows-build:
runs-on: windows-latest
Expand Down Expand Up @@ -126,13 +99,6 @@ jobs:
with:
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

- name: Add Chromium Binary to Reporting for Testing
run: |
curl.exe -LO https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-windows-x64.zip
Expand-Archive -Path 'chromium-windows-x64.zip'
Move-Item -Path "./chromium-windows-x64/.chromium" -Destination "./.chromium"
rd chromium-windows-x64.zip
rd chromium-windows-x64
- name: OpenSearch Dashboards Plugin Bootstrap
uses: nick-fields/retry@v1
with:
Expand All @@ -150,23 +116,14 @@ jobs:
- name: Build Artifact
run: |
yarn build
cd build
mkdir -p ./windows-x64/opensearch-dashboards/${{ env.PLUGIN_NAME }}
mv ./${{ env.PLUGIN_NAME }}-*.zip ./windows-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip
cd windows-x64
curl.exe -LO https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-windows-x64.zip
Expand-Archive -Path 'chromium-windows-x64.zip'
Move-Item -Path "./chromium-windows-x64/.chromium" -Destination "./opensearch-dashboards/${{ env.PLUGIN_NAME }}"
rd chromium-windows-x64.zip
rd chromium-windows-x64
Compress-Archive -Path "./${{ env.ARTIFACT_NAME }}-*.zip" -Destination "./opensearch-dashboards"
mv ./${{ env.ARTIFACT_NAME }}-*.zip ..
cd ..
mv ./build/*.zip ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact For Windows
uses: actions/upload-artifact@v1
with:
name: dashboards-reports-windows-x64
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-windows-x64.zip
name: dashboards-reports-windows
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip

macos-build:
runs-on: macos-latest
Expand All @@ -190,16 +147,11 @@ jobs:
registry-url: 'https://registry.npmjs.org'


- name: Checkout Plugin
uses: actions/checkout@v1
with:
- name: Checkout Plugin
uses: actions/checkout@v1
with:
path: OpenSearch-Dashboards/plugins/${{ env.PLUGIN_NAME }}

- name: Add Chromium Binary to Reporting for Testing
run: |
wget https://github.com/opendistro-for-elasticsearch/kibana-reports/releases/download/chromium-1.12.0.0/chromium-macos-x64.zip
unzip chromium-macos-x64.zip
rm chromium-macos-x64.zip
- name: OpenSearch Dashboards Plugin Bootstrap
uses: nick-fields/retry@v1
with:
Expand All @@ -217,17 +169,10 @@ jobs:
- name: Build Artifact
run: |
yarn build
cd build
mkdir -p ./macos-x64/opensearch-dashboards/${{ env.PLUGIN_NAME }}
mv ./${{ env.PLUGIN_NAME }}-*.zip ./macos-x64/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-macos-x64.zip
cd macos-x64
wget https://github.com/opensearch-project/dashboards-reports/releases/download/chromium-1.12.0.0/chromium-macos-x64.zip
unzip chromium-macos-x64.zip -d ./opensearch-dashboards/${{ env.PLUGIN_NAME }}
zip -ur ./${{ env.ARTIFACT_NAME }}-*.zip ./opensearch-dashboards
mv ./${{ env.ARTIFACT_NAME }}-*.zip ..
cd ..
- name: Upload Artifact For MacOS x64
mv ./build/*.zip ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
- name: Upload Artifact For MacOS
uses: actions/upload-artifact@v1
with:
name: dashboards-reports-macosx-x64
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}-macos-x64.zip
name: dashboards-reports-macosx
path: ./build/${{ env.ARTIFACT_NAME }}-${{ env.OPENSEARCH_PLUGIN_VERSION }}.zip
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,4 @@ yarn-error.log
.history/
.eslintcache
package-lock.json
/target/
.chromium/
/target/
1 change: 1 addition & 0 deletions .opensearch_dashboards-plugin-helpers.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"yarn.lock",
".i18nrc.json",
"common/**/*",
"scripts/**/*",
"public/**/*",
"server/**/*",
"translations/**/*"
Expand Down
33 changes: 0 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,39 +87,6 @@ Please see [developer guide](DEVELOPER_GUIDE.md).

OpenSearch Dashboards Reports integration with [Notifications](https://github.com/opensearch-project/notifications) is currently in progress. Tracking [here](https://github.com/opensearch-project/dashboards-reports/issues/72)

## Troubleshooting

### Fail to launch Chromium

There could be two reasons for this problem

1. You are not having the correct version of headless-chrome matching to the OS that your OpenSearch Dashboards is running. Different versions of headless-chrome can be found [here](https://github.com/opensearch-project/dashboards-reports/releases/tag/chromium-1.12.0.0)

2. Missing additional dependencies. Please refer to [additional dependencies section](./dashboards-reports/rendering-engine/headless-chrome/README.md#additional-libaries) to install required dependencies according to your operating system.

### Missing Font Dependencies

Chromium may not have all of the dependencies you may require to be able to view all of the content of your reports.

If you are using a CentOS/RHEL system, install the following packages:

- [`ipa-gothic-fonts`](https://centos.pkgs.org/7/centos-x86_64/ipa-gothic-fonts-003.03-5.el7.noarch.rpm.html)
- [`xorg-x11-fonts-100dpi`](https://centos.pkgs.org/7/centos-x86_64/xorg-x11-fonts-100dpi-7.5-9.el7.noarch.rpm.html)
- [`xorg-x11-fonts-75dpi`](https://centos.pkgs.org/7/centos-x86_64/xorg-x11-fonts-75dpi-7.5-9.el7.noarch.rpm.html)
- [`xorg-x11-utils`](https://centos.pkgs.org/7/centos-x86_64/xorg-x11-utils-7.5-23.el7.x86_64.rpm.html)
- [`xorg-x11-fonts-cyrillic`](https://centos.pkgs.org/7/centos-x86_64/xorg-x11-fonts-cyrillic-7.5-9.el7.noarch.rpm.html)
- [`xorg-x11-fonts-Type1`](https://centos.pkgs.org/7/centos-x86_64/xorg-x11-fonts-Type1-7.5-9.el7.noarch.rpm.html)
- [`xorg-x11-fonts-misc`](https://centos.pkgs.org/7/centos-x86_64/xorg-x11-fonts-misc-7.5-9.el7.noarch.rpm.html)
- [`fontconfig`](https://www.freedesktop.org/wiki/Software/fontconfig/)
- [`freetype`](https://freetype.org/)

If you are using a Ubuntu/Debian system, install the following packages:

- [`fonts-liberation`](https://packages.debian.org/search?keywords=fonts-liberation)
- [`libfontconfig1`](https://packages.debian.org/sid/libfontconfig1)

The installation command for both systems can be found [here](./dashboards-reports/rendering-engine/headless-chrome/README.md).

## Code of Conduct

This project has adopted the [Amazon Open Source Code of Conduct](CODE_OF_CONDUCT.md). For more information see the [Code of Conduct FAQ](https://aws.github.io/code-of-conduct-faq), or contact [[email protected]](mailto:[email protected]) with any additional questions or comments.
Expand Down
15 changes: 9 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reports-dashboards",
"version": "2.1.0.0",
"version": "3.0.0.0",
"description": "OpenSearch Dashboards Reports Plugin",
"license": "Apache-2.0",
"main": "index.ts",
Expand All @@ -13,20 +13,21 @@
"test": "../../node_modules/.bin/jest --config ./test/jest.config.js",
"cypress:run": "cypress run",
"cypress:open": "cypress open",
"plugin_helpers": "node ../../scripts/plugin_helpers"
"plugin_helpers": "node ../../scripts/plugin_helpers",
"postinstall": "node ./scripts/patch-html2canvas.js"
},
"dependencies": {
"async-mutex": "^0.2.6",
"babel-polyfill": "^6.26.0",
"cron-validator": "^1.1.1",
"dompurify": "^2.4.1",
"elastic-builder": "^2.7.1",
"enzyme-adapter-react-16": "^1.15.5",
"html2canvas": "1.4.1",
"jest-fetch-mock": "^3.0.3",
"jquery": "^3.5.0",
"jsdom": "16.5.0",
"json-2-csv": "^3.7.6",
"puppeteer-core": "^13.7.0",
"jspdf": "^2.5.1",
"react-addons-test-utils": "^15.6.2",
"react-id-generator": "^3.0.1",
"react-markdown": "^4.3.1",
Expand All @@ -44,7 +45,6 @@
"@types/dompurify": "^2.3.3",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jsdom": "^16.2.3",
"@types/puppeteer-core": "^5.4.0",
"@types/react": "^16.14.23",
"@types/react-addons-test-utils": "^0.14.25",
"@types/react-dom": "^16.9.8",
Expand All @@ -60,6 +60,7 @@
"identity-obj-proxy": "^3.0.0",
"jest-dom": "^4.0.0",
"react-test-renderer": "^16.12.0",
"replace-in-file": "^6.3.5",
"ts-jest": "^26.1.0"
},
"resolutions": {
Expand All @@ -68,12 +69,14 @@
"y18n": "^5.0.5",
"lodash": "^4.17.21",
"path-parse": "^1.0.7",
"glob-parent": "^5.1.2",
"glob-parent": "^6.0.2",
"css-what": "^5.0.1",
"ansi-regex": "5.0.1",
"json-schema": "0.4.0",
"ws": "^7.4.6",
"minimatch": "^3.0.5",
"terser": "^4.8.1",
"moment": "^2.29.4",
"loader-utils": "^2.0.3"
}
}
72 changes: 54 additions & 18 deletions public/components/context_menu/context_menu.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,30 @@
*/

/* eslint-disable no-restricted-globals */
import $ from 'jquery';
//@ts-check
import { i18n } from '@osd/i18n';
import $ from 'jquery';
import { parse } from 'url';
import { readStreamToFile } from '../main/main_utils';
import { uiSettingsService } from '../utils/settings_service';
import {
GENERATE_REPORT_PARAM,
GENERATE_REPORT_PARAM_REGEX,
} from '../visual_report/constants';
import { generateReport } from '../visual_report/generate_report';
import {
contextMenuCreateReportDefinition,
getTimeFieldsFromUrl,
displayLoadingModal,
addSuccessOrFailureToast,
contextMenuCreateReportDefinition,
contextMenuViewReports,
displayLoadingModal,
getTimeFieldsFromUrl,
replaceQueryURL,
} from './context_menu_helpers';
import {
getMenuItem,
popoverMenu,
popoverMenuDiscover,
getMenuItem,
} from './context_menu_ui';
import { parse } from 'url';
import { uiSettingsService } from '../utils/settings_service';

const generateInContextReport = async (
timeRanges,
Expand Down Expand Up @@ -102,23 +108,28 @@ const generateInContextReport = async (
credentials: 'include',
}
)
.then((response) => {
if (response.status === 200) {
$('#reportGenerationProgressModal').remove();
addSuccessOrFailureToast('success');
} else {
if (response.status === 403) {
.then(async (response) => [response.status, await response.json()])
.then(async ([status, data]) => {
if (status !== 200) {
if (status === 403) {
addSuccessOrFailureToast('permissionsFailure');
} else if (response.status === 503) {
} else if (status === 503) {
addSuccessOrFailureToast('timeoutFailure', reportSource);
} else {
addSuccessOrFailureToast('failure');
}
} else if (fileFormat === 'pdf' || fileFormat === 'png') {
try {
await generateReport(data.reportId);
addSuccessOrFailureToast('success');
} catch (error) {
console.error(error);
addSuccessOrFailureToast('failure');
}
} else if (data.data) {
await readStreamToFile(data.data, fileFormat, data.filename);
}
return response.json();
})
.then(async (data) => {
await readStreamToFile(data.data, fileFormat, data.filename);
$('#reportGenerationProgressModal').remove();
});
};

Expand Down Expand Up @@ -213,9 +224,34 @@ $(function () {
});
});

checkURLParams();
locationHashChanged();
});

/* generate a report if flagged in URL params */
const checkURLParams = async () => {
const [hash, query] = location.href.split('#')[1].split('?');
const params = new URLSearchParams(query);
const id = params.get(GENERATE_REPORT_PARAM);
if (!id) return;
await new Promise((resolve) => setTimeout(resolve, 1000));
displayLoadingModal();
try {
await generateReport(id, 30000);
window.history.replaceState(
{},
'',
`#${hash}?${query.replace(GENERATE_REPORT_PARAM_REGEX, '')}`
);
addSuccessOrFailureToast('success');
} catch (error) {
console.error(error);
addSuccessOrFailureToast('failure');
} finally {
$('#reportGenerationProgressModal').remove();
}
};

const isDiscoverNavMenu = (navMenu) => {
return (
navMenu[0].children.length === 5 &&
Expand Down
Loading

0 comments on commit df8b413

Please sign in to comment.