mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Backport eslint updates to 5.x (#10139)
* [eslint] update eslint config to 0.3.0 * [eslint] autofix * [fixtures/hits] reformat to comply with max-len lint rule * [eslint] enable no-var and autofix * [eslint] enable prefer-const and autofix * [eslint] fix autofix-incompatible no-var and prefer-const violations * [eslint] enable quotes+no-extra-semi and autofix
This commit is contained in:
parent
bf3734bc8d
commit
9ed7e81b62
925 changed files with 5415 additions and 5404 deletions
|
@ -2,7 +2,3 @@
|
|||
extends: '@elastic/kibana'
|
||||
rules:
|
||||
no-unused-vars: off
|
||||
no-var: off
|
||||
prefer-const: off
|
||||
no-extra-semi: off
|
||||
quotes: off
|
||||
|
|
|
@ -168,7 +168,7 @@
|
|||
"wreck": "6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@elastic/eslint-config-kibana": "0.2.1",
|
||||
"@elastic/eslint-config-kibana": "0.3.0",
|
||||
"angular-mocks": "1.4.7",
|
||||
"auto-release-sinon": "1.0.3",
|
||||
"babel-eslint": "6.1.2",
|
||||
|
@ -180,6 +180,7 @@
|
|||
"del": "1.2.1",
|
||||
"elasticdump": "2.1.1",
|
||||
"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",
|
||||
|
|
|
@ -110,7 +110,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;
|
||||
|
|
|
@ -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}"`;
|
||||
}, '');
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 + ']';
|
||||
}
|
||||
|
|
|
@ -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));
|
||||
});
|
||||
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
|
|
|
@ -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; },
|
||||
|
|
|
@ -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
|
||||
};
|
||||
}
|
||||
|
|
|
@ -42,4 +42,4 @@ export function download(settings, logger) {
|
|||
}
|
||||
|
||||
return tryNext();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -140,4 +140,4 @@ export async function extract(settings, logger) {
|
|||
logger.error(err);
|
||||
throw new Error('Error extracting plugin archive');
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1 +1 @@
|
|||
export class UnsupportedProtocolError extends Error {};
|
||||
export class UnsupportedProtocolError extends Error {}
|
||||
|
|
|
@ -41,6 +41,6 @@ export default class Logger {
|
|||
}
|
||||
process.stderr.write(`${data}\n`);
|
||||
this.previousLineEnded = true;
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -29,4 +29,4 @@ export default function pluginList(program) {
|
|||
)
|
||||
.description('list installed plugins')
|
||||
.action(processCommand);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -6,4 +6,4 @@ export function parse(command, options) {
|
|||
};
|
||||
|
||||
return settings;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -39,4 +39,4 @@ export default function pluginRemove(program) {
|
|||
`common examples:
|
||||
remove x-pack`)
|
||||
.action(processCommand);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -12,4 +12,4 @@ export function parse(command, options) {
|
|||
settings.pluginPath = resolve(settings.pluginDir, settings.plugin);
|
||||
|
||||
return settings;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -29,7 +29,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) {
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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: [
|
||||
{
|
||||
|
|
|
@ -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}']);
|
||||
|
|
|
@ -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] }
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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: "",
|
||||
|
|
|
@ -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"] }
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -108,7 +108,7 @@ module.exports = function (api) {
|
|||
tokenizer: "",
|
||||
char_filter: [],
|
||||
filter: [],
|
||||
explain: {__one_of: [false, true]},
|
||||
explain: { __one_of: [false, true] },
|
||||
attributes: []
|
||||
}
|
||||
});
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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: {}
|
||||
|
|
|
@ -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
|
||||
},
|
||||
|
|
|
@ -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": {}
|
||||
}
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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' }
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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.startRetrievingAutoCompleteInfo();
|
||||
};
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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"
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -26,21 +26,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()
|
||||
}
|
||||
|
@ -235,7 +235,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
|
||||
});
|
||||
|
||||
|
@ -253,8 +253,8 @@ export function initializeInput($el, $actionsEl, $copyAsCurlEl, output) {
|
|||
require('./input_resize')(input, output);
|
||||
|
||||
return input;
|
||||
};
|
||||
}
|
||||
|
||||
export default function getInput() {
|
||||
return input;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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"];
|
||||
|
|
|
@ -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;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 }
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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");
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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("Input 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);
|
||||
|
|
|
@ -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"]
|
||||
}
|
||||
]
|
||||
|
|
|
@ -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"] }
|
||||
);
|
||||
|
|
|
@ -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" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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" }
|
||||
);
|
||||
})();
|
||||
|
|
|
@ -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")] }
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -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',
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -43,4 +43,4 @@ export default function mapUri(cluster, proxyPrefix) {
|
|||
const mappedUrl = formatUrl(mappedUrlComponents);
|
||||
done(null, mappedUrl, mappedHeaders);
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@ export default function (kibana) {
|
|||
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@ export default function (kibana) {
|
|||
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -92,4 +92,4 @@ export default function HistogramVisType(Private) {
|
|||
}
|
||||
])
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -79,4 +79,4 @@ export default function HistogramVisType(Private) {
|
|||
}
|
||||
])
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -98,4 +98,4 @@ export default function HistogramVisType(Private) {
|
|||
}
|
||||
])
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -70,4 +70,4 @@ export default function HistogramVisType(Private) {
|
|||
}
|
||||
])
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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) {
|
|||
}
|
||||
])
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -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 () {
|
||||
|
||||
|
|
|
@ -35,7 +35,7 @@ describe('dashboard panels', function () {
|
|||
$compile($el)($scope);
|
||||
$scope.$digest();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
function findPanelWithVisualizationId(id) {
|
||||
return $scope.state.panels.find((panel) => { return panel.id === id; });
|
||||
|
@ -52,7 +52,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);
|
||||
});
|
||||
|
@ -61,7 +61,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);
|
||||
|
@ -71,7 +71,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"},
|
||||
|
@ -101,7 +101,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"},
|
||||
|
|
|
@ -137,7 +137,7 @@ app.directive('dashboardGrid', function ($compile, Notifier) {
|
|||
}
|
||||
});
|
||||
added.forEach(addPanel);
|
||||
};
|
||||
}
|
||||
|
||||
if (added.length) {
|
||||
$scope.saveState();
|
||||
|
|
|
@ -59,10 +59,10 @@ module.factory('SavedDashboard', function (courier, config) {
|
|||
refreshInterval: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
display: {type: 'string'},
|
||||
pause: { type: 'boolean'},
|
||||
section: { type: 'integer'},
|
||||
value: { type: 'integer'}
|
||||
display: { type: 'string' },
|
||||
pause: { type: 'boolean' },
|
||||
section: { type: 'integer' },
|
||||
value: { type: 'integer' }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export function savedDashboardRegister(savedDashboards) {
|
||||
return savedDashboards;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -51,9 +51,9 @@ app.directive('discFieldChooser', function ($location, globalState, config, $rou
|
|||
missing: true
|
||||
},
|
||||
boolOpts: [
|
||||
{label: 'any', value: undefined },
|
||||
{label: 'yes', value: true },
|
||||
{label: 'no', value: false }
|
||||
{ label: 'any', value: undefined },
|
||||
{ label: 'yes', value: true },
|
||||
{ label: 'no', value: false }
|
||||
],
|
||||
toggleVal: function (name, def) {
|
||||
if (filter.vals[name] !== def) filter.vals[name] = def;
|
||||
|
@ -204,7 +204,7 @@ app.directive('discFieldChooser', function ($location, globalState, config, $rou
|
|||
type: type,
|
||||
aggs: [
|
||||
agg,
|
||||
{schema: 'metric', type: 'count', 'id': '2'}
|
||||
{ schema: 'metric', type: 'count', 'id': '2' }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
|
|
@ -584,4 +584,4 @@ function discoverController($scope, config, courier, $route, $window, Notifier,
|
|||
}
|
||||
|
||||
init();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export default function savedSearchObjectFn(savedSearches) {
|
||||
return savedSearches;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -53,10 +53,10 @@ const init = function (index, type, id) {
|
|||
});
|
||||
break;
|
||||
case 'missingIndex':
|
||||
deferred.reject({status: 404});
|
||||
deferred.reject({ status: 404 });
|
||||
break;
|
||||
case 'badRequest':
|
||||
deferred.reject({status: 500});
|
||||
deferred.reject({ status: 500 });
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,4 +23,4 @@ export default function (indexPattern) {
|
|||
});
|
||||
|
||||
return dateScripts;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ uiModules.get('apps/management')
|
|||
});
|
||||
|
||||
$scope.$watchCollection('indexPattern.fields', function () {
|
||||
$scope.conflictFields = _.filter($scope.indexPattern.fields, {type: 'conflict'});
|
||||
$scope.conflictFields = _.filter($scope.indexPattern.fields, { type: 'conflict' });
|
||||
});
|
||||
|
||||
$scope.refreshFields = function () {
|
||||
|
|
|
@ -30,4 +30,4 @@ export default function GetFieldTypes() {
|
|||
}
|
||||
];
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -40,7 +40,7 @@ uiModules.get('apps/management')
|
|||
const fields = filter($scope.indexPattern.getNonScriptedFields(), $scope.fieldFilter);
|
||||
const sourceFilters = $scope.indexPattern.sourceFilters && $scope.indexPattern.sourceFilters.map(f => f.value) || [];
|
||||
const fieldWildcardMatch = fieldWildcardMatcher(sourceFilters);
|
||||
_.find($scope.editSections, {index: 'indexedFields'}).count = fields.length; // Update the tab count
|
||||
_.find($scope.editSections, { index: 'indexedFields' }).count = fields.length; // Update the tab count
|
||||
|
||||
$scope.rows = fields.map(function (field) {
|
||||
const childScope = _.assign($scope.$new(), { field: field });
|
||||
|
|
|
@ -4,4 +4,4 @@ export default function RefreshKibanaIndexFn(esAdmin, kbnIndex) {
|
|||
index: kbnIndex
|
||||
});
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
|
@ -41,7 +41,7 @@ uiModules.get('apps/management')
|
|||
rowScopes.length = 0;
|
||||
|
||||
const fields = filter($scope.indexPattern.getScriptedFields(), $scope.fieldFilter);
|
||||
_.find($scope.editSections, {index: 'scriptedFields'}).count = fields.length; // Update the tab count
|
||||
_.find($scope.editSections, { index: 'scriptedFields' }).count = fields.length; // Update the tab count
|
||||
|
||||
$scope.rows = fields.map(function (field) {
|
||||
const rowScope = $scope.$new();
|
||||
|
|
|
@ -39,7 +39,7 @@ uiModules.get('apps/management')
|
|||
$scope.indexPatternList = ids.map(function (id) {
|
||||
return {
|
||||
id: id,
|
||||
url: kbnUrl.eval('#/management/kibana/indices/{{id}}', {id: id}),
|
||||
url: kbnUrl.eval('#/management/kibana/indices/{{id}}', { id: id }),
|
||||
class: 'sidebar-item-title ' + ($scope.editingId === id ? 'active' : ''),
|
||||
default: $scope.defaultIndex === id
|
||||
};
|
||||
|
|
|
@ -82,7 +82,7 @@ uiModules.get('kibana')
|
|||
]);
|
||||
});
|
||||
// Update the tab count
|
||||
find($scope.$parent.editSections, {index: 'sourceFilters'}).count = $scope.rows.length;
|
||||
find($scope.$parent.editSections, { index: 'sourceFilters' }).count = $scope.rows.length;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -52,7 +52,7 @@ uiModules.get('apps/management')
|
|||
$q.all(services).then(function (data) {
|
||||
$scope.services = sortBy(data, 'title');
|
||||
let tab = $scope.services[0];
|
||||
if ($state.tab) $scope.currentTab = tab = find($scope.services, {title: $state.tab});
|
||||
if ($state.tab) $scope.currentTab = tab = find($scope.services, { title: $state.tab });
|
||||
|
||||
$scope.$watch('state.tab', function (tab) {
|
||||
if (!tab) $scope.changeTab($scope.services[0]);
|
||||
|
@ -121,7 +121,7 @@ uiModules.get('apps/management')
|
|||
|
||||
// TODO: Migrate all scope methods to the controller.
|
||||
$scope.bulkExport = function () {
|
||||
const objs = $scope.selectedItems.map(partialRight(extend, {type: $scope.currentTab.type}));
|
||||
const objs = $scope.selectedItems.map(partialRight(extend, { type: $scope.currentTab.type }));
|
||||
retrieveAndExportDocs(objs);
|
||||
};
|
||||
|
||||
|
@ -138,7 +138,7 @@ uiModules.get('apps/management')
|
|||
if (!objs.length) return notify.error('No saved objects to export.');
|
||||
esAdmin.mget({
|
||||
index: kbnIndex,
|
||||
body: {docs: objs.map(transformToMget)}
|
||||
body: { docs: objs.map(transformToMget) }
|
||||
})
|
||||
.then(function (response) {
|
||||
saveToFile(response.docs.map(partialRight(pick, '_id', '_type', '_source')));
|
||||
|
@ -147,11 +147,11 @@ uiModules.get('apps/management')
|
|||
|
||||
// Takes an object and returns the associated data needed for an mget API request
|
||||
function transformToMget(obj) {
|
||||
return {_id: obj.id, _type: obj.type};
|
||||
return { _id: obj.id, _type: obj.type };
|
||||
}
|
||||
|
||||
function saveToFile(results) {
|
||||
const blob = new Blob([angular.toJson(results, true)], {type: 'application/json'});
|
||||
const blob = new Blob([angular.toJson(results, true)], { type: 'application/json' });
|
||||
saveAs(blob, 'export.json');
|
||||
}
|
||||
|
||||
|
@ -165,7 +165,7 @@ uiModules.get('apps/management')
|
|||
}
|
||||
|
||||
return Promise.map(docs, function (doc) {
|
||||
const service = find($scope.services, {type: doc._type}).service;
|
||||
const service = find($scope.services, { type: doc._type }).service;
|
||||
return service.get().then(function (obj) {
|
||||
obj.id = doc._id;
|
||||
return obj.applyESResp(doc).then(function () {
|
||||
|
|
|
@ -147,7 +147,7 @@ uiModules.get('apps/management')
|
|||
session.setUseSoftTabs(true);
|
||||
session.on('changeAnnotation', function () {
|
||||
const annotations = session.getAnnotations();
|
||||
if (_.some(annotations, { type: 'error'})) {
|
||||
if (_.some(annotations, { type: 'error' })) {
|
||||
if (!_.contains($scope.aceInvalidEditors, fieldName)) {
|
||||
$scope.aceInvalidEditors.push(fieldName);
|
||||
}
|
||||
|
|
|
@ -10,27 +10,27 @@ describe('Settings', function () {
|
|||
});
|
||||
|
||||
it('should return the explicitly defined type of a setting', function () {
|
||||
expect(getValType({type: 'string'})).to.be('string');
|
||||
expect(getValType({type: 'json'})).to.be('json');
|
||||
expect(getValType({type: 'string', value: 5})).to.be('string');
|
||||
expect(getValType({ type: 'string' })).to.be('string');
|
||||
expect(getValType({ type: 'json' })).to.be('json');
|
||||
expect(getValType({ type: 'string', value: 5 })).to.be('string');
|
||||
});
|
||||
|
||||
it('should return array if the value is an Array and there is no defined type', function () {
|
||||
expect(getValType({type: 'string'}, [1, 2, 3])).to.be('string');
|
||||
expect(getValType({type: 'json', value: [1, 2, 3]})).to.be('json');
|
||||
expect(getValType({ type: 'string' }, [1, 2, 3])).to.be('string');
|
||||
expect(getValType({ type: 'json', value: [1, 2, 3] })).to.be('json');
|
||||
|
||||
expect(getValType({value: 'someString'}, [1, 2, 3])).to.be('array');
|
||||
expect(getValType({value: [1, 2, 3]}, 'someString')).to.be('array');
|
||||
expect(getValType({ value: 'someString' }, [1, 2, 3])).to.be('array');
|
||||
expect(getValType({ value: [1, 2, 3] }, 'someString')).to.be('array');
|
||||
|
||||
});
|
||||
|
||||
it('should return the type of the default value if there is no type and it is not an array', function () {
|
||||
expect(getValType({value: 'someString'})).to.be('string');
|
||||
expect(getValType({value: 'someString'}, 42)).to.be('string');
|
||||
expect(getValType({ value: 'someString' })).to.be('string');
|
||||
expect(getValType({ value: 'someString' }, 42)).to.be('string');
|
||||
});
|
||||
|
||||
it('should return the type of the value if the default value is null', function () {
|
||||
expect(getValType({value: null}, 'someString')).to.be('string');
|
||||
expect(getValType({ value: null }, 'someString')).to.be('string');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,7 +26,7 @@ uiRoutes
|
|||
resolve: {
|
||||
savedVis: function (savedVisualizations, courier, $route, Private) {
|
||||
const visTypes = Private(RegistryVisTypesProvider);
|
||||
const visType = _.find(visTypes, {name: $route.current.params.type});
|
||||
const visType = _.find(visTypes, { name: $route.current.params.type });
|
||||
if (visType.requiresSearch && !$route.current.params.indexPattern && !$route.current.params.savedSearchId) {
|
||||
throw new Error('You must provide either an indexPattern or a savedSearchId');
|
||||
}
|
||||
|
@ -131,13 +131,13 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie
|
|||
const stateDefaults = {
|
||||
uiState: savedVis.uiStateJSON ? JSON.parse(savedVis.uiStateJSON) : {},
|
||||
linked: !!savedVis.savedSearchId,
|
||||
query: searchSource.getOwn('query') || {query_string: {query: '*'}},
|
||||
query: searchSource.getOwn('query') || { query_string: { query: '*' } },
|
||||
filters: searchSource.getOwn('filter') || [],
|
||||
vis: savedVisState
|
||||
};
|
||||
|
||||
// Instance of app_state.js.
|
||||
let $state = $scope.$state = (function initState() {
|
||||
const $state = $scope.$state = (function initState() {
|
||||
// This is used to sync visualization state with the url when `appState.save()` is called.
|
||||
const appState = new AppState(stateDefaults);
|
||||
|
||||
|
@ -368,4 +368,4 @@ function VisEditor($scope, $route, timefilter, AppState, $window, kbnUrl, courie
|
|||
}
|
||||
|
||||
init();
|
||||
};
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
export default function savedVisualizationFn(savedVisualizations) {
|
||||
return savedVisualizations;
|
||||
};
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ describe('createMappingsFromPatternFields', function () {
|
|||
});
|
||||
|
||||
it('should set the same default mapping for all non-strings', function () {
|
||||
let mappings = createMappingsFromPatternFields(testFields);
|
||||
const mappings = createMappingsFromPatternFields(testFields);
|
||||
|
||||
_.forEach(mappings, function (mapping) {
|
||||
if (mapping.type !== 'text') {
|
||||
|
@ -50,7 +50,7 @@ describe('createMappingsFromPatternFields', function () {
|
|||
});
|
||||
|
||||
it('should give strings a multi-field mapping with a "text" base type', function () {
|
||||
let mappings = createMappingsFromPatternFields(testFields);
|
||||
const mappings = createMappingsFromPatternFields(testFields);
|
||||
|
||||
_.forEach(mappings, function (mapping) {
|
||||
if (mapping.type === 'text') {
|
||||
|
@ -60,8 +60,8 @@ describe('createMappingsFromPatternFields', function () {
|
|||
});
|
||||
|
||||
it('should handle nested fields', function () {
|
||||
testFields.push({name: 'geo.coordinates', type: 'geo_point'});
|
||||
let mappings = createMappingsFromPatternFields(testFields);
|
||||
testFields.push({ name: 'geo.coordinates', type: 'geo_point' });
|
||||
const mappings = createMappingsFromPatternFields(testFields);
|
||||
|
||||
expect(mappings).to.have.property('geo');
|
||||
expect(mappings.geo).to.have.property('properties');
|
||||
|
@ -74,7 +74,7 @@ describe('createMappingsFromPatternFields', function () {
|
|||
});
|
||||
|
||||
it('should map all number fields as an ES double', function () {
|
||||
let mappings = createMappingsFromPatternFields(testFields);
|
||||
const mappings = createMappingsFromPatternFields(testFields);
|
||||
|
||||
expect(mappings).to.have.property('bytes');
|
||||
expect(mappings.bytes).to.have.property('type', 'double');
|
||||
|
|
|
@ -15,7 +15,7 @@ module.exports = function createMappingsFromPatternFields(fields) {
|
|||
mapping = {
|
||||
type: 'text',
|
||||
fields: {
|
||||
keyword: {type: 'keyword', ignore_above: 256}
|
||||
keyword: { type: 'keyword', ignore_above: 256 }
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ export function registerFieldCapabilities(server) {
|
|||
return _.pick(value, ['searchable', 'aggregatable']);
|
||||
});
|
||||
|
||||
reply({fields: fieldsFilteredValues});
|
||||
reply({ fields: fieldsFilteredValues });
|
||||
},
|
||||
(error) => {
|
||||
reply(handleESError(error));
|
||||
|
|
|
@ -15,7 +15,7 @@ export default function registerCount(server) {
|
|||
})
|
||||
.then(
|
||||
function (res) {
|
||||
reply({count: res.count});
|
||||
reply({ count: res.count });
|
||||
},
|
||||
function (error) {
|
||||
reply(handleESError(error));
|
||||
|
|
|
@ -10,4 +10,4 @@ export default function (kibana) {
|
|||
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -10,4 +10,4 @@ export default function (kibana) {
|
|||
|
||||
});
|
||||
|
||||
};
|
||||
}
|
||||
|
|
|
@ -34,8 +34,8 @@ describe('metric vis', function () {
|
|||
$scope.processTableGroups({
|
||||
tables: [{
|
||||
columns: [
|
||||
{title: '1st percentile of bytes'},
|
||||
{title: '99th percentile of bytes'}
|
||||
{ title: '1st percentile of bytes' },
|
||||
{ title: '99th percentile of bytes' }
|
||||
],
|
||||
rows: [[ { toString: () => formatter(182) }, { toString: () => formatter(445842.4634666484) } ]]
|
||||
}]
|
||||
|
|
|
@ -7,4 +7,4 @@ export default function (kibana) {
|
|||
]
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
|
@ -9,4 +9,4 @@ export default function (kibana) {
|
|||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue