From b037242d2fd176965740a64f262f7df8fe24e60d Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 6 Apr 2022 14:06:32 -0400 Subject: [PATCH 1/3] Fixes failing tests due to snapshot mismatch Signed-off-by: Darshit Chanpura --- .../test/__snapshots__/account-nav-button.test.tsx.snap | 2 +- .../tenant-list/test/__snapshots__/edit-modal.test.tsx.snap | 2 ++ .../panels/test/__snapshots__/nav-panel.test.tsx.snap | 6 ++++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/public/apps/account/test/__snapshots__/account-nav-button.test.tsx.snap b/public/apps/account/test/__snapshots__/account-nav-button.test.tsx.snap index d38f48226..c45a38eee 100644 --- a/public/apps/account/test/__snapshots__/account-nav-button.test.tsx.snap +++ b/public/apps/account/test/__snapshots__/account-nav-button.test.tsx.snap @@ -16,7 +16,7 @@ exports[`Account navigation button renders 1`] = ` id="actionsMenu" isOpen={false} onClick={[Function]} - ownFocus={false} + ownFocus={true} panelPaddingSize="s" > `; From bfe23211ed508e4657665d909332b1b6607bf5f6 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Wed, 6 Apr 2022 15:13:06 -0400 Subject: [PATCH 2/3] Replaces sasslint to stylelint to conform to changes in core dashboards Signed-off-by: Darshit Chanpura --- .sass-lint.yml => .stylelintrc.yml | 0 package.json | 10 +++++----- public/apps/configuration/_index.scss | 16 ++++++++-------- .../panels/audit-logging/_index.scss | 6 +++--- .../panels/permission-tree/_index.scss | 2 +- public/apps/customerror/_index.scss | 8 ++++---- public/apps/login/_index.scss | 10 +++++----- public/index.scss | 0 public/index.ts | 3 --- 9 files changed, 26 insertions(+), 29 deletions(-) rename .sass-lint.yml => .stylelintrc.yml (100%) delete mode 100644 public/index.scss diff --git a/.sass-lint.yml b/.stylelintrc.yml similarity index 100% rename from .sass-lint.yml rename to .stylelintrc.yml diff --git a/package.json b/package.json index 2dca9de6f..8372a6a2f 100644 --- a/package.json +++ b/package.json @@ -15,20 +15,20 @@ "build": "yarn plugin-helpers build && node build_tools/rename_zip.js", "start": "node ../../scripts/opensearch-dashboards --dev", "lint:es": "node ../../scripts/eslint", - "lint:sass": "node ../../scripts/sasslint", - "lint": "yarn run lint:es && yarn run lint:sass", + "lint:style": "node ../../scripts/stylelint", + "lint": "yarn run lint:es && yarn run lint:style", "test:jest_server": "node ./test/run_jest_tests.js --config ./test/jest.config.server.js", "test:jest_ui": "node ./test/run_jest_tests.js --config ./test/jest.config.ui.js" }, "devDependencies": { - "@elastic/eslint-import-resolver-kibana": "link:../../packages/osd-eslint-import-resolver-opensearch-dashboards", + "@elastic/eslint-import-resolver-kibana": "link:../../packages/osd-eslint-import-resolver-opensearch-dashboards", "typescript": "4.0.2", "gulp-rename": "2.0.0", - "@testing-library/react-hooks": "^3.4.1", + "@testing-library/react-hooks": "^7.0.2", "@types/hapi__wreck": "^15.0.1" }, "dependencies": { - "@hapi/wreck": "^15.0.2", + "@hapi/wreck": "^17.1.0", "@hapi/cryptiles": "5.0.0", "html-entities": "1.3.1" } diff --git a/public/apps/configuration/_index.scss b/public/apps/configuration/_index.scss index d44f5c004..57f25c45d 100644 --- a/public/apps/configuration/_index.scss +++ b/public/apps/configuration/_index.scss @@ -13,21 +13,21 @@ * permissions and limitations under the License. */ - .panel-header-count { - color: #687078; - font-weight: normal; +.panel-header-count { + color: #687078; + font-weight: normal; } .panel-header-subtext { - width: 75%; + width: 75%; } .text-center { - text-align: 'center' + text-align: "center"; } .panel-restrict-width { - max-width: 75%; + max-width: 75%; } .external-link-inline-block { @@ -35,9 +35,9 @@ } .table-items { - font-size: inherit; + font-size: inherit; } .limit-width-input { - max-width: 400px; + max-width: 400px; } diff --git a/public/apps/configuration/panels/audit-logging/_index.scss b/public/apps/configuration/panels/audit-logging/_index.scss index 99c62cf55..22d30dbc2 100644 --- a/public/apps/configuration/panels/audit-logging/_index.scss +++ b/public/apps/configuration/panels/audit-logging/_index.scss @@ -1,11 +1,11 @@ .described-form-group { - max-width: 1500px + max-width: 1500px; } .form-row { - max-width: 800px + max-width: 800px; } pre code { - color: #666666; + color: #666; } diff --git a/public/apps/configuration/panels/permission-tree/_index.scss b/public/apps/configuration/panels/permission-tree/_index.scss index 9b24849c8..97e56d677 100644 --- a/public/apps/configuration/panels/permission-tree/_index.scss +++ b/public/apps/configuration/panels/permission-tree/_index.scss @@ -15,7 +15,7 @@ .permission-tree-container { max-height: 200px; - overflow-Y: scroll; + overflow-y: scroll; width: 100%; } diff --git a/public/apps/customerror/_index.scss b/public/apps/customerror/_index.scss index 84b565640..5c1039837 100644 --- a/public/apps/customerror/_index.scss +++ b/public/apps/customerror/_index.scss @@ -14,8 +14,8 @@ */ .custom-error-wrapper { - margin: 10% auto; - width: 350px; - padding: 1rem; - position: relative; + margin: 10% auto; + width: 350px; + padding: 1rem; + position: relative; } diff --git a/public/apps/login/_index.scss b/public/apps/login/_index.scss index 62adac225..5b48bd965 100644 --- a/public/apps/login/_index.scss +++ b/public/apps/login/_index.scss @@ -14,12 +14,12 @@ */ .login-wrapper { - margin: 10% auto; - width: 350px; - padding: 1rem; - position: relative; + margin: 10% auto; + width: 350px; + padding: 1rem; + position: relative; } .btn-login { - width: 100%; + width: 100%; } diff --git a/public/index.scss b/public/index.scss deleted file mode 100644 index e69de29bb..000000000 diff --git a/public/index.ts b/public/index.ts index 6cc350b86..d09f3dc49 100644 --- a/public/index.ts +++ b/public/index.ts @@ -12,9 +12,6 @@ * express or implied. See the License for the specific language governing * permissions and limitations under the License. */ - -import './index.scss'; - import { SecurityPlugin } from './plugin'; import { PluginInitializerContext } from '../../../src/core/public'; From 01fc571f14564ffc881686cfdbe944932a5a36d9 Mon Sep 17 00:00:00 2001 From: Darshit Chanpura Date: Thu, 7 Apr 2022 17:08:36 -0400 Subject: [PATCH 3/3] Bumps artifact version to 2.0.0.0 and updates node to 14.18.2 and removes test workflow filter for branches Signed-off-by: Darshit Chanpura --- .github/workflows/integration-test.yml | 17 ++++++----------- .github/workflows/unit-test.yml | 11 ++--------- common/index.ts | 3 ++- opensearch_dashboards.json | 4 ++-- package.json | 6 +++--- server/auth/types/basic/routes.ts | 2 +- 6 files changed, 16 insertions(+), 27 deletions(-) diff --git a/.github/workflows/integration-test.yml b/.github/workflows/integration-test.yml index 7c80705dd..36056110b 100644 --- a/.github/workflows/integration-test.yml +++ b/.github/workflows/integration-test.yml @@ -1,12 +1,6 @@ name: Integration Tests -on: - pull_request: - branches: - - main - push: - branches: - - main +on: [push, pull_request] jobs: tests: @@ -15,12 +9,13 @@ jobs: steps: - name: Download OpenSearch Core run: | - wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/488/linux/x64/builds/opensearch/dist/opensearch-min-1.3.0-linux-x64.tar.gz + wget https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.0.0-alpha1/latest/linux/x64/builds/opensearch/dist/opensearch-min-2.0.0-alpha1-linux-x64.tar.gz tar -xzf opensearch-*.tar.gz rm -f opensearch-*.tar.gz - + - name: Download OpenSearch Security Plugin - run: wget -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/1.3.0/488/linux/x64/builds/opensearch/plugins/opensearch-security-1.3.0.0.zip + run: wget -O opensearch-security.zip https://ci.opensearch.org/ci/dbc/distribution-build-opensearch/2.0.0-alpha1/latest/linux/x64/builds/opensearch/plugins/opensearch-security-2.0.0.0-alpha1.zip + - name: Run OpenSearch with plugin run: | @@ -50,7 +45,7 @@ jobs: with: path: OpenSearch-Dashboards repository: opensearch-project/OpenSearch-Dashboards - ref: '1.x' + ref: 'main' fetch-depth: 0 - name: Create plugins dir diff --git a/.github/workflows/unit-test.yml b/.github/workflows/unit-test.yml index 3cd6cbb6f..42f7533b0 100644 --- a/.github/workflows/unit-test.yml +++ b/.github/workflows/unit-test.yml @@ -1,13 +1,6 @@ name: Unit Tests -on: - pull_request: - branches: - - main - - 1.* - push: - branches: - - main +on: [push, pull_request] jobs: tests: @@ -20,7 +13,7 @@ jobs: with: path: OpenSearch-Dashboards repository: opensearch-project/OpenSearch-Dashboards - ref: '1.x' + ref: 'main' fetch-depth: 0 - name: Create plugins dir run: | diff --git a/common/index.ts b/common/index.ts index b3dc4ae8d..b820a3992 100644 --- a/common/index.ts +++ b/common/index.ts @@ -44,5 +44,6 @@ export enum AuthType { */ export function isValidResourceName(resourceName: string): boolean { // see: https://javascript.info/regexp-unicode - return !/[\p{C}%]/u.test(resourceName) && resourceName.length > 0; + const exp = new RegExp('[\\p{C}%]', 'u'); + return !exp.test(resourceName) && resourceName.length > 0; } diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index cd9a36e2a..30acf144e 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -1,7 +1,7 @@ { "id": "securityDashboards", - "version": "1.3.0.0", - "opensearchDashboardsVersion": "1.3.0", + "version": "2.0.0.0", + "opensearchDashboardsVersion": "2.0.0", "configPath": ["opensearch_security"], "requiredPlugins": ["navigation"], "server": true, diff --git a/package.json b/package.json index 8372a6a2f..7508917bd 100644 --- a/package.json +++ b/package.json @@ -1,10 +1,10 @@ { "name": "opensearch-security-dashboards", - "version": "1.3.0.0", + "version": "2.0.0.0", "main": "target/plugins/opensearch_security_dashboards", "opensearchDashboards": { - "version": "1.3.0", - "templateVersion": "1.3.0" + "version": "2.0.0", + "templateVersion": "2.0.0" }, "license": "Apache-2.0", "homepage": "https://github.com/opensearch-project/security-dashboards-plugin", diff --git a/server/auth/types/basic/routes.ts b/server/auth/types/basic/routes.ts index affe36120..41da5b3e0 100644 --- a/server/auth/types/basic/routes.ts +++ b/server/auth/types/basic/routes.ts @@ -171,7 +171,7 @@ export class BasicAuthRoutes { ? this.coreSetup.http.basePath.serverBasePath : '/'; const requestQuery = request.url.query as ParsedUrlQueryParams; - if (requestQuery.nextUrl !== undefined) { + if (requestQuery?.nextUrl !== undefined) { redirectUrl = requestQuery.nextUrl; } context.security_plugin.logger.info('The Redirect Path is ' + redirectUrl);