Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate workbench to OpenSearch Dashboards #6

Merged
merged 6 commits into from
Apr 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions .github/workflows/sql-workbench-release-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ on:
- 'v*'

env:
PLUGIN_NAME: opendistroQueryWorkbenchKibana
OD_VERSION: 1.13.0.0
PLUGIN_NAME: queryWorkbenchDashboards
OD_VERSION: 1.15.0.0

jobs:

Expand All @@ -27,13 +27,13 @@ jobs:
- name: Checkout Plugin
uses: actions/checkout@v1

- name: Checkout Kibana
- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v1
with:
repository: opendistro-for-elasticsearch/kibana-oss
ref: 7.10.2
repository: opensearch-project/Opensearch-Dashboards
ref: 1.x
token: ${{secrets.OD_ACCESS}}
path: sql/kibana
path: sql/OpenSearch-Dashboards

- name: Setup Node
uses: actions/setup-node@v1
Expand All @@ -42,25 +42,25 @@ jobs:

- name: Move Workbench to Plugins Dir
run: |
mv workbench kibana/plugins
mv workbench OpenSearch-Dashboards/plugins

- name: Kibana Plugin Bootstrap
- name: OpenSearch Dashboards Plugin Bootstrap
uses: nick-invision/retry@v1
with:
timeout_minutes: 60
max_attempts: 3
command: cd kibana/plugins/workbench; yarn kbn bootstrap
command: cd OpenSearch-Dashboards/plugins/workbench; yarn osd bootstrap

- name: Build
run: |
cd kibana/plugins/workbench
cd OpenSearch-Dashboards/plugins/workbench
yarn build
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}.zip

- name: Upload to S3
shell: bash
run: |
cd kibana/plugins/workbench
cd OpenSearch-Dashboards/plugins/workbench
zip=`ls ./build/*.zip`

# Inject the build number before the suffix
Expand Down
24 changes: 12 additions & 12 deletions .github/workflows/sql-workbench-test-and-build-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ name: SQL Workbench Test and Build
on: [pull_request, push]

env:
PLUGIN_NAME: opendistroQueryWorkbenchKibana
OD_VERSION: 1.13.0.0
PLUGIN_NAME: queryWorkbenchDashboards
OD_VERSION: 1.15.0.0

jobs:

Expand All @@ -15,36 +15,36 @@ jobs:
steps:
- name: Checkout Plugin
uses: actions/checkout@v1
- name: Checkout Kibana
- name: Checkout OpenSearch Dashboards
uses: actions/checkout@v1
with:
repository: elastic/kibana
ref: v7.10.2
path: sql/kibana
repository: opensearch-project/Opensearch-Dashboards
ref: 1.x
path: sql/OpenSearch-Dashboards
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think paths should remain lowercase. + below many

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Even though the OpenSearch-Dashboards repo has the upper case?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're right. In hindsight maybe we should have made repo names lowercase, but YOLO.

- name: Setup Node
uses: actions/setup-node@v1
with:
node-version: '10.23.1'
- name: Move Workbench to Plugins Dir
run: |
mv workbench kibana/plugins
- name: Kibana Plugin Bootstrap
mv workbench OpenSearch-Dashboards/plugins
- name: OpenSearch Dashboards Plugin Bootstrap
uses: nick-invision/retry@v1
with:
timeout_minutes: 60
max_attempts: 3
command: cd kibana/plugins/workbench; yarn kbn bootstrap
command: cd OpenSearch-Dashboards/plugins/workbench; yarn osd bootstrap
- name: Test
run: |
cd kibana/plugins/workbench
cd OpenSearch-Dashboards/plugins/workbench
yarn test:jest
- name: Build Artifact
run: |
cd kibana/plugins/workbench
cd OpenSearch-Dashboards/plugins/workbench
yarn build
mv ./build/*.zip ./build/${{ env.PLUGIN_NAME }}-${{ env.OD_VERSION }}.zip
- name: Upload Artifact
uses: actions/upload-artifact@v1
with:
name: workbench
path: kibana/plugins/workbench/build
path: OpenSearch-Dashboards/plugins/workbench/build
2 changes: 1 addition & 1 deletion workbench/.cypress/integration/ui.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ describe('Test and verify SQL downloads', () => {
url: url,
headers: {
'content-type': 'application/json;charset=UTF-8',
'kbn-version': '7.10.2',
'osd-version': '7.10.2',
davidcui1225 marked this conversation as resolved.
Show resolved Hide resolved
},
body: {
'query': 'select * from accounts where balance > 49500'
Expand Down
2 changes: 1 addition & 1 deletion workbench/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ information to effectively respond to your bug report or contribution.

We welcome you to use the GitHub issue tracker to report bugs or suggest features.

When filing an issue, please check [existing open](https://github.com/opendistro-for-elasticsearch/sql/issues?q=is%3Aissue+is%3Aclosed+label%3AWorkbench), or [recently closed](https://github.com/opendistro-for-elasticsearch/sql/issues?q=is%3Aissue+is%3Aclosed+label%3AWorkbench), issues to make sure somebody else hasn't already
When filing an issue, please check [existing open](https://github.com/opensearch-project/sql/issues?q=is%3Aissue+is%3Aopen+workbench), or [recently closed](https://github.com/opensearch-project/sql/issues?q=is%3Aissue+workbench+is%3Aclosed+), issues to make sure somebody else hasn't already
reported the issue. Please try to include as much information as you can. Details like these are incredibly useful:

* A reproducible test case or series of steps
Expand Down
2 changes: 1 addition & 1 deletion workbench/NOTICE
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Open Distro for Elasticsearch SQL Kibana Plugin
OpenSearch Dashboards SQL Plugin
Copyright 2018-2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
32 changes: 16 additions & 16 deletions workbench/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Open Distro for Elasticsearch Query Workbench
# OpenSearch Dashboards Query Workbench

The Open Distro for Elasticsearch Query Workbench enables you to query your Elasticsearch data using either SQL or PPL syntax from a dedicated Kibana UI. You can download your query results data in JSON, JDBC, CSV and raw text formats.
The OpenSearch Dashboards Query Workbench enables you to query your OpenSearch data using either SQL or PPL syntax from a dedicated OpenSearch Dashboards UI. You can download your query results data in JSON, JDBC, CSV and raw text formats.


## Documentation
Expand All @@ -10,29 +10,29 @@ Please see our technical [documentation](https://opendistro.github.io/for-elasti

## Setup

1. Download Elasticsearch for the version that matches the [Kibana version specified in package.json](./package.json#L8).
1. Download and install the most recent version of [Open Distro for Elasticsearch SQL plugin](https://github.com/opendistro-for-elasticsearch/sql).
1. Download the Kibana source code for the [version specified in package.json](./package.json#L8) you want to set up.
1. Download OpenSearch for the version that matches the [OpenSearch Dashboards version specified in package.json](./package.json#L8).
1. Download and install the most recent version of [OpenSearch SQL plugin](https://github.com/opensearch-project/sql#open-distro-for-elasticsearch-sql).
1. Download the OpenSearch Dashboards source code for the [version specified in package.json](./package.json#L8) you want to set up.

See the [Kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#setting-up-your-development-environment) for more instructions on setting up your development environment.
See the [OpenSearch Dashboards contributing guide](https://github.com/opensearch-project/OpenSearch-Dashboards/blob/main/CONTRIBUTING.md) to get started.

1. Change your node version to the version specified in `.node-version` inside the Kibana root directory.
1. cd into the Kibana source code directory.
1. Change your node version to the version specified in `.node-version` inside the OpenSearch Dashboards root directory.
1. cd into the OpenSearch Dashboards source code directory.
1. Check out this package from version control into the `plugins` directory.
```
git clone [email protected]:opendistro-for-elasticsearch/sql.git plugins --no-checkout
git clone [email protected]:opensearch-project/sql.git plugins --no-checkout
cd plugins
echo 'workbench/*' >> .git/info/sparse-checkout
git config core.sparseCheckout true
git checkout master
git checkout main
```
6. Run `yarn kbn bootstrap` inside `kibana/plugins/workbench`.
6. Run `yarn osd bootstrap` inside `OpenSearch-Dashboards/plugins/workbench`.
davidcui1225 marked this conversation as resolved.
Show resolved Hide resolved

Ultimately, your directory structure should look like this:

```md
.
├── kibana
├── OpenSearch-Dashboards
davidcui1225 marked this conversation as resolved.
Show resolved Hide resolved
│ └── plugins
│ └── workbench
```
Expand All @@ -49,21 +49,21 @@ Example output: `./build/opendistro-query-workbench-*.zip`

- `yarn start`

Starts Kibana and includes this plugin. Kibana will be available on `localhost:5601`.
Starts OpenSearch Dashboards and includes this plugin. OpenSearch Dashboards will be available on `localhost:5601`.

- `NODE_PATH=../../node_modules yarn test:jest`

Runs the plugin tests.


## Contributing to Open Distro for Elasticsearch Query Workbench
## Contributing to OpenSearch SQL Workbench

- Refer to [CONTRIBUTING.md](./CONTRIBUTING.md).
- Since this is a workbench, it can be useful to review the [Kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) alongside the documentation around [workbenchs](https://www.elastic.co/guide/en/kibana/master/kibana-plugins.html) and [plugin development](https://www.elastic.co/guide/en/kibana/master/plugin-development.html).
- We welcome you to get involved in development, documentation, testing the OpenSearch SQL Workbench plugin. See our [CONTRIBUTING.md](./CONTRIBUTING.md) and join in.

## Bugs, Enhancements or Questions

Please file an issue to report any bugs you may find, enhancements you may need or questions you may have [here](https://github.com/opendistro-for-elasticsearch/sql/issues).
Please file an issue to report any bugs you may find, enhancements you may need or questions you may have [here](https://github.com/opensearch-project/sql/issues).

## License

Expand Down
9 changes: 0 additions & 9 deletions workbench/kibana.json

This file was deleted.

9 changes: 9 additions & 0 deletions workbench/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"id": "queryWorkbenchDashboards",
"version": "1.15.0.0",
"opensearchDashboardsVersion": "7.10.2",
"server": true,
"ui": true,
"requiredPlugins": ["navigation"],
"optionalPlugins": []
}
16 changes: 7 additions & 9 deletions workbench/package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
{
"name": "opendistro-query-workbench",
"version": "1.13.0.0",
"version": "1.15.0.0",
"description": "Query Workbench",
"main": "index.js",
"license": "Apache-2.0",
"homepage": "https://github.com/opendistro-for-elasticsearch/sql/tree/master/workbench",
"kibana": {
"homepage": "https://github.com/opensearch-project/sql/tree/main/workbench",
"opensearchDashboards": {
"version": "7.10.2",
"templateVersion": "6.3.3"
},
"repository": {
"type": "git",
"url": "https://github.com/opendistro-for-elasticsearch/sql/tree/master/workbench"
"url": "https://github.com/opensearch-project/sql/tree/main/workbench"
},
"scripts": {
"kbn": "node ../../scripts/kbn",
"osd": "node ../../scripts/osd",
"opensearch": "node ../../scripts/opensearch",
"lint": "tslint .",
"start": "plugin-helpers start",
"test:server": "plugin-helpers test:server",
Expand All @@ -28,7 +29,6 @@
"react-double-scrollbar": "^0.0.15"
},
"devDependencies": {
"@elastic/eslint-import-resolver-kibana": "link:../../packages/kbn-eslint-import-resolver-kibana",
"@types/hapi-latest": "npm:@types/[email protected]",
"@types/react-router-dom": "^5.1.5",
"cypress": "^5.0.0",
Expand Down Expand Up @@ -57,8 +57,6 @@
"**/@types/react-dom": "^16.0.5",
"**/@types/react-router-dom": "^4.3.1",
"eslint-utils": "^2.0.0",
"**/@types/react": "16.3.14",
"lodash": "^4.17.21",
"ssri": "8.0.1"
"**/@types/react": "16.3.14"
}
}
2 changes: 1 addition & 1 deletion workbench/public/components/Main/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import {
Tree,
} from '../../utils/utils';
import { MESSAGE_TAB_LABEL } from '../../utils/constants';
import { CoreStart } from 'kibana/public';
import { CoreStart } from '../../../../../src/core/public';

interface ResponseData {
ok: boolean;
Expand Down
2 changes: 1 addition & 1 deletion workbench/public/components/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
*/

import React from 'react';
import { I18nProvider } from '@kbn/i18n/react';
import { I18nProvider } from '@osd/i18n/react';
davidcui1225 marked this conversation as resolved.
Show resolved Hide resolved
import { BrowserRouter as Router, Route } from 'react-router-dom';

import { EuiPage, EuiPageBody } from '@elastic/eui';
Expand Down
2 changes: 1 addition & 1 deletion workbench/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import './index.scss';
import { WorkbenchPlugin } from './plugin';

// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
// as well as, OpenSearch Dashboards Platform `plugin()` initializer.
export function plugin() {
return new WorkbenchPlugin();
}
Expand Down
4 changes: 2 additions & 2 deletions workbench/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ export class WorkbenchPlugin implements Plugin<WorkbenchPluginSetup, WorkbenchPl
title: PLUGIN_NAME,
category: {
id: 'odfe',
label: 'Open Distro for Elasticsearch',
label: 'OpenSearch',
order: 2000,
},
order: 1000,
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
// Get start services as specified in kibana.json
// Get start services as specified in opensearch_dashboards.json
const [coreStart, depsStart] = await core.getStartServices();
// Render the application
return renderApp(coreStart, depsStart as AppPluginStartDependencies, params);
Expand Down
4 changes: 2 additions & 2 deletions workbench/server/clusters/sql/createSqlCluster.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ import sqlPlugin from './sqlPlugin';
import { CLUSTER, DEFAULT_HEADERS } from '../../services/utils/constants';

export default function createSqlCluster(server) {
const { customHeaders, ...rest } = server.config().get('elasticsearch');
server.plugins.elasticsearch.createCluster(
const { customHeaders, ...rest } = server.config().get('opensearch');
server.plugins.opensearch.createCluster(
CLUSTER.SQL,
{
plugins: [ sqlPlugin ],
Expand Down
2 changes: 1 addition & 1 deletion workbench/server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { PluginInitializerContext } from '../../../src/core/server';
import { WorkbenchPlugin } from './plugin';

// This exports static code and TypeScript types,
// as well as, Kibana Platform `plugin()` initializer.
// as well as, OpenSearch Dashboards Platform `plugin()` initializer.

export function plugin(initializerContext: PluginInitializerContext) {
return new WorkbenchPlugin(initializerContext);
Expand Down
4 changes: 2 additions & 2 deletions workbench/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import {

import { WorkbenchPluginSetup, WorkbenchPluginStart } from './types';
import defineRoutes from './routes';
import sqlPlugin from './clusters/sql/sqlPlugin';
import sqlPlugin from './clusters/sql/sqlPlugin';


export class WorkbenchPlugin implements Plugin<WorkbenchPluginSetup, WorkbenchPluginStart> {
Expand All @@ -37,7 +37,7 @@ export class WorkbenchPlugin implements Plugin<WorkbenchPluginSetup, WorkbenchPl
public setup(core: CoreSetup) {
this.logger.debug('opendistroQueryWorkbench: Setup');
const router = core.http.createRouter();
const client: ILegacyClusterClient = core.elasticsearch.legacy.createClient(
const client: ILegacyClusterClient = core.opensearch.legacy.createClient(
'query_workbench',
{
plugins: [sqlPlugin]
Expand Down
Loading