Merge code plugin to xpack

This commit is contained in:
Fuyao Zhao 2018-12-06 17:02:05 -08:00
parent 9eda4c57bc
commit 1625d01522
327 changed files with 920 additions and 10718 deletions

16
code/.gitignore vendored
View file

@ -1,16 +0,0 @@
gen/
bin/
!/kibana-extra/code/packages/code-filename-check/bin/
.DS_Store
.gradle/
.idea/
.cache/
out/
.settings/
build
*.iws
*.iml
*.ipr
/data/
.project
.classpath

View file

@ -1,3 +0,0 @@
{
"styleSheetToCompile": "public/styles.scss"
}

View file

@ -1,6 +0,0 @@
{
"git.ignoreLimitWarning": true,
"editor.tabSize": 2,
"editor.rulers": [110],
"files.trimTrailingWhitespace": true
}

View file

View file

@ -1,41 +0,0 @@
# Setting Up Your Development Environment
> You'll need to have a `java` binary in `PATH` or set `JAVA_HOME` to use the gradlew scripts.
> On windows use `./gradlew.bat` anywhere you see `./gradlew`
Fork, then clone the `code` repo and move into it
```bash
git clone https://github.com/[YOUR_USERNAME]/castro.git code
cd code
```
Bootstrap the castro repo and pull a local checkout of the Kibana repo by running the bootstrap gradle task
```bash
./gradlew bootstrap
```
Move into the Kibana checkout and start elasticsearch from a nightly snapshot.
```bash
./gradlew startDeps
```
Start Kibana with code
```bash
./gradlew startKibana
```
In order to develop code intelligence feature, you need to checkout submodule:
```bash
./scripts/update
```
then run
```bash
./gradlew lsp:javascript:build
```

View file

@ -1,223 +0,0 @@
ELASTIC LICENSE AGREEMENT
PLEASE READ CAREFULLY THIS ELASTIC LICENSE AGREEMENT (THIS "AGREEMENT"), WHICH
CONSTITUTES A LEGALLY BINDING AGREEMENT AND GOVERNS ALL OF YOUR USE OF ALL OF
THE ELASTIC SOFTWARE WITH WHICH THIS AGREEMENT IS INCLUDED ("ELASTIC SOFTWARE")
THAT IS PROVIDED IN OBJECT CODE FORMAT, AND, IN ACCORDANCE WITH SECTION 2 BELOW,
CERTAIN OF THE ELASTIC SOFTWARE THAT IS PROVIDED IN SOURCE CODE FORMAT. BY
INSTALLING OR USING ANY OF THE ELASTIC SOFTWARE GOVERNED BY THIS AGREEMENT, YOU
ARE ASSENTING TO THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU DO NOT AGREE
WITH SUCH TERMS AND CONDITIONS, YOU MAY NOT INSTALL OR USE THE ELASTIC SOFTWARE
GOVERNED BY THIS AGREEMENT. IF YOU ARE INSTALLING OR USING THE SOFTWARE ON
BEHALF OF A LEGAL ENTITY, YOU REPRESENT AND WARRANT THAT YOU HAVE THE ACTUAL
AUTHORITY TO AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT ON BEHALF OF
SUCH ENTITY.
Posted Date: April 20, 2018
This Agreement is entered into by and between Elasticsearch BV ("Elastic") and
You, or the legal entity on behalf of whom You are acting (as applicable,
"You").
1. OBJECT CODE END USER LICENSES, RESTRICTIONS AND THIRD PARTY OPEN SOURCE
SOFTWARE
1.1 Object Code End User License. Subject to the terms and conditions of
Section 1.2 of this Agreement, Elastic hereby grants to You, AT NO CHARGE and
for so long as you are not in breach of any provision of this Agreement, a
License to the Basic Features and Functions of the Elastic Software.
1.2 Reservation of Rights; Restrictions. As between Elastic and You, Elastic
and its licensors own all right, title and interest in and to the Elastic
Software, and except as expressly set forth in Sections 1.1, and 2.1 of this
Agreement, no other license to the Elastic Software is granted to You under
this Agreement, by implication, estoppel or otherwise. You agree not to: (i)
reverse engineer or decompile, decrypt, disassemble or otherwise reduce any
Elastic Software provided to You in Object Code, or any portion thereof, to
Source Code, except and only to the extent any such restriction is prohibited
by applicable law, (ii) except as expressly permitted in this Agreement,
prepare derivative works from, modify, copy or use the Elastic Software Object
Code or the Commercial Software Source Code in any manner; (iii) except as
expressly permitted in Section 1.1 above, transfer, sell, rent, lease,
distribute, sublicense, loan or otherwise transfer, Elastic Software Object
Code, in whole or in part, to any third party; (iv) use Elastic Software
Object Code for providing time-sharing services, any software-as-a-service,
service bureau services or as part of an application services provider or
other service offering (collectively, "SaaS Offering") where obtaining access
to the Elastic Software or the features and functions of the Elastic Software
is a primary reason or substantial motivation for users of the SaaS Offering
to access and/or use the SaaS Offering ("Prohibited SaaS Offering"); (v)
circumvent the limitations on use of Elastic Software provided to You in
Object Code format that are imposed or preserved by any License Key, or (vi)
alter or remove any Marks and Notices in the Elastic Software. If You have any
question as to whether a specific SaaS Offering constitutes a Prohibited SaaS
Offering, or are interested in obtaining Elastic's permission to engage in
commercial or non-commercial distribution of the Elastic Software, please
contact elastic_license@elastic.co.
1.3 Third Party Open Source Software. The Commercial Software may contain or
be provided with third party open source libraries, components, utilities and
other open source software (collectively, "Open Source Software"), which Open
Source Software may have applicable license terms as identified on a website
designated by Elastic. Notwithstanding anything to the contrary herein, use of
the Open Source Software shall be subject to the license terms and conditions
applicable to such Open Source Software, to the extent required by the
applicable licensor (which terms shall not restrict the license rights granted
to You hereunder, but may contain additional rights). To the extent any
condition of this Agreement conflicts with any license to the Open Source
Software, the Open Source Software license will govern with respect to such
Open Source Software only. Elastic may also separately provide you with
certain open source software that is licensed by Elastic. Your use of such
Elastic open source software will not be governed by this Agreement, but by
the applicable open source license terms.
2. COMMERCIAL SOFTWARE SOURCE CODE
2.1 Limited License. Subject to the terms and conditions of Section 2.2 of
this Agreement, Elastic hereby grants to You, AT NO CHARGE and for so long as
you are not in breach of any provision of this Agreement, a limited,
non-exclusive, non-transferable, fully paid up royalty free right and license
to the Commercial Software in Source Code format, without the right to grant
or authorize sublicenses, to prepare Derivative Works of the Commercial
Software, provided You (i) do not hack the licensing mechanism, or otherwise
circumvent the intended limitations on the use of Elastic Software to enable
features other than Basic Features and Functions or those features You are
entitled to as part of a Subscription, and (ii) use the resulting object code
only for reasonable testing purposes.
2.2 Restrictions. Nothing in Section 2.1 grants You the right to (i) use the
Commercial Software Source Code other than in accordance with Section 2.1
above, (ii) use a Derivative Work of the Commercial Software outside of a
Non-production Environment, in any production capacity, on a temporary or
permanent basis, or (iii) transfer, sell, rent, lease, distribute, sublicense,
loan or otherwise make available the Commercial Software Source Code, in whole
or in part, to any third party. Notwithstanding the foregoing, You may
maintain a copy of the repository in which the Source Code of the Commercial
Software resides and that copy may be publicly accessible, provided that you
include this Agreement with Your copy of the repository.
3. TERMINATION
3.1 Termination. This Agreement will automatically terminate, whether or not
You receive notice of such Termination from Elastic, if You breach any of its
provisions.
3.2 Post Termination. Upon any termination of this Agreement, for any reason,
You shall promptly cease the use of the Elastic Software in Object Code format
and cease use of the Commercial Software in Source Code format. For the
avoidance of doubt, termination of this Agreement will not affect Your right
to use Elastic Software, in either Object Code or Source Code formats, made
available under the Apache License Version 2.0.
3.3 Survival. Sections 1.2, 2.2. 3.3, 4 and 5 shall survive any termination or
expiration of this Agreement.
4. DISCLAIMER OF WARRANTIES AND LIMITATION OF LIABILITY
4.1 Disclaimer of Warranties. TO THE MAXIMUM EXTENT PERMITTED UNDER APPLICABLE
LAW, THE ELASTIC SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
AND ELASTIC AND ITS LICENSORS MAKE NO WARRANTIES WHETHER EXPRESSED, IMPLIED OR
STATUTORY REGARDING OR RELATING TO THE ELASTIC SOFTWARE. TO THE MAXIMUM EXTENT
PERMITTED UNDER APPLICABLE LAW, ELASTIC AND ITS LICENSORS SPECIFICALLY
DISCLAIM ALL IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
PURPOSE AND NON-INFRINGEMENT WITH RESPECT TO THE ELASTIC SOFTWARE, AND WITH
RESPECT TO THE USE OF THE FOREGOING. FURTHER, ELASTIC DOES NOT WARRANT RESULTS
OF USE OR THAT THE ELASTIC SOFTWARE WILL BE ERROR FREE OR THAT THE USE OF THE
ELASTIC SOFTWARE WILL BE UNINTERRUPTED.
4.2 Limitation of Liability. IN NO EVENT SHALL ELASTIC OR ITS LICENSORS BE
LIABLE TO YOU OR ANY THIRD PARTY FOR ANY DIRECT OR INDIRECT DAMAGES,
INCLUDING, WITHOUT LIMITATION, FOR ANY LOSS OF PROFITS, LOSS OF USE, BUSINESS
INTERRUPTION, LOSS OF DATA, COST OF SUBSTITUTE GOODS OR SERVICES, OR FOR ANY
SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES OF ANY KIND, IN CONNECTION WITH
OR ARISING OUT OF THE USE OR INABILITY TO USE THE ELASTIC SOFTWARE, OR THE
PERFORMANCE OF OR FAILURE TO PERFORM THIS AGREEMENT, WHETHER ALLEGED AS A
BREACH OF CONTRACT OR TORTIOUS CONDUCT, INCLUDING NEGLIGENCE, EVEN IF ELASTIC
HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
5. MISCELLANEOUS
This Agreement completely and exclusively states the entire agreement of the
parties regarding the subject matter herein, and it supersedes, and its terms
govern, all prior proposals, agreements, or other communications between the
parties, oral or written, regarding such subject matter. This Agreement may be
modified by Elastic from time to time, and any such modifications will be
effective upon the "Posted Date" set forth at the top of the modified
Agreement. If any provision hereof is held unenforceable, this Agreement will
continue without said provision and be interpreted to reflect the original
intent of the parties. This Agreement and any non-contractual obligation
arising out of or in connection with it, is governed exclusively by Dutch law.
This Agreement shall not be governed by the 1980 UN Convention on Contracts
for the International Sale of Goods. All disputes arising out of or in
connection with this Agreement, including its existence and validity, shall be
resolved by the courts with jurisdiction in Amsterdam, The Netherlands, except
where mandatory law provides for the courts at another location in The
Netherlands to have jurisdiction. The parties hereby irrevocably waive any and
all claims and defenses either might otherwise have in any such action or
proceeding in any of such courts based upon any alleged lack of personal
jurisdiction, improper venue, forum non conveniens or any similar claim or
defense. A breach or threatened breach, by You of Section 2 may cause
irreparable harm for which damages at law may not provide adequate relief, and
therefore Elastic shall be entitled to seek injunctive relief without being
required to post a bond. You may not assign this Agreement (including by
operation of law in connection with a merger or acquisition), in whole or in
part to any third party without the prior written consent of Elastic, which
may be withheld or granted by Elastic in its sole and absolute discretion.
Any assignment in violation of the preceding sentence is void. Notices to
Elastic may also be sent to legal@elastic.co.
6. DEFINITIONS
The following terms have the meanings ascribed:
6.1 "Affiliate" means, with respect to a party, any entity that controls, is
controlled by, or which is under common control with, such party, where
"control" means ownership of at least fifty percent (50%) of the outstanding
voting shares of the entity, or the contractual right to establish policy for,
and manage the operations of, the entity.
6.2 "Basic Features and Functions" means those features and functions of the
Elastic Software that are eligible for use under a Basic license, as set forth
at https://www.elastic.co/subscriptions, as may be modified by Elastic from
time to time.
6.3 "Commercial Software" means the Elastic Software Source Code in any file
containing a header stating the contents are subject to the Elastic License or
which is contained in the repository folder labeled "x-pack", unless a LICENSE
file present in the directory subtree declares a different license.
6.4 "Derivative Work of the Commercial Software" means, for purposes of this
Agreement, any modification(s) or enhancement(s) to the Commercial Software,
which represent, as a whole, an original work of authorship.
6.5 "License" means a limited, non-exclusive, non-transferable, fully paid up,
royalty free, right and license, without the right to grant or authorize
sublicenses, solely for Your internal business operations to (i) install and
use the applicable Features and Functions of the Elastic Software in Object
Code, and (ii) permit Contractors and Your Affiliates to use the Elastic
software as set forth in (i) above, provided that such use by Contractors must
be solely for Your benefit and/or the benefit of Your Affiliates, and You
shall be responsible for all acts and omissions of such Contractors and
Affiliates in connection with their use of the Elastic software that are
contrary to the terms and conditions of this Agreement.
6.6 "License Key" means a sequence of bytes, including but not limited to a
JSON blob, that is used to enable certain features and functions of the
Elastic Software.
6.7 "Marks and Notices" means all Elastic trademarks, trade names, logos and
notices present on the Documentation as originally provided by Elastic.
6.8 "Non-production Environment" means an environment for development, testing
or quality assurance, where software is not used for production purposes.
6.9 "Object Code" means any form resulting from mechanical transformation or
translation of Source Code form, including but not limited to compiled object
code, generated documentation, and conversions to other media types.
6.10 "Source Code" means the preferred form of computer software for making
modifications, including but not limited to software source code,
documentation source, and configuration files.
6.11 "Subscription" means the right to receive Support Services and a License
to the Commercial Software.

View file

@ -1,69 +0,0 @@
# Codesearch
## Source
The source for the CodeSearch plugin can be found in `kibana-extras/codesearch`. This is in the correct location to use a local checkout of the Kibana repository that is created in `kibana` the first time you run `yarn kbn bootstrap`
## Environment
Install Node version 8.11.4 and yarn version 1.10.1. If you want to quickly start the stack with tmux script, you need to install tmux and tmuxp
```$bash
brew install tmux
pip install tmuxp
```
## Development
See the [contributing guide](./CONTRIBUTING.md) for instructions setting up your development environment. Once you have completed that, use the following scripts.
- `./scripts/update_submodule`
Initialize and clone submodules like kibana, language servers, etc
All following commands need to be run under `kibana-extra/codesearch`:
- `yarn kbn bootstrap`
Install dependencies in Kibana and codesearch.
- `yarn start-deps`
Start an elasticsearch instance using a nightly snapshot.
- `yarn start`
Start kibana and have it include the codesearch plugin. After this is started you should be able to visit kibana interface at http://localhost:5601
- `yarn tslint`
Lint the sourcecode with [`tslint`](https://github.com/palantir/tslint).
- `yarn tslint --fix`
Lint the sourcecode with [`tslint`](https://github.com/palantir/tslint) and fix any auto-fixable errors.
- `yarn type-check`
Check types in the source code with the TypeScript compiler.
- `yarn type-check --watch`
Check types in the source code with the TypeScript compiler once initially and again whenever a source file changes.
You could bring up the stack and have it run in background without worry about get process killed: after bootstraping, just run
```
./scripts/tmux_session
```
Note that language servers need to be built separately:
- Typescript: `cd lsp/javascript-typescript-langserver; yarn run build` or `yarn watch` for continuous build
- Java: `cd lsp/java-langserver; ./mvnw package`
To start production environment
- `NODE_ENV=production node $NODE_OPTIONS --no-warnings src/cli --plugin-path ../kibana-extra/codesearch --config ../config/kibana/kibana.yml`
## License
All files in this repository are subject to the Elastic License. See [`LICENSE.txt`](./LICENSE.txt) for details.

View file

@ -1,43 +0,0 @@
plugins {
id 'com.gradle.build-scan' version '1.15.1'
}
allprojects {
repositories {
mavenCentral()
}
apply {
plugin "idea"
}
}
buildScan {
licenseAgreementUrl = 'https://gradle.com/terms-of-service'
licenseAgree = 'yes'
if (System.getenv('CI')) {
publishAlways()
tag 'CI'
}
}
task checkoutSubmodule(type: Exec) {
commandLine "bash", "-c", "git submodule update --init --remote --rebase"
}
//task startDeps(type: Exec) {
// commandLine "docker-compose", "up", "-d"
//}
//
//task stopDeps(type: Exec) {
// commandLine "docker-compose", "down"
//}
idea {
module {
excludeDirs += [file("kibana")]
}
}
wrapper {
distributionUrl = "https://services.gradle.org/distributions/gradle-4.10-all.zip"
}

View file

@ -1,18 +0,0 @@
metricbeat.modules:
- module: system
metricsets:
- cpu
- filesystem
- memory
- network
- process
enabled: true
period: 10s
processes: ['.*']
cpu_ticks: false
output.elasticsearch:
hosts: [ "docker.for.mac.localhost:9201" ]
setup.kibana:
host: "docker.for.mac.localhost:5601"

View file

@ -1,18 +0,0 @@
optimize:
sourceMaps: false
# sourceMaps: '#cheap-source-map'
code:
redirectToNode: http://localhost:5601/{baseUrl}
enableGlobalReference: false
# repos:
# - repo: 'github.com/Microsoft/TypeScript-Node-Starter'
# init:
# - 'yarn'
# - 'install'
xpack.security.encryptionKey: "something_at_least_32_characters"
xpack.reporting.encryptionKey: "something_at_least_32_characters"
elasticsearch.username: "elastic"
elasticsearch.password: "changeme"

View file

@ -1,15 +0,0 @@
optimize:
unsafeCache: true
sourceMaps: false
# sourceMaps: '#cheap-source-map'
code:
enableGlobalReference: false
# repos:
# - repo: 'github.com/Microsoft/TypeScript-Node-Starter'
# init:
# - 'yarn'
# - 'install'
xpack.security.encryptionKey: "something_at_least_32_characters"
xpack.reporting.encryptionKey: "something_at_least_32_characters"

View file

@ -1,2 +0,0 @@
node:
name: "dev"

View file

@ -1,15 +0,0 @@
input {
tcp {
port => 5000
codec => "json"
}
}
output {
elasticsearch {
hosts => [ "elasticsearch:9200" ]
}
stdout {
codec => json
}
}

View file

@ -1,4 +0,0 @@
kibanaVersion = 991e805669d69c9df25709e1ab4195c4ae08bb56
nodeVersion = 8.14.0
yarnVersion = 1.12.3

Binary file not shown.

View file

@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

172
code/gradlew vendored
View file

@ -1,172 +0,0 @@
#!/usr/bin/env sh
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi
exec "$JAVACMD" "$@"

84
code/gradlew.bat vendored
View file

@ -1,84 +0,0 @@
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS=
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto init
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto init
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:init
@rem Get command-line arguments, handling Windows variants
if not "%OS%" == "Windows_NT" goto win9xME_args
:win9xME_args
@rem Slurp the command line arguments.
set CMD_LINE_ARGS=
set _SKIP=2
:win9xME_args_slurp
if "x%~1" == "x" goto execute
set CMD_LINE_ARGS=%*
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -1 +0,0 @@
Subproject commit a64afc05590e944a042cd12fe572b793e792b442

View file

@ -1,10 +0,0 @@
npm-debug.log*
node_modules
/build/
*.js
!packages/code-esqueue/**/*.js
!packages/code-filename-check/**/*.js
!webpackShims/init-monaco.js
!server/lib/**/*.js
/public/styles.css
yarn-error.log

View file

@ -1,5 +0,0 @@
{
"singleQuote": true,
"trailingComma": "es5",
"printWidth": 100
}

View file

@ -1,91 +0,0 @@
buildscript {
repositories {
jcenter()
}
}
plugins {
id "com.moowork.node" version "1.2.0"
}
node {
version = rootProject.nodeVersion
yarnVersion = rootProject.yarnVersion
download = true
}
task bootstrap(type: YarnTask, dependsOn: [yarnSetup, rootProject.tasks.checkoutSubmodule]) {
inputs.property("kibanaVersion", kibanaVersion)
inputs.files(
file("$rootDir/kibana-extra/code/package.json"),
file("$rootDir/kibana-extra/code/yarn.lock"),
file("$rootDir/kibana/yarn.lock"),
file("$rootDir/kibana/x-pack/yarn.lock"),
fileTree("$rootDir/kibana/packages") {
include "*/yarn.lock"
}
)
outputs.files(
file("$rootDir/kibana-extra/code/node_modules/.yarn-integrity"),
file("$rootDir/kibana/node_modules/.yarn-integrity"),
file("$rootDir/kibana/x-pack/node_modules/.yarn-integrity"),
fileTree("$rootDir/kibana/packages") {
include "*/node_modules/.yarn-integrity"
}
)
args = ['kbn', 'bootstrap']
}
task startKibana(type: YarnTask, dependsOn: [bootstrap]) {
args = ['start', '--logging.json=false']
}
if (!Boolean.valueOf(System.getenv('LSP_DETACH'))) {
tasks.startKibana.dependsOn(":lsp:javascript-typescript-langserver:build")
}
task startFullKibana(type: YarnTask, dependsOn: [bootstrap, ":lsp:javascript-typescript-langserver:build", ":lsp:eclipse.jdt.ls:build"]) {
args = ['start', '--logging.json=false']
}
task debugKibana(type: YarnTask, dependsOn: [bootstrap, ":lsp:javascript-typescript-langserver:build"]) {
args = ['debug', '--logging.json=false']
}
task test(type: YarnTask) {
args = ['test']
}
task startDeps(type: YarnTask, dependsOn: [bootstrap]) {
args = ['start-deps']
}
task startCacheDeps(type: YarnTask, dependsOn: [bootstrap]) {
args = ['start-cache-deps']
}
task checkAllFilenames(type: YarnTask, dependsOn: [bootstrap]) {
args = ['check_all_filenames']
}
task lint(type: YarnTask, dependsOn: [bootstrap]) {
args = ['tslint']
}
task lintFix(type: YarnTask, dependsOn: [bootstrap]) {
args = ['tslint', '--fix']
}
task typeCheck(type: YarnTask, dependsOn: [bootstrap]) {
args = ['type-check']
}
task typeCheckWatch(type: YarnTask, dependsOn: [bootstrap]) {
args = ['type-check', '--watch']
}
tasks.withType(YarnTask) { task ->
task.environment = ['FORCE_COLOR': 'true']
}

View file

@ -1,140 +0,0 @@
{
"name": "code",
"version": "0.0.1",
"description": "code",
"main": "index.js",
"private": true,
"license": "Elastic-License",
"kibana": {
"version": "kibana",
"templateVersion": "1.0.0"
},
"codeIndexVersion": "1",
"scripts": {
"_preinstall": "node ../../kibana/preinstall_check",
"kbn": "node ../../kibana/scripts/kbn",
"tslint": "tslint --project tsconfig.json --format stylish",
"start": "plugin-helpers start --config ../config/kibana/kibana.yml",
"debug-another": "node --inspect ../../kibana/scripts/kibana.js -p 5701 --config ../../config/kibana/kibana.another.yml --optimize.enabled=false --env.name=development --plugin-path=.",
"another": "node ../../kibana/scripts/kibana.js -p 5701 --config ../../config/kibana/kibana.another.yml --env.name=development --plugin-path=.",
"test:server": "plugin-helpers test:server",
"test:browser": "plugin-helpers test:browser",
"precommit": "lint-staged",
"prepush": "yarn test",
"build": "plugin-helpers build",
"start-deps": "node ../../kibana/scripts/es.js snapshot -E path.data=../../data",
"start-cache-deps": "node ../../kibana/scripts/es.js archive ../../kibana/.es/cache/elasticsearch-7.0.0-alpha1-SNAPSHOT.tar.gz -E path.data=../../data",
"debug": "node --inspect ../../kibana/scripts/kibana.js --config ../../config/kibana/kibana.yml --env.name=development --optimize.enabled=false --plugin-path=.",
"type-check": "tsc --project tsconfig.json --noEmit --pretty",
"test": "jest",
"lsp:benchmark": "cd ./server/lsp && jest --testRegex lsp_benchmark.ts"
},
"jest": {
"globals": {
"ts-jest": {
"diagnostics": false
}
},
"transform": {
"^.+\\.tsx?$": "ts-jest"
},
"testRegex": "(\\.|/)test\\.(jsx?|tsx?)$",
"moduleFileExtensions": [
"ts",
"tsx",
"js",
"jsx",
"json",
"node"
]
},
"lint-staged": {
"*.{ts,tsx}": "yarn run tslint",
"*.{js,ts,tsx}": "check_precommit_filenames"
},
"devDependencies": {
"@code/filename-check": "link:packages/code-filename-check",
"@elastic/eui": "5.0.0",
"@kbn/plugin-helpers": "link:../../kibana/packages/kbn-plugin-helpers",
"@types/angular": "^1.6.48",
"@types/boom": "7.2.0",
"@types/elasticsearch": "^5.0.24",
"@types/file-type": "^5.2.1",
"@types/get-port": "^3.2.0 ",
"@types/git-url-parse": "^9.0.0",
"@types/glob": "^5.0.35",
"@types/hapi": "^17.6.2",
"@types/jest": "^23.3.1",
"@types/js-yaml": "^3.11.2",
"@types/node": "^10.5.3",
"@types/nodegit": "^0.22.1",
"@types/papaparse": "^4.5.5",
"@types/proper-lockfile": "^3.0.0",
"@types/query-string": "^6.1.0",
"@types/react": "^16.3.16",
"@types/react-dom": "^16.0.6",
"@types/react-redux": "^6.0.2",
"@types/react-router-dom": "^4.2.7",
"@types/react-test-renderer": "^16.0.3",
"@types/redux-actions": "^2.3.0",
"@types/rimraf": "^2.0.2",
"@types/sinon": "^5.0.5",
"@types/socket.io": "^1.4.38",
"@types/socket.io-client": "^1.4.32",
"@types/styled-components": "^4.1.0",
"@types/tar-fs": "^1.16.1",
"expect.js": "^0.3.1",
"husky": "^0.14.3",
"jest": "^23.5.0",
"lint-staged": "^7.2.0",
"react-test-renderer": "^16.6.3",
"sinon": "^7.0.0",
"ts-jest": "^23.1.3",
"tslint": "^5.10.0",
"tslint-react": "^3.6.0",
"typescript": "^3.0.3"
},
"dependencies": {
"@code/esqueue": "link:packages/code-esqueue",
"@code/lsp-extension": "link:../../lsp/javascript-typescript-langserver/packages/lsp-extension",
"boom": "7.2.0",
"del": "^3.0.0",
"elasticsearch": "^15.1.1",
"file-type": "^8.1.0",
"get-port": "^3.2.0",
"git-url-parse": "^9.0.1",
"github-markdown-css": "^2.10.0",
"h2o2": "^8.1.2",
"highlights": "^3.1.1",
"history": "^4.7.2",
"immer": "^1.5.0",
"language-detect": "^1.1.0",
"moment": "^2.22.2",
"monaco-editor": "^0.14.3",
"nodegit": "git+https://github.com/elastic/nodegit.git",
"papaparse": "^4.6.2",
"path-to-regexp": "^2.2.1",
"popper.js": "^1.14.3",
"prop-types": "15.5.8",
"proper-lockfile": "^3.0.2",
"query-string": "^6.1.0",
"react": "^16.3.0",
"react-dom": "^16.4.1",
"react-markdown": "^3.4.1",
"react-redux": "^5.0.7",
"react-router": "^4.3.1",
"react-router-dom": "^4.3.1",
"redux": "^4.0.0",
"redux-actions": "^2.4.0",
"redux-saga": "^0.16.0",
"reselect": "^3.0.1",
"socket.io": "^2.1.1",
"socket.io-client": "^2.1.1",
"stats-lite": "^2.2.0",
"styled-components": "^3.4.5",
"tar-fs": "^1.16.3",
"vscode-jsonrpc": "^3.6.2",
"vscode-languageserver": "^4.2.1",
"vscode-languageserver-types": "^3.10.0"
}
}

View file

@ -1,2 +0,0 @@
export { events } from './constants/events';
export { Esqueue } from './esqueue'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env node
require('../../../../../kibana/src/setup_node_env');
require('../check_all_filenames');

View file

@ -1,3 +0,0 @@
#!/usr/bin/env node
require('../../../../../kibana/src/setup_node_env');
require('../check_precommit_filenames');

View file

@ -1,21 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { resolve } from 'path';
import globby from 'globby';
import { checkFiles } from './check_files';
import { File } from './file';
import { run } from './run';
run(async log => {
const paths = await globby(['**/*', '!**/node_modules/**'], {
cwd: resolve(__dirname, '../../'),
});
return checkFiles(log, paths.map(path => new File(path)));
});

View file

@ -1,128 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { basename, relative } from 'path';
import { ToolingLog } from '@kbn/dev-utils';
import chalk from 'chalk';
import minimatch from 'minimatch';
import { IGNORE_DIRECTORY_GLOBS, IGNORE_FILE_GLOBS, KEBAB_CASE_DIRECTORY_GLOBS } from './config';
import { File } from './file';
const NON_SNAKE_CASE_RE = /[A-Z \-]/;
const NON_KEBAB_CASE_RE = /[A-Z \_]/;
function listPaths(paths: string[]) {
return paths.map(path => ` - ${path}`).join('\n');
}
function matchesAnyGlob(path: string, globs: string[]) {
return globs.some(glob =>
minimatch(path, glob, {
dot: true,
})
);
}
/**
* IGNORE_DIRECTORY_GLOBS patterns match directories which should
* be ignored from casing validation. When one of the parent directories
* of a file matches these rules this function strips it from the
* path that is validated.
*
* if `file = new File('foo/bar/BAZ/index.js')` and `/foo/bar/BAZ`
* is matched by an `IGNORE_DIRECTORY_GLOBS` pattern then this
* function will return 'index.js' and only that part of the path
* will be validated.
*
* @param {File} file
* @return {string} pathToCheck
*/
function getPathWithoutIgnoredParents(file: File) {
for (const parent of file.getRelativeParentDirs()) {
if (matchesAnyGlob(parent, IGNORE_DIRECTORY_GLOBS)) {
return relative(parent, file.getRelativePath());
}
}
return file.getRelativePath();
}
/**
* Check for directories in the passed File objects which match the
* KEBAB_CASE_DIRECTORY_GLOBS and ensure that those directories use
* kebab case
*/
function checkForKebabCase(log: ToolingLog, files: File[]) {
const errorPaths = files
.reduce(
(acc, file) => {
const parents = file.getRelativeParentDirs();
return acc.concat(
parents.filter(
parent =>
matchesAnyGlob(parent, KEBAB_CASE_DIRECTORY_GLOBS) &&
NON_KEBAB_CASE_RE.test(basename(parent))
)
);
},
[] as string[]
)
.reduce((acc, path) => (acc.includes(path) ? acc : acc.concat(path)), [] as string[]);
if (errorPaths.length) {
log.error(`These directories MUST use kebab-case.\n${listPaths(errorPaths)}`);
return false;
}
return true;
}
/**
* Check that all passed File objects are using valid casing. Every
* file SHOULD be using snake_case but some files are allowed to stray
* based on casing_check_config.
*/
function checkForSnakeCase(log: ToolingLog, files: File[]) {
const errorPaths: string[] = [];
const warningPaths: string[] = [];
files.forEach(file => {
const path = file.getRelativePath();
const ignored = matchesAnyGlob(path, IGNORE_FILE_GLOBS);
if (ignored) {
log.debug('%j ignored', file);
return;
}
const pathToValidate = getPathWithoutIgnoredParents(file);
const invalid = NON_SNAKE_CASE_RE.test(pathToValidate);
if (!invalid) {
log.debug('%j uses valid casing', file);
} else {
const ignoredParent = file.getRelativePath().slice(0, -pathToValidate.length);
errorPaths.push(`${chalk.dim(ignoredParent)}${pathToValidate}`);
}
});
if (warningPaths.length) {
log.warning(`Filenames SHOULD be snake_case.\n${listPaths(warningPaths)}`);
}
if (errorPaths.length) {
log.error(`Filenames MUST use snake_case.\n${listPaths(errorPaths)}`);
return false;
}
return true;
}
export function checkFiles(log: ToolingLog, files: File[]) {
return checkForKebabCase(log, files) && checkForSnakeCase(log, files);
}

View file

@ -1,16 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { resolve } from 'path';
import { checkFiles } from './check_files';
import { File } from './file';
import { run } from './run';
run(log => {
const files = process.argv.slice(2).map(path => new File(resolve(path)));
return checkFiles(log, files);
});

View file

@ -1,42 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
/**
* These patterns are used to identify files that are not supposed
* to be snake_case because their names are determined by other
* systems or rules.
*
* @type {Array}
*/
export const IGNORE_FILE_GLOBS = ['types/**/*', '**/{webpackShims,__mocks__}/**/*'];
/**
* These patterns are matched against directories and indicate
* folders that must use kebab case.
*
* @type {Array}
*/
export const KEBAB_CASE_DIRECTORY_GLOBS = ['packages/*'];
/**
* These patterns are matched against directories and indicate
* explicit folders that are NOT supposed to use snake_case.
*
* When a file in one of these directories is checked, the directory
* matched by these patterns is removed from the path before
* the casing check so that the files casing is still checked. This
* allows folders like `src/ui/public/flot-charts` to exist, which
* is named to match the npm package and follow the kebab-casing
* convention there, but allows us to still verify that files within
* that directory use snake_case
*
* @type {Array}
*/
export const IGNORE_DIRECTORY_GLOBS = [
...KEBAB_CASE_DIRECTORY_GLOBS,
'**/webpackShims',
'packages/*',
];

View file

@ -1,68 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { dirname, extname, join, relative, resolve, sep } from 'path';
const PROJECT_ROOT = resolve(__dirname, '../../');
export class File {
private path: string;
private relativePath: string;
private ext: string;
constructor(path: string) {
this.path = resolve(path);
this.relativePath = relative(PROJECT_ROOT, this.path);
this.ext = extname(this.path);
}
public getAbsolutePath() {
return this.path;
}
public getRelativePath() {
return this.relativePath;
}
public isJs() {
return this.ext === '.js';
}
public isTypescript() {
return this.ext === '.ts' || this.ext === '.tsx';
}
public isFixture() {
return this.relativePath.split(sep).includes('__fixtures__');
}
public getRelativeParentDirs() {
const parents: string[] = [];
while (true) {
// NOTE: resolve() produces absolute paths, so we have to use join()
const parent = parents.length
? join(parents[parents.length - 1], '..')
: dirname(this.relativePath);
if (parent === '..' || parent === '.') {
break;
} else {
parents.push(parent);
}
}
return parents;
}
public toString() {
return this.relativePath;
}
public toJSON() {
return this.relativePath;
}
}

View file

@ -1,18 +0,0 @@
{
"name": "@code/filename-check",
"version": "0.0.0",
"private": true,
"bin": {
"check_all_filenames": "bin/check_all_filenames",
"check_precommit_filenames": "bin/check_precommit_filenames"
},
"dependencies": {
"@kbn/dev-utils": "link:../../../../kibana/packages/kbn-dev-utils",
"chalk": "^2.4.1",
"globby": "^8.0.1",
"minimatch": "^3.0.4"
},
"devDependencies": {
"@types/globby": "^8.0.0"
}
}

View file

@ -1,23 +0,0 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
import { ToolingLog } from '@kbn/dev-utils';
const log = new ToolingLog({
level: 'info',
writeTo: process.stdout,
});
export async function run(checker: (log: ToolingLog) => boolean | Promise<boolean>) {
try {
if (!(await checker(log))) {
process.exit(1);
}
} catch (error) {
log.error(error);
process.exit(1);
}
}

File diff suppressed because it is too large Load diff

View file

@ -1,24 +0,0 @@
{
"extends": "../../kibana/tsconfig.json",
"compilerOptions": {
"resolveJsonModule": true,
"baseUrl": ".",
"paths": {
"*": [
"*",
"webpackShims/*"
],
"ui/*": [
"../../kibana/src/ui/public/*"
]
}
},
"include": [
"**/*"
],
"exclude": [
".gradle",
"node_modules",
"build"
]
}

View file

@ -1,3 +0,0 @@
{
"extends": ["../../kibana/x-pack/tslint.yaml", "tslint-react"]
}

File diff suppressed because it is too large Load diff

@ -1 +0,0 @@
Subproject commit f8d3d2b0651013daa63a987413fa0da6b62c987a

@ -1 +0,0 @@
Subproject commit cb98fd63502e4966af61f008c0a13e85ef0df6ff

View file

@ -1,3 +0,0 @@
#/bin/bash
lsof -n -i :5601 | grep LISTEN | awk '{ print $2; }' | xargs kill -9

View file

@ -1,8 +0,0 @@
#!/usr/bin/env bash
cd $(dirname $0)/../lsp/javascript-typescript-langserver
git fetch
git checkout -f master
git reset --hard origin/master
git clean -xdf

View file

@ -1,5 +0,0 @@
#!/usr/bin/env bash
cd $(dirname $0)/..
tmuxp load scripts/tmux_session.yaml

View file

@ -1,31 +0,0 @@
# download: pip install --user tmuxp
# usage: tmuxp load tmux_session.yaml
# see: https://github.com/tmux-python/tmuxp
session_name: castro-dev
windows:
- window_name: kibana
panes:
- shell_command:
- cd kibana-extra/codesearch
- yarn start
- window_name: deps
layout: even-horizontal
panes:
- shell_command:
- cd kibana-extra/codesearch
- yarn start-deps
#- window_name: backend
# layout: even-horizontal
# panes:
# - shell_command:
# - ./gradlew bootRun
# - shell_command:
# - ./gradlew -t :backend:build
- window_name: others
layout: even-horizontal
panes:
- shell_command:
- cd lsp/
- shell_command:
-

View file

@ -1,3 +0,0 @@
#/bin/bash
git submodule update --init --remote --rebase

View file

@ -1,6 +0,0 @@
//include 'util'
//include 'elasticsearch'
include 'kibana-extra:code'
include 'lsp:javascript-typescript-langserver'
include 'lsp:java-langserver'

View file

@ -1,3 +0,0 @@
#!/usr/bin/env bash
echo 'not yet implemented'

View file

@ -1,4 +0,0 @@
#!/usr/bin/env bash
./gradlew lint --no-daemon
./gradlew checkAllFilenames --no-daemon

View file

@ -18,6 +18,7 @@ import { dashboardMode } from './plugins/dashboard_mode';
import { logstash } from './plugins/logstash';
import { beats } from './plugins/beats_management';
import { apm } from './plugins/apm';
import { code } from './plugins/code';
import { licenseManagement } from './plugins/license_management';
import { cloud } from './plugins/cloud';
import { indexManagement } from './plugins/index_management';
@ -46,6 +47,7 @@ module.exports = function (kibana) {
logstash(kibana),
beats(kibana),
apm(kibana),
code(kibana),
canvas(kibana),
licenseManagement(kibana),
cloud(kibana),

View file

@ -30,6 +30,7 @@
"@kbn/plugin-helpers": "9.0.2",
"@kbn/test": "1.0.0",
"@types/angular": "1.6.50",
"@types/boom": "7.2.0",
"@types/d3-array": "^1.2.1",
"@types/d3-scale": "^2.0.0",
"@types/d3-shape": "^1.2.2",
@ -37,24 +38,41 @@
"@types/d3-time-format": "^2.1.0",
"@types/elasticsearch": "^5.0.26",
"@types/expect.js": "^0.3.29",
"@types/file-type": "^5.2.1",
"@types/get-port": "^3.2.0 ",
"@types/git-url-parse": "^9.0.0",
"@types/glob": "^5.0.35",
"@types/graphql": "^0.13.1",
"@types/hapi": "^17.0.18",
"@types/history": "^4.6.2",
"@types/jest": "^23.3.1",
"@types/joi": "^13.4.2",
"@types/jsonwebtoken": "^7.2.7",
"@types/js-yaml": "^3.11.2",
"@types/lodash": "^3.10.1",
"@types/mocha": "^5.2.5",
"@types/node": "^10.5.3",
"@types/nodegit": "^0.22.1",
"@types/papaparse": "^4.5.5",
"@types/pngjs": "^3.3.1",
"@types/proper-lockfile": "^3.0.0",
"@types/prop-types": "^15.5.3",
"@types/query-string": "^6.1.0",
"@types/react": "16.3.14",
"@types/react-datepicker": "^1.1.5",
"@types/react-dom": "^16.0.5",
"@types/react-redux": "^6.0.6",
"@types/react-router-dom": "^4.3.1",
"@types/react-test-renderer": "^16.0.3",
"@types/reduce-reducers": "^0.1.3",
"@types/redux-actions": "^2.3.0",
"@types/rimraf": "^2.0.2",
"@types/sinon": "^5.0.1",
"@types/socket.io": "^1.4.38",
"@types/socket.io-client": "^1.4.32",
"@types/styled-components": "^4.1.0",
"@types/supertest": "^2.0.5",
"@types/tar-fs": "^1.16.1",
"@types/uuid": "^3.4.4",
"abab": "^1.0.4",
"ansi-colors": "^3.0.5",
@ -85,6 +103,7 @@
"gulp-mocha": "2.2.0",
"gulp-multi-process": "^1.3.1",
"hapi": "^17.5.3",
"husky": "^0.14.3",
"jest": "^23.5.0",
"jest-cli": "^23.5.0",
"jest-styled-components": "^6.1.1",
@ -109,6 +128,9 @@
"tmp": "0.0.31",
"tree-kill": "^1.1.0",
"ts-loader": "^5.2.2",
"ts-jest": "^23.1.3",
"tslint": "^5.10.0",
"tslint-react": "^3.6.0",
"typescript": "^3.0.3",
"vinyl-fs": "^3.0.2",
"xml-crypto": "^0.10.1",
@ -116,6 +138,7 @@
"yargs": "4.8.1"
},
"dependencies": {
"@code/esqueue": "link:plugins/code/packages/esqueue",
"@elastic/datemath": "5.0.1",
"@elastic/eui": "5.3.0",
"@elastic/node-crypto": "0.1.2",
@ -162,12 +185,16 @@
"dedent": "^0.7.0",
"dragselect": "1.8.1",
"elasticsearch": "^15.2.0",
"elastic-lsp-extension": "^0.1.0",
"extract-zip": "1.5.0",
"file-saver": "^1.3.8",
"file-type": "^8.1.0",
"font-awesome": "4.4.0",
"formsy-react": "^1.1.5",
"get-port": "2.1.0",
"getos": "^3.1.0",
"git-url-parse": "^9.0.1",
"github-markdown-css": "^2.10.0",
"glob": "6.0.4",
"graphql": "^0.13.2",
"graphql-fields": "^1.0.2",
@ -175,16 +202,20 @@
"graphql-tools": "^3.0.2",
"handlebars": "^4.0.10",
"hapi-auth-cookie": "^9.0.0",
"highlights": "^3.1.1",
"history": "4.7.2",
"history-extra": "^4.0.2",
"humps": "2.0.1",
"h2o2": "^8.1.2",
"icalendar": "0.7.1",
"immer": "^1.5.0",
"inline-style": "^2.0.0",
"intl": "^1.2.5",
"isomorphic-fetch": "2.2.1",
"joi": "^13.5.2",
"jquery": "^3.3.1",
"jsonwebtoken": "^8.3.0",
"language-detect": "^1.1.0",
"lodash": "npm:@elastic/lodash@3.10.1-kibana1",
"lodash.keyby": "^4.6.0",
"lodash.lowercase": "^4.3.0",
@ -199,8 +230,10 @@
"mime": "^2.2.2",
"mkdirp": "0.5.1",
"moment": "^2.20.1",
"monaco-editor": "^0.14.3",
"moment-duration-format": "^1.3.0",
"moment-timezone": "^0.5.14",
"nodegit": "git+https://github.com/elastic/nodegit.git",
"ngreact": "^0.5.1",
"nodemailer": "^4.6.4",
"object-path-immutable": "^0.5.3",
@ -211,9 +244,12 @@
"pluralize": "3.1.0",
"pngjs": "3.3.1",
"polished": "^1.9.2",
"popper.js": "^1.14.3",
"proper-lockfile": "^3.0.2",
"prop-types": "^15.6.0",
"puid": "1.0.5",
"puppeteer-core": "^1.7.0",
"query-string": "^6.1.0",
"raw-loader": "0.5.1",
"react": "^16.3.0",
"react-apollo": "^2.1.4",
@ -222,6 +258,7 @@
"react-datetime": "^2.14.0",
"react-dom": "^16.3.0",
"react-dropzone": "^4.2.9",
"react-markdown": "^3.4.1",
"react-markdown-renderer": "^1.4.0",
"react-portal": "^3.2.0",
"react-redux": "^5.0.7",
@ -238,6 +275,7 @@
"redux": "4.0.0",
"redux-actions": "2.2.1",
"redux-observable": "^1.0.0",
"redux-saga": "^0.16.0",
"redux-thunk": "2.3.0",
"redux-thunks": "^1.0.0",
"request": "^2.88.0",
@ -247,6 +285,8 @@
"rison-node": "0.3.1",
"rxjs": "^6.2.1",
"semver": "5.1.0",
"socket.io": "^2.1.1",
"socket.io-client": "^2.1.1",
"squel": "^5.12.2",
"style-it": "^1.6.12",
"styled-components": "3.3.3",
@ -260,6 +300,9 @@
"unbzip2-stream": "1.0.9",
"uuid": "3.0.1",
"venn.js": "0.2.9",
"vscode-jsonrpc": "^3.6.2",
"vscode-languageserver": "^4.2.1",
"vscode-languageserver-types": "^3.10.0",
"xregexp": "3.2.0"
},
"engines": {

5
x-pack/plugins/code/.gitignore vendored Normal file
View file

@ -0,0 +1,5 @@
*.js
!packages/esqueue/**/*.js
!webpackShims/init-monaco.js
!server/lib/**/*.js
/public/styles.css

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { SymbolLocator } from '@code/lsp-extension';
import { SymbolLocator } from 'elastic-lsp-extension';
import { TextDocumentPositionParams } from 'vscode-languageserver';
import {
Definition,

View file

@ -45,11 +45,13 @@ import { SocketService } from './server/socket_service';
import { ServerLoggerFactory } from './server/utils/server_logger_factory';
// tslint:disable-next-line no-default-export
export default (kibana: any) =>
export const code = (kibana: any) =>
new kibana.Plugin({
require: ['elasticsearch'],
name: 'code',
require: ['kibana', 'elasticsearch', 'xpack_main'],
id: 'code',
configPrefix: 'xpack.code',
publicDir: resolve(__dirname, 'public'),
uiExports: {
app: {
title: 'Code',
@ -85,8 +87,8 @@ export default (kibana: any) =>
},
init: async (server: Server, options: any) => {
const queueIndex = server.config().get('code.queueIndex');
const queueTimeout = server.config().get('code.queueTimeout');
const queueIndex = server.config().get('xpack.code.queueIndex');
const queueTimeout = server.config().get('xpack.code.queueTimeout');
const adminCluster = server.plugins.elasticsearch.getCluster('admin');
const dataCluster = server.plugins.elasticsearch.getCluster('data');
const log = new Log(server);

View file

@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/
import { DetailSymbolInformation } from '@code/lsp-extension';
import { DetailSymbolInformation } from 'elastic-lsp-extension';
import { IRange } from 'monaco-editor';
import { Repository, SourceHit } from '../model';

View file

@ -0,0 +1,3 @@
{
"codeIndexVersion": "1"
}

View file

@ -1,14 +1,14 @@
/*
* Borrowed from https://github.com/elastic/kibana/tree/master/x-pack/plugins/reporting/server/lib/esqueue
* TODO(mengwei): need to abstract this esqueue as a common library when merging into kibana's main repo.
* /
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
/*
* Borrowed from https://github.com/elastic/kibana/tree/master/x-pack/plugins/reporting/server/lib/esqueue
* TODO(mengwei): need to abstract this esqueue as a common library when merging into kibana's main repo.
*/
import { EventEmitter } from 'events';
import { Job } from './job';
import { Worker } from './worker';
@ -18,7 +18,7 @@ import { indexTimestamp } from './helpers/index_timestamp';
function omit(obj, keysToOmit) {
return Object.keys(obj).reduce((acc, key) => (
keysToOmit.includes(key) ? acc : { ...acc, [key]: obj[key] }
), {})
), {});
}
export class Esqueue extends EventEmitter {

View file

@ -1,13 +1,13 @@
/*
* Borrowed from https://github.com/elastic/kibana/blob/master/x-pack/common/poller.js
* /
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/
/*
* Borrowed from https://github.com/elastic/kibana/blob/master/x-pack/common/poller.js
*/
import _ from 'lodash';
export class Poller {

View file

@ -4,4 +4,5 @@
* you may not use this file except in compliance with the Elastic License.
*/
export { runPrecommitHook } from './run_precommit_hook';
export { events } from './constants/events';
export { Esqueue } from './esqueue';

View file

@ -5,6 +5,7 @@
"license": "Elastic-License",
"types": "./types/index.d.ts",
"dependencies": {
"lodash": "^4.17.11",
"moment": "^2.20.1",
"puid": "1.0.5"
}

View file

@ -189,7 +189,7 @@ export class Worker extends events.EventEmitter {
const doc = {
status: constants.JOB_STATUS_CANCELLED,
completed_at: completedTime,
}
};
return this.client.update({
index: job._index,

Some files were not shown because too many files have changed in this diff Show more