Skip to content
This repository has been archived by the owner on Mar 31, 2021. It is now read-only.

Support v7.1.1 Compatibility #13

Merged
merged 9 commits into from
Dec 5, 2019
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
12 changes: 12 additions & 0 deletions .kibana-plugin-helpers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"styleSheetToCompile": "public/app.scss",
"buildSourcePatterns": [
"package.json",
"tsconfig.json",
"yarn.lock",
".yarnrc",
"index.js",
"{lib,public,server,test}/**/*",
"!__tests__"
]
}
63 changes: 61 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,65 @@
## Open Distro for Elasticsearch SQL Kibana Plugin
# Open Distro for Elasticsearch SQL Kibana

The Open Distro for Elasticsearch SQL Kibana plugin lets you query your Elasticsearch data using SQL syntax from a dedicated Kibana UI. You can then download data in JSON, JDBC, or CSV format.


## Documentation

Please see our [documentation](https://opendistro.github.io/for-elasticsearch-docs/).


## Setup

1. Download Elasticsearch for the version that matches the [Kibana version specified in package.json](./package.json#L8).
1. Download and install the appropriate [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.

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.

1. Change your node version to the version specified in `.node-version` inside the Kibana root directory.
1. Create a `kibana-extra` directory as a sibling directory to the Kibana source code directory.
1. Check out this package from version control into the `kibana-extra` directory.
1. Run `yarn kbn bootstrap` inside `kibana-extra/opendistro-elasticsearch-sql-kibana`.

Ultimately, your directory structure should look like this:

```md
.
├── kibana
├── kibana-extra
│ └── opendistro-elasticsearch-sql-kibana
```


## Build

To build the plugin's distributable zip simply run `yarn build`.

Example output: `./build/opendistro-kibana-sql-1.0.0.0.zip`


## Run

- `yarn start`

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

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

Runs the plugin tests.


## Contributing to Open Distro for Elasticsearch SQL Kibana

- Refer to [CONTRIBUTING.md](./CONTRIBUTING.md).
- Since this is a Kibana plugin, it can be useful to review the [Kibana contributing guide](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md) alongside the documentation around [Kibana plugins](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).



## License

This library is licensed under the Apache 2.0 License.
This code is licensed under the Apache 2.0 License.

## Copyright

Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
397 changes: 397 additions & 0 deletions THIRD-PARTY

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

// babelrc doesn't respect NODE_PATH anymore but using require does.
// Alternative to install them locally in node_modules
module.exports = {
presets: [require("@babel/preset-env"), require("@babel/preset-react"), require("@babel/preset-typescript")],
plugins: [require("@babel/plugin-proposal-class-properties"), require("@babel/plugin-proposal-object-rest-spread")],
};

54 changes: 54 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
/*
* Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License").
* You may not use this file except in compliance with the License.
* A copy of the License is located at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* or in the "license" file accompanying this file. This file is distributed
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
* express or implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

import query from './server/routes/query';
import translate from './server/routes/translate';
import QueryService from './server/services/QueryService';
import TranslateService from './server/services/TranslateService';
import { createSqlCluster } from './server/clusters';

export const PLUGIN_NAME = 'opendistro-sql-kibana';

export default function (kibana) {
return new kibana.Plugin({
require: ['elasticsearch'],
name: PLUGIN_NAME,
uiExports: {
app: {
title: 'SQL Console',
description: 'SQL Console',
main: 'plugins/' + PLUGIN_NAME + '/app',
icon:'plugins/' + PLUGIN_NAME + '/icons/sql.svg',
},
styleSheetPaths: require('path').resolve(__dirname, 'public/app.scss'),
},

config(Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
}).default();
},

init(server, options) { // eslint-disable-line no-unused-vars
// Create Clusters
createSqlCluster(server);
const client = server.plugins.elasticsearch;

// Add server routes and initialize the plugin here
query(server, new QueryService(client));
translate(server, new TranslateService(client));
}
});
}
Loading