mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
[eslint] enable object-curly-spacing and no-global-assign (#9486)
* [eslint] update eslint config to 0.3.0 * [eslint] autofix * [fixtures/hits] reformat to comply with max-len lint rule
This commit is contained in:
parent
bff1533503
commit
db60725a02
210 changed files with 1030 additions and 1016 deletions
|
@ -169,7 +169,7 @@
|
|||
"wreck": "6.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@elastic/eslint-config-kibana": "0.2.2",
|
||||
"@elastic/eslint-config-kibana": "0.3.0",
|
||||
"angular-mocks": "1.4.7",
|
||||
"auto-release-sinon": "1.0.3",
|
||||
"babel-eslint": "6.1.2",
|
||||
|
@ -181,6 +181,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",
|
||||
|
|
|
@ -108,7 +108,7 @@ export default class BasePathProxy {
|
|||
method: '*',
|
||||
path: `/{oldBasePath}/{kbnPath*}`,
|
||||
handler(req, reply) {
|
||||
const {oldBasePath, kbnPath = ''} = req.params;
|
||||
const { oldBasePath, kbnPath = '' } = req.params;
|
||||
|
||||
const isGet = req.method === 'get';
|
||||
const isBasePath = oldBasePath.length === 3;
|
||||
|
|
|
@ -28,7 +28,7 @@ function ES_5_0() {
|
|||
}, this);
|
||||
}
|
||||
|
||||
ES_5_0.prototype = _.create(Api.prototype, {'constructor': ES_5_0});
|
||||
ES_5_0.prototype = _.create(Api.prototype, { 'constructor': ES_5_0 });
|
||||
|
||||
(function (cls) {
|
||||
cls.addEndpointDescription = function (endpoint, description) {
|
||||
|
|
|
@ -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' }
|
||||
}
|
||||
});
|
||||
};
|
||||
|
|
|
@ -151,7 +151,7 @@ module.exports = function (kibana) {
|
|||
method: ['GET', 'POST'],
|
||||
handler: function (req, reply) {
|
||||
let server = require('./api_server/server');
|
||||
let {sense_version, apis} = req.query;
|
||||
let { sense_version, apis } = req.query;
|
||||
if (!apis) {
|
||||
reply(Boom.badRequest('"apis" is a required param.'));
|
||||
return;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -76,9 +76,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 });
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -165,13 +165,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 "
|
||||
|
@ -180,7 +180,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);
|
||||
|
@ -324,7 +324,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;
|
||||
|
@ -373,7 +373,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":
|
||||
|
@ -513,7 +513,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" }
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -824,7 +824,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) {
|
||||
|
||||
|
|
|
@ -24,21 +24,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()
|
||||
}
|
||||
|
@ -224,7 +224,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
|
||||
});
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -14,8 +14,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 }
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -24,8 +24,8 @@ var InputHighlightRules = function () {
|
|||
/*jshint -W015 */
|
||||
this.$rules = {
|
||||
"start": mergeTokens([
|
||||
{token: "comment", regex: /^#.*$/},
|
||||
{token: "paren.lparen", regex: "{", next: "json", push: true}
|
||||
{ token: "comment", regex: /^#.*$/ },
|
||||
{ token: "paren.lparen", regex: "{", next: "json", push: true }
|
||||
],
|
||||
addEOL(["method"], /([a-zA-Z]+)/, "start", "method_sep")
|
||||
,
|
||||
|
|
|
@ -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) {
|
||||
|
@ -1711,7 +1711,7 @@ define("sense_editor/mode/worker_parser", ['require', 'exports', 'module' ], fun
|
|||
}
|
||||
}
|
||||
return reviver.call(holder, key, value);
|
||||
})({'': result}, '') : result;
|
||||
})({ '': result }, '') : result;
|
||||
};
|
||||
});
|
||||
|
||||
|
@ -1764,7 +1764,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");
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ let input = require('../../src/input');
|
|||
let editor_input1 = require('raw!./editor_input1.txt');
|
||||
|
||||
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;
|
||||
|
||||
|
||||
module("Editor", {
|
||||
|
@ -272,7 +272,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: {
|
||||
|
@ -287,7 +287,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: {
|
||||
|
@ -296,7 +296,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
|
||||
|
@ -310,7 +310,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
|
||||
|
@ -324,13 +324,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) {
|
||||
|
@ -344,7 +344,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
|
||||
|
|
|
@ -3,7 +3,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 () {
|
||||
|
@ -96,7 +96,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;
|
||||
});
|
||||
|
@ -173,13 +173,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}" } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -190,16 +190,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" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -213,12 +213,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"]
|
||||
}
|
||||
]
|
||||
|
@ -232,7 +232,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Missing KB",
|
||||
cursor: {row: 0, column: 1},
|
||||
cursor: { row: 0, column: 1 },
|
||||
no_context: true
|
||||
}
|
||||
]
|
||||
|
@ -257,7 +257,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Missing KB - global auto complete",
|
||||
cursor: {row: 2, column: 5},
|
||||
cursor: { row: 2, column: 5 },
|
||||
autoCompleteSet: ["t1"]
|
||||
}
|
||||
]
|
||||
|
@ -277,37 +277,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
|
||||
}
|
||||
]
|
||||
|
@ -327,42 +327,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"]
|
||||
}
|
||||
|
||||
|
@ -385,11 +385,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] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -398,31 +398,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]
|
||||
}
|
||||
|
@ -445,14 +445,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" }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -479,17 +479,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;
|
||||
}
|
||||
|
@ -514,8 +514,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"] }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -524,14 +524,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")]
|
||||
}
|
||||
]
|
||||
|
@ -561,7 +561,7 @@ context_tests(
|
|||
lines_regex: "other"
|
||||
},
|
||||
"no_match": {}
|
||||
}, {"always": {}}]
|
||||
}, { "always": {} }]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -571,7 +571,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Conditionals",
|
||||
cursor: {row: 2, column: 15},
|
||||
cursor: { row: 2, column: 15 },
|
||||
autoCompleteSet: [
|
||||
tt("always", {}), tt("match", {})
|
||||
]
|
||||
|
@ -605,18 +605,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
|
||||
]
|
||||
}
|
||||
|
@ -628,37 +628,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)
|
||||
]
|
||||
|
@ -683,7 +683,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Empty string as default",
|
||||
cursor: {row: 0, column: 1},
|
||||
cursor: { row: 0, column: 1 },
|
||||
autoCompleteSet: [tt("query", "")]
|
||||
}
|
||||
]
|
||||
|
@ -765,7 +765,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", [
|
||||
{}
|
||||
|
@ -774,37 +774,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/
|
||||
|
||||
}
|
||||
|
@ -834,7 +834,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Top level scope link",
|
||||
cursor: {row: 0, column: 1},
|
||||
cursor: { row: 0, column: 1 },
|
||||
autoCompleteSet: [
|
||||
tt("t1", 2)
|
||||
]
|
||||
|
@ -862,7 +862,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Path after empty object",
|
||||
cursor: {row: 1, column: 10},
|
||||
cursor: { row: 1, column: 10 },
|
||||
autoCompleteSet: ["a", "b"]
|
||||
}
|
||||
]
|
||||
|
@ -878,8 +878,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 } }
|
||||
}
|
||||
]
|
||||
);
|
||||
|
@ -899,7 +899,7 @@ context_tests(
|
|||
patterns: ["_endpoint"],
|
||||
data_autocomplete_rules: {
|
||||
"a": [
|
||||
{b: 1}
|
||||
{ b: 1 }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -909,12 +909,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", [
|
||||
{}
|
||||
])]
|
||||
|
@ -944,15 +944,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" }
|
||||
]
|
||||
}
|
||||
]
|
||||
|
@ -967,7 +967,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "initial doc start",
|
||||
cursor: {row: 1, column: 0},
|
||||
cursor: { row: 1, column: 0 },
|
||||
autoCompleteSet: ["{"],
|
||||
prefixToAdd: "",
|
||||
suffixToAdd: ""
|
||||
|
@ -988,14 +988,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
|
||||
}
|
||||
|
||||
|
@ -1033,7 +1033,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: ""
|
||||
|
@ -1049,21 +1049,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: ""
|
||||
|
@ -1079,10 +1079,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: "",
|
||||
|
@ -1099,7 +1099,7 @@ context_tests(
|
|||
[
|
||||
{
|
||||
name: "Endpoints with two slashes",
|
||||
cursor: {row: 0, column: 20},
|
||||
cursor: { row: 0, column: 20 },
|
||||
autoCompleteSet: ["stats"],
|
||||
prefixToAdd: "",
|
||||
suffixToAdd: "",
|
||||
|
@ -1116,13 +1116,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: "",
|
||||
|
@ -1139,13 +1139,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: "",
|
||||
|
@ -1162,13 +1162,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: "",
|
||||
|
@ -1186,13 +1186,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: ""
|
||||
|
@ -1208,10 +1208,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: ""
|
||||
|
@ -1227,13 +1227,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: ""
|
||||
|
@ -1249,17 +1249,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: ""
|
||||
|
@ -1275,14 +1275,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: ""
|
||||
|
@ -1297,14 +1297,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: ""
|
||||
|
@ -1327,32 +1327,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" }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ let $ = require('jquery');
|
|||
let input = require('../../src/input');
|
||||
|
||||
var token_iterator = ace.require("ace/token_iterator");
|
||||
var {test, module, ok, fail, asyncTest, deepEqual, equal, start} = QUnit;
|
||||
var { test, module, ok, fail, asyncTest, deepEqual, equal, start } = QUnit;
|
||||
|
||||
module("Tokenization", {
|
||||
setup: function () {
|
||||
|
@ -24,7 +24,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);
|
||||
}
|
||||
|
||||
|
@ -51,7 +51,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);
|
||||
|
|
|
@ -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")] }
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ describe('plugins/elasticsearch', function () {
|
|||
it('sends configured custom headers even if the same named header exists in request', function () {
|
||||
const server = stubServer({
|
||||
'elasticsearch.requestHeadersWhitelist': ['x-my-custom-header'],
|
||||
'elasticsearch.customHeaders': {'x-my-custom-header': 'asconfigured'}
|
||||
'elasticsearch.customHeaders': { 'x-my-custom-header': 'asconfigured' }
|
||||
});
|
||||
|
||||
mapUri(server)(request, function (err, upstreamUri, upstreamHeaders) {
|
||||
|
|
|
@ -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({
|
||||
|
|
|
@ -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
|
||||
}
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 () {
|
||||
|
||||
|
|
|
@ -89,7 +89,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
panels: dash.panelsJSON ? JSON.parse(dash.panelsJSON) : [],
|
||||
options: dash.optionsJSON ? JSON.parse(dash.optionsJSON) : {},
|
||||
uiState: dash.uiStateJSON ? JSON.parse(dash.uiStateJSON) : {},
|
||||
query: extractQueryFromFilters(dash.searchSource.getOwn('filter')) || {query_string: {query: '*'}},
|
||||
query: extractQueryFromFilters(dash.searchSource.getOwn('filter')) || { query_string: { query: '*' } },
|
||||
filters: _.reject(dash.searchSource.getOwn('filter'), matchQueryFilter),
|
||||
};
|
||||
|
||||
|
@ -245,7 +245,7 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
|
|||
if (id) {
|
||||
notify.info('Saved Dashboard as "' + dash.title + '"');
|
||||
if (dash.id !== $routeParams.id) {
|
||||
kbnUrl.change('/dashboard/{{id}}', {id: dash.id});
|
||||
kbnUrl.change('/dashboard/{{id}}', { id: dash.id });
|
||||
} else {
|
||||
docTitle.change(dash.lastSavedTitle);
|
||||
}
|
||||
|
|
|
@ -59,10 +59,10 @@ module.factory('SavedDashboard', function (courier, config) {
|
|||
refreshInterval: {
|
||||
type: 'object',
|
||||
properties: {
|
||||
display: {type: 'keyword'},
|
||||
pause: { type: 'boolean'},
|
||||
section: { type: 'integer'},
|
||||
value: { type: 'integer'}
|
||||
display: { type: 'keyword' },
|
||||
pause: { type: 'boolean' },
|
||||
section: { type: 'integer' },
|
||||
value: { type: 'integer' }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
@ -38,7 +38,7 @@ module.service('savedDashboards', function (Promise, SavedDashboard, kbnIndex, e
|
|||
};
|
||||
|
||||
this.urlFor = function (id) {
|
||||
return kbnUrl.eval('#/dashboard/{{id}}', {id: id});
|
||||
return kbnUrl.eval('#/dashboard/{{id}}', { id: id });
|
||||
};
|
||||
|
||||
this.delete = function (ids) {
|
||||
|
@ -75,7 +75,7 @@ module.service('savedDashboards', function (Promise, SavedDashboard, kbnIndex, e
|
|||
}
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
body = { query: { match_all: {} } };
|
||||
}
|
||||
|
||||
return es.search({
|
||||
|
|
|
@ -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' }
|
||||
]
|
||||
}
|
||||
})
|
||||
|
|
|
@ -486,7 +486,7 @@ function discoverController($scope, config, courier, $route, $window, Notifier,
|
|||
$scope.searchSource.highlight({
|
||||
pre_tags: [highlightTags.pre],
|
||||
post_tags: [highlightTags.post],
|
||||
fields: {'*': {}},
|
||||
fields: { '*': {} },
|
||||
require_field_match: false,
|
||||
fragment_size: 2147483647 // Limit of an integer.
|
||||
});
|
||||
|
|
|
@ -49,7 +49,7 @@ module.service('savedSearches', function (Promise, config, kbnIndex, es, createN
|
|||
};
|
||||
|
||||
this.urlFor = function (id) {
|
||||
return kbnUrl.eval('#/discover/{{id}}', {id: id});
|
||||
return kbnUrl.eval('#/discover/{{id}}', { id: id });
|
||||
};
|
||||
|
||||
this.delete = function (ids) {
|
||||
|
@ -79,7 +79,7 @@ module.service('savedSearches', function (Promise, config, kbnIndex, es, createN
|
|||
}
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
body = { query: { match_all: {} } };
|
||||
}
|
||||
|
||||
return es.search({
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,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 () {
|
||||
|
|
|
@ -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 });
|
||||
|
|
|
@ -38,7 +38,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;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -43,7 +43,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]);
|
||||
|
@ -92,7 +92,7 @@ uiModules.get('apps/management')
|
|||
};
|
||||
|
||||
$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);
|
||||
};
|
||||
|
||||
|
@ -108,7 +108,7 @@ uiModules.get('apps/management')
|
|||
if (!objs.length) return notify.error('No saved objects to export.');
|
||||
es.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')));
|
||||
|
@ -117,11 +117,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');
|
||||
}
|
||||
|
||||
|
@ -134,7 +134,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 () {
|
||||
|
|
|
@ -140,7 +140,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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,7 +23,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');
|
||||
}
|
||||
|
@ -138,7 +138,7 @@ function VisEditor($scope, $route, timefilter, AppState, $location, kbnUrl, $tim
|
|||
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
|
||||
};
|
||||
|
@ -307,7 +307,7 @@ function VisEditor($scope, $route, timefilter, AppState, $location, kbnUrl, $tim
|
|||
if (savedVis.id === $route.current.params.id) {
|
||||
docTitle.change(savedVis.lastSavedTitle);
|
||||
} else {
|
||||
kbnUrl.change('/visualize/edit/{{id}}', {id: savedVis.id});
|
||||
kbnUrl.change('/visualize/edit/{{id}}', { id: savedVis.id });
|
||||
}
|
||||
}
|
||||
}, notify.fatal);
|
||||
|
|
|
@ -39,7 +39,7 @@ app.service('savedVisualizations', function (Promise, es, kbnIndex, SavedVis, Pr
|
|||
};
|
||||
|
||||
this.urlFor = function (id) {
|
||||
return kbnUrl.eval('#/visualize/edit/{{id}}', {id: id});
|
||||
return kbnUrl.eval('#/visualize/edit/{{id}}', { id: id });
|
||||
};
|
||||
|
||||
this.delete = function (ids) {
|
||||
|
@ -70,7 +70,7 @@ app.service('savedVisualizations', function (Promise, es, kbnIndex, SavedVis, Pr
|
|||
if (!typeName || !visTypes.byName[typeName]) {
|
||||
if (!typeName) notify.error('Visualization type is missing. Please add a type to this visualization.', hit);
|
||||
else notify.error('Visualization type of "' + typeName + '" is invalid. Please change to a valid type.', hit);
|
||||
return kbnUrl.redirect('/management/kibana/objects/savedVisualizations/{{id}}', {id: source.id});
|
||||
return kbnUrl.redirect('/management/kibana/objects/savedVisualizations/{{id}}', { id: source.id });
|
||||
}
|
||||
|
||||
source.type = visTypes.byName[typeName];
|
||||
|
@ -92,7 +92,7 @@ app.service('savedVisualizations', function (Promise, es, kbnIndex, SavedVis, Pr
|
|||
}
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
body = { query: { match_all: {} } };
|
||||
}
|
||||
|
||||
return es.search({
|
||||
|
|
|
@ -47,7 +47,7 @@ module.controller('VisualizeWizardStep2', function ($route, $scope, $location, t
|
|||
const type = $route.current.params.type;
|
||||
|
||||
$scope.step2WithSearchUrl = function (hit) {
|
||||
return kbnUrl.eval('#/visualize/create?&type={{type}}&savedSearchId={{id}}', {type: type, id: hit.id});
|
||||
return kbnUrl.eval('#/visualize/create?&type={{type}}&savedSearchId={{id}}', { type: type, id: hit.id });
|
||||
};
|
||||
|
||||
timefilter.enabled = false;
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('createMappingsFromPatternFields', function () {
|
|||
});
|
||||
|
||||
it('should handle nested fields', function () {
|
||||
testFields.push({name: 'geo.coordinates', type: 'geo_point'});
|
||||
testFields.push({ name: 'geo.coordinates', type: 'geo_point' });
|
||||
const mappings = createMappingsFromPatternFields(testFields);
|
||||
|
||||
expect(mappings).to.have.property('geo');
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -14,7 +14,7 @@ export default function registerCount(server) {
|
|||
})
|
||||
.then(
|
||||
function (res) {
|
||||
reply({count: res.count});
|
||||
reply({ count: res.count });
|
||||
},
|
||||
function (error) {
|
||||
reply(handleESError(error));
|
||||
|
|
|
@ -20,7 +20,7 @@ describe('metric vis', function () {
|
|||
it('should set the metric label and value', function () {
|
||||
$scope.processTableGroups({
|
||||
tables: [{
|
||||
columns: [{title: 'Count'}],
|
||||
columns: [{ title: 'Count' }],
|
||||
rows: [[4301021]],
|
||||
aggConfig: function () {
|
||||
return {
|
||||
|
@ -41,8 +41,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: [[182, 445842.4634666484]],
|
||||
aggConfig: function () {
|
||||
|
|
|
@ -103,7 +103,7 @@ describe('Integration', function () {
|
|||
});
|
||||
|
||||
it('displays an error if the search had no hits', function () {
|
||||
init(new OneRangeVis(), { hits: { total: 0, hits: [] }});
|
||||
init(new OneRangeVis(), { hits: { total: 0, hits: [] } });
|
||||
|
||||
expect($el.find('kbn-agg-table-group').size()).to.be(0);
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ describe('Controller', function () {
|
|||
vis.aggs.forEach(function (agg, i) { agg.id = 'agg_' + (i + 1); });
|
||||
|
||||
$rootScope.vis = vis;
|
||||
$rootScope.uiState = new AppState({uiState: {}}).makeStateful('uiState');
|
||||
$rootScope.uiState = new AppState({ uiState: {} }).makeStateful('uiState');
|
||||
$rootScope.newScope = function (scope) { $scope = scope; };
|
||||
|
||||
$el = $('<div>')
|
||||
|
@ -112,7 +112,7 @@ describe('Controller', function () {
|
|||
columnIndex: 1,
|
||||
direction: 'asc'
|
||||
};
|
||||
initController(new OneRangeVis({sort: sortObj}));
|
||||
initController(new OneRangeVis({ sort: sortObj }));
|
||||
|
||||
// modify the data to not have any buckets
|
||||
const resp = _.cloneDeep(fixtures.oneRangeBucket);
|
||||
|
|
|
@ -2,7 +2,7 @@ import expect from 'expect.js';
|
|||
import _ from 'lodash';
|
||||
import TagCloud from 'plugins/tagcloud/tag_cloud';
|
||||
import d3 from 'd3';
|
||||
import {fromNode, delay} from 'bluebird';
|
||||
import { fromNode, delay } from 'bluebird';
|
||||
|
||||
describe('tag cloud tests', function () {
|
||||
|
||||
|
@ -11,9 +11,9 @@ describe('tag cloud tests', function () {
|
|||
const midValue = (minValue + maxValue) / 2;
|
||||
const baseTest = {
|
||||
data: [
|
||||
{text: 'foo', value: minValue},
|
||||
{text: 'bar', value: midValue},
|
||||
{text: 'foobar', value: maxValue},
|
||||
{ text: 'foo', value: minValue },
|
||||
{ text: 'bar', value: midValue },
|
||||
{ text: 'foobar', value: maxValue },
|
||||
],
|
||||
options: {
|
||||
orientation: 'single',
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import d3 from 'd3';
|
||||
import d3TagCloud from 'd3-cloud';
|
||||
import vislibComponentsSeedColorsProvider from 'ui/vislib/components/color/seed_colors';
|
||||
import {EventEmitter} from 'events';
|
||||
import { EventEmitter } from 'events';
|
||||
|
||||
|
||||
const ORIENTATIONS = {
|
||||
|
@ -314,14 +314,14 @@ class TagCloud extends EventEmitter {
|
|||
|
||||
}
|
||||
|
||||
TagCloud.STATUS = {COMPLETE: 0, INCOMPLETE: 1};
|
||||
TagCloud.STATUS = { COMPLETE: 0, INCOMPLETE: 1 };
|
||||
|
||||
function seed() {
|
||||
return 0.5;//constant seed (not random) to ensure constant layouts for identical data
|
||||
}
|
||||
|
||||
function toWordTag(word) {
|
||||
return {value: word.value, text: word.text};
|
||||
return { value: word.value, text: word.text };
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -18,7 +18,7 @@ module.controller('KbnTagCloudController', function ($scope, $element, Private,
|
|||
const clickHandler = filterBarClickHandler(appState);
|
||||
const aggs = $scope.vis.aggs.getResponseAggs();
|
||||
const aggConfigResult = new AggConfigResult(aggs[0], false, event, event);
|
||||
clickHandler({point: {aggConfigResult: aggConfigResult}});
|
||||
clickHandler({ point: { aggConfigResult: aggConfigResult } });
|
||||
});
|
||||
tagCloud.on('renderComplete', () => {
|
||||
|
||||
|
@ -89,11 +89,11 @@ module.controller('KbnTagCloudController', function ($scope, $element, Private,
|
|||
|
||||
$scope.$watch(getContainerSize, _.debounce(() => {
|
||||
tagCloud.resize();
|
||||
}, 1000, {trailing: true}), true);
|
||||
}, 1000, { trailing: true }), true);
|
||||
|
||||
|
||||
function getContainerSize() {
|
||||
return {width: $element.width(), height: $element.height()};
|
||||
return { width: $element.width(), height: $element.height() };
|
||||
}
|
||||
|
||||
function getValue(metricsAgg, bucket) {
|
||||
|
|
|
@ -18,8 +18,8 @@ uiModules.get('kibana/table_vis')
|
|||
connect: true,
|
||||
tooltips: true,
|
||||
step: 1,
|
||||
range: {'min': 1, 'max': 100},
|
||||
format: {to: (value) => parseInt(value) + 'px', from: value => parseInt(value)}
|
||||
range: { 'min': 1, 'max': 100 },
|
||||
format: { to: (value) => parseInt(value) + 'px', from: value => parseInt(value) }
|
||||
});
|
||||
slider.noUiSlider.on('change', function () {
|
||||
const fontSize = slider.noUiSlider.get();
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function ({env, bundle}) {
|
||||
module.exports = function ({ env, bundle }) {
|
||||
|
||||
const pluginSlug = env.pluginInfo.sort()
|
||||
.map(p => ' * - ' + p)
|
||||
|
|
|
@ -230,14 +230,14 @@ app.controller('timelion', function (
|
|||
if (id) {
|
||||
notify.info('Saved sheet as "' + savedSheet.title + '"');
|
||||
if (savedSheet.id !== $routeParams.id) {
|
||||
kbnUrl.change('/{{id}}', {id: savedSheet.id});
|
||||
kbnUrl.change('/{{id}}', { id: savedSheet.id });
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function saveExpression(title) {
|
||||
savedVisualizations.get({type: 'timelion'}).then(function (savedExpression) {
|
||||
savedVisualizations.get({ type: 'timelion' }).then(function (savedExpression) {
|
||||
savedExpression.visState.params = {
|
||||
expression: $scope.state.sheet[$scope.state.selected],
|
||||
interval: $scope.state.interval
|
||||
|
|
|
@ -17,7 +17,7 @@ app.directive('fixedElementRoot', function ($timeout) {
|
|||
fixedAt = $(window).scrollTop();
|
||||
fixed.addClass(fixed.attr('fixed-element'));
|
||||
body.addClass(fixed.attr('fixed-element-body'));
|
||||
body.css({top: fixed.height()});
|
||||
body.css({ top: fixed.height() });
|
||||
}
|
||||
|
||||
if ($(window).scrollTop() < fixedAt) {
|
||||
|
|
|
@ -5,7 +5,7 @@ require('ui/state_management/app_state');
|
|||
module.exports = function dashboardContext(Private, getAppState) {
|
||||
return function () {
|
||||
const queryFilter = Private(require('ui/filter_bar/query_filter'));
|
||||
const bool = {must: [], must_not: []};
|
||||
const bool = { must: [], must_not: [] };
|
||||
const filterBarFilters = queryFilter.getFilters();
|
||||
const queryBarFilter = getAppState().query;
|
||||
|
||||
|
@ -27,6 +27,6 @@ module.exports = function dashboardContext(Private, getAppState) {
|
|||
}
|
||||
});
|
||||
|
||||
return {bool: bool};
|
||||
return { bool: bool };
|
||||
};
|
||||
};
|
||||
|
|
|
@ -30,7 +30,7 @@ define(function (require) {
|
|||
};
|
||||
|
||||
this.urlFor = function (id) {
|
||||
return kbnUrl.eval('#/{{id}}', {id: id});
|
||||
return kbnUrl.eval('#/{{id}}', { id: id });
|
||||
};
|
||||
|
||||
this.delete = function (ids) {
|
||||
|
@ -54,7 +54,7 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
body = { query: { match_all: {} } };
|
||||
}
|
||||
|
||||
return es.search({
|
||||
|
|
|
@ -103,7 +103,7 @@ module.exports = function (tlConfig) {
|
|||
}
|
||||
|
||||
return promise.then(function (result) {
|
||||
return invokeChain({type:'chain', chain: chain}, [result]);
|
||||
return invokeChain({ type:'chain', chain: chain }, [result]);
|
||||
});
|
||||
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ const _ = require('lodash');
|
|||
module.exports = (function () {
|
||||
const functionArray = _.map(functions, function (val, key) {
|
||||
// TODO: This won't work on frozen objects, it should be removed when everything is converted to datasources and chainables
|
||||
return _.extend({}, val, {name: key});
|
||||
return _.extend({}, val, { name: key });
|
||||
});
|
||||
|
||||
function toDocBlock(fn) {
|
||||
|
|
|
@ -7,7 +7,7 @@ module.exports = function (server) {
|
|||
handler: function (request, reply) {
|
||||
const functionArray = _.map(server.plugins.timelion.functions, function (val, key) {
|
||||
// TODO: This won't work on frozen objects, it should be removed when everything is converted to datasources and chainables
|
||||
return _.extend({}, val, {name: key});
|
||||
return _.extend({}, val, { name: key });
|
||||
});
|
||||
reply(_.sortBy(functionArray, 'name'));
|
||||
}
|
||||
|
|
|
@ -5,7 +5,7 @@ const chainRunnerFn = require('../handlers/chain_runner.js');
|
|||
const timelionDefaults = require('../lib/get_namespaced_settings')();
|
||||
|
||||
function replyWithError(e, reply) {
|
||||
reply({title: e.toString(), message: e.toString(), stack: e.stack}).code(400);
|
||||
reply({ title: e.toString(), message: e.toString(), stack: e.stack }).code(400);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ describe(filename, () => {
|
|||
});
|
||||
|
||||
it('leaves existing bars alone when called without option, if they exist', () => {
|
||||
seriesList.list[0].bars = {foo: true};
|
||||
seriesList.list[0].bars = { foo: true };
|
||||
return invoke(fn, [seriesList]).then((r) => {
|
||||
const bars = _.map(r.output.list, 'bars');
|
||||
expect(bars[0].foo).to.equal(true);
|
||||
|
|
|
@ -9,18 +9,18 @@ import esResponse from './fixtures/es_response';
|
|||
|
||||
import Promise from 'bluebird';
|
||||
import _ from 'lodash';
|
||||
import {expect} from 'chai';
|
||||
import { expect } from 'chai';
|
||||
import invoke from './helpers/invoke_series_fn.js';
|
||||
|
||||
function stubResponse(response) {
|
||||
return {
|
||||
server: {plugins:{
|
||||
server: { plugins:{
|
||||
elasticsearch: {
|
||||
callWithRequest: function () {
|
||||
return Promise.resolve(response);
|
||||
}
|
||||
}
|
||||
}}
|
||||
} }
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -30,7 +30,7 @@ describe(filename, () => {
|
|||
describe('seriesList processor', () => {
|
||||
it('throws an error then the index is missing', () => {
|
||||
tlConfig = stubResponse({
|
||||
_shards: {total: 0}
|
||||
_shards: { total: 0 }
|
||||
});
|
||||
return invoke(es, [5], tlConfig)
|
||||
.then(expect.fail)
|
||||
|
@ -91,8 +91,8 @@ describe(filename, () => {
|
|||
it('adds a metric agg for each metric', () => {
|
||||
config.metric = ['sum:beer', 'avg:bytes'];
|
||||
agg = createDateAgg(config, tlConfig);
|
||||
expect(agg.time_buckets.aggs['sum(beer)']).to.eql({sum: {field: 'beer'}});
|
||||
expect(agg.time_buckets.aggs['avg(bytes)']).to.eql({avg: {field: 'bytes'}});
|
||||
expect(agg.time_buckets.aggs['sum(beer)']).to.eql({ sum: { field: 'beer' } });
|
||||
expect(agg.time_buckets.aggs['avg(bytes)']).to.eql({ avg: { field: 'bytes' } });
|
||||
});
|
||||
|
||||
it('has a special `count` metric that uses a script', () => {
|
||||
|
@ -150,17 +150,17 @@ describe(filename, () => {
|
|||
from: 1,
|
||||
to: 5,
|
||||
},
|
||||
request: {payload: {extended: {es: {filter:{
|
||||
request: { payload: { extended: { es: { filter:{
|
||||
bool: {
|
||||
must: [
|
||||
{query: {query_string: {query: 'foo'}}}
|
||||
{ query: { query_string: { query: 'foo' } } }
|
||||
],
|
||||
must_not: [
|
||||
{query: {query_string: {query: 'bar'}}},
|
||||
{query: {query_string: {query: 'baz'}}}
|
||||
{ query: { query_string: { query: 'bar' } } },
|
||||
{ query: { query_string: { query: 'baz' } } }
|
||||
]
|
||||
}
|
||||
}}}}}
|
||||
} } } } }
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -182,11 +182,11 @@ describe(filename, () => {
|
|||
it('adds a time filter to the bool querys must clause', () => {
|
||||
let request = fn(config, tlConfig);
|
||||
expect(request.body.query.bool.must.length).to.eql(1);
|
||||
expect(request.body.query.bool.must[0]).to.eql({range: {'@timestamp': {
|
||||
expect(request.body.query.bool.must[0]).to.eql({ range: { '@timestamp': {
|
||||
lte: 5,
|
||||
gte: 1,
|
||||
format: 'epoch_millis'
|
||||
}}});
|
||||
} } });
|
||||
|
||||
config.kibana = true;
|
||||
request = fn(config, tlConfig);
|
||||
|
@ -213,7 +213,7 @@ describe(filename, () => {
|
|||
describe('Aggregation flattening', () => {
|
||||
let config;
|
||||
beforeEach(() => {
|
||||
config = {fit: 'nearest'};
|
||||
config = { fit: 'nearest' };
|
||||
});
|
||||
|
||||
describe('timeBucketsToPairs', () => {
|
||||
|
@ -221,9 +221,9 @@ describe(filename, () => {
|
|||
|
||||
it('Should convert a single metric agg', () => {
|
||||
const buckets = [
|
||||
{key: 1000, count: {value: 3}},
|
||||
{key: 2000, count: {value: 14}},
|
||||
{key: 3000, count: {value: 15}}
|
||||
{ key: 1000, count: { value: 3 } },
|
||||
{ key: 2000, count: { value: 14 } },
|
||||
{ key: 3000, count: { value: 15 } }
|
||||
];
|
||||
|
||||
expect(fn(buckets)).to.eql({
|
||||
|
@ -233,9 +233,9 @@ describe(filename, () => {
|
|||
|
||||
it('Should convert multiple metric aggs', () => {
|
||||
const buckets = [
|
||||
{key: 1000, count: {value: 3}, max: {value: 92}},
|
||||
{key: 2000, count: {value: 14}, max: {value: 65}},
|
||||
{key: 3000, count: {value: 15}, max: {value: 35}}
|
||||
{ key: 1000, count: { value: 3 }, max: { value: 92 } },
|
||||
{ key: 2000, count: { value: 14 }, max: { value: 65 } },
|
||||
{ key: 3000, count: { value: 15 }, max: { value: 35 } }
|
||||
];
|
||||
|
||||
expect(fn(buckets)).to.eql({
|
||||
|
|
|
@ -14,31 +14,31 @@ module.exports = {
|
|||
},
|
||||
aggregations: {
|
||||
q: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: {
|
||||
QueryA: {
|
||||
FieldA: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: [
|
||||
{
|
||||
key: 'ValueA',
|
||||
FieldB: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: [
|
||||
{
|
||||
key: 'Value2A',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 264},
|
||||
MetricB: {value: 398}
|
||||
MetricA: { value: 264 },
|
||||
MetricB: { value: 398 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 264},
|
||||
MetricB: {value: 1124}
|
||||
MetricA: { value: 264 },
|
||||
MetricB: { value: 1124 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -46,17 +46,17 @@ module.exports = {
|
|||
{
|
||||
key: 'Value2B',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 699},
|
||||
MetricB: {value: 457}
|
||||
MetricA: { value: 699 },
|
||||
MetricB: { value: 457 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 110},
|
||||
MetricB: {value: 506}
|
||||
MetricA: { value: 110 },
|
||||
MetricB: { value: 506 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -67,22 +67,22 @@ module.exports = {
|
|||
{
|
||||
key: 'ValueB',
|
||||
FieldB: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: [
|
||||
{
|
||||
key: 'Value2B',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 152},
|
||||
MetricB: {value: 61}
|
||||
MetricA: { value: 152 },
|
||||
MetricB: { value: 61 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 518},
|
||||
MetricB: {value: 77}
|
||||
MetricA: { value: 518 },
|
||||
MetricB: { value: 77 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -90,17 +90,17 @@ module.exports = {
|
|||
{
|
||||
key: 'Value2A',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 114},
|
||||
MetricB: {value: 23}
|
||||
MetricA: { value: 114 },
|
||||
MetricB: { value: 23 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 264},
|
||||
MetricB: {value: 45}
|
||||
MetricA: { value: 264 },
|
||||
MetricB: { value: 45 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -113,27 +113,27 @@ module.exports = {
|
|||
},
|
||||
QueryB: {
|
||||
FieldA: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: [
|
||||
{
|
||||
key: 'ValueA',
|
||||
FieldB: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: [
|
||||
{
|
||||
key: 'Value2B',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 621},
|
||||
MetricB: {value: 12}
|
||||
MetricA: { value: 621 },
|
||||
MetricB: { value: 12 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 751},
|
||||
MetricB: {value: 12}
|
||||
MetricA: { value: 751 },
|
||||
MetricB: { value: 12 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -141,17 +141,17 @@ module.exports = {
|
|||
{
|
||||
key: 'Value2A',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 110},
|
||||
MetricB: {value: 11}
|
||||
MetricA: { value: 110 },
|
||||
MetricB: { value: 11 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 648},
|
||||
MetricB: {value: 12}
|
||||
MetricA: { value: 648 },
|
||||
MetricB: { value: 12 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -162,22 +162,22 @@ module.exports = {
|
|||
{
|
||||
key: 'ValueC',
|
||||
FieldB: {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
buckets: [
|
||||
{
|
||||
key: 'Value2C',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 755},
|
||||
MetricB: {value: 10}
|
||||
MetricA: { value: 755 },
|
||||
MetricB: { value: 10 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 713},
|
||||
MetricB: {value: 18}
|
||||
MetricA: { value: 713 },
|
||||
MetricB: { value: 18 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -185,17 +185,17 @@ module.exports = {
|
|||
{
|
||||
key: 'Value2A',
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
buckets: [
|
||||
{
|
||||
key: 1000,
|
||||
MetricA: {value: 391},
|
||||
MetricB: {value: 4}
|
||||
MetricA: { value: 391 },
|
||||
MetricB: { value: 4 }
|
||||
},
|
||||
{
|
||||
key: 2000,
|
||||
MetricA: {value: 802},
|
||||
MetricB: {value: 4}
|
||||
MetricA: { value: 802 },
|
||||
MetricB: { value: 4 }
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ const graphiteResponse = function (url) {
|
|||
};
|
||||
|
||||
const filename = require('path').basename(__filename);
|
||||
const fn = proxyquire(`../${filename}`, {'node-fetch': graphiteResponse});
|
||||
const fn = proxyquire(`../${filename}`, { 'node-fetch': graphiteResponse });
|
||||
|
||||
const invoke = require('./helpers/invoke_series_fn.js');
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ describe(filename, () => {
|
|||
it('should create the _global object if it does not exist', () => {
|
||||
expect(seriesList.list[0]._global).to.equal(undefined);
|
||||
return invoke(fn, [seriesList, 'nw', 3]).then((r) => {
|
||||
expect(r.output.list[0]._global).to.eql({legend:{noColumns: 3, position: 'nw'}});
|
||||
expect(r.output.list[0]._global).to.eql({ legend:{ noColumns: 3, position: 'nw' } });
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ describe(filename, function () {
|
|||
}
|
||||
});
|
||||
};
|
||||
fn = proxyquire(`../${filename}`, {'node-fetch': response});
|
||||
fn = proxyquire(`../${filename}`, { 'node-fetch': response });
|
||||
});
|
||||
|
||||
it('should wrap the quandl response up in a seriesList', function () {
|
||||
|
@ -67,7 +67,7 @@ describe(filename, function () {
|
|||
});
|
||||
|
||||
it('should throw an error is passed an unsupported interval', function () {
|
||||
return invoke(fn, [], {time:{interval:'2d'}})
|
||||
return invoke(fn, [], { time:{ interval:'2d' } })
|
||||
.then(expect.fail)
|
||||
.catch(function (r) {
|
||||
expect(r).to.be.an('error');
|
||||
|
@ -75,7 +75,7 @@ describe(filename, function () {
|
|||
});
|
||||
|
||||
it('should use the configured API key when talking to quandl', function () {
|
||||
return invoke(fn, [], {settings:{'timelion:quandl.key': 'bEeR'}}).then(function () {
|
||||
return invoke(fn, [], { settings:{ 'timelion:quandl.key': 'bEeR' } }).then(function () {
|
||||
expect(calledWith.params.auth_token).to.eql('bEeR');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,10 +3,10 @@ const createDateAgg = require('./create_date_agg');
|
|||
|
||||
module.exports = function buildRequest(config, tlConfig) {
|
||||
|
||||
const bool = {must: [], must_not: []};
|
||||
const bool = { must: [], must_not: [] };
|
||||
|
||||
const timeFilter = {range:{}};
|
||||
timeFilter.range[config.timefield] = {gte: tlConfig.time.from, lte: tlConfig.time.to, format: 'epoch_millis'};
|
||||
const timeFilter = { range:{} };
|
||||
timeFilter.range[config.timefield] = { gte: tlConfig.time.from, lte: tlConfig.time.to, format: 'epoch_millis' };
|
||||
bool.must.push(timeFilter);
|
||||
|
||||
// Use the kibana filter bar filters
|
||||
|
@ -16,10 +16,10 @@ module.exports = function buildRequest(config, tlConfig) {
|
|||
|
||||
const aggs = {
|
||||
'q': {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
filters: {
|
||||
filters: _.chain(config.q).map(function (q) {
|
||||
return [q, {query_string:{query: q}}];
|
||||
return [q, { query_string:{ query: q } }];
|
||||
}).zipObject().value(),
|
||||
},
|
||||
aggs: {}
|
||||
|
@ -32,7 +32,7 @@ module.exports = function buildRequest(config, tlConfig) {
|
|||
clause = clause.split(':');
|
||||
if (clause[0] && clause[1]) {
|
||||
aggCursor[clause[0]] = {
|
||||
meta: {type: 'split'},
|
||||
meta: { type: 'split' },
|
||||
terms: {
|
||||
field: clause[0],
|
||||
size: parseInt(clause[1], 10)
|
||||
|
|
|
@ -3,7 +3,7 @@ const _ = require('lodash');
|
|||
module.exports = function createDateAgg(config, tlConfig) {
|
||||
const dateAgg = {
|
||||
time_buckets: {
|
||||
meta: {type: 'time_buckets'},
|
||||
meta: { type: 'time_buckets' },
|
||||
date_histogram: {
|
||||
field: config.timefield,
|
||||
interval: config.interval,
|
||||
|
@ -26,13 +26,13 @@ module.exports = function createDateAgg(config, tlConfig) {
|
|||
dateAgg.time_buckets.aggs[metric] = {
|
||||
bucket_script: {
|
||||
buckets_path: '_count',
|
||||
script: {inline: '_value', lang: 'expression'}
|
||||
script: { inline: '_value', lang: 'expression' }
|
||||
}
|
||||
};
|
||||
} else if (metric[0] && metric[1]) {
|
||||
const metricName = metric[0] + '(' + metric[1] + ')';
|
||||
dateAgg.time_buckets.aggs[metricName] = {};
|
||||
dateAgg.time_buckets.aggs[metricName][metric[0]] = {field: metric[1]};
|
||||
dateAgg.time_buckets.aggs[metricName][metric[0]] = { field: metric[1] };
|
||||
} else {
|
||||
throw new Error ('`metric` requires metric:field or simply count');
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ module.exports = new Datasource ('worldbank_indicators', {
|
|||
const seriesLists = _.map(countries, function (country) {
|
||||
const code = 'countries/' + country + '/indicators/' + config.indicator;
|
||||
const wbArgs = [code];
|
||||
wbArgs.byName = {code: code};
|
||||
wbArgs.byName = { code: code };
|
||||
return worldbank.timelionFn(wbArgs, tlConfig);
|
||||
});
|
||||
|
||||
|
|
|
@ -1,22 +1,35 @@
|
|||
import _ from 'lodash';
|
||||
export default function fitsFixture() {
|
||||
return _.map([
|
||||
{_source: {'@timestamp': 0, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 10, request: 'foo'}},
|
||||
{_source: {'@timestamp': 1, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 20, request: 'bar'}},
|
||||
{_source: {'@timestamp': 2, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'bar'}},
|
||||
{_source: {'@timestamp': 3, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'baz'}},
|
||||
{_source: {'@timestamp': 4, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'baz'}},
|
||||
{_source: {'@timestamp': 5, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 30, request: 'baz'}},
|
||||
{_source: {'@timestamp': 6, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}},
|
||||
{_source: {'@timestamp': 7, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}},
|
||||
{_source: {'@timestamp': 8, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}},
|
||||
{_source: {'@timestamp': 9, ssl: true, ip: '192.168.0.1', extension: 'php', 'machine.os': 'Linux', bytes: 40.141592, request: 'bat'}},
|
||||
], function (p, i) {
|
||||
return _.merge({}, p, {
|
||||
return [
|
||||
// extension
|
||||
// | machine.os
|
||||
//timestamp | | bytes
|
||||
//| ssl ip | | | request
|
||||
[ 0, true, '192.168.0.1', 'php', 'Linux', 10, 'foo' ],
|
||||
[ 1, true, '192.168.0.1', 'php', 'Linux', 20, 'bar' ],
|
||||
[ 2, true, '192.168.0.1', 'php', 'Linux', 30, 'bar' ],
|
||||
[ 3, true, '192.168.0.1', 'php', 'Linux', 30, 'baz' ],
|
||||
[ 4, true, '192.168.0.1', 'php', 'Linux', 30, 'baz' ],
|
||||
[ 5, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat' ],
|
||||
[ 6, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat' ],
|
||||
[ 7, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat' ],
|
||||
[ 8, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat' ],
|
||||
[ 9, true, '192.168.0.1', 'php', 'Linux', 40.141592, 'bat' ],
|
||||
].map((row, i) => {
|
||||
return {
|
||||
_score: 1,
|
||||
_id: 1000 + i,
|
||||
_type: 'test',
|
||||
_index: 'test-index'
|
||||
});
|
||||
_index: 'test-index',
|
||||
_source: {
|
||||
'@timestamp': row[0],
|
||||
ssl: row[1],
|
||||
ip: row[2],
|
||||
extension: row[3],
|
||||
'machine.os': row[4],
|
||||
bytes: row[5],
|
||||
request: row[6],
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = (kbnServer, server, config) => {
|
|||
xforward: true
|
||||
}
|
||||
},
|
||||
config: {auth: false}
|
||||
config: { auth: false }
|
||||
});
|
||||
|
||||
return fromNode(cb => {
|
||||
|
|
|
@ -224,7 +224,7 @@ describe('lib/config/config', function () {
|
|||
it('should allow you to extend the schema with a prefix', function () {
|
||||
const newSchema = Joi.object({ test: Joi.boolean().default(true) }).default();
|
||||
config.extendSchema('prefix.myTest', newSchema);
|
||||
expect(config.get('prefix')).to.eql({ myTest: { test: true }});
|
||||
expect(config.get('prefix')).to.eql({ myTest: { test: true } });
|
||||
expect(config.get('prefix.myTest')).to.eql({ test: true });
|
||||
expect(config.get('prefix.myTest.test')).to.be(true);
|
||||
});
|
||||
|
|
|
@ -13,23 +13,23 @@ describe('Config schema', function () {
|
|||
describe('server', function () {
|
||||
describe('basePath', function () {
|
||||
it('accepts empty strings', function () {
|
||||
const { error } = validate({ server: { basePath: '' }});
|
||||
const { error } = validate({ server: { basePath: '' } });
|
||||
expect(error == null).to.be.ok();
|
||||
});
|
||||
|
||||
it('accepts strings with leading slashes', function () {
|
||||
const { error } = validate({ server: { basePath: '/path' }});
|
||||
const { error } = validate({ server: { basePath: '/path' } });
|
||||
expect(error == null).to.be.ok();
|
||||
});
|
||||
|
||||
it('rejects strings with trailing slashes', function () {
|
||||
const { error } = validate({ server: { basePath: '/path/' }});
|
||||
const { error } = validate({ server: { basePath: '/path/' } });
|
||||
expect(error).to.have.property('details');
|
||||
expect(error.details[0]).to.have.property('path', 'server.basePath');
|
||||
});
|
||||
|
||||
it('rejects strings without leading slashes', function () {
|
||||
const { error } = validate({ server: { basePath: 'path' }});
|
||||
const { error } = validate({ server: { basePath: 'path' } });
|
||||
expect(error).to.have.property('details');
|
||||
expect(error.details[0]).to.have.property('path', 'server.basePath');
|
||||
});
|
||||
|
|
|
@ -29,7 +29,7 @@ module.exports = async function (kbnServer, server, config) {
|
|||
lookupCompressed: true
|
||||
}
|
||||
},
|
||||
config: {auth: false}
|
||||
config: { auth: false }
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -41,7 +41,7 @@ module.exports = async function (kbnServer, server, config) {
|
|||
handler: {
|
||||
file: filePath
|
||||
},
|
||||
config: {auth: false}
|
||||
config: { auth: false }
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import expect from 'expect.js';
|
||||
import path from '../';
|
||||
import { accessSync, R_OK} from 'fs';
|
||||
import { accessSync, R_OK } from 'fs';
|
||||
|
||||
describe('Default path finder', function () {
|
||||
it('should find a kibana.yml', () => {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { accessSync, R_OK} from 'fs';
|
||||
import { accessSync, R_OK } from 'fs';
|
||||
import { find } from 'lodash';
|
||||
import { fromRoot } from '../../utils';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import {values} from 'lodash';
|
||||
import { values } from 'lodash';
|
||||
import expect from 'expect.js';
|
||||
import sinon from 'auto-release-sinon';
|
||||
import pluginInit from '../plugin_init';
|
||||
|
|
|
@ -25,11 +25,11 @@ export default async (plugins) => {
|
|||
};
|
||||
|
||||
const collection = plugins.toArray();
|
||||
for (const {id} of collection) {
|
||||
for (const { id } of collection) {
|
||||
await initialize(id, 'preInit');
|
||||
}
|
||||
|
||||
for (const {id} of collection) {
|
||||
for (const { id } of collection) {
|
||||
await initialize(id, 'init');
|
||||
}
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@ import Status from '../status';
|
|||
import ServerStatus from '../server_status';
|
||||
|
||||
describe('ServerStatus class', function () {
|
||||
const plugin = {id: 'name', version: '1.2.3'};
|
||||
const plugin = { id: 'name', version: '1.2.3' };
|
||||
|
||||
let server;
|
||||
let serverStatus;
|
||||
|
@ -99,8 +99,8 @@ describe('ServerStatus class', function () {
|
|||
|
||||
describe('#toJSON()', function () {
|
||||
it('serializes to overall status and individuals', function () {
|
||||
const pluginOne = {id: 'one', version: '1.0.0'};
|
||||
const pluginTwo = {id: 'two', version: '2.0.0'};
|
||||
const pluginOne = { id: 'one', version: '1.0.0' };
|
||||
const pluginTwo = { id: 'two', version: '2.0.0' };
|
||||
|
||||
const service = serverStatus.create('some service');
|
||||
const p1 = serverStatus.createForPlugin(pluginOne);
|
||||
|
|
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