Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
d739c4e
Make space selector a button (#26889)
timroes Dec 11, 2018
6c44fed
[ML] Adds isRequired where applicable to timeseries_chart props. (#26…
walterra Dec 11, 2018
92a8b49
Translate share (#26802)
Nox911 Dec 11, 2018
f401d03
Only show change password form when a password change is possible (#2…
legrego Dec 11, 2018
a07cf88
[Beats CM] Add basic license type (#26935)
mattapperson Dec 11, 2018
d7a2135
Improve wording when creating a space (#26915)
legrego Dec 11, 2018
e61e1ac
fixing issue with multiple execution in console (#26933)
bmcconaghy Dec 11, 2018
818241f
fixing a11y error (#26906)
bhavyarm Dec 11, 2018
dccc2c7
[i18n] Translate ML - File Datavisualizer (Part 1) (#25641)
tibmt Dec 11, 2018
eb04a36
Use new _graph endpoints (#26956)
timroes Dec 11, 2018
4e63fbd
[ML] Do not pass datafeed query to Discover in custom URL (#26957)
peteharverson Dec 11, 2018
eb1da65
quick ILM fixes (#26966)
bmcconaghy Dec 11, 2018
56fcc6d
Fixing a11y errors in querybar and suggestion_component (#26892)
bhavyarm Dec 11, 2018
f06ec83
do not pass 'sortOrder' to EuiContextMenuItem in share context menu (…
nreese Dec 11, 2018
350ce18
Feat: Workpad Templates (#23966)
cqliu1 Dec 11, 2018
cfdebb7
Convert i18n IDs to camel case. (#26792)
cjcenizal Dec 11, 2018
ab13658
[CCR] Update auto-follow pattern serialization to support new ES api …
sebelga Dec 11, 2018
4ccbabe
fix lint errors (#26985)
jbudz Dec 11, 2018
f88a884
Fix: Support columns with dots (#26659)
w33ble Dec 11, 2018
459cbe4
upgrade resize-observer-polyfill version (#26990)
mw-ding Dec 11, 2018
be91f2c
Merge remote-tracking branch 'upstream/master' into feature/ccr
cjcenizal Dec 11, 2018
774ce42
Fixing issues with the url.search being null in Node 10 (#26992)
kobelb Dec 12, 2018
d01aaef
Hide logs from deleteAll on task: clean client modules into dll (#26884)
mistic Dec 12, 2018
f1520f8
[APM] Fix for library frames not collapsing (#26827)
ogupte Dec 12, 2018
c4afd32
[i18n] Translate untranslated labels (#26416)
Nox911 Dec 12, 2018
ac10ba5
[ML] Fix word break in anomalies and jobs tables (#26978)
peteharverson Dec 12, 2018
078dd93
[CCR] Add delete auto-follow pattern endpoint
Dec 10, 2018
04d393b
[CCR] Add app UI to delete an auto-follow pattern
Dec 12, 2018
d6533dd
[CCR] Fix notifications bug and translation
Dec 12, 2018
9134ad4
fixes other bucket request (#26874)
ppisljar Dec 12, 2018
46a8ad4
[I18n] Register translations before plugins init (#26078)
LeanidShutau Dec 12, 2018
f5320d2
[Infra UI] Fix styling after breaking EUI changes (#27021)
weltenwort Dec 12, 2018
a67cb98
[i18n] Optimize translation labels for Roles page (#26945)
maryia-lapata Dec 12, 2018
4f3a827
Update APM readme
sorenlouv Dec 12, 2018
df593e3
[APM] Convert errors API to typescript (#26801)
sorenlouv Dec 12, 2018
9aecea4
[I18n] Allow i18n filter usage outside of interpolation expressions …
LeanidShutau Dec 12, 2018
94b2b83
Introduce `recordOf` schema. Remove redundant declarations. (#26952)
azasypkin Dec 12, 2018
2616c45
[Infra UI] Fix graphql type generation after package upgrades (#26991)
weltenwort Dec 12, 2018
7e2e450
Adding label-has-associated-control to jsx-a11y lint rules and associ…
bhavyarm Dec 12, 2018
af8147d
[i18n] Translate ML - File Datavisualizer (Part 2) (#25642)
tibmt Dec 12, 2018
2fc7dee
[ML] Remove duplicate import in file_datavisualizer_directive (#27044)
peteharverson Dec 12, 2018
c4900f7
fixing some validation issues with edit policy (#27045)
bmcconaghy Dec 12, 2018
71631be
[CCR] Fix failing CI
Dec 12, 2018
b48e817
[CCR] Add icon to delete auto-follow pattern from table
Dec 12, 2018
f3545f3
Typescript search embeddable (#26863)
Dec 12, 2018
7f4ac5d
[ML] calendar eui conversion (#26741)
alvarezmelissa87 Dec 12, 2018
17db63c
Silently swallow request failures so that the create button isn't blo…
jen-huang Dec 12, 2018
4e684c7
Redirecting to /, instead of /login, on the successfully logged out …
kobelb Dec 12, 2018
0c20f04
adding reload indices button to index management (#27033)
bmcconaghy Dec 12, 2018
575399d
adding informational callout when step_info message is present (#27046)
bmcconaghy Dec 12, 2018
e118030
Better fix for wonky page preview resizing issue (#26795)
cqliu1 Dec 12, 2018
93e3a4c
Reporting regression: reports always retrying regardless of outcome (…
joelgriffith Dec 12, 2018
af851a3
Updated tinymath ref links (#27085)
cqliu1 Dec 12, 2018
ded7063
[security] Support alternate auth providers for login (#26979)
epixa Dec 13, 2018
132ee7d
Merge remote-tracking branch 'upstream/master' into feature/ccr
cjcenizal Dec 13, 2018
b4a492f
[CCR] Improve Remote Clusters copy and form validation (#26928)
cjcenizal Dec 13, 2018
e316963
Management: Index Pattern directory rename / correction (#26858)
mattkime Dec 13, 2018
1435deb
[i18n] Translate url (#26804)
Nox911 Dec 13, 2018
0b480f0
[I18n] Fix wrong FormattedMessage example in readme (#27035)
LeanidShutau Dec 13, 2018
a7ad4fb
[I18n] Translate kibana - visualize (#25638)
LeanidShutau Dec 13, 2018
346b9a9
Translate missing labels in Discover (#26953)
Nox911 Dec 13, 2018
6fb3b7d
[CCR] Add CR changes
Dec 13, 2018
997088a
Merge branch 'feature/ccr' into feature/ccr_delete_auto_follow_patter…
Dec 13, 2018
a4c6d24
[Home] update APM index pattern (#27118)
jalvz Dec 13, 2018
a067ff0
Merge remote-tracking branch 'upstream/master' into feature/ccr
Dec 13, 2018
fa36598
Merge branch 'feature/ccr' into feature/ccr_delete_auto_follow_patter…
Dec 13, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ module.exports = {
'jsx-a11y/click-events-have-key-events': 'off',
'jsx-a11y/anchor-has-content': 'off',
'jsx-a11y/tabindex-no-positive': 'off',
'jsx-a11y/label-has-associated-control': 'off',
'jsx-a11y/aria-role': 'off',
},
},
Expand Down
3 changes: 3 additions & 0 deletions .i18nrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,15 @@
"xpack.rollupJobs": "x-pack/plugins/rollup",
"xpack.searchProfiler": "x-pack/plugins/searchprofiler",
"xpack.security": "x-pack/plugins/security",
"xpack.spaces": "x-pack/plugins/spaces",
"xpack.watcher": "x-pack/plugins/watcher"
},
"exclude": [
"src/ui/ui_render/bootstrap/app_bootstrap.js",
"src/ui/ui_render/ui_render_mixin.js",
"x-pack/plugins/infra/public/graphql/types.ts",
"x-pack/plugins/infra/public/utils/loading_state/loading_result.ts",
"x-pack/plugins/infra/server/graphql/types.ts",
"x-pack/plugins/infra/server/lib/domains/log_entries_domain/log_entries_domain.ts"
]
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,7 @@
"getos": "^3.1.0",
"glob": "^7.1.2",
"glob-all": "^3.1.0",
"globby": "^8.0.1",
"good-squeeze": "2.1.0",
"h2o2": "^8.1.2",
"handlebars": "4.0.5",
Expand Down Expand Up @@ -205,7 +206,7 @@
"regression": "2.0.0",
"request": "^2.88.0",
"reselect": "^3.0.1",
"resize-observer-polyfill": "1.2.1",
"resize-observer-polyfill": "^1.5.0",
"rimraf": "2.4.3",
"rison-node": "1.0.0",
"rxjs": "^6.2.1",
Expand All @@ -216,7 +217,7 @@
"style-loader": "0.23.1",
"tar": "2.2.0",
"tinygradient": "0.3.0",
"tinymath": "1.1.0",
"tinymath": "1.1.1",
"topojson-client": "3.0.0",
"trunc-html": "1.0.2",
"trunc-text": "1.0.2",
Expand Down Expand Up @@ -337,7 +338,6 @@
"fetch-mock": "^5.13.1",
"geckodriver": "1.12.2",
"getopts": "2.0.0",
"globby": "^8.0.1",
"grunt": "1.0.1",
"grunt-cli": "^1.2.0",
"grunt-contrib-watch": "^1.1.0",
Expand Down
7 changes: 6 additions & 1 deletion packages/elastic-datemath/src/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,16 @@ declare const datemath: {
unitsAsc: Unit[];
unitsDesc: Unit[];

/**
* Parses a string into a moment object. The string can be something like "now - 15m".
* @param options.forceNow If this optional parameter is supplied, "now" will be treated as this
* date, rather than the real "now".
*/
parse(
input: string,
options?: {
roundUp?: boolean;
forceNow?: boolean;
forceNow?: Date;
momentInstance?: typeof moment;
}
): moment.Moment | undefined;
Expand Down
1 change: 1 addition & 0 deletions packages/eslint-config-kibana/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@ module.exports = {
'jsx-a11y/role-supports-aria-props': 'error',
'jsx-a11y/scope': 'error',
'jsx-a11y/tabindex-no-positive': 'error',
'jsx-a11y/label-has-associated-control': 'error',
'react/jsx-equals-spacing': ['error', 'never'],
'react/jsx-indent': ['error', 2],
'react/no-will-update-set-state': 'error',
Expand Down
11 changes: 11 additions & 0 deletions packages/kbn-config-schema/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ import {
NumberType,
ObjectType,
Props,
RecordOfOptions,
RecordOfType,
StringOptions,
StringType,
Type,
Expand Down Expand Up @@ -105,6 +107,14 @@ function mapOf<K, V>(
return new MapOfType(keyType, valueType, options);
}

function recordOf<K extends string, V>(
keyType: Type<K>,
valueType: Type<V>,
options?: RecordOfOptions<K, V>
): Type<Record<K, V>> {
return new RecordOfType(keyType, valueType, options);
}

function oneOf<A, B, C, D, E, F, G, H, I, J>(
types: [Type<A>, Type<B>, Type<C>, Type<D>, Type<E>, Type<F>, Type<G>, Type<H>, Type<I>, Type<J>],
options?: TypeOptions<A | B | C | D | E | F | G | H | I | J>
Expand Down Expand Up @@ -175,6 +185,7 @@ export const schema = {
number,
object,
oneOf,
recordOf,
siblingRef,
string,
};
Expand Down
48 changes: 48 additions & 0 deletions packages/kbn-config-schema/src/internals/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,54 @@ export const internals = Joi.extend([
},
],
},
{
name: 'record',
pre(value: any, state: State, options: ValidationOptions) {
if (!isPlainObject(value)) {
return this.createError('record.base', { value }, state, options);
}

return value as any;
},
rules: [
anyCustomRule,
{
name: 'entries',
params: { key: Joi.object().schema(), value: Joi.object().schema() },
validate(params, value, state, options) {
const result = {} as Record<string, any>;
for (const [entryKey, entryValue] of Object.entries(value)) {
const { value: validatedEntryKey, error: keyError } = Joi.validate(
entryKey,
params.key
);

if (keyError) {
return this.createError('record.key', { entryKey, reason: keyError }, state, options);
}

const { value: validatedEntryValue, error: valueError } = Joi.validate(
entryValue,
params.value
);

if (valueError) {
return this.createError(
'record.value',
{ entryKey, reason: valueError },
state,
options
);
}

result[validatedEntryKey] = validatedEntryValue;
}

return result as any;
},
},
],
},
{
name: 'array',

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`fails when not receiving expected key type 1`] = `"[name]: expected value of type [number] but got [string]"`;
exports[`fails when not receiving expected key type 1`] = `"[key(\\"name\\")]: expected value of type [number] but got [string]"`;

exports[`fails when not receiving expected value type 1`] = `"[name]: expected value of type [string] but got [number]"`;

exports[`includes namespace in failure when wrong key type 1`] = `"[foo-namespace.name]: expected value of type [number] but got [string]"`;
exports[`includes namespace in failure when wrong key type 1`] = `"[foo-namespace.key(\\"name\\")]: expected value of type [number] but got [string]"`;

exports[`includes namespace in failure when wrong top-level type 1`] = `"[foo-namespace]: expected value of type [Map] or [object] but got [Array]"`;

Expand Down
1 change: 1 addition & 0 deletions packages/kbn-config-schema/src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export { MaybeType } from './maybe_type';
export { MapOfOptions, MapOfType } from './map_type';
export { NumberOptions, NumberType } from './number_type';
export { ObjectType, Props, TypeOf } from './object_type';
export { RecordOfOptions, RecordOfType } from './record_type';
export { StringOptions, StringType } from './string_type';
export { UnionType } from './union_type';
20 changes: 9 additions & 11 deletions packages/kbn-config-schema/src/types/literal_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,14 @@ import { Type } from './type';

export class LiteralType<T> extends Type<T> {
constructor(value: T) {
super(internals.any(), {
// Before v13.3.0 Joi.any().value() didn't provide raw value if validation
// fails, so to display this value in error message we should provide
// custom validation function. Once we upgrade Joi, we'll be able to use
// `value()` with custom `any.allowOnly` error handler instead.
validate(valueToValidate) {
if (valueToValidate !== value) {
return `expected value to equal [${value}] but got [${valueToValidate}]`;
}
},
});
super(internals.any().valid(value));
}

protected handleError(type: string, { value, valids: [expectedValue] }: Record<string, any>) {
switch (type) {
case 'any.required':
case 'any.allowOnly':
return `expected value to equal [${expectedValue}] but got [${value}]`;
}
}
}
13 changes: 10 additions & 3 deletions packages/kbn-config-schema/src/types/map_type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/

import typeDetect from 'type-detect';
import { SchemaTypeError } from '../errors';
import { SchemaTypeError, SchemaTypesError } from '../errors';
import { internals } from '../internals';
import { Type, TypeOptions } from './type';

Expand Down Expand Up @@ -51,9 +51,16 @@ export class MapOfType<K, V> extends Type<Map<K, V>> {
case 'map.key':
case 'map.value':
const childPathWithIndex = reason.path.slice();
childPathWithIndex.splice(path.length, 0, entryKey.toString());
childPathWithIndex.splice(
path.length,
0,
// If `key` validation failed, let's stress that to make error more obvious.
type === 'map.key' ? `key("${entryKey}")` : entryKey.toString()
);

return new SchemaTypeError(reason.message, childPathWithIndex);
return reason instanceof SchemaTypesError
? new SchemaTypesError(reason, childPathWithIndex, reason.errors)
: new SchemaTypeError(reason, childPathWithIndex);
}
}
}
122 changes: 122 additions & 0 deletions packages/kbn-config-schema/src/types/record_of_type.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import { schema } from '..';

test('handles object as input', () => {
const type = schema.recordOf(schema.string(), schema.string());
const value = {
name: 'foo',
};
expect(type.validate(value)).toEqual({ name: 'foo' });
});

test('fails when not receiving expected value type', () => {
const type = schema.recordOf(schema.string(), schema.string());
const value = {
name: 123,
};

expect(() => type.validate(value)).toThrowErrorMatchingInlineSnapshot(
`"[name]: expected value of type [string] but got [number]"`
);
});

test('fails when not receiving expected key type', () => {
const type = schema.recordOf(
schema.oneOf([schema.literal('nickName'), schema.literal('lastName')]),
schema.string()
);

const value = {
name: 'foo',
};

expect(() => type.validate(value)).toThrowErrorMatchingInlineSnapshot(`
"[key(\\"name\\")]: types that failed validation:
- [0]: expected value to equal [nickName] but got [name]
- [1]: expected value to equal [lastName] but got [name]"
`);
});

test('includes namespace in failure when wrong top-level type', () => {
const type = schema.recordOf(schema.string(), schema.string());
expect(() => type.validate([], {}, 'foo-namespace')).toThrowErrorMatchingInlineSnapshot(
`"[foo-namespace]: expected value of type [object] but got [Array]"`
);
});

test('includes namespace in failure when wrong value type', () => {
const type = schema.recordOf(schema.string(), schema.string());
const value = {
name: 123,
};

expect(() => type.validate(value, {}, 'foo-namespace')).toThrowErrorMatchingInlineSnapshot(
`"[foo-namespace.name]: expected value of type [string] but got [number]"`
);
});

test('includes namespace in failure when wrong key type', () => {
const type = schema.recordOf(schema.string({ minLength: 10 }), schema.string());
const value = {
name: 'foo',
};

expect(() => type.validate(value, {}, 'foo-namespace')).toThrowErrorMatchingInlineSnapshot(
`"[foo-namespace.key(\\"name\\")]: value is [name] but it must have a minimum length of [10]."`
);
});

test('returns default value if undefined', () => {
const obj = { foo: 'bar' };

const type = schema.recordOf(schema.string(), schema.string(), {
defaultValue: obj,
});

expect(type.validate(undefined)).toEqual(obj);
});

test('recordOf within recordOf', () => {
const type = schema.recordOf(schema.string(), schema.recordOf(schema.string(), schema.number()));
const value = {
foo: {
bar: 123,
},
};

expect(type.validate(value)).toEqual({ foo: { bar: 123 } });
});

test('object within recordOf', () => {
const type = schema.recordOf(
schema.string(),
schema.object({
bar: schema.number(),
})
);
const value = {
foo: {
bar: 123,
},
};

expect(type.validate(value)).toEqual({ foo: { bar: 123 } });
});
Loading