Merge remote-tracking branch 'upstream/master' into console_scripts

This commit is contained in:
Boaz Leskes 2016-12-23 16:17:52 +01:00
commit 036b0f6aa7
1384 changed files with 12923 additions and 64802 deletions

View file

@ -1,5 +1,8 @@
/src/core_plugins/timelion/bower_components
/src/core_plugins/timelion/vendor_components
test/fixtures/scenarios
optimize
test/fixtures/scenarios
/optimize
/src/fixtures/vislib/mock_data
/src/ui/public/angular-bootstrap
/test/fixtures/scenarios
/src/core_plugins/console/public/webpackShims
/src/core_plugins/console/public/tests/webpackShims
/src/ui/public/utils/decode_geo_hash.js
/src/core_plugins/timelion/public/webpackShims/jquery.flot.*

View file

@ -1,2 +1,4 @@
---
extends: '@elastic/kibana'
rules:
no-unused-vars: off

1
.gitignore vendored
View file

@ -34,3 +34,4 @@ selenium
*.swp
*.swo
*.out
src/ui_framework/doc_site/build/*.js*

View file

@ -38,18 +38,6 @@ module.exports = function (grunt) {
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= package.author.company %>;' +
' Licensed <%= package.license %> */\n'
},
lintThese: [
'Gruntfile.js',
'<%= root %>/tasks/**/*.js',
'<%= root %>/test/**/*.js',
'<%= src %>/**/*.js',
'!<%= src %>/ui/public/angular-bootstrap/**/*.js',
'!<%= src %>/core_plugins/timelion/bower_components/**/*.js',
'!<%= src %>/core_plugins/timelion/vendor_components/**/*.js',
'!<%= src %>/fixtures/**/*.js',
'!<%= root %>/test/fixtures/scenarios/**/*.js'
]
};
grunt.config.merge(config);

View file

@ -97,3 +97,7 @@
# Set the interval in milliseconds to sample system and process performance
# metrics. Minimum is 100ms. Defaults to 5000.
#ops.interval: 5000
# The default locale. This locale can be used in certain circumstances to substitute any missing
# translations.
#i18n.defaultLocale: "en"

16
docs/development.asciidoc Normal file
View file

@ -0,0 +1,16 @@
[[development]]
= Contributing to Kibana
[partintro]
--
Contributing to Kibana can be daunting at first, but it doesn't have to be. If
you're planning a pull request to the Kibana repository, you may want to start
with <<core-development>>.
If you'd prefer to use Kibana's internal plugin API, then check out
<<plugin-development>>.
--
include::development/core-development.asciidoc[]
include::development/plugin-development.asciidoc[]

View file

@ -0,0 +1,12 @@
[[core-development]]
== Core Development
* <<development-basepath>>
* <<development-dependencies>>
* <<development-modules>>
include::core/development-basepath.asciidoc[]
include::core/development-dependencies.asciidoc[]
include::core/development-modules.asciidoc[]

View file

@ -0,0 +1,87 @@
[[development-basepath]]
=== Considerations for basePath
All communication from the Kibana UI to the server needs to respect the
`server.basePath`. Here are the "blessed" strategies for dealing with this
based on the context:
[float]
==== `<img>` and `<a>` elements
Write the `src` or `href` urls as you would without the base path, but then
replace `src` or `href` with `kbn-src` or `kbn-href`.
["source","shell"]
-----------
<img kbn-src="plugins/kibana/images/logo.png">
-----------
[float]
==== Getting a static asset url
Use webpack to import the asset into the build. This will give you a URL in
JavaScript and gives webpack a chance to perform optimizations and
cache-busting.
["source","shell"]
-----------
// in plugin/public/main.js
import uiChrome from 'ui/chrome';
import logoUrl from 'plugins/facechimp/assets/banner.png';
uiChrome.setBrand({
logo: `url(${logoUrl}) center no-repeat`
});
-----------
[float]
==== API requests from the front-end
Use `chrome.addBasePath()` to append the basePath to the front of the url.
["source","shell"]
-----------
import chrome from 'ui/chrome';
$http.get(chrome.addBasePath('/api/plugin/things'));
-----------
[float]
==== Server side
Append `config.get('server.basePath')` to any absolute URL path.
["source","shell"]
-----------
const basePath = server.config().get('server.basePath');
server.route({
path: '/redirect',
handler(req, reply) {
reply.redirect(`${basePath}/otherLocation`);
}
});
-----------
[float]
==== BasePathProxy in dev mode
The Kibana dev server automatically runs behind a proxy with a random
`server.basePath`. This way developers will be constantly verifying that their
code works with basePath, while they write it.
To accomplish this the `serve` task does a few things:
1. change the port for the server to the `dev.basePathProxyTarget` setting (default `5603`)
2. start a `BasePathProxy` at `server.port`
- picks a random 3-letter value for `randomBasePath`
- redirects from `/` to `/{randomBasePath}`
- redirects from `/{any}/app/{appName}` to `/{randomBasePath}/app/{appName}` so that refreshes should work
- proxies all requests starting with `/{randomBasePath}/` to the Kibana server
This proxy can sometimes have unintended side effects in development, so when
needed you can opt out by passing the `--no-base-path` flag to the `serve` task
or `npm start`.
["source","shell"]
-----------
npm start -- --no-base-path
-----------

View file

@ -0,0 +1,103 @@
[[development-dependencies]]
=== Managing Dependencies
While developing plugins for use in the Kibana front-end environment you will
probably want to include a library or two (at least). While that should be
simple to do 90% of the time, there are always outliers, and some of those
outliers are very popular projects.
Before you can use an external library with Kibana you have to install it. You
do that using...
[float]
==== npm (preferred method)
Once you've http://npmsearch.com[found] a dependency you want to add, you can
install it like so:
["source","shell"]
-----------
npm install --save some-neat-library
-----------
At the top of a javascript file, just import the library using it's name:
["source","shell"]
-----------
import someNeatLibrary from 'some-neat-library';
-----------
Just like working in node.js, front-end code can require node modules installed
by npm without any additional configuration.
[float]
==== webpackShims
When a library you want to use does use es6 or common.js modules but is not
available on npm, you can copy the source of the library into a webpackShim.
["source","shell"]
-----------
# create a directory for our new library to live
mkdir -p webpackShims/some-neat-library
# download the library you want to use into that directory
curl https://cdnjs.com/some-neat-library/library.js > webpackShims/some-neat-library/index.js
-----------
Then include the library in your JavaScript code as you normally would:
["source","shell"]
-----------
import someNeatLibrary from 'some-neat-library';
-----------
[float]
==== Shimming third party code
Some JavaScript libraries do not declare their dependencies in a way that tools
like webpack can understand. It is also often the case that libraries do not
`export` their provided values, but simply write them to a global variable name
(or something to that effect).
When pulling code like this into Kibana we need to write "shims" that will
adapt the third party code to work with our application, other libraries, and
module system. To do this we can utilize the `webpackShims` directory.
The easiest way to explain how to write a shim is to show you some. Here is our
webpack shim for jQuery:
["source","shell"]
-----------
// webpackShims/jquery.js
module.exports = window.jQuery = window.$ = require('node_modules/jquery/dist/jquery');
require('ui/jquery/findTestSubject')(window.$);
-----------
This shim is loaded up anytime an `import 'jquery';` statement is found by
webpack, because of the way that `webpackShims` behaves like `node_modules`.
When that happens, the shim does two things:
. Assign the exported value of the actual jQuery module to the window at `$` and `jQuery`, allowing libraries like angular to detect that jQuery is available, and use it as the module's export value.
. Finally, a jQuery plugin that we wrote is included so that every time a file imports jQuery it will get both jQuery and the `$.findTestSubject` helper function.
Here is what our webpack shim for angular looks like:
["source","shell"]
-----------
// webpackShims/angular.js
require('jquery');
require('node_modules/angular/angular');
require('node_modules/angular-elastic/elastic');
require('ui/modules').get('kibana', ['monospaced.elastic']);
module.exports = window.angular;
-----------
What this shim does is fairly simple if you go line by line:
. makes sure that jQuery is loaded before angular (which actually runs the shim above)
. load the angular.js file from the npm installation
. load the angular-elastic plugin, a plugin we want to always be included whenever we import angular
. use the `ui/modules` module to add the module exported by angular-elastic as a dependency to the `kibana` angular module
. finally, export the window.angular variable. This means that writing `import angular from 'angular';` will properly set the angular variable to the angular library, rather than undefined which is the default behavior.

View file

@ -0,0 +1,80 @@
[[development-modules]]
=== Modules and Autoloading
[float]
==== Autoloading
Because of the disconnect between JS modules and angular directives, filters,
and services it is difficult to know what you need to import. It is even more
difficult to know if you broke something by removing an import that looked
unused.
To prevent this from being an issue the ui module provides "autoloading"
modules. The sole purpose of these modules is to extend the environment with
certain components. Here is a breakdown of those modules:
- *`import 'ui/autoload/styles'`*
Imports all styles at the root of `src/ui/public/styles`
- *`import 'ui/autoload/directives'`*
Imports all directives in `src/ui/public/directives`
- *`import 'ui/autoload/filters'`*
Imports all filters in `src/ui/public/filters`
- *`import 'ui/autoload/modules'`*
Imports angular and several ui services and "components" which Kibana
depends on without importing. The full list of imports is hard coded in the
module. Hopefully this list will shrink over time as we properly map out
the required modules and import them were they are actually necessary.
- *`import 'ui/autoload/all'`*
Imports all of the above modules
[float]
==== Resolving Require Paths
Kibana uses Webpack to bundle Kibana's dependencies.
Here is how import/require statements are resolved to a file:
NOTE: if you're familiar with the node.js algorithm, the changes are in *2.ii* and *3.i.f* to *3.i.g*
. Pick an algorithm
* if the path starts with a '.'
** append it the directory of the current file
** proceed to *3*
* if the path starts with a '/'
** search for this exact path
** proceed to *3*
* proceed to *2*
. Search for a named module
* `moduleName` = dirname(require path)`
* match if `moduleName` is or starts with one of these aliases
** replace the alias with the match and continue to ***3***
* match when any of these conditions are met:
** `./webpackShims/${moduleName}` is a directory
** `./node_modules/${moduleName}` is a directory
* if no match was found
** move to the parent directory
** start again at *2.iii* until reaching the root directory or a match is found
* if a match was found
** replace the `moduleName` prefix from the require statement with the full path of the match and proceed to *3*
. Search for a file
* the first of the following paths that resolves to a **file** is our match
** path + '.js'
** path + '.json'
** path + '.jsx'
** path + '.less'
** path
** path/${basename(path)} + '.js'
** path/${basename(path)} + '.json'
** path/${basename(path)} + '.jsx'
** path/${basename(path)} + '.less'
** path/${basename(path)}
** path/index + '.js'
** path/index + '.json'
** path/index + '.jsx'
** path/index + '.less'
** path/index
* if none of the above paths matches then an error is thrown

View file

@ -0,0 +1,14 @@
[[plugin-development]]
== Plugin Development
[IMPORTANT]
==============================================
The Kibana plugin interfaces are in a state of constant development. We cannot provide backwards compatibility for plugins due to the high rate of change. Kibana enforces that the installed plugins match the version of Kibana itself. Plugin developers will have to release a new version of their plugin for each new Kibana release as a result.
==============================================
* <<development-plugin-resources>>
* <<development-uiexports>>
include::plugin/development-plugin-resources.asciidoc[]
include::plugin/development-uiexports.asciidoc[]

View file

@ -0,0 +1,28 @@
[[development-plugin-resources]]
=== Plugin Resources
Here are some resources that will be helpful for getting started with plugin development
[float]
==== Our IRC channel
Many Kibana developers hang out on `irc.freenode.net` in the `#kibana` channel. We *want* to help you with plugin development. Even more than that, we *want your help* in understanding your plugin goals so we can build a great plugin system for you! If you've never used IRC, welcome to the fun. You can get started with the http://webchat.freenode.net/?channels=kibana[Freenode Web Client].
[float]
==== Some light reading
- Our {repo}blob/master/CONTRIBUTING.md[contributing guide] can help you get a development environment going
- Tim Roes' excellent blog series https://www.timroes.de/2016/02/21/writing-kibana-plugins-custom-applications/[Writing Kibana Plugins]
[float]
==== Videos
- https://www.elastic.co/elasticon/2015/sf/contributors-guide-to-the-kibana-galaxy[Contributors Guide to the Kibana Galaxy]
- https://www.elastic.co/elasticon/conf/2016/sf/how-to-build-your-own-kibana-plugins[Kibana Plugin Dev - Elasticon 2016]
[float]
==== Plugin Generator
Check out the https://github.com/elastic/generator-kibana-plugin[plugin generator] to kick-start your plugin.
[float]
==== References in the code
- {repo}blob/{branch}/src/server/plugins/plugin.js[Plugin class]: What options does the `kibana.Plugin` class accept?
- <<development-uiexports>>: What type of exports are available?

View file

@ -0,0 +1,17 @@
[[development-uiexports]]
=== UI Exports
An aggregate list of available UiExport types:
[cols="<h,<",options="header",]
|=======================================================================
| Type | Purpose
| hacks | Any module that should be included in every application
| visTypes | Modules that register providers with the `ui/registry/vis_types` registry.
| fieldFormats | Modules that register providers with the `ui/registry/field_formats` registry.
| spyModes | Modules that register providers with the `ui/registry/spy_modes` registry.
| chromeNavControls | Modules that register providers with the `ui/registry/chrome_nav_controls` registry.
| navbarExtensions | Modules that register providers with the `ui/registry/navbar_extensions` registry.
| docViews | Modules that register providers with the `ui/registry/doc_views` registry.
| app | Adds an application to the system. This uiExport type is defined as an object of metadata rather than just a module id.
|=======================================================================

View file

@ -1,20 +1,21 @@
[[kibana-guide]]
= Kibana User Guide
:version: 6.0.0-alpha1
:major-version: 6.x
:docker-image: docker.elastic.co/kibana/kibana:{version}
//////////
release-state can be: released | prerelease | unreleased
//////////
:release-state: unreleased
:es-ref: https://www.elastic.co/guide/en/elasticsearch/reference/master/
:version: 6.0.0-alpha1
:major-version: 6.x
:branch: master
:docker-image: docker.elastic.co/kibana/kibana:{version}
:es-ref: https://www.elastic.co/guide/en/elasticsearch/reference/{branch}/
:xpack-ref: https://www.elastic.co/guide/en/x-pack/current/
:issue: https://github.com/elastic/kibana/issues/
:pull: https://github.com/elastic/kibana/pull/
:commit: https://github.com/elastic/kibana/commit/
:repo: https://github.com/elastic/kibana/
:issue: {repo}issues/
:pull: {repo}pull/
:commit: {repo}commit/
:security: https://www.elastic.co/community/security/
@ -39,3 +40,5 @@ include::console.asciidoc[]
include::management.asciidoc[]
include::plugins.asciidoc[]
include::development.asciidoc[]

View file

@ -1,4 +1,13 @@
[[breaking-changes-6.0]]
== Breaking changes in 6.0
There are not yet any breaking changes in Kibana 6.0
This section discusses the changes that you need to be aware of when migrating
your application to Kibana 6.0.
[float]
=== Removed option to use unsupported scripting languages
*Details:* Kibana 5.x allowed users to create scripted fields using any scripting language enabled in Elasticsearch.
Kibana 6.0 will only support Painless and Lucene expression based scripts.
*Impact:* You will need to migrate your groovy, python, javascript, etc. scripted fields to Painless or Lucene expressions.

View file

@ -126,3 +126,5 @@ you must specify the path to that configuration file each time you use the `bin/
64:: Unknown command or incorrect option parameter
74:: I/O error
70:: Other error
include::plugins/known-plugins.asciidoc[]

View file

@ -0,0 +1,41 @@
[[known-plugins]]
== Known Plugins
[IMPORTANT]
.Plugin compatibility
==============================================
The Kibana plugin interfaces are in a state of constant development. We cannot provide backwards compatibility for plugins due to the high rate of change. Kibana enforces that the installed plugins match the version of Kibana itself. Plugin developers will have to release a new version of their plugin for each new Kibana release as a result.
==============================================
This list of plugins is not guaranteed to work on your version of Kibana. Instead, these are plugins that were known to work at some point with Kibana *5.x*. The Kibana installer will reject any plugins that haven't been published for your specific version of Kibana.
[float]
=== Packs
* https://www.elastic.co/downloads/x-pack[X-Pack] - security, monitoring, reporting, alerts, graph
[float]
=== Apps
* https://github.com/sivasamyk/logtrail[LogTrail] - View, analyze, search and tail log events in realtime with a developer/sysadmin friendly interface
[float]
=== Timelion Extensions
* https://github.com/fermiumlabs/mathlion[mathlion] (fermiumlabs) - enables equation parsing and advanced math under Timelion
[float]
=== Visualizations
* https://github.com/prelert/kibana-swimlane-vis[Swimlanes] (prelert)
* https://github.com/sbeyn/kibana-plugin-line-sg[Line] (sbeyn)
* https://github.com/sbeyn/kibana-plugin-gauge-sg[Gauge] (sbeyn)
* https://github.com/sbeyn/kibana-plugin-traffic-sg[Traffic] (sbeyn)
* https://github.com/JuanCarniglia/area3d_vis[3D Graph] (JuanCarniglia)
* https://github.com/nreese/enhanced_tilemap[Enhanced Tilemap] (nreese)
* https://github.com/dlumbrer/kbn_network[Network Plugin] (dlumbrer)
* https://github.com/mstoyano/kbn_c3js_vis[C3JS Visualizations] (mstoyano)
* https://github.com/clamarque/Kibana_health_metric_vis[Health Metric] (clamarque)
* https://github.com/ommsolutions/kibana_ext_metrics_vis[Extended Metric] (ommsolutions)
[float]
=== Other
* https://github.com/nreese/kibana-time-plugin[Time picker as a dashboard panel] Widget to view and edit the time range from within dashboards.
NOTE: If you want your plugin to be added to this page, open a {repo}tree/{branch}/docs/plugins/known-plugins.asciidoc[pull request].

View file

@ -88,6 +88,10 @@ mappings are available:
`SERVER_PORT`:: `server.port`
`SERVER_SSL_CERT`:: `server.ssl.cert`
`SERVER_SSL_KEY`:: `server.ssl.key`
`XPACK_SECURITY_COOKIENAME`:: `xpack.security.cookieName`
`XPACK_SECURITY_ENCRYPTIONKEY`:: `xpack.security.encryptionKey`
`XPACK_SECURITY_SECURECOOKIES`:: `xpack.security.secureCookies`
`XPACK_SECURITY_SESSIONTIMEOUT`:: `xpack.security.sessionTimeout`
These variables can be set with +docker-compose+ like this:

View file

@ -62,7 +62,8 @@
"makelogs": "makelogs",
"mocha": "mocha",
"mocha:debug": "mocha --debug-brk",
"sterilize": "grunt sterilize"
"sterilize": "grunt sterilize",
"uiFramework:start": "webpack-dev-server --config src/ui_framework/doc_site/webpack.config.js --hot --inline --content-base src/ui_framework/doc_site/build"
},
"repository": {
"type": "git",
@ -72,7 +73,8 @@
"@bigfunger/decompress-zip": "0.2.0-stripfix3",
"@bigfunger/jsondiffpatch": "0.1.38-webpack",
"@elastic/datemath": "2.3.0",
"@elastic/kibana-ui-framework": "0.0.11",
"@elastic/kibana-ui-framework": "0.0.13",
"@elastic/webpack-directory-name-as-main": "2.0.2",
"@spalger/filesaver": "1.1.2",
"@spalger/leaflet-draw": "0.2.3",
"@spalger/leaflet-heat": "0.1.3",
@ -80,13 +82,15 @@
"@spalger/test-subj-selector": "0.2.1",
"@spalger/ui-ace": "0.2.3",
"JSONStream": "1.1.1",
"accept-language-parser": "1.2.0",
"angular": "1.4.7",
"angular-bootstrap-colorpicker": "3.0.19",
"angular-elastic": "2.5.0",
"angular-route": "1.4.7",
"angular-sanitize": "1.5.7",
"angular-sortable-view": "0.0.15",
"ansicolors": "0.3.2",
"autoprefixer": "6.3.7",
"autoprefixer": "6.5.4",
"autoprefixer-loader": "2.0.0",
"babel": "5.8.38",
"babel-core": "5.8.38",
@ -103,8 +107,8 @@
"d3": "3.5.6",
"d3-cloud": "1.2.1",
"dragula": "3.7.0",
"elasticsearch": "12.0.0-rc5",
"elasticsearch-browser": "12.0.0-rc5",
"elasticsearch": "12.1.2",
"elasticsearch-browser": "12.1.2",
"encode-uri-query": "1.0.0",
"even-better": "7.0.2",
"expiry-js": "0.1.7",
@ -131,7 +135,7 @@
"json-stringify-safe": "5.0.1",
"jstimezonedetect": "1.0.5",
"leaflet": "0.7.5",
"less": "2.7.0",
"less": "2.7.1",
"less-loader": "2.2.3",
"lodash": "3.10.1",
"marked": "0.3.6",
@ -141,14 +145,17 @@
"moment-timezone": "0.5.4",
"no-ui-slider": "1.2.0",
"node-fetch": "1.3.2",
"node-sass": "3.8.0",
"node-uuid": "1.4.7",
"pegjs": "0.9.0",
"postcss-loader": "1.2.1",
"querystring-browser": "1.0.4",
"raw-loader": "0.5.1",
"request": "2.61.0",
"rimraf": "2.4.3",
"rison-node": "1.0.0",
"rjs-repack-loader": "1.0.6",
"sass-loader": "4.0.0",
"script-loader": "0.6.1",
"semver": "5.1.0",
"style-loader": "0.12.3",
@ -159,23 +166,25 @@
"url-loader": "0.5.6",
"validate-npm-package-name": "2.2.2",
"vision": "4.1.0",
"webpack": "1.12.15",
"webpack-directory-name-as-main": "1.0.0",
"webpack": "github:elastic/webpack#fix/query-params-for-aliased-loaders",
"whatwg-fetch": "0.9.0",
"wreck": "6.2.0"
},
"devDependencies": {
"@elastic/eslint-config-kibana": "0.0.3",
"@elastic/eslint-config-kibana": "0.3.0",
"angular-mocks": "1.4.7",
"auto-release-sinon": "1.0.3",
"babel-eslint": "4.1.8",
"babel-eslint": "6.1.2",
"chai": "3.5.0",
"cheerio": "0.22.0",
"chokidar": "1.6.0",
"chromedriver": "2.24.1",
"classnames": "2.2.5",
"del": "1.2.1",
"elasticdump": "2.1.1",
"eslint": "1.10.3",
"eslint-plugin-mocha": "1.1.0",
"eslint": "3.11.1",
"eslint-plugin-babel": "4.0.0",
"eslint-plugin-mocha": "4.7.0",
"event-stream": "3.3.2",
"expect.js": "0.3.1",
"faker": "1.1.0",
@ -189,9 +198,11 @@
"grunt-karma": "2.0.0",
"grunt-run": "0.6.0",
"grunt-simple-mocha": "0.4.0",
"gruntify-eslint": "1.0.1",
"gulp-sourcemaps": "1.7.3",
"handlebars": "4.0.5",
"highlight.js": "9.0.0",
"history": "2.1.1",
"html-loader": "0.4.3",
"husky": "0.8.1",
"image-diff": "1.6.0",
"intern": "3.2.3",
@ -203,6 +214,7 @@
"karma-ie-launcher": "0.2.0",
"karma-mocha": "0.2.0",
"karma-safari-launcher": "0.1.1",
"keymirror": "0.1.1",
"license-checker": "5.1.2",
"load-grunt-config": "0.19.2",
"makelogs": "3.1.1",
@ -214,12 +226,21 @@
"npm": "3.10.8",
"portscanner": "1.0.0",
"proxyquire": "1.7.10",
"react": "15.2.0",
"react-addons-test-utils": "15.2.0",
"react-dom": "15.2.0",
"react-redux": "4.4.5",
"react-router": "2.0.0",
"react-router-redux": "4.0.4",
"redux": "3.0.0",
"redux-thunk": "0.1.0",
"simple-git": "1.37.0",
"sinon": "1.17.2",
"source-map": "0.5.6",
"source-map-support": "0.2.10",
"supertest": "1.2.0",
"supertest-as-promised": "2.0.2"
"supertest-as-promised": "2.0.2",
"webpack-dev-server": "1.14.1"
},
"engines": {
"node": "6.9.0",

View file

@ -24,7 +24,7 @@ export default class MockClusterFork extends EventEmitter {
dead = true;
this.emit('exit');
cluster.emit('exit', this, this.exitCode || 0);
}());
})();
}),
},
isDead: sinon.spy(() => dead),
@ -39,6 +39,6 @@ export default class MockClusterFork extends EventEmitter {
await wait();
dead = false;
this.emit('online');
}());
})();
}
}

View file

@ -108,7 +108,7 @@ export default class BasePathProxy {
method: '*',
path: `/{oldBasePath}/{kbnPath*}`,
handler(req, reply) {
const {oldBasePath, kbnPath = ''} = req.params;
const { oldBasePath, kbnPath = '' } = req.params;
const isGet = req.method === 'get';
const isBasePath = oldBasePath.length === 3;

View file

@ -86,19 +86,16 @@ module.exports = class ClusterManager {
const chokidar = require('chokidar');
const fromRoot = require('../../utils/from_root');
const watchPaths = uniq(
[
fromRoot('src/core_plugins'),
fromRoot('src/server'),
fromRoot('src/ui'),
fromRoot('src/utils'),
fromRoot('config'),
...extraPaths
]
.map(path => resolve(path))
);
const watchPaths = [
fromRoot('src/core_plugins'),
fromRoot('src/server'),
fromRoot('src/ui'),
fromRoot('src/utils'),
fromRoot('config'),
...extraPaths
].map(path => resolve(path));
this.watcher = chokidar.watch(watchPaths, {
this.watcher = chokidar.watch(uniq(watchPaths), {
cwd: fromRoot('.'),
ignored: /[\\\/](\..*|node_modules|bower_components|public|__tests__)[\\\/]/
});

View file

@ -5,16 +5,16 @@ import { EventEmitter } from 'events';
import { BinderFor, fromRoot } from '../../utils';
let cliPath = fromRoot('src/cli');
let baseArgs = _.difference(process.argv.slice(2), ['--no-watch']);
let baseArgv = [process.execPath, cliPath].concat(baseArgs);
const cliPath = fromRoot('src/cli');
const baseArgs = _.difference(process.argv.slice(2), ['--no-watch']);
const baseArgv = [process.execPath, cliPath].concat(baseArgs);
cluster.setupMaster({
exec: cliPath,
silent: false
});
let dead = fork => {
const dead = fork => {
return fork.isDead() || fork.killed;
};
@ -40,7 +40,7 @@ module.exports = class Worker extends EventEmitter {
this.clusterBinder = new BinderFor(cluster);
this.processBinder = new BinderFor(process);
let argv = _.union(baseArgv, opts.argv || []);
const argv = _.union(baseArgv, opts.argv || []);
this.env = {
kbnWorkerType: this.type,
kbnWorkerArgv: JSON.stringify(argv)
@ -124,8 +124,8 @@ module.exports = class Worker extends EventEmitter {
}
flushChangeBuffer() {
let files = _.unique(this.changes.splice(0));
let prefix = files.length > 1 ? '\n - ' : '';
const files = _.unique(this.changes.splice(0));
const prefix = files.length > 1 ? '\n - ' : '';
return files.reduce(function (list, file) {
return `${list || ''}${prefix}"${file}"`;
}, '');

View file

@ -40,15 +40,15 @@ Command.prototype.unknownArgv = function (argv) {
* @return {[type]} [description]
*/
Command.prototype.collectUnknownOptions = function () {
let title = `Extra ${this._name} options`;
const title = `Extra ${this._name} options`;
this.allowUnknownOption();
this.getUnknownOptions = function () {
let opts = {};
let unknowns = this.unknownArgv();
const opts = {};
const unknowns = this.unknownArgv();
while (unknowns.length) {
let opt = unknowns.shift().split('=');
const opt = unknowns.shift().split('=');
if (opt[0].slice(0, 2) !== '--') {
this.error(`${title} "${opt[0]}" must start with "--"`);
}
@ -75,14 +75,14 @@ Command.prototype.collectUnknownOptions = function () {
};
Command.prototype.parseOptions = _.wrap(Command.prototype.parseOptions, function (parse, argv) {
let opts = parse.call(this, argv);
const opts = parse.call(this, argv);
this.unknownArgv(opts.unknown);
return opts;
});
Command.prototype.action = _.wrap(Command.prototype.action, function (action, fn) {
return action.call(this, function (...args) {
let ret = fn.apply(this, args);
const ret = fn.apply(this, args);
if (ret && typeof ret.then === 'function') {
ret.then(null, function (e) {
console.log('FATAL CLI ERROR', e.stack);

View file

@ -5,12 +5,12 @@ module.exports = function (command, spaces) {
return command.outputHelp();
}
let defCmd = _.find(command.commands, function (cmd) {
const defCmd = _.find(command.commands, function (cmd) {
return cmd._name === 'serve';
});
let desc = !command.description() ? '' : command.description();
let cmdDef = !defCmd ? '' : `=${defCmd._name}`;
const desc = !command.description() ? '' : command.description();
const cmdDef = !defCmd ? '' : `=${defCmd._name}`;
return (
`
@ -31,11 +31,11 @@ function indent(str, n) {
}
function commandsSummary(program) {
let cmds = _.compact(program.commands.map(function (cmd) {
let name = cmd._name;
const cmds = _.compact(program.commands.map(function (cmd) {
const name = cmd._name;
if (name === '*') return;
let opts = cmd.options.length ? ' [options]' : '';
let args = cmd._args.map(function (arg) {
const opts = cmd.options.length ? ' [options]' : '';
const args = cmd._args.map(function (arg) {
return humanReadableArgName(arg);
}).join(' ');
@ -45,7 +45,7 @@ function commandsSummary(program) {
];
}));
let cmdLColWidth = cmds.reduce(function (width, cmd) {
const cmdLColWidth = cmds.reduce(function (width, cmd) {
return Math.max(width, cmd[0].length);
}, 0);
@ -69,6 +69,6 @@ ${indent(cmd.optionHelp(), 2)}
}
function humanReadableArgName(arg) {
let nameOutput = arg.name + (arg.variadic === true ? '...' : '');
const nameOutput = arg.name + (arg.variadic === true ? '...' : '');
return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';
}

View file

@ -1,7 +1,7 @@
import _ from 'lodash';
import ansicolors from 'ansicolors';
let log = _.restParam(function (color, label, rest1) {
const log = _.restParam(function (color, label, rest1) {
console.log.apply(console, [color(` ${_.trim(label)} `)].concat(rest1));
});

View file

@ -5,8 +5,8 @@ import listCommand from './list';
import installCommand from './install';
import removeCommand from './remove';
let argv = process.env.kbnWorkerArgv ? JSON.parse(process.env.kbnWorkerArgv) : process.argv.slice();
let program = new Command('bin/kibana-plugin');
const argv = process.env.kbnWorkerArgv ? JSON.parse(process.env.kbnWorkerArgv) : process.argv.slice();
const program = new Command('bin/kibana-plugin');
program
.version(pkg.version)
@ -23,7 +23,7 @@ program
.command('help <command>')
.description('get the help for a specific command')
.action(function (cmdName) {
let cmd = _.find(program.commands, { _name: cmdName });
const cmd = _.find(program.commands, { _name: cmdName });
if (!cmd) return program.error(`unknown command ${cmdName}`);
cmd.help();
});
@ -35,7 +35,7 @@ program
});
// check for no command name
let subCommand = argv[2] && !String(argv[2][0]).match(/^-|^\.|\//);
const subCommand = argv[2] && !String(argv[2][0]).match(/^-|^\.|\//);
if (!subCommand) {
program.defaultHelp();
}

View file

@ -8,7 +8,7 @@ describe('kibana cli', function () {
describe('commander options', function () {
let program = {
const program = {
command: function () { return program; },
description: function () { return program; },
option: function () { return program; },

View file

@ -19,7 +19,7 @@ export function cleanPrevious(settings, logger) {
resolve();
}
});
};
}
export function cleanArtifacts(settings) {
// delete the working directory.
@ -29,4 +29,4 @@ export function cleanArtifacts(settings) {
rimraf.sync(settings.plugins[0].path);
}
catch (e) {} // eslint-disable-line no-empty
};
}

View file

@ -42,4 +42,4 @@ export function download(settings, logger) {
}
return tryNext();
};
}

View file

@ -3,7 +3,7 @@ import { createWriteStream, createReadStream, unlinkSync, statSync } from 'fs';
function openSourceFile({ sourcePath }) {
try {
let fileInfo = statSync(sourcePath);
const fileInfo = statSync(sourcePath);
const readStream = createReadStream(sourcePath);

View file

@ -53,7 +53,7 @@ export default async function downloadUrl(logger, sourceUrl, targetPath, timeout
const { req, resp } = await sendRequest({ sourceUrl, timeout });
try {
let totalSize = parseFloat(resp.headers['content-length']) || 0;
const totalSize = parseFloat(resp.headers['content-length']) || 0;
const progress = new Progress(logger);
progress.init(totalSize);

View file

@ -49,4 +49,4 @@ export default function pluginInstall(program) {
install file:///Path/to/my/x-pack.zip
install https://path.to/my/x-pack.zip`)
.action(processCommand);
};
}

View file

@ -140,4 +140,4 @@ export async function extract(settings, logger) {
logger.error(err);
throw new Error('Error extracting plugin archive');
}
};
}

View file

@ -21,7 +21,7 @@ export function parseMilliseconds(val) {
}
return result;
};
}
export function parse(command, options, kbnPackage) {
const settings = {
@ -44,4 +44,4 @@ export function parse(command, options, kbnPackage) {
};
return settings;
};
}

View file

@ -1 +1 @@
export class UnsupportedProtocolError extends Error {};
export class UnsupportedProtocolError extends Error {}

View file

@ -41,6 +41,6 @@ export default class Logger {
}
process.stderr.write(`${data}\n`);
this.previousLineEnded = true;
};
}
}

View file

@ -29,4 +29,4 @@ export default function pluginList(program) {
)
.description('list installed plugins')
.action(processCommand);
};
}

View file

@ -6,4 +6,4 @@ export function parse(command, options) {
};
return settings;
};
}

View file

@ -39,4 +39,4 @@ export default function pluginRemove(program) {
`common examples:
remove x-pack`)
.action(processCommand);
};
}

View file

@ -12,4 +12,4 @@ export function parse(command, options) {
settings.pluginPath = resolve(settings.pluginDir, settings.plugin);
return settings;
};
}

View file

@ -1,34 +1,36 @@
---
root: true
extends: '@elastic/kibana'
extends: '../../../.eslintrc'
rules:
block-scoped-var: [0]
camelcase: [0]
curly: [0]
dot-location: [0]
dot-notation: [0]
eqeqeq: [0]
guard-for-in: [0]
indent: [0]
max-len: [0]
new-cap: [0]
no-caller: [0]
no-empty: [0]
no-extend-native: [0]
no-loop-func: [0]
no-multi-str: [0]
no-nested-ternary: [0]
no-proto: [0]
no-sequences: [0]
no-undef: [0]
no-use-before-define: [0]
one-var: [0]
quotes: [0]
space-before-blocks: [0]
space-in-parens: [0]
space-infix-ops: [0]
semi: [0]
strict: [0]
wrap-iife: [0]
block-scoped-var: off
camelcase: off
curly: off
dot-location: off
dot-notation: off
eqeqeq: off
guard-for-in: off
indent: off
max-len: off
new-cap: off
no-caller: off
no-empty: off
no-extend-native: off
no-loop-func: off
no-multi-str: off
no-nested-ternary: off
no-proto: off
no-sequences: off
no-undef: off
no-use-before-define: off
one-var: off
quotes: off
space-before-blocks: off
space-in-parens: off
space-infix-ops: off
semi: off
strict: off
wrap-iife: off
no-var: off
prefer-const: off

View file

@ -28,7 +28,7 @@ function ES_5_0() {
}, this);
}
ES_5_0.prototype = _.create(Api.prototype, {'constructor': ES_5_0});
ES_5_0.prototype = _.create(Api.prototype, { 'constructor': ES_5_0 });
(function (cls) {
cls.addEndpointDescription = function (endpoint, description) {

View file

@ -1,12 +1,12 @@
var simple_metric = {
__template: {field: ""},
__template: { field: "" },
field: "{field}",
missing: 0,
script: {
// populated by a global rule
}
}, field_metric = {
__template: {field: ""},
__template: { field: "" },
field: "{field}"
}, gap_policy = {
__one_of: ["skip", "insert_zeros"]
@ -51,9 +51,9 @@ var rules = {
}
},
"filters": {
"*": {__scope_link: "GLOBAL.filter"}
"*": { __scope_link: "GLOBAL.filter" }
},
"other_bucket": {__one_of: [true, false]},
"other_bucket": { __one_of: [true, false] },
"other_bucket_key": ""
},
"missing": field_metric,
@ -81,9 +81,9 @@ var rules = {
__template: {
"_term": "asc"
},
"_term": {__one_of: ["asc", "desc"]},
"_count": {__one_of: ["asc", "desc"]},
"*": {__one_of: ["asc", "desc"]}
"_term": { __one_of: ["asc", "desc"] },
"_count": { __one_of: ["asc", "desc"] },
"*": { __one_of: ["asc", "desc"] }
},
"min_doc_count": 10,
"script": {
@ -91,9 +91,9 @@ var rules = {
},
"include": ".*",
"exclude": ".*",
"execution_hint": {__one_of: ["map", "global_ordinals", "global_ordinals_hash", "global_ordinals_low_cardinality"]},
"show_term_doc_count_error": {__one_of: [true, false]},
"collect_mode": {__one_of: ["depth_first", "breadth_first"]},
"execution_hint": { __one_of: ["map", "global_ordinals", "global_ordinals_hash", "global_ordinals_low_cardinality"] },
"show_term_doc_count_error": { __one_of: [true, false] },
"collect_mode": { __one_of: ["depth_first", "breadth_first"] },
"missing": ""
},
"significant_terms": {
@ -105,22 +105,22 @@ var rules = {
"shard_size": 10,
"shard_min_doc_count": 10,
"min_doc_count": 10,
"include": {__one_of: ["*", {pattern: "", flags: ""}]},
"exclude": {__one_of: ["*", {pattern: "", flags: ""}]},
"execution_hint": {__one_of: ["map", "global_ordinals", "global_ordinals_hash"]},
"include": { __one_of: ["*", { pattern: "", flags: "" }] },
"exclude": { __one_of: ["*", { pattern: "", flags: "" }] },
"execution_hint": { __one_of: ["map", "global_ordinals", "global_ordinals_hash"] },
"background_filter": {
__scope_link: "GLOBAL.filter"
},
"mutual_information": {
"include_negatives": {__one_of: [true, false]}
"include_negatives": { __one_of: [true, false] }
},
"chi_square": {
"include_negatives": {__one_of: [true, false]},
"background_is_superset": {__one_of: [true, false]}
"include_negatives": { __one_of: [true, false] },
"background_is_superset": { __one_of: [true, false] }
},
"percentage": {},
"gnd": {
"background_is_superset": {__one_of: [true, false]}
"background_is_superset": { __one_of: [true, false] }
},
"script_heuristic": {
__template: {
@ -135,14 +135,14 @@ var rules = {
__template: {
"field": "",
"ranges": [
{"from": 50, "to": 100},
{ "from": 50, "to": 100 },
]
},
"field": "{field}",
"ranges": [
{"to": 50, "from": 100, "key": ""}
{ "to": 50, "from": 100, "key": "" }
],
"keyed": {__one_of: [true, false]},
"keyed": { __one_of: [true, false] },
"script": {
// populated by a global rule
}
@ -151,15 +151,15 @@ var rules = {
__template: {
"field": "",
"ranges": [
{"from": "now-10d/d", "to": "now"},
{ "from": "now-10d/d", "to": "now" },
]
},
"field": "{field}",
"format": "MM-yyy",
"ranges": [
{"to": "", "from": "", "key": ""}
{ "to": "", "from": "", "key": "" }
],
"keyed": {__one_of: [true, false]},
"keyed": { __one_of: [true, false] },
"script": {
// populated by a global rule
}
@ -168,15 +168,15 @@ var rules = {
__template: {
"field": "",
"ranges": [
{"from": "10.0.0.5", "to": "10.0.0.10"},
{ "from": "10.0.0.5", "to": "10.0.0.10" },
]
},
"field": "{field}",
"format": "MM-yyy",
"ranges": [
{"to": "", "from": "", "key": "", "mask": "10.0.0.127/25"}
{ "to": "", "from": "", "key": "", "mask": "10.0.0.127/25" }
],
"keyed": {__one_of: [true, false]},
"keyed": { __one_of: [true, false] },
"script": {
// populated by a global rule
}
@ -193,11 +193,11 @@ var rules = {
__template: {
"_key": "asc"
},
"_key": {__one_of: ["asc", "desc"]},
"_count": {__one_of: ["asc", "desc"]},
"*": {__one_of: ["asc", "desc"]}
"_key": { __one_of: ["asc", "desc"] },
"_count": { __one_of: ["asc", "desc"] },
"*": { __one_of: ["asc", "desc"] }
},
"keyed": {__one_of: [true, false]},
"keyed": { __one_of: [true, false] },
"missing": 0
},
"date_histogram": {
@ -206,20 +206,20 @@ var rules = {
"interval": "month"
},
"field": "{field}",
"interval": {__one_of: ["year", "quarter", "week", "day", "hour", "minute", "second"]},
"interval": { __one_of: ["year", "quarter", "week", "day", "hour", "minute", "second"] },
"min_doc_count": 0,
"order": {
__template: {
"_key": "asc"
},
"_key": {__one_of: ["asc", "desc"]},
"_count": {__one_of: ["asc", "desc"]},
"*": {__one_of: ["asc", "desc"]}
"_key": { __one_of: ["asc", "desc"] },
"_count": { __one_of: ["asc", "desc"] },
"*": { __one_of: ["asc", "desc"] }
},
"keyed": {__one_of: [true, false]},
"keyed": { __one_of: [true, false] },
"pre_zone": "-01:00",
"post_zone": "-01:00",
"pre_zone_adjust_large_interval": {__one_of: [true, false]},
"pre_zone_adjust_large_interval": { __one_of: [true, false] },
"factor": 1000,
"pre_offset": "1d",
"post_offset": "1d",
@ -230,18 +230,18 @@ var rules = {
"geo_distance": {
__template: {
"field": "location",
"origin": {"lat": 52.3760, "lon": 4.894},
"origin": { "lat": 52.3760, "lon": 4.894 },
"ranges": [
{"from": 100, "to": 300},
{ "from": 100, "to": 300 },
]
},
"field": "{field}",
"origin": {"lat": 0.0, "lon": 0.0},
"unit": {__one_of: ["mi", "km", "in", "yd", "m", "cm", "mm"]},
"origin": { "lat": 0.0, "lon": 0.0 },
"unit": { __one_of: ["mi", "km", "in", "yd", "m", "cm", "mm"] },
"ranges": [
{"from": 50, "to": 100}
{ "from": 50, "to": 100 }
],
"distance_type": {__one_of: ["arc", "sloppy_arc", "plane"]}
"distance_type": { __one_of: ["arc", "sloppy_arc", "plane"] }
},
"geohash_grid": {
@ -250,7 +250,7 @@ var rules = {
"precision": 3
},
"field": "{field}",
"precision": {__one_of: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]},
"precision": { __one_of: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12] },
"size": 10,
"shard_size": 10
},
@ -269,7 +269,7 @@ var rules = {
// populated by a global rule
},
"compression": 100,
"method": {__one_of: ["hdr", "tdigest"]},
"method": { __one_of: ["hdr", "tdigest"] },
missing: 0
},
"cardinality": {
@ -311,7 +311,7 @@ var rules = {
field: ""
},
field: "{field}",
wrap_longitude: {__one_of: [true, false]}
wrap_longitude: { __one_of: [true, false] }
},
"top_hits": {
__template: {
@ -324,7 +324,7 @@ var rules = {
__scope_link: "_search.sort"
},
highlight: {},
explain: {__one_of: [true, false]},
explain: { __one_of: [true, false] },
_source: {
__template: "",
__scope_link: "_search._source"
@ -333,7 +333,7 @@ var rules = {
__scope_link: "_search.script_fields"
},
docvalue_fields: ["{field}"],
version: {__one_of: [true, false]}
version: { __one_of: [true, false] }
},
"percentile_ranks": {
__template: {
@ -346,7 +346,7 @@ var rules = {
// populated by a global rule
},
"compression": 100,
"method": {__one_of: ["hdr", "tdigest"]},
"method": { __one_of: ["hdr", "tdigest"] },
missing: 0
},
"sampler": {
@ -357,7 +357,7 @@ var rules = {
},
"shard_size": 100,
"max_docs_per_value": 3,
"execution_hint": {__one_of: ["map", "global_ordinals", "bytes_hash"]}
"execution_hint": { __one_of: ["map", "global_ordinals", "bytes_hash"] }
},
"children": {
__template: {
@ -378,9 +378,9 @@ var rules = {
format: "",
gap_policy: gap_policy,
"window": 5,
model: {__one_of: ["simple", "linear", "ewma", "holt", "holt_winters"]},
model: { __one_of: ["simple", "linear", "ewma", "holt", "holt_winters"] },
settings: {
type: {__one_of: ["add", "mult"]},
type: { __one_of: ["add", "mult"] },
alpha: 0.5,
beta: 0.5,
gamma: 0.5,

View file

@ -7,7 +7,7 @@ module.exports = function (api) {
data_autocomplete_rules: {
'actions': {
__template: [
{'add': {'index': 'test1', 'alias': 'alias1'}}
{ 'add': { 'index': 'test1', 'alias': 'alias1' } }
],
__any_of: [
{

View file

@ -1,7 +1,7 @@
let _ = require("lodash");
function addSimpleCat(endpoint, api, params, patterns) {
var url_params = {"help": "__flag__", "v": "__flag__", "bytes": ["b"]};
var url_params = { "help": "__flag__", "v": "__flag__", "bytes": ["b"] };
_.each(params || [], function (p) {
if (_.isString(p)) {
url_params[p] = "__flag__";
@ -37,10 +37,10 @@ module.exports = function (api) {
addSimpleCat('_cat/allocation', api, null, ['_cat/allocation', '_cat/allocation/{nodes}']);
addSimpleCat('_cat/count', api);
addSimpleCat('_cat/health', api, [
{"ts": ["false", "true"]}
{ "ts": ["false", "true"] }
]);
addSimpleCat('_cat/indices', api, [
{h: []},
{ h: [] },
"pri",
],
['_cat/indices', '_cat/indices/{indices}']);

View file

@ -38,11 +38,11 @@ module.exports = function (api) {
persistent: {
cluster: {
routing: {
'allocation.enable': {__one_of: ["all", "primaries", "new_primaries", "none"]},
'allocation.disk.threshold_enabled': {__one_of: [false, true]},
'allocation.enable': { __one_of: ["all", "primaries", "new_primaries", "none"] },
'allocation.disk.threshold_enabled': { __one_of: [false, true] },
'allocation.disk.watermark.low': '85%',
'allocation.disk.watermark.high': '90%',
'allocation.disk.include_relocations': {__one_of: [true, false]},
'allocation.disk.include_relocations': { __one_of: [true, false] },
'allocation.disk.reroute_interval': '60s',
'allocation.exclude': {
'_ip': "",
@ -68,11 +68,11 @@ module.exports = function (api) {
'values': []
}
},
'allocation.allow_rebalance': {__one_of: ['always', 'indices_primaries_active', 'indices_all_active']},
'allocation.allow_rebalance': { __one_of: ['always', 'indices_primaries_active', 'indices_all_active'] },
'allocation.cluster_concurrent_rebalance': 2,
'allocation.node_initial_primaries_recoveries': 4,
'allocation.node_concurrent_recoveries': 2,
'allocation.same_shard.host': {__one_of: [false, true]}
'allocation.same_shard.host': { __one_of: [false, true] }
}
},
indices: {
@ -121,7 +121,7 @@ module.exports = function (api) {
index: "{index}",
shard: 0,
node: "{node}",
allow_primary: {__one_of: [true, false]}
allow_primary: { __one_of: [true, false] }
},
allocate: {
__template: {
@ -132,11 +132,11 @@ module.exports = function (api) {
index: "{index}",
shard: 0,
node: "{node}",
allow_primary: {__one_of: [true, false]}
allow_primary: { __one_of: [true, false] }
}
}
],
dry_run: {__one_of: [true, false]}
dry_run: { __one_of: [true, false] }
}
});
};

View file

@ -114,7 +114,7 @@ module.exports = function (api) {
},
"doc": {},
"upsert": {},
"scripted_upsert": {__one_of: [true, false]}
"scripted_upsert": { __one_of: [true, false] }
}
});
@ -159,13 +159,13 @@ module.exports = function (api) {
fields: [
"{field}"
],
offsets: {__one_of: [false, true]},
payloads: {__one_of: [false, true]},
positions: {__one_of: [false, true]},
term_statistics: {__one_of: [true, false]},
field_statistics: {__one_of: [false, true]},
offsets: { __one_of: [false, true] },
payloads: { __one_of: [false, true] },
positions: { __one_of: [false, true] },
term_statistics: { __one_of: [true, false] },
field_statistics: { __one_of: [false, true] },
per_field_analyzer: {
__template: {"FIELD": ""},
__template: { "FIELD": "" },
"{field}": ""
},
routing: "",
@ -206,14 +206,14 @@ module.exports = function (api) {
fields: [
"{field}"
],
offsets: {__one_of: [false, true]},
payloads: {__one_of: [false, true]},
positions: {__one_of: [false, true]},
term_statistics: {__one_of: [true, false]},
field_statistics: {__one_of: [false, true]},
dfs: {__one_of: [true, false]},
offsets: { __one_of: [false, true] },
payloads: { __one_of: [false, true] },
positions: { __one_of: [false, true] },
term_statistics: { __one_of: [true, false] },
field_statistics: { __one_of: [false, true] },
dfs: { __one_of: [true, false] },
per_field_analyzer: {
__template: {"FIELD": ""},
__template: { "FIELD": "" },
"{field}": ""
},
routing: "",

View file

@ -260,7 +260,7 @@ filters.range = {
lt: 20,
time_zone: "+1:00",
"format": "dd/MM/yyyy||yyyy",
execution: {__one_of: ["index", "fielddata"]}
execution: { __one_of: ["index", "fielddata"] }
}
};

View file

@ -108,7 +108,7 @@ module.exports = function (api) {
tokenizer: "",
char_filter: [],
filter: [],
explain: {__one_of: [false, true]},
explain: { __one_of: [false, true] },
attributes: []
}
});

View file

@ -195,7 +195,7 @@ module.exports = function (api) {
__scope_link: '_put_mapping.type.properties.field'
}
},
copy_to: {__one_of: ['{field}', ['{field}']]},
copy_to: { __one_of: ['{field}', ['{field}']] },
// nested
include_in_parent: BOOLEAN,

View file

@ -38,7 +38,7 @@ module.exports = function (api) {
query: {},
filter: {},
size: 10,
track_scores: {__one_of: [true, false]},
track_scores: { __one_of: [true, false] },
sort: "_score",
aggs: {},
highlight: {}
@ -64,7 +64,7 @@ module.exports = function (api) {
query: {},
filter: {},
size: 10,
track_scores: {__one_of: [true, false]},
track_scores: { __one_of: [true, false] },
sort: "_score",
aggs: {},
highlight: {}

View file

@ -120,7 +120,7 @@ module.exports = function (api) {
__one_of: [true, false]
},
tie_breaker: 0.0,
type: {__one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix']}
type: { __one_of: ['best_fields', 'most_fields', 'cross_fields', 'phrase', 'phrase_prefix'] }
},
bool: {
must: [
@ -321,12 +321,12 @@ module.exports = function (api) {
},
query: "",
fields: ["{field}"],
default_operator: {__one_of: ["OR", "AND"]},
default_operator: { __one_of: ["OR", "AND"] },
analyzer: "",
flags: "OR|AND|PREFIX",
lowercase_expanded_terms: {__one_of: [true, false]},
lowercase_expanded_terms: { __one_of: [true, false] },
locale: "ROOT",
lenient: {__one_of: [true, false]}
lenient: { __one_of: [true, false] }
},
range: {
__template: {
@ -606,8 +606,8 @@ module.exports = function (api) {
)
],
boost: 1.0,
boost_mode: {__one_of: ["multiply", "replace", "sum", "avg", "max", "min"]},
score_mode: {__one_of: ["multiply", "sum", "first", "avg", "max", "min"]},
boost_mode: { __one_of: ["multiply", "replace", "sum", "avg", "max", "min"] },
score_mode: { __one_of: ["multiply", "sum", "first", "avg", "max", "min"] },
max_boost: 10,
min_score: 1.0
},

View file

@ -112,9 +112,9 @@ module.exports = function (api) {
""
]
},
distance_type: {__one_of: ["sloppy_arc", "arc", "plane"]},
sort_mode: {__one_of: ["min", "max", "avg"]},
order: {__one_of: ["asc", "desc"]},
distance_type: { __one_of: ["sloppy_arc", "arc", "plane"] },
sort_mode: { __one_of: ["min", "max", "avg"] },
order: { __one_of: ["asc", "desc"] },
unit: "km"
}
}
@ -173,7 +173,7 @@ module.exports = function (api) {
},
stats: [''],
timeout: "1s",
version: {__one_of: [true, false]}
version: { __one_of: [true, false] }
}
});
@ -187,8 +187,8 @@ module.exports = function (api) {
data_autocomplete_rules: {
"template": {
__one_of: [
{__scope_link: "_search"},
{__scope_link: "GLOBAL.script"}
{ __scope_link: "_search" },
{ __scope_link: "GLOBAL.script" }
]
},
"params": {}
@ -202,8 +202,8 @@ module.exports = function (api) {
],
data_autocomplete_rules: {
__one_of: [
{"inline": {__scope_link: "_search"}},
{__scope_link: "GLOBAL.script"}
{ "inline": { __scope_link: "_search" } },
{ __scope_link: "GLOBAL.script" }
],
"params": {}
}

View file

@ -9,7 +9,7 @@ module.exports = function (api) {
},
data_autocomplete_rules: {
indices: "*",
ignore_unavailable: {__one_of: [true, false]},
ignore_unavailable: { __one_of: [true, false] },
include_global_state: false,
rename_pattern: "index_(.+)",
rename_replacement: "restored_index_$1"
@ -41,9 +41,9 @@ module.exports = function (api) {
},
data_autocomplete_rules: {
indices: "*",
ignore_unavailable: {__one_of: [true, false]},
include_global_state: {__one_of: [true, false]},
partial: {__one_of: [true, false]}
ignore_unavailable: { __one_of: [true, false] },
include_global_state: { __one_of: [true, false] },
partial: { __one_of: [true, false] }
}
});
@ -86,7 +86,7 @@ module.exports = function (api) {
'_snapshot/{id}'
],
data_autocomplete_rules: {
__template: {"type": ""},
__template: { "type": "" },
"type": {
__one_of: ["fs", "url", "s3", "hdfs"]
@ -101,7 +101,7 @@ module.exports = function (api) {
location: "path"
},
location: "path",
compress: {__one_of: [true, false]},
compress: { __one_of: [true, false] },
concurrent_streams: 5,
chunk_size: "10m",
max_restore_bytes_per_sec: "20mb",
@ -129,7 +129,7 @@ module.exports = function (api) {
base_path: "",
concurrent_streams: 5,
chunk_size: "10m",
compress: {__one_of: [true, false]}
compress: { __one_of: [true, false] }
},
{// hdfs
__condition: {
@ -140,10 +140,10 @@ module.exports = function (api) {
},
uri: "",
path: "some/path",
load_defaults: {__one_of: [true, false]},
load_defaults: { __one_of: [true, false] },
conf_location: "cfg.xml",
concurrent_streams: 5,
compress: {__one_of: [true, false]},
compress: { __one_of: [true, false] },
chunk_size: "10m"
}
]

View file

@ -19,9 +19,9 @@ module.exports = function (api) {
],
data_autocomplete_rules: {
template: 'index*',
warmers: {__scope_link: '_warmer'},
mappings: {__scope_link: '_put_mapping'},
settings: {__scope_link: '_put_settings'}
warmers: { __scope_link: '_warmer' },
mappings: { __scope_link: '_put_mapping' },
settings: { __scope_link: '_put_settings' }
}
});
};

View file

@ -151,7 +151,7 @@ module.exports = function (kibana) {
method: ['GET', 'POST'],
handler: function (req, reply) {
let server = require('./api_server/server');
let {sense_version, apis} = req.query;
let { sense_version, apis } = req.query;
if (!apis) {
reply(Boom.badRequest('"apis" is a required param.'));
return;

View file

@ -30,9 +30,9 @@ export default function init(input, output, sourceLocation = 'stored') {
}
}
else if (/^https?:\/\//.test(sourceLocation)) {
var loadFrom = {url: sourceLocation, dataType: "text", kbnXsrfToken: false};
var loadFrom = { url: sourceLocation, dataType: "text", kbnXsrfToken: false };
if (/https?:\/\/api.github.com/.test(sourceLocation)) {
loadFrom.headers = {Accept: "application/vnd.github.v3.raw"};
loadFrom.headers = { Accept: "application/vnd.github.v3.raw" };
}
$.ajax(loadFrom).done(function (data) {
resetToValues(data);
@ -110,4 +110,4 @@ export default function init(input, output, sourceLocation = 'stored') {
loadSavedState();
setupAutosave();
mappings.retrieveAutocompleteInfoFromServer();
};
}

View file

@ -75,9 +75,9 @@ module.exports = function (editor) {
function addMetaToTermsList(list, meta, template) {
return _.map(list, function (t) {
if (typeof t !== "object") {
t = {name: t};
t = { name: t };
}
return _.defaults(t, {meta: meta, template: template});
return _.defaults(t, { meta: meta, template: template });
});
}
@ -164,13 +164,13 @@ module.exports = function (editor) {
var nonEmptyToken = editor.parser.nextNonEmptyToken(tokenIter);
switch (nonEmptyToken ? nonEmptyToken.type : "NOTOKEN") {
case "paren.rparen":
newPos = {row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn()};
newPos = { row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn() };
break;
case "punctuation.colon":
nonEmptyToken = editor.parser.nextNonEmptyToken(tokenIter);
if ((nonEmptyToken || {}).type == "paren.lparen") {
nonEmptyToken = editor.parser.nextNonEmptyToken(tokenIter);
newPos = {row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn()};
newPos = { row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn() };
if (nonEmptyToken && nonEmptyToken.value.indexOf('"') === 0) {
newPos.column++;
} // don't stand on "
@ -179,7 +179,7 @@ module.exports = function (editor) {
case "paren.lparen":
case "punctuation.comma":
tokenIter.stepForward();
newPos = {row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn()};
newPos = { row: tokenIter.getCurrentTokenRow(), column: tokenIter.getCurrentTokenColumn() };
break;
}
editor.moveCursorToPosition(newPos);
@ -322,7 +322,7 @@ module.exports = function (editor) {
context.updatedForToken = _.clone(session.getTokenAt(pos.row, pos.column));
if (!context.updatedForToken) {
context.updatedForToken = {value: "", start: pos.column};
context.updatedForToken = { value: "", start: pos.column };
} // empty line
var anchorToken = context.createdWithToken;
@ -371,7 +371,7 @@ module.exports = function (editor) {
break;
}
context.textBoxPosition = {row: context.rangeToReplace.start.row, column: context.rangeToReplace.start.column};
context.textBoxPosition = { row: context.rangeToReplace.start.row, column: context.rangeToReplace.start.column };
switch (context.autoCompleteType) {
case "path":
@ -509,7 +509,7 @@ module.exports = function (editor) {
function addMethodAutoCompleteSetToContext(context, pos) {
context.autoCompleteSet = _.map(["GET", "PUT", "POST", "DELETE", "HEAD"], function (m, i) {
return {name: m, score: -i, meta: "method"}
return { name: m, score: -i, meta: "method" }
})
}
@ -838,7 +838,7 @@ module.exports = function (editor) {
LAST_EVALUATED_TOKEN = null;
return;
}
currentToken = {start: 0, value: ""}; // empty row
currentToken = { start: 0, value: "" }; // empty row
}
currentToken.row = pos.row; // extend token with row. Ace doesn't supply it by default

View file

@ -97,7 +97,7 @@ function compileParametrizedValue(value, compilingContext, template) {
}
component = component(value, null, template);
if (!_.isUndefined(template)) {
component = engine.wrapComponentWithDefaults(component, {template: template});
component = engine.wrapComponentWithDefaults(component, { template: template });
}
return component;
@ -169,7 +169,7 @@ function ObjectComponent(name, constants, patternsAndWildCards) {
ObjectComponent.prototype = _.create(
engine.AutocompleteComponent.prototype,
{'constructor': ObjectComponent});
{ 'constructor': ObjectComponent });
(function (cls) {
@ -244,7 +244,7 @@ function ScopeResolver(link, compilingContext) {
ScopeResolver.prototype = _.create(
engine.SharedComponent.prototype,
{'constructor': ScopeResolver});
{ 'constructor': ScopeResolver });
(function (cls) {
@ -316,7 +316,7 @@ function ConditionalProxy(predicate, delegate) {
ConditionalProxy.prototype = _.create(
engine.SharedComponent.prototype,
{'constructor': ConditionalProxy});
{ 'constructor': ConditionalProxy });
(function (cls) {
@ -345,7 +345,7 @@ function GlobalOnlyComponent(name) {
GlobalOnlyComponent.prototype = _.create(
engine.AutocompleteComponent.prototype,
{'constructor': ObjectComponent});
{ 'constructor': ObjectComponent });
(function (cls) {

View file

@ -39,7 +39,7 @@ function SharedComponent(name, parent) {
SharedComponent.prototype = _.create(
module.exports.AutocompleteComponent.prototype,
{'constructor': SharedComponent});
{ 'constructor': SharedComponent });
module.exports.SharedComponent = SharedComponent;
@ -68,7 +68,7 @@ function ListComponent(name, list, parent, multi_valued, allow_non_valid_values)
this.allow_non_valid_values = _.isUndefined(allow_non_valid_values) ? false : allow_non_valid_values;
}
ListComponent.prototype = _.create(SharedComponent.prototype, {"constructor": ListComponent});
ListComponent.prototype = _.create(SharedComponent.prototype, { "constructor": ListComponent });
module.exports.ListComponent = ListComponent;
@ -88,9 +88,9 @@ module.exports.ListComponent = ListComponent;
var meta = this.getDefaultTermMeta();
ret = _.map(ret, function (term) {
if (_.isString(term)) {
term = {"name": term};
term = { "name": term };
}
return _.defaults(term, {meta: meta});
return _.defaults(term, { meta: meta });
});
}
@ -141,7 +141,7 @@ function SimpleParamComponent(name, parent) {
SharedComponent.call(this, name, parent);
}
SimpleParamComponent.prototype = _.create(SharedComponent.prototype, {"constructor": SimpleParamComponent});
SimpleParamComponent.prototype = _.create(SharedComponent.prototype, { "constructor": SimpleParamComponent });
module.exports.SimpleParamComponent = SimpleParamComponent;
(function (cls) {
@ -162,7 +162,7 @@ function ConstantComponent(name, parent, options) {
this.options = options || [name];
}
ConstantComponent.prototype = _.create(SharedComponent.prototype, {"constructor": ConstantComponent});
ConstantComponent.prototype = _.create(SharedComponent.prototype, { "constructor": ConstantComponent });
module.exports.ConstantComponent = ConstantComponent;
(function (cls) {
@ -207,7 +207,7 @@ module.exports.wrapComponentWithDefaults = function (component, defaults) {
}
result = _.map(result, function (term) {
if (!_.isObject(term)) {
term = {name: term};
term = { name: term };
}
return _.defaults(term, defaults);
}, this);
@ -320,7 +320,7 @@ module.exports.populateContext = function (tokenPath, context, editor, includeAu
_.each(ws.components, function (component) {
_.each(component.getTerms(contextForState, editor), function (term) {
if (!_.isObject(term)) {
term = {name: term};
term = { name: term };
}
autoCompleteSet.push(term);
});

View file

@ -6,12 +6,12 @@ function ParamComponent(name, parent, description) {
this.description = description;
}
ParamComponent.prototype = _.create(engine.ConstantComponent.prototype, {"constructor": ParamComponent});
ParamComponent.prototype = _.create(engine.ConstantComponent.prototype, { "constructor": ParamComponent });
module.exports.ParamComponent = ParamComponent;
(function (cls) {
cls.getTerms = function () {
var t = {name: this.name};
var t = { name: this.name };
if (this.description === "__flag__") {
t.meta = "flag"
}

View file

@ -9,7 +9,7 @@ function AcceptEndpointComponent(endpoint, parent) {
this.endpoint = endpoint
}
AcceptEndpointComponent.prototype = _.create(engine.SharedComponent.prototype, {"constructor": AcceptEndpointComponent});
AcceptEndpointComponent.prototype = _.create(engine.SharedComponent.prototype, { "constructor": AcceptEndpointComponent });
(function (cls) {

View file

@ -1,4 +1,4 @@
<div class="localDropdownTitle">Help</div>
<div class="kuiLocalDropdownTitle">Help</div>
<tabset>
<tab heading="Request format">

View file

@ -1,4 +1,4 @@
<div class="localDropdownTitle">History</div>
<div class="kuiLocalDropdownTitle">History</div>
<div class="history-body">
<ul class="list-group history-reqs">

View file

@ -1,9 +1,9 @@
<div class="localDropdownTitle">Settings</div>
<div class="kuiLocalDropdownTitle">Settings</div>
<form class="form" name="settingsForm" ng-submit="settingsForm.$valid && settings.apply()">
<div class="form-group">
<div class="localDropdownHeader">
<div class="localDropdownHeader__label">Font Size</div>
<div class="kuiLocalDropdownHeader">
<div class="kuiLocalDropdownHeader__label">Font Size</div>
</div>
<div>
@ -27,8 +27,8 @@
</div>
<div class="form-group">
<div class="localDropdownHeader">
<div class="localDropdownHeader__label">Autocomplete</div>
<div class="kuiLocalDropdownHeader">
<div class="kuiLocalDropdownHeader__label">Autocomplete</div>
</div>
<div class="checkbox">

View file

@ -1,4 +1,4 @@
<div class="localDropdownTitle">Welcome to Console</div>
<div class="kuiLocalDropdownTitle">Welcome to Console</div>
<p><strong>Quick intro to the UI</strong></p>

View file

@ -28,21 +28,21 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output) {
input.commands.addCommand({
name: 'auto indent request',
bindKey: {win: 'Ctrl-I', mac: 'Command-I'},
bindKey: { win: 'Ctrl-I', mac: 'Command-I' },
exec: function () {
input.autoIndent();
}
});
input.commands.addCommand({
name: 'move to previous request start or end',
bindKey: {win: 'Ctrl-Up', mac: 'Command-Up'},
bindKey: { win: 'Ctrl-Up', mac: 'Command-Up' },
exec: function () {
input.moveToPreviousRequestEdge()
}
});
input.commands.addCommand({
name: 'move to next request start or end',
bindKey: {win: 'Ctrl-Down', mac: 'Command-Down'},
bindKey: { win: 'Ctrl-Down', mac: 'Command-Down' },
exec: function () {
input.moveToNextRequestEdge()
}
@ -228,7 +228,7 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output) {
input.commands.addCommand({
name: 'send to elasticsearch',
bindKey: {win: 'Ctrl-Enter', mac: 'Command-Enter'},
bindKey: { win: 'Ctrl-Enter', mac: 'Command-Enter' },
exec: sendCurrentRequestToES
});
@ -246,8 +246,8 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output) {
require('./input_resize')(input, output);
return input;
};
}
export default function getInput() {
return input;
};
}

View file

@ -17,7 +17,7 @@ function IndexAutocompleteComponent(name, parent, multi_valued) {
IndexAutocompleteComponent.prototype = _.create(
autocomplete_engine.ListComponent.prototype,
{'constructor': IndexAutocompleteComponent});
{ 'constructor': IndexAutocompleteComponent });
(function (cls) {
cls.validateTokens = function (tokens) {
@ -47,7 +47,7 @@ function TypeAutocompleteComponent(name, parent, multi_valued) {
TypeAutocompleteComponent.prototype = _.create(
autocomplete_engine.ListComponent.prototype,
{'constructor': TypeAutocompleteComponent});
{ 'constructor': TypeAutocompleteComponent });
(function (cls) {
cls.validateTokens = function (tokens) {
@ -69,7 +69,7 @@ TypeAutocompleteComponent.prototype = _.create(
function FieldGenerator(context) {
return _.map(mappings.getFields(context.indices, context.types), function (field) {
return {name: field.name, meta: field.type};
return { name: field.name, meta: field.type };
});
}
@ -79,7 +79,7 @@ function FieldAutocompleteComponent(name, parent, multi_valued) {
FieldAutocompleteComponent.prototype = _.create(
autocomplete_engine.ListComponent.prototype,
{'constructor': FieldAutocompleteComponent});
{ 'constructor': FieldAutocompleteComponent });
(function (cls) {
cls.validateTokens = function (tokens) {
@ -109,7 +109,7 @@ function IdAutocompleteComponent(name, parent, multi) {
IdAutocompleteComponent.prototype = _.create(
autocomplete_engine.SharedComponent.prototype,
{'constructor': IdAutocompleteComponent});
{ 'constructor': IdAutocompleteComponent });
(function (cls) {
cls.match = function (token, context, editor) {

View file

@ -155,7 +155,7 @@ function getFieldNamesFromFieldMapping(field_name, field_mapping) {
return applyPathSettings(nested_fields);
}
var ret = {name: field_name, type: field_type};
var ret = { name: field_name, type: field_type };
if (field_mapping["index_name"]) {
ret.name = field_mapping["index_name"];

View file

@ -41,7 +41,7 @@ export function initializeOutput($el) {
session.toggleFold(false);
}
session.insert({row: lastLine, column: 0}, "\n" + val);
session.insert({ row: lastLine, column: 0 }, "\n" + val);
output.moveCursorTo(lastLine + 1, 0);
if (typeof cb === 'function') {
setTimeout(cb);
@ -65,8 +65,8 @@ export function initializeOutput($el) {
}
return output;
};
}
export default function getOutput() {
return output;
};
}

View file

@ -16,8 +16,8 @@ var InputHighlightRules = function () {
reg = reg.source;
}
return [
{token: tokens.concat(["whitespace"]), regex: reg + "(\\s*)$", next: nextIfEOL},
{token: tokens, regex: reg, next: normalNext}
{ token: tokens.concat(["whitespace"]), regex: reg + "(\\s*)$", next: nextIfEOL },
{ token: tokens, regex: reg, next: normalNext }
];
}
@ -26,8 +26,8 @@ var InputHighlightRules = function () {
/*jshint -W015 */
this.$rules = {
"start": mergeTokens([
{token: "comment", regex: /^#.*$/},
{token: "paren.lparen", regex: "{", next: "json", push: true}
{ token: "comment", regex: /^#.*$/ },
{ token: "paren.lparen", regex: "{", next: "json", push: true }
],
addEOL(["method"], /([a-zA-Z]+)/, "start", "method_sep")
,

View file

@ -7,7 +7,7 @@
window.console = function () {
var msgs = Array.prototype.slice.call(arguments, 0);
window.postMessage({type: "log", data: msgs});
window.postMessage({ type: "log", data: msgs });
};
window.console.error =
window.console.warn =
@ -273,7 +273,7 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib
} else if (Array.isArray(text)) {
this._insertLines(0, text);
} else {
this.insert({row: 0, column: 0}, text);
this.insert({ row: 0, column: 0 }, text);
}
};
@ -283,7 +283,7 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib
this.setValue = function (text) {
var len = this.getLength();
this.remove(new Range(0, 0, len, this.getLine(len - 1).length));
this.insert({row: 0, column: 0}, text);
this.insert({ row: 0, column: 0 }, text);
};
this.getValue = function () {
return this.getAllLines().join(this.getNewLineCharacter());
@ -386,12 +386,12 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib
};
this.insertLines = function (row, lines) {
if (row >= this.getLength())
return this.insert({row: row, column: 0}, "\n" + lines.join("\n"));
return this.insert({ row: row, column: 0 }, "\n" + lines.join("\n"));
return this._insertLines(Math.max(row, 0), lines);
};
this._insertLines = function (row, lines) {
if (lines.length == 0)
return {row: row, column: 0};
return { row: row, column: 0 };
var end;
if (lines.length > 0xFFFF) {
end = this._insertLines(row, lines.slice(0xFFFF));
@ -596,9 +596,9 @@ define('ace/document', ['require', 'exports', 'module' , 'ace/lib/oop', 'ace/lib
for (var i = startRow || 0, l = lines.length; i < l; i++) {
index -= lines[i].length + newlineLength;
if (index < 0)
return {row: i, column: index + lines[i].length + newlineLength};
return { row: i, column: index + lines[i].length + newlineLength };
}
return {row: l - 1, column: lines[l - 1].length};
return { row: l - 1, column: lines[l - 1].length };
};
this.positionToIndex = function (pos, startRow) {
var lines = this.$lines || this.getAllLines();
@ -680,7 +680,7 @@ define('ace/lib/event_emitter', ['require', 'exports', 'module' ], function (req
EventEmitter.setDefaultHandler = function (eventName, callback) {
var handlers = this._defaultHandlers
if (!handlers)
handlers = this._defaultHandlers = {_disabled_: {}};
handlers = this._defaultHandlers = { _disabled_: {} };
if (handlers[eventName]) {
var old = handlers[eventName];
@ -918,14 +918,14 @@ define('ace/range', ['require', 'exports', 'module' ], function (require, export
this.clipRows = function (firstRow, lastRow) {
var start, end;
if (this.end.row > lastRow)
end = {row: lastRow + 1, column: 0};
end = { row: lastRow + 1, column: 0 };
else if (this.end.row < firstRow)
end = {row: firstRow, column: 0};
end = { row: firstRow, column: 0 };
if (this.start.row > lastRow)
start = {row: lastRow + 1, column: 0};
start = { row: lastRow + 1, column: 0 };
else if (this.start.row < firstRow)
start = {row: firstRow, column: 0};
start = { row: firstRow, column: 0 };
return Range.fromPoints(start || this.start, end || this.end);
};
@ -935,9 +935,9 @@ define('ace/range', ['require', 'exports', 'module' ], function (require, export
if (cmp == 0)
return this;
else if (cmp == -1)
start = {row: row, column: column};
start = { row: row, column: column };
else
end = {row: row, column: column};
end = { row: row, column: column };
return Range.fromPoints(start || this.start, end || this.end);
};
@ -1337,7 +1337,7 @@ define("sense_editor/mode/worker_parser", ['require', 'exports', 'module' ], fun
text,
annotate = function (type, text) {
annos.push({type: type, text: text, at: at});
annos.push({ type: type, text: text, at: at });
},
error = function (m) {
@ -1732,7 +1732,7 @@ define("sense_editor/mode/worker_parser", ['require', 'exports', 'module' ], fun
}
}
return reviver.call(holder, key, value);
})({'': result}, '') : result;
})({ '': result }, '') : result;
};
});
@ -1785,7 +1785,7 @@ define("sense_editor/mode/worker", ['require', 'exports', 'module' , 'ace/lib/oo
var nl = this.doc.getNewLineCharacter().length;
if (!len) {
return { row: 0, column: 0};
return { row: 0, column: 0 };
}
var lineStart = 0, line;

View file

@ -59,7 +59,7 @@ export function getCurrentSettings() {
};
}
export function updateSettings({ fontSize, wrapMode, autocomplete}) {
export function updateSettings({ fontSize, wrapMode, autocomplete }) {
setFontSize(fontSize);
setWrapMode(wrapMode);
setAutocomplete(autocomplete);

View file

@ -2,7 +2,7 @@ let _ = require('lodash');
let curl = require('../../src/curl');
let curlTests = require('raw!./curl_parsing_tests.txt');
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("CURL");

View file

@ -5,7 +5,7 @@ let editor_input1 = require('raw!./editor_input1.txt');
let utils = require('../../src/utils');
var aceRange = ace.require("ace/range");
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
let input;
@ -309,7 +309,7 @@ function multi_req_test(name, editor_input, range, expected) {
}
multi_req_test("mid body to mid body", editor_input1,
{start: {row: 12}, end: {row: 17}}, [{
{ start: { row: 12 }, end: { row: 17 } }, [{
method: "PUT",
url: "index_1/type1/1",
data: {
@ -324,7 +324,7 @@ multi_req_test("mid body to mid body", editor_input1,
}]);
multi_req_test("single request start to end", editor_input1,
{start: {row: 10}, end: {row: 13}}, [{
{ start: { row: 10 }, end: { row: 13 } }, [{
method: "PUT",
url: "index_1/type1/1",
data: {
@ -333,7 +333,7 @@ multi_req_test("single request start to end", editor_input1,
}]);
multi_req_test("start to end, with comment", editor_input1,
{start: {row: 6}, end: {row: 13}}, [{
{ start: { row: 6 }, end: { row: 13 } }, [{
method: "GET",
url: "_stats?level=shards",
data: null
@ -347,7 +347,7 @@ multi_req_test("start to end, with comment", editor_input1,
}]);
multi_req_test("before start to after end, with comments", editor_input1,
{start: {row: 4}, end: {row: 14}}, [{
{ start: { row: 4 }, end: { row: 14 } }, [{
method: "GET",
url: "_stats?level=shards",
data: null
@ -361,13 +361,13 @@ multi_req_test("before start to after end, with comments", editor_input1,
}]);
multi_req_test("between requests", editor_input1,
{start: {row: 21}, end: {row: 22}}, []);
{ start: { row: 21 }, end: { row: 22 } }, []);
multi_req_test("between requests - with comment", editor_input1,
{start: {row: 20}, end: {row: 22}}, []);
{ start: { row: 20 }, end: { row: 22 } }, []);
multi_req_test("between requests - before comment", editor_input1,
{start: {row: 19}, end: {row: 22}}, []);
{ start: { row: 19 }, end: { row: 22 } }, []);
function multi_req_copy_as_curl_test(name, editor_input, range, expected) {
@ -381,7 +381,7 @@ function multi_req_copy_as_curl_test(name, editor_input, range, expected) {
multi_req_copy_as_curl_test("start to end, with comment", editor_input1,
{start: {row: 6}, end: {row: 13}}, `
{ start: { row: 6 }, end: { row: 13 } }, `
curl -XGET "http://localhost:9200/_stats?level=shards"
#in between comment

View file

@ -4,7 +4,7 @@ let kb = require('../../src/kb');
let mappings = require('../../src/mappings');
let $ = require('jquery');
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("Integration", {
setup: function () {
@ -98,7 +98,7 @@ function process_context_test(data, mapping, kb_schemes, request_line, test) {
if (test["autoCompleteSet"]) {
var expected_terms = _.map(test["autoCompleteSet"], function (t) {
if (typeof t !== "object") {
t = {"name": t};
t = { "name": t };
}
return t;
});
@ -175,13 +175,13 @@ var SEARCH_KB = {
"_search"
],
data_autocomplete_rules: {
query: {match_all: {}, term: {"{field}": {__template: {"f": 1}}}},
query: { match_all: {}, term: { "{field}": { __template: { "f": 1 } } } },
size: {},
facets: {
__template: {
"FIELD": {}
},
"*": {terms: {field: "{field}"}}
"*": { terms: { field: "{field}" } }
}
}
}
@ -192,16 +192,16 @@ var MAPPING = {
"index1": {
"type1.1": {
"properties": {
"field1.1.1": {"type": "string"},
"field1.1.2": {"type": "string"}
"field1.1.1": { "type": "string" },
"field1.1.2": { "type": "string" }
}
}
},
"index2": {
"type2.1": {
"properties": {
"field2.1.1": {"type": "string"},
"field2.1.2": {"type": "string"}
"field2.1.1": { "type": "string" },
"field2.1.2": { "type": "string" }
}
}
}
@ -215,12 +215,12 @@ context_tests(
[
{
name: "Empty doc",
cursor: {row: 0, column: 1},
cursor: { row: 0, column: 1 },
initialValue: "",
addTemplate: true,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 0, column: 1}, end: {row: 0, column: 1}},
rangeToReplace: { start: { row: 0, column: 1 }, end: { row: 0, column: 1 } },
autoCompleteSet: ["facets", "query", "size"]
}
]
@ -234,7 +234,7 @@ context_tests(
[
{
name: "Missing KB",
cursor: {row: 0, column: 1},
cursor: { row: 0, column: 1 },
no_context: true
}
]
@ -259,7 +259,7 @@ context_tests(
[
{
name: "Missing KB - global auto complete",
cursor: {row: 2, column: 5},
cursor: { row: 2, column: 5 },
autoCompleteSet: ["t1"]
}
]
@ -279,37 +279,37 @@ context_tests(
[
{
name: "existing dictionary key, no template",
cursor: {row: 1, column: 6},
cursor: { row: 1, column: 6 },
initialValue: "query",
addTemplate: false,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 1, column: 3}, end: {row: 1, column: 10}},
rangeToReplace: { start: { row: 1, column: 3 }, end: { row: 1, column: 10 } },
autoCompleteSet: ["facets", "query", "size"]
},
{
name: "existing inner dictionary key",
cursor: {row: 2, column: 7},
cursor: { row: 2, column: 7 },
initialValue: "field",
addTemplate: false,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 2, column: 6}, end: {row: 2, column: 13}},
rangeToReplace: { start: { row: 2, column: 6 }, end: { row: 2, column: 13 } },
autoCompleteSet: ["match_all", "term"]
},
{
name: "existing dictionary key, yes template",
cursor: {row: 4, column: 7},
cursor: { row: 4, column: 7 },
initialValue: "facets",
addTemplate: true,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 4, column: 3}, end: {row: 4, column: 15}},
rangeToReplace: { start: { row: 4, column: 3 }, end: { row: 4, column: 15 } },
autoCompleteSet: ["facets", "query", "size"]
},
{
name: "ignoring meta keys",
cursor: {row: 4, column: 14},
cursor: { row: 4, column: 14 },
no_context: true
}
]
@ -329,42 +329,42 @@ context_tests(
[
{
name: "trailing comma, end of line",
cursor: {row: 4, column: 16},
cursor: { row: 4, column: 16 },
initialValue: "",
addTemplate: true,
prefixToAdd: "",
suffixToAdd: ", ",
rangeToReplace: {start: {row: 4, column: 16}, end: {row: 4, column: 16}},
rangeToReplace: { start: { row: 4, column: 16 }, end: { row: 4, column: 16 } },
autoCompleteSet: ["facets", "query", "size"]
},
{
name: "trailing comma, beginning of line",
cursor: {row: 5, column: 1},
cursor: { row: 5, column: 1 },
initialValue: "",
addTemplate: true,
prefixToAdd: "",
suffixToAdd: ", ",
rangeToReplace: {start: {row: 5, column: 1}, end: {row: 5, column: 1}},
rangeToReplace: { start: { row: 5, column: 1 }, end: { row: 5, column: 1 } },
autoCompleteSet: ["facets", "query", "size"]
},
{
name: "prefix comma, beginning of line",
cursor: {row: 6, column: 0},
cursor: { row: 6, column: 0 },
initialValue: "",
addTemplate: true,
prefixToAdd: ", ",
suffixToAdd: "",
rangeToReplace: {start: {row: 6, column: 0}, end: {row: 6, column: 0}},
rangeToReplace: { start: { row: 6, column: 0 }, end: { row: 6, column: 0 } },
autoCompleteSet: ["facets", "query", "size"]
},
{
name: "prefix comma, end of line",
cursor: {row: 5, column: 14},
cursor: { row: 5, column: 14 },
initialValue: "",
addTemplate: true,
prefixToAdd: ", ",
suffixToAdd: "",
rangeToReplace: {start: {row: 5, column: 14}, end: {row: 5, column: 14}},
rangeToReplace: { start: { row: 5, column: 14 }, end: { row: 5, column: 14 } },
autoCompleteSet: ["facets", "query", "size"]
}
@ -387,11 +387,11 @@ context_tests(
"_test"
],
data_autocomplete_rules: {
object: {bla: 1},
object: { bla: 1 },
array: [1],
value_one_of: {__one_of: [1, 2]},
value_one_of: { __one_of: [1, 2] },
value: 3,
"*": {__one_of: [4, 5]}
"*": { __one_of: [4, 5] }
}
}
}
@ -400,31 +400,31 @@ context_tests(
[
{
name: "not matching object when { is not opened",
cursor: {row: 1, column: 12},
cursor: { row: 1, column: 12 },
initialValue: "",
autoCompleteSet: ["{"]
},
{
name: "not matching array when [ is not opened",
cursor: {row: 2, column: 12},
cursor: { row: 2, column: 12 },
initialValue: "",
autoCompleteSet: ["["]
},
{
name: "matching value with one_of",
cursor: {row: 3, column: 19},
cursor: { row: 3, column: 19 },
initialValue: "",
autoCompleteSet: [1, 2]
},
{
name: "matching value",
cursor: {row: 4, column: 12},
cursor: { row: 4, column: 12 },
initialValue: "",
autoCompleteSet: [3]
},
{
name: "matching any value with one_of",
cursor: {row: 5, column: 21},
cursor: { row: 5, column: 21 },
initialValue: "",
autoCompleteSet: [4, 5]
}
@ -447,14 +447,14 @@ context_tests(
[
{
name: "* matching everything",
cursor: {row: 5, column: 15},
cursor: { row: 5, column: 15 },
initialValue: "",
addTemplate: true,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 5, column: 15}, end: {row: 5, column: 15}},
rangeToReplace: { start: { row: 5, column: 15 }, end: { row: 5, column: 15 } },
autoCompleteSet: [
{name: "terms", meta: "API"}
{ name: "terms", meta: "API" }
]
}
]
@ -481,17 +481,17 @@ context_tests(
[
{
name: "{index} matching",
cursor: {row: 1, column: 15},
cursor: { row: 1, column: 15 },
autoCompleteSet: [
{name: "index1", meta: "index"},
{name: "index2", meta: "index"}
{ name: "index1", meta: "index" },
{ name: "index2", meta: "index" }
]
}
]
);
function tt(term, template, meta) {
term = {name: term, template: template};
term = { name: term, template: template };
if (meta) {
term.meta = meta;
}
@ -516,8 +516,8 @@ context_tests(
array: ["a", "b"],
number: 1,
object: {},
fixed: {__template: {"a": 1}},
oneof: {__one_of: ["o1", "o2"]}
fixed: { __template: { "a": 1 } },
oneof: { __one_of: ["o1", "o2"] }
}
}
}
@ -526,14 +526,14 @@ context_tests(
[
{
name: "Templates 1",
cursor: {row: 1, column: 0},
cursor: { row: 1, column: 0 },
autoCompleteSet: [
tt("array", []), tt("fixed", {a: 1}), tt("number", 1), tt("object", {}), tt("oneof", "o1")
tt("array", []), tt("fixed", { a: 1 }), tt("number", 1), tt("object", {}), tt("oneof", "o1")
]
},
{
name: "Templates - one off",
cursor: {row: 4, column: 12},
cursor: { row: 4, column: 12 },
autoCompleteSet: [tt("o1"), tt("o2")]
}
]
@ -563,7 +563,7 @@ context_tests(
lines_regex: "other"
},
"no_match": {}
}, {"always": {}}]
}, { "always": {} }]
}
}
}
@ -573,7 +573,7 @@ context_tests(
[
{
name: "Conditionals",
cursor: {row: 2, column: 15},
cursor: { row: 2, column: 15 },
autoCompleteSet: [
tt("always", {}), tt("match", {})
]
@ -607,18 +607,18 @@ context_tests(
"_endpoint"
],
data_autocomplete_rules: {
any_of_numbers: {__template: [1, 2], __any_of: [1, 2, 3]},
any_of_numbers: { __template: [1, 2], __any_of: [1, 2, 3] },
any_of_obj: {
__template: [
{c: 1}
{ c: 1 }
], __any_of: [
{a: 1, b: 2},
{c: 1}
{ a: 1, b: 2 },
{ c: 1 }
]
},
any_of_mixed: {
__any_of: [
{a: 1},
{ a: 1 },
3
]
}
@ -630,37 +630,37 @@ context_tests(
[
{
name: "Any of - templates",
cursor: {row: 1, column: 0},
cursor: { row: 1, column: 0 },
autoCompleteSet: [
tt("any_of_mixed", []),
tt("any_of_numbers", [1, 2]),
tt("any_of_obj", [
{c: 1}
{ c: 1 }
])
]
},
{
name: "Any of - numbers",
cursor: {row: 2, column: 2},
cursor: { row: 2, column: 2 },
autoCompleteSet: [1, 2, 3]
},
{
name: "Any of - object",
cursor: {row: 6, column: 2},
cursor: { row: 6, column: 2 },
autoCompleteSet: [
tt("a", 1), tt("b", 2), tt("c", 1)
]
},
{
name: "Any of - mixed - obj",
cursor: {row: 11, column: 2},
cursor: { row: 11, column: 2 },
autoCompleteSet: [
tt("a", 1)
]
},
{
name: "Any of - mixed - both",
cursor: {row: 13, column: 2},
cursor: { row: 13, column: 2 },
autoCompleteSet: [
tt("{"), tt(3)
]
@ -685,7 +685,7 @@ context_tests(
[
{
name: "Empty string as default",
cursor: {row: 0, column: 1},
cursor: { row: 0, column: 1 },
autoCompleteSet: [tt("query", "")]
}
]
@ -767,7 +767,7 @@ context_tests(
[
{
name: "Relative scope link test",
cursor: {row: 2, column: 12},
cursor: { row: 2, column: 12 },
autoCompleteSet: [
tt("b", {}), tt("c", {}), tt("d", {}), tt("e", {}), tt("f", [
{}
@ -776,37 +776,37 @@ context_tests(
},
{
name: "External scope link test",
cursor: {row: 3, column: 12},
cursor: { row: 3, column: 12 },
autoCompleteSet: [tt("t2", 1)]
},
{
name: "Global scope link test",
cursor: {row: 4, column: 12},
cursor: { row: 4, column: 12 },
autoCompleteSet: [tt("t1", 2), tt("t1a", {})]
},
{
name: "Global scope link with an internal scope link",
cursor: {row: 5, column: 17},
cursor: { row: 5, column: 17 },
autoCompleteSet: [tt("t1", 2), tt("t1a", {})]
},
{
name: "Entire endpoint scope link test",
cursor: {row: 7, column: 12},
cursor: { row: 7, column: 12 },
autoCompleteSet: [tt("target", {})]
},
{
name: "A scope link within an array",
cursor: {row: 9, column: 10},
cursor: { row: 9, column: 10 },
autoCompleteSet: [tt("t2", 1)]
},
{
name: "A function based scope link",
cursor: {row: 11, column: 12},
cursor: { row: 11, column: 12 },
autoCompleteSet: [tt("a", 1), tt("b", 2)]
},
{
name: "A global scope link with wrong link",
cursor: {row: 12, column: 12},
cursor: { row: 12, column: 12 },
assertThrows: /broken/
}
@ -836,7 +836,7 @@ context_tests(
[
{
name: "Top level scope link",
cursor: {row: 0, column: 1},
cursor: { row: 0, column: 1 },
autoCompleteSet: [
tt("t1", 2)
]
@ -864,7 +864,7 @@ context_tests(
[
{
name: "Path after empty object",
cursor: {row: 1, column: 10},
cursor: { row: 1, column: 10 },
autoCompleteSet: ["a", "b"]
}
]
@ -880,8 +880,8 @@ context_tests(
[
{
name: "Replace an empty string",
cursor: {row: 1, column: 4},
rangeToReplace: {start: {row: 1, column: 3}, end: {row: 1, column: 9}}
cursor: { row: 1, column: 4 },
rangeToReplace: { start: { row: 1, column: 3 }, end: { row: 1, column: 9 } }
}
]
);
@ -901,7 +901,7 @@ context_tests(
patterns: ["_endpoint"],
data_autocomplete_rules: {
"a": [
{b: 1}
{ b: 1 }
]
}
}
@ -911,12 +911,12 @@ context_tests(
[
{
name: "List of objects - internal autocomplete",
cursor: {row: 3, column: 10},
cursor: { row: 3, column: 10 },
autoCompleteSet: ["b"]
},
{
name: "List of objects - external template",
cursor: {row: 0, column: 1},
cursor: { row: 0, column: 1 },
autoCompleteSet: [tt("a", [
{}
])]
@ -946,15 +946,15 @@ context_tests(
[
{
name: "Field completion as scope",
cursor: {row: 3, column: 10},
autoCompleteSet: [tt("field1.1.1", {"f": 1}, "string"), tt("field1.1.2", {"f": 1}, "string")]
cursor: { row: 3, column: 10 },
autoCompleteSet: [tt("field1.1.1", { "f": 1 }, "string"), tt("field1.1.2", { "f": 1 }, "string")]
},
{
name: "Field completion as value",
cursor: {row: 9, column: 23},
cursor: { row: 9, column: 23 },
autoCompleteSet: [
{name: "field1.1.1", meta: "string"},
{name: "field1.1.2", meta: "string"}
{ name: "field1.1.1", meta: "string" },
{ name: "field1.1.2", meta: "string" }
]
}
]
@ -969,7 +969,7 @@ context_tests(
[
{
name: "initial doc start",
cursor: {row: 1, column: 0},
cursor: { row: 1, column: 0 },
autoCompleteSet: ["{"],
prefixToAdd: "",
suffixToAdd: ""
@ -990,14 +990,14 @@ context_tests(
[
{
name: "Cursor rows after request end",
cursor: {row: 4, column: 0},
cursor: { row: 4, column: 0 },
autoCompleteSet: ["GET", "PUT", "POST", "DELETE", "HEAD"],
prefixToAdd: "",
suffixToAdd: " "
},
{
name: "Cursor just after request end",
cursor: {row: 2, column: 1},
cursor: { row: 2, column: 1 },
no_context: true
}
@ -1035,7 +1035,7 @@ context_tests(
[
{
name: "Endpoints with slashes - no slash",
cursor: {row: 0, column: 8},
cursor: { row: 0, column: 8 },
autoCompleteSet: ["_cluster/nodes/stats", "_cluster/stats", "_search", "index1", "index2"],
prefixToAdd: "",
suffixToAdd: ""
@ -1051,21 +1051,21 @@ context_tests(
[
{
name: "Endpoints with slashes - before slash",
cursor: {row: 0, column: 7},
cursor: { row: 0, column: 7 },
autoCompleteSet: ["_cluster/nodes/stats", "_cluster/stats", "_search", "index1", "index2"],
prefixToAdd: "",
suffixToAdd: ""
},
{
name: "Endpoints with slashes - on slash",
cursor: {row: 0, column: 12},
cursor: { row: 0, column: 12 },
autoCompleteSet: ["_cluster/nodes/stats", "_cluster/stats", "_search", "index1", "index2"],
prefixToAdd: "",
suffixToAdd: ""
},
{
name: "Endpoints with slashes - after slash",
cursor: {row: 0, column: 13},
cursor: { row: 0, column: 13 },
autoCompleteSet: ["nodes/stats", "stats"],
prefixToAdd: "",
suffixToAdd: ""
@ -1081,10 +1081,10 @@ context_tests(
[
{
name: "Endpoints with slashes - after slash",
cursor: {row: 0, column: 14},
cursor: { row: 0, column: 14 },
autoCompleteSet: [
{name: "nodes/stats", meta: "endpoint"},
{name: "stats", meta: "endpoint"}
{ name: "nodes/stats", meta: "endpoint" },
{ name: "stats", meta: "endpoint" }
],
prefixToAdd: "",
suffixToAdd: "",
@ -1101,7 +1101,7 @@ context_tests(
[
{
name: "Endpoints with two slashes",
cursor: {row: 0, column: 20},
cursor: { row: 0, column: 20 },
autoCompleteSet: ["stats"],
prefixToAdd: "",
suffixToAdd: "",
@ -1118,13 +1118,13 @@ context_tests(
[
{
name: "Immediately after space + method",
cursor: {row: 0, column: 4},
cursor: { row: 0, column: 4 },
autoCompleteSet: [
{name: "_cluster/nodes/stats", meta: "endpoint"},
{name: "_cluster/stats", meta: "endpoint"},
{name: "_search", meta: "endpoint"},
{name: "index1", meta: "index"},
{name: "index2", meta: "index"}
{ name: "_cluster/nodes/stats", meta: "endpoint" },
{ name: "_cluster/stats", meta: "endpoint" },
{ name: "_search", meta: "endpoint" },
{ name: "index1", meta: "index" },
{ name: "index2", meta: "index" }
],
prefixToAdd: "",
suffixToAdd: "",
@ -1141,13 +1141,13 @@ context_tests(
[
{
name: "Endpoints by subpart",
cursor: {row: 0, column: 6},
cursor: { row: 0, column: 6 },
autoCompleteSet: [
{name: "_cluster/nodes/stats", meta: "endpoint"},
{name: "_cluster/stats", meta: "endpoint"},
{name: "_search", meta: "endpoint"},
{name: "index1", meta: "index"},
{name: "index2", meta: "index"}
{ name: "_cluster/nodes/stats", meta: "endpoint" },
{ name: "_cluster/stats", meta: "endpoint" },
{ name: "_search", meta: "endpoint" },
{ name: "index1", meta: "index" },
{ name: "index2", meta: "index" }
],
prefixToAdd: "",
suffixToAdd: "",
@ -1164,13 +1164,13 @@ context_tests(
[
{
name: "Endpoints by subpart",
cursor: {row: 0, column: 7},
cursor: { row: 0, column: 7 },
autoCompleteSet: [
{name: "_cluster/nodes/stats", meta: "endpoint"},
{name: "_cluster/stats", meta: "endpoint"},
{name: "_search", meta: "endpoint"},
{name: "index1", meta: "index"},
{name: "index2", meta: "index"}
{ name: "_cluster/nodes/stats", meta: "endpoint" },
{ name: "_cluster/stats", meta: "endpoint" },
{ name: "_search", meta: "endpoint" },
{ name: "index1", meta: "index" },
{ name: "index2", meta: "index" }
],
prefixToAdd: "",
suffixToAdd: "",
@ -1188,13 +1188,13 @@ context_tests(
[
{
name: "Params just after ?",
cursor: {row: 0, column: 12},
cursor: { row: 0, column: 12 },
autoCompleteSet: [
{name: "filter_path", meta: "param", "insert_value": "filter_path="},
{name: "format", meta: "param", "insert_value": "format="},
{name: "pretty", meta: "flag"},
{name: "scroll", meta: "param", "insert_value": "scroll="},
{name: "search_type", meta: "param", "insert_value": "search_type="},
{ name: "filter_path", meta: "param", "insert_value": "filter_path=" },
{ name: "format", meta: "param", "insert_value": "format=" },
{ name: "pretty", meta: "flag" },
{ name: "scroll", meta: "param", "insert_value": "scroll=" },
{ name: "search_type", meta: "param", "insert_value": "search_type=" },
],
prefixToAdd: "",
suffixToAdd: ""
@ -1210,10 +1210,10 @@ context_tests(
[
{
name: "Params values",
cursor: {row: 0, column: 19},
cursor: { row: 0, column: 19 },
autoCompleteSet: [
{name: "json", meta: "format"},
{name: "yaml", meta: "format"}
{ name: "json", meta: "format" },
{ name: "yaml", meta: "format" }
],
prefixToAdd: "",
suffixToAdd: ""
@ -1229,13 +1229,13 @@ context_tests(
[
{
name: "Params after amp",
cursor: {row: 0, column: 24},
cursor: { row: 0, column: 24 },
autoCompleteSet: [
{name: "filter_path", meta: "param", "insert_value": "filter_path="},
{name: "format", meta: "param", "insert_value": "format="},
{name: "pretty", meta: "flag"},
{name: "scroll", meta: "param", "insert_value": "scroll="},
{name: "search_type", meta: "param", "insert_value": "search_type="},
{ name: "filter_path", meta: "param", "insert_value": "filter_path=" },
{ name: "format", meta: "param", "insert_value": "format=" },
{ name: "pretty", meta: "flag" },
{ name: "scroll", meta: "param", "insert_value": "scroll=" },
{ name: "search_type", meta: "param", "insert_value": "search_type=" },
],
prefixToAdd: "",
suffixToAdd: ""
@ -1251,17 +1251,17 @@ context_tests(
[
{
name: "Params on existing param",
cursor: {row: 0, column: 26},
cursor: { row: 0, column: 26 },
rangeToReplace: {
start: {row: 0, column: 24},
end: {row: 0, column: 30}
start: { row: 0, column: 24 },
end: { row: 0, column: 30 }
},
autoCompleteSet: [
{name: "filter_path", meta: "param", "insert_value": "filter_path="},
{name: "format", meta: "param", "insert_value": "format="},
{name: "pretty", meta: "flag"},
{name: "scroll", meta: "param", "insert_value": "scroll="},
{name: "search_type", meta: "param", "insert_value": "search_type="},
{ name: "filter_path", meta: "param", "insert_value": "filter_path=" },
{ name: "format", meta: "param", "insert_value": "format=" },
{ name: "pretty", meta: "flag" },
{ name: "scroll", meta: "param", "insert_value": "scroll=" },
{ name: "search_type", meta: "param", "insert_value": "search_type=" },
],
prefixToAdd: "",
suffixToAdd: ""
@ -1277,14 +1277,14 @@ context_tests(
[
{
name: "Params on existing value",
cursor: {row: 0, column: 37},
cursor: { row: 0, column: 37 },
rangeToReplace: {
start: {row: 0, column: 36},
end: {row: 0, column: 39}
start: { row: 0, column: 36 },
end: { row: 0, column: 39 }
},
autoCompleteSet: [
{name: "count", meta: "search_type"},
{name: "query_then_fetch", meta: "search_type"},
{ name: "count", meta: "search_type" },
{ name: "query_then_fetch", meta: "search_type" },
],
prefixToAdd: "",
suffixToAdd: ""
@ -1299,14 +1299,14 @@ context_tests(
[
{
name: "Params on just after = with existing value",
cursor: {row: 0, column: 36},
cursor: { row: 0, column: 36 },
rangeToReplace: {
start: {row: 0, column: 36},
end: {row: 0, column: 36}
start: { row: 0, column: 36 },
end: { row: 0, column: 36 }
},
autoCompleteSet: [
{name: "count", meta: "search_type"},
{name: "query_then_fetch", meta: "search_type"},
{ name: "count", meta: "search_type" },
{ name: "query_then_fetch", meta: "search_type" },
],
prefixToAdd: "",
suffixToAdd: ""
@ -1329,32 +1329,32 @@ context_tests(
[
{
name: "fullurl - existing dictionary key, no template",
cursor: {row: 1, column: 6},
cursor: { row: 1, column: 6 },
initialValue: "query",
addTemplate: false,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 1, column: 3}, end: {row: 1, column: 10}},
rangeToReplace: { start: { row: 1, column: 3 }, end: { row: 1, column: 10 } },
autoCompleteSet: ["facets", "query", "size"]
},
{
name: "fullurl - existing inner dictionary key",
cursor: {row: 2, column: 7},
cursor: { row: 2, column: 7 },
initialValue: "field",
addTemplate: false,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 2, column: 6}, end: {row: 2, column: 13}},
rangeToReplace: { start: { row: 2, column: 6 }, end: { row: 2, column: 13 } },
autoCompleteSet: ["match_all", "term"]
},
{
name: "fullurl - existing dictionary key, yes template",
cursor: {row: 4, column: 7},
cursor: { row: 4, column: 7 },
initialValue: "facets",
addTemplate: true,
prefixToAdd: "",
suffixToAdd: "",
rangeToReplace: {start: {row: 4, column: 3}, end: {row: 4, column: 15}},
rangeToReplace: { start: { row: 4, column: 3 }, end: { row: 4, column: 15 } },
autoCompleteSet: ["facets", "query", "size"]
}
]

View file

@ -2,7 +2,7 @@ let kb = require('../../src/kb');
let mappings = require('../../src/mappings');
let autocomplete_engine = require('../../src/autocomplete/engine');
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("Knowledge base", {
setup: function () {
@ -19,8 +19,8 @@ var MAPPING = {
"index1": {
"type1.1": {
"properties": {
"field1.1.1": {"type": "string"},
"field1.1.2": {"type": "long"}
"field1.1.1": { "type": "string" },
"field1.1.2": { "type": "long" }
}
},
"type1.2": {
@ -30,8 +30,8 @@ var MAPPING = {
"index2": {
"type2.1": {
"properties": {
"field2.1.1": {"type": "string"},
"field2.1.2": {"type": "string"}
"field2.1.1": { "type": "string" },
"field2.1.2": { "type": "string" }
}
}
}
@ -42,13 +42,13 @@ function testUrlContext(tokenPath, otherTokenValues, expectedContext) {
if (expectedContext.autoCompleteSet) {
expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) {
if (_.isString(t)) {
t = {name: t}
t = { name: t }
}
return t;
})
}
var context = {otherTokenValues: otherTokenValues};
var context = { otherTokenValues: otherTokenValues };
autocomplete_engine.populateContext(tokenPath, context, null,
expectedContext.autoCompleteSet, kb.getTopLevelUrlCompleteComponents()
);
@ -62,7 +62,7 @@ function testUrlContext(tokenPath, otherTokenValues, expectedContext) {
function norm(t) {
if (_.isString(t)) {
return {name: t};
return { name: t };
}
return t;
}
@ -78,11 +78,11 @@ function testUrlContext(tokenPath, otherTokenValues, expectedContext) {
}
function t(term) {
return {name: term, meta: "type"};
return { name: term, meta: "type" };
}
function i(term) {
return {name: term, meta: "index"};
return { name: term, meta: "index" };
}
function index_test(name, tokenPath, otherTokenValues, expectedContext) {
@ -93,7 +93,7 @@ function index_test(name, tokenPath, otherTokenValues, expectedContext) {
_multi_indices: {
patterns: ["{indices}/_multi_indices"]
},
_single_index: {patterns: ["{index}/_single_index"]},
_single_index: { patterns: ["{index}/_single_index"] },
_no_index: {
// testing default patters
// patterns: ["_no_index"]
@ -110,22 +110,22 @@ function index_test(name, tokenPath, otherTokenValues, expectedContext) {
}
index_test("Index integration 1", [], [],
{autoCompleteSet: ["_no_index", i("index1"), i("index2")]}
{ autoCompleteSet: ["_no_index", i("index1"), i("index2")] }
);
index_test("Index integration 2", [], ["index1"],
// still return _no_index as index1 is not committed to yet.
{autoCompleteSet: ["_no_index", i("index2")]}
{ autoCompleteSet: ["_no_index", i("index2")] }
);
index_test("Index integration 2", ["index1"], [],
{indices: ["index1"], autoCompleteSet: ["_multi_indices", "_single_index"]}
{ indices: ["index1"], autoCompleteSet: ["_multi_indices", "_single_index"] }
);
index_test("Index integration 2", [
["index1", "index2"]
], [],
{indices: ["index1", "index2"], autoCompleteSet: ["_multi_indices"]}
{ indices: ["index1", "index2"], autoCompleteSet: ["_multi_indices"] }
);
function type_test(name, tokenPath, otherTokenValues, expectedContext) {
@ -133,9 +133,9 @@ function type_test(name, tokenPath, otherTokenValues, expectedContext) {
var test_api = kb._test.loadApisFromJson({
"type_test": {
endpoints: {
_multi_types: {patterns: ["{indices}/{types}/_multi_types"]},
_single_type: {patterns: ["{indices}/{type}/_single_type"]},
_no_types: {patterns: ["{indices}/_no_types"]}
_multi_types: { patterns: ["{indices}/{types}/_multi_types"] },
_single_type: { patterns: ["{indices}/{type}/_single_type"] },
_no_types: { patterns: ["{indices}/_no_types"] }
}
}
}, kb._test.globalUrlComponentFactories);
@ -149,24 +149,24 @@ function type_test(name, tokenPath, otherTokenValues, expectedContext) {
}
type_test("Type integration 1", ["index1"], [],
{indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1"), t("type1.2")]}
{ indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1"), t("type1.2")] }
);
type_test("Type integration 2", ["index1"], ["type1.2"],
// we are not yet comitted to type1.2, so _no_types is returned
{indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1")]}
{ indices: ["index1"], autoCompleteSet: ["_no_types", t("type1.1")] }
);
type_test("Type integration 3", ["index2"], [],
{indices: ["index2"], autoCompleteSet: ["_no_types", t("type2.1")]}
{ indices: ["index2"], autoCompleteSet: ["_no_types", t("type2.1")] }
);
type_test("Type integration 4", ["index1", "type1.2"], [],
{indices: ["index1"], types: ["type1.2"], autoCompleteSet: ["_multi_types", "_single_type"]}
{ indices: ["index1"], types: ["type1.2"], autoCompleteSet: ["_multi_types", "_single_type"] }
);
type_test("Type integration 5", [
["index1", "index2"],
["type1.2", "type1.1"]
], [],
{indices: ["index1", "index2"], types: ["type1.2", "type1.1"], autoCompleteSet: ["_multi_types"]}
{ indices: ["index1", "index2"], types: ["type1.2", "type1.1"], autoCompleteSet: ["_multi_types"] }
);

View file

@ -1,6 +1,6 @@
let mappings = require('../../src/mappings');
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("Mappings", {
setup: function () {
@ -22,7 +22,7 @@ function fc(f1, f2) {
}
function f(name, type) {
return {name: name, type: type || "string"};
return { name: name, type: type || "string" };
}
test("Multi fields", function () {
@ -34,16 +34,16 @@ test("Multi fields", function () {
"type": "multi_field",
"path": "just_name",
"fields": {
"first_name": {"type": "string", "index": "analyzed"},
"any_name": {"type": "string", "index": "analyzed"}
"first_name": { "type": "string", "index": "analyzed" },
"any_name": { "type": "string", "index": "analyzed" }
}
},
"last_name": {
"type": "multi_field",
"path": "just_name",
"fields": {
"last_name": {"type": "string", "index": "analyzed"},
"any_name": {"type": "string", "index": "analyzed"}
"last_name": { "type": "string", "index": "analyzed" },
"any_name": { "type": "string", "index": "analyzed" }
}
}
}
@ -64,13 +64,13 @@ test("Multi fields 1.0 style", function () {
"type": "string", "index": "analyzed",
"path": "just_name",
"fields": {
"any_name": {"type": "string", "index": "analyzed"}
"any_name": { "type": "string", "index": "analyzed" }
}
},
"last_name": {
"type": "string", "index": "no",
"fields": {
"raw": {"type": "string", "index": "analyzed"}
"raw": { "type": "string", "index": "analyzed" }
}
}
}
@ -132,14 +132,14 @@ QUnit.test("Nested fields", function () {
"properties": {
"name": {
"properties": {
"first_name": {"type": "string"},
"last_name": {"type": "string"}
"first_name": { "type": "string" },
"last_name": { "type": "string" }
}
},
"sid": {"type": "string", "index": "not_analyzed"}
"sid": { "type": "string", "index": "not_analyzed" }
}
},
"message": {"type": "string"}
"message": { "type": "string" }
}
}
}
@ -161,10 +161,10 @@ test("Enabled fields", function () {
"type": "object",
"enabled": false
},
"sid": {"type": "string", "index": "not_analyzed"}
"sid": { "type": "string", "index": "not_analyzed" }
}
},
"message": {"type": "string"}
"message": { "type": "string" }
}
}
}
@ -184,16 +184,16 @@ test("Path tests", function () {
"type": "object",
"path": "just_name",
"properties": {
"first1": {"type": "string"},
"last1": {"type": "string", "index_name": "i_last_1"}
"first1": { "type": "string" },
"last1": { "type": "string", "index_name": "i_last_1" }
}
},
"name2": {
"type": "object",
"path": "full",
"properties": {
"first2": {"type": "string"},
"last2": {"type": "string", "index_name": "i_last_2"}
"first2": { "type": "string" },
"last2": { "type": "string", "index_name": "i_last_2" }
}
}
}
@ -210,7 +210,7 @@ test("Use index_name tests", function () {
"index": {
"person": {
"properties": {
"last1": {"type": "string", "index_name": "i_last_1"}
"last1": { "type": "string", "index_name": "i_last_1" }
}
}
}
@ -244,14 +244,14 @@ test("Aliases", function () {
"test_index1": {
"type1": {
"properties": {
"last1": {"type": "string", "index_name": "i_last_1"}
"last1": { "type": "string", "index_name": "i_last_1" }
}
}
},
"test_index2": {
"type2": {
"properties": {
"last1": {"type": "string", "index_name": "i_last_1"}
"last1": { "type": "string", "index_name": "i_last_1" }
}
}
}

View file

@ -4,7 +4,7 @@ import { initializeInput } from '../../src/input';
let input;
var token_iterator = ace.require("ace/token_iterator");
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("Tokenization", {
@ -27,7 +27,7 @@ function tokensAsList() {
t = input.parser.nextNonEmptyToken(iter);
}
while (t) {
ret.push({value: t.value, type: t.type});
ret.push({ value: t.value, type: t.type });
t = input.parser.nextNonEmptyToken(iter);
}
@ -54,7 +54,7 @@ function token_test(token_list, prefix, data) {
var tokens = tokensAsList();
var normTokenList = [];
for (var i = 0; i < token_list.length; i++) {
normTokenList.push({type: token_list[i++], value: token_list[i]});
normTokenList.push({ type: token_list[i++], value: token_list[i] });
}
deepEqual(tokens, normTokenList, "Doc:\n" + data);

View file

@ -2,7 +2,7 @@ let _ = require('lodash');
let url_pattern_matcher = require('../../src/autocomplete/url_pattern_matcher');
let autocomplete_engine = require('../../src/autocomplete/engine');
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("Url autocomplete");
@ -32,7 +32,7 @@ function patterns_test(name, endpoints, tokenPath, expectedContext, globalUrlCom
if (expectedContext.autoCompleteSet) {
expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) {
if (_.isString(t)) {
t = {name: t}
t = { name: t }
}
return t;
});
@ -63,7 +63,7 @@ function patterns_test(name, endpoints, tokenPath, expectedContext, globalUrlCom
function t(name, meta) {
if (meta) {
return {name: name, meta: meta};
return { name: name, meta: meta };
}
return name;
}
@ -79,14 +79,14 @@ function t(name, meta) {
patterns_test("simple single path - completion",
endpoints,
"a/b$",
{endpoint: "1"}
{ endpoint: "1" }
);
patterns_test("simple single path - completion, with auto complete",
endpoints,
"a/b",
{autoCompleteSet: []}
{ autoCompleteSet: [] }
);
patterns_test("simple single path - partial, without auto complete",
@ -98,13 +98,13 @@ function t(name, meta) {
patterns_test("simple single path - partial, with auto complete",
endpoints,
"a",
{autoCompleteSet: ["b"]}
{ autoCompleteSet: ["b"] }
);
patterns_test("simple single path - partial, with auto complete",
endpoints,
[],
{autoCompleteSet: ["a/b"]}
{ autoCompleteSet: ["a/b"] }
);
patterns_test("simple single path - different path",
@ -132,31 +132,31 @@ function t(name, meta) {
patterns_test("shared path - completion 1",
endpoints,
"a/b$",
{endpoint: "1"}
{ endpoint: "1" }
);
patterns_test("shared path - completion 2",
endpoints,
"a/c$",
{endpoint: "2"}
{ endpoint: "2" }
);
patterns_test("shared path - completion 1 with param",
endpoints,
"a/b/v$",
{endpoint: "1", p: "v"}
{ endpoint: "1", p: "v" }
);
patterns_test("shared path - partial, with auto complete",
endpoints,
"a",
{autoCompleteSet: ["b", "c"]}
{ autoCompleteSet: ["b", "c"] }
);
patterns_test("shared path - partial, with auto complete of param, no options",
endpoints,
"a/b",
{autoCompleteSet: []}
{ autoCompleteSet: [] }
);
patterns_test("shared path - partial, without auto complete",
@ -168,7 +168,7 @@ function t(name, meta) {
patterns_test("shared path - different path - with auto complete",
endpoints,
"a/e",
{autoCompleteSet: []}
{ autoCompleteSet: [] }
);
patterns_test("shared path - different path - without auto complete",
@ -198,25 +198,25 @@ function t(name, meta) {
patterns_test("option testing - completion 1",
endpoints,
"a/a$",
{endpoint: "1", p: ["a"]}
{ endpoint: "1", p: ["a"] }
);
patterns_test("option testing - completion 2",
endpoints,
"a/b$",
{endpoint: "1", p: ["b"]}
{ endpoint: "1", p: ["b"] }
);
patterns_test("option testing - completion 3",
endpoints,
"a/b,a$",
{endpoint: "1", p: ["b", "a"]}
{ endpoint: "1", p: ["b", "a"] }
);
patterns_test("option testing - completion 4",
endpoints,
"a/c$",
{endpoint: "2"}
{ endpoint: "2" }
);
patterns_test("option testing - completion 5",
@ -228,7 +228,7 @@ function t(name, meta) {
patterns_test("option testing - partial, with auto complete",
endpoints,
"a",
{autoCompleteSet: [t("a", "p"), t("b", "p"), "c"]}
{ autoCompleteSet: [t("a", "p"), t("b", "p"), "c"] }
);
patterns_test("option testing - partial, without auto complete",
@ -241,7 +241,7 @@ function t(name, meta) {
patterns_test("option testing - different path - with auto complete",
endpoints,
"a/e",
{autoCompleteSet: []}
{ autoCompleteSet: [] }
);
@ -284,14 +284,14 @@ function t(name, meta) {
patterns_test("global parameters testing - completion 1",
endpoints,
"a/a$",
{endpoint: "1", p: ["a"]},
{ endpoint: "1", p: ["a"] },
globalFactories
);
patterns_test("global parameters testing - completion 2",
endpoints,
"b/g1$",
{endpoint: "2", p: ["g1"]},
{ endpoint: "2", p: ["g1"] },
globalFactories
);
@ -299,27 +299,27 @@ function t(name, meta) {
patterns_test("global parameters testing - partial, with auto complete",
endpoints,
"a",
{autoCompleteSet: [t("a", "p"), t("b", "p")]},
{ autoCompleteSet: [t("a", "p"), t("b", "p")] },
globalFactories
);
patterns_test("global parameters testing - partial, with auto complete 2",
endpoints,
"b",
{autoCompleteSet: [t("g1", "p"), t("g2", "p"), t("la", "l"), t("lb", "l")]},
{ autoCompleteSet: [t("g1", "p"), t("g2", "p"), t("la", "l"), t("lb", "l")] },
globalFactories
);
patterns_test("Non valid token acceptance - partial, with auto complete 1",
endpoints,
"b/la",
{autoCompleteSet: ["c"], "l": ["la"]},
{ autoCompleteSet: ["c"], "l": ["la"] },
globalFactories
);
patterns_test("Non valid token acceptance - partial, with auto complete 2",
endpoints,
"b/non_valid",
{autoCompleteSet: ["c"], "l": ["non_valid"]},
{ autoCompleteSet: ["c"], "l": ["non_valid"] },
globalFactories
);
@ -336,25 +336,25 @@ function t(name, meta) {
patterns_test("look ahead - autocomplete before param 1",
endpoints,
"a",
{autoCompleteSet: ["b"]}
{ autoCompleteSet: ["b"] }
);
patterns_test("look ahead - autocomplete before param 2",
endpoints,
[],
{autoCompleteSet: ["a/b"]}
{ autoCompleteSet: ["a/b"] }
);
patterns_test("look ahead - autocomplete after param 1",
endpoints,
"a/b/v",
{autoCompleteSet: ["c/e"], "p": "v"}
{ autoCompleteSet: ["c/e"], "p": "v" }
);
patterns_test("look ahead - autocomplete after param 2",
endpoints,
"a/b/v/c",
{autoCompleteSet: ["e"], "p": "v"}
{ autoCompleteSet: ["e"], "p": "v" }
);
})();
@ -380,7 +380,7 @@ function t(name, meta) {
patterns_test("Competing endpoints - priority 1",
e,
"a/b$",
{method: "GET", endpoint: "1_param", "p": "b"}
{ method: "GET", endpoint: "1_param", "p": "b" }
);
e = _.cloneDeep(endpoints);
e["1_param"].priority = 1;
@ -388,7 +388,7 @@ function t(name, meta) {
patterns_test("Competing endpoints - priority 2",
e,
"a/b$",
{method: "GET", endpoint: "2_explicit"}
{ method: "GET", endpoint: "2_explicit" }
);
e = _.cloneDeep(endpoints);
@ -396,7 +396,7 @@ function t(name, meta) {
patterns_test("Competing endpoints - priority 3",
e,
"a/b$",
{method: "GET", endpoint: "2_explicit"}
{ method: "GET", endpoint: "2_explicit" }
);
})();
@ -431,44 +431,44 @@ function t(name, meta) {
patterns_test("Competing endpoint - sub url of another - auto complete",
endpoints,
"a",
{method: "GET", autoCompleteSet: ["b"]}
{ method: "GET", autoCompleteSet: ["b"] }
);
patterns_test("Competing endpoint - sub url of another, complete 1",
endpoints,
"a$",
{method: "GET", endpoint: "1_GET"}
{ method: "GET", endpoint: "1_GET" }
);
patterns_test("Competing endpoint - sub url of another, complete 2",
endpoints,
"a$",
{method: "PUT", endpoint: "1_PUT"}
{ method: "PUT", endpoint: "1_PUT" }
);
patterns_test("Competing endpoint - sub url of another, complete 3",
endpoints,
"a$",
{method: "DELETE"}
{ method: "DELETE" }
);
patterns_test("Competing endpoint - extension of another, complete 1, auto complete",
endpoints,
"a/b$",
{method: "PUT", autoCompleteSet: []}
{ method: "PUT", autoCompleteSet: [] }
);
patterns_test("Competing endpoint - extension of another, complete 1",
endpoints,
"a/b$",
{method: "GET", endpoint: "2_GET"}
{ method: "GET", endpoint: "2_GET" }
);
patterns_test("Competing endpoint - extension of another, complete 1",
endpoints,
"a/b$",
{method: "DELETE", endpoint: "2_DELETE"}
{ method: "DELETE", endpoint: "2_DELETE" }
);
patterns_test("Competing endpoint - extension of another, complete 1",
endpoints,
"a/b$",
{method: "PUT"}
{ method: "PUT" }
);
})();

View file

@ -2,7 +2,7 @@ let _ = require('lodash');
let url_params = require('../../src/autocomplete/url_params');
let autocomplete_engine = require('../../src/autocomplete/engine');
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
module("Url params");
@ -23,7 +23,7 @@ function param_test(name, description, tokenPath, expectedContext, globalParams)
if (expectedContext.autoCompleteSet) {
expectedContext.autoCompleteSet = _.map(expectedContext.autoCompleteSet, function (t) {
if (_.isString(t)) {
t = {name: t}
t = { name: t }
}
return t;
});
@ -49,14 +49,14 @@ function param_test(name, description, tokenPath, expectedContext, globalParams)
function t(name, meta, insert_value) {
var r = name;
if (meta) {
r = {name: name, meta: meta};
r = { name: name, meta: meta };
if (meta === "param" && !insert_value) {
insert_value = name + "=";
}
}
if (insert_value) {
if (_.isString(r)) {
r = {name: name}
r = { name: name }
}
r.insert_value = insert_value;
}
@ -71,19 +71,19 @@ function t(name, meta, insert_value) {
param_test("settings params",
params,
"a/1",
{"a": ["1"]}
{ "a": ["1"] }
);
param_test("autocomplete top level",
params,
[],
{autoCompleteSet: [t("a", "param"), t("b", "flag")]}
{ autoCompleteSet: [t("a", "param"), t("b", "flag")] }
);
param_test("autocomplete top level, with defaults",
params,
[],
{autoCompleteSet: [t("a", "param"), t("b", "flag"), t("c", "param")]},
{ autoCompleteSet: [t("a", "param"), t("b", "flag"), t("c", "param")] },
{
"c": [2]
}
@ -92,13 +92,13 @@ function t(name, meta, insert_value) {
param_test("autocomplete values",
params,
"a",
{autoCompleteSet: [t("1", "a"), t("2", "a")]}
{ autoCompleteSet: [t("1", "a"), t("2", "a")] }
);
param_test("autocomplete values flag",
params,
"b",
{autoCompleteSet: [t("true", "b"), t("false", "b")]}
{ autoCompleteSet: [t("true", "b"), t("false", "b")] }
);

View file

@ -8,7 +8,7 @@ let version = pkg.version;
describe('plugins/elasticsearch', function () {
describe('lib/is_upgradeable', function () {
let server = {
const server = {
config: _.constant({
get: function (key) {
switch (key) {
@ -44,7 +44,7 @@ describe('plugins/elasticsearch', function () {
upgradeDoc('5.0.0-alpha1', '5.0.0', false);
it('should handle missing _id field', function () {
let doc = {
const doc = {
'_index': '.kibana',
'_type': 'config',
'_score': 1,
@ -58,7 +58,7 @@ describe('plugins/elasticsearch', function () {
});
it('should handle _id of @@version', function () {
let doc = {
const doc = {
'_index': '.kibana',
'_type': 'config',
'_id': '@@version',

View file

@ -47,7 +47,7 @@ describe('plugins/elasticsearch', function () {
it('sends configured custom headers even if the same named header exists in request', function () {
const server = stubServer({
'elasticsearch.requestHeadersWhitelist': ['x-my-custom-header'],
'elasticsearch.customHeaders': {'x-my-custom-header': 'asconfigured'}
'elasticsearch.customHeaders': { 'x-my-custom-header': 'asconfigured' }
});
mapUri(server)(request, function (err, upstreamUri, upstreamHeaders) {

View file

@ -94,13 +94,13 @@ describe('plugins/elasticsearch', function () {
testRoute({
method: 'POST',
url: '/elasticsearch/.kibana/__kibanaQueryValidator/_validate/query?explain=true&ignore_unavailable=true',
payload: {query: {query_string: {analyze_wildcard: true, query: '*'}}}
payload: { query: { query_string: { analyze_wildcard: true, query: '*' } } }
});
testRoute({
method: 'POST',
url: '/elasticsearch/_mget',
payload: {docs: [{_index: '.kibana', _type: 'index-pattern', _id: '[logstash-]YYYY.MM.DD'}]}
payload: { docs: [{ _index: '.kibana', _type: 'index-pattern', _id: '[logstash-]YYYY.MM.DD' }] }
});
testRoute({

View file

@ -39,7 +39,7 @@ function createProxy(server, method, route, config) {
assign(options.config, config);
server.route(options);
};
}
createProxy.createPath = function createPath(path) {
const pre = '/elasticsearch';

View file

@ -45,4 +45,4 @@ export default function mapUri(server, prefix) {
const mappedUrl = formatUrl(mappedUrlComponents);
done(null, mappedUrl, mappedHeaders);
};
};
}

View file

@ -10,4 +10,4 @@ export default function (kibana) {
});
};
}

View file

@ -16,9 +16,9 @@ const hit = {
'_source': {
'extension': 'html',
'bytes': 100,
'area': [{lat: 7, lon: 7}],
'area': [{ lat: 7, lon: 7 }],
'noMapping': 'hasNoMapping',
'objectArray': [{foo: true}, {bar: false}],
'objectArray': [{ foo: true }, { bar: false }],
'_underscore': 1
}
};

View file

@ -26,7 +26,7 @@ docViewsRegistry.register(function () {
};
$scope.showArrayInObjectsWarning = function (row, field) {
let value = $scope.flattened[field];
const value = $scope.flattened[field];
return _.isArray(value) && typeof value[0] === 'object';
};
}

View file

@ -10,4 +10,4 @@ export default function (kibana) {
});
};
}

View file

@ -83,4 +83,4 @@ export default function HistogramVisType(Private) {
}
])
});
};
}

View file

@ -79,4 +79,4 @@ export default function HistogramVisType(Private) {
}
])
});
};
}

View file

@ -89,4 +89,4 @@ export default function HistogramVisType(Private) {
}
])
});
};
}

View file

@ -70,4 +70,4 @@ export default function HistogramVisType(Private) {
}
])
});
};
}

View file

@ -57,7 +57,7 @@ export default function TileMapVisType(Private, getAppState, courier, config) {
const pushFilter = Private(FilterBarPushFilterProvider)(getAppState());
const indexPatternName = agg.vis.indexPattern.id;
const field = agg.fieldName();
const filter = {geo_bounding_box: {}};
const filter = { geo_bounding_box: {} };
filter.geo_bounding_box[field] = event.bounds;
pushFilter(filter, false, indexPatternName);
@ -113,4 +113,4 @@ export default function TileMapVisType(Private, getAppState, courier, config) {
}
])
});
};
}

View file

@ -1,5 +1,5 @@
import expect from 'expect.js';
import {patternToIngest, ingestToPattern} from '../convert_pattern_and_ingest_name';
import { patternToIngest, ingestToPattern } from '../convert_pattern_and_ingest_name';
describe('convertPatternAndTemplateName', function () {

View file

@ -1,5 +1,8 @@
import { resolve } from 'path';
import Promise from 'bluebird';
import { mkdirp as mkdirpNode } from 'mkdirp';
import manageUuid from './server/lib/manage_uuid';
import ingest from './server/routes/api/ingest';
import search from './server/routes/api/search';
@ -13,6 +16,7 @@ module.exports = function (kibana) {
const kbnBaseUrl = '/app/kibana';
return new kibana.Plugin({
id: 'kibana',
config: function (Joi) {
return Joi.object({
enabled: Joi.boolean().default(true),
@ -39,7 +43,7 @@ module.exports = function (kibana) {
],
injectVars: function (server, options) {
let config = server.config();
const config = server.config();
return {
kbnDefaultAppId: config.get('kibana.defaultAppId'),
tilemap: config.get('tilemap')
@ -70,6 +74,7 @@ module.exports = function (kibana) {
description: 'compose visualizations for much win',
icon: 'plugins/kibana/assets/dashboard.svg',
}, {
id: 'kibana:dev_tools',
title: 'Dev Tools',
order: 9001,
url: '/app/kibana#/dev_tools',
@ -85,12 +90,17 @@ module.exports = function (kibana) {
linkToLastSubUrl: false
},
],
injectDefaultVars(server, options) {
return {
kbnIndex: options.index,
kbnBaseUrl
};
},
translations: [
resolve(__dirname, './translations/en.json')
]
},
preInit: async function (server) {
@ -113,9 +123,7 @@ module.exports = function (kibana) {
search(server);
settings(server);
scripts(server);
server.expose('systemApi', systemApi);
}
});
};

View file

@ -24,7 +24,7 @@ describe('dashboard panels', function () {
$compile($el)($scope);
$scope.$digest();
});
};
}
function findPanelWithVisualizationId(id) {
return $scope.state.panels.find((panel) => { return panel.id === id; });
@ -41,7 +41,7 @@ describe('dashboard panels', function () {
it('loads with no vizualizations', function () {
ngMock.inject((SavedDashboard) => {
let dash = new SavedDashboard();
const dash = new SavedDashboard();
dash.init();
compile(dash);
});
@ -50,7 +50,7 @@ describe('dashboard panels', function () {
it('loads one vizualization', function () {
ngMock.inject((SavedDashboard) => {
let dash = new SavedDashboard();
const dash = new SavedDashboard();
dash.init();
dash.panelsJSON = `[{"col":3,"id":"foo1","row":1,"size_x":2,"size_y":2,"type":"visualization"}]`;
compile(dash);
@ -60,7 +60,7 @@ describe('dashboard panels', function () {
it('loads vizualizations in correct order', function () {
ngMock.inject((SavedDashboard) => {
let dash = new SavedDashboard();
const dash = new SavedDashboard();
dash.init();
dash.panelsJSON = `[
{"col":3,"id":"foo1","row":1,"size_x":2,"size_y":2,"type":"visualization"},
@ -90,7 +90,7 @@ describe('dashboard panels', function () {
it('initializes visualizations with the default size', function () {
ngMock.inject((SavedDashboard) => {
let dash = new SavedDashboard();
const dash = new SavedDashboard();
dash.init();
dash.panelsJSON = `[
{"col":3,"id":"foo1","row":1,"type":"visualization"},

View file

@ -0,0 +1,15 @@
import ngMock from 'ng_mock';
import expect from 'expect.js';
describe('SavedDashboards Service', function () {
let savedDashboardLoader;
beforeEach(ngMock.module('kibana'));
beforeEach(ngMock.inject(function (savedDashboards) {
savedDashboardLoader = savedDashboards;
}));
it('delete returns a native promise', function () {
expect(savedDashboardLoader.delete(['1','2'])).to.be.a(Promise);
});
});

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