Skip to content

Commit

Permalink
Create index pattern / create_index_pattern/lib => typescript (elasti…
Browse files Browse the repository at this point in the history
…c#56811) (elastic#56880)

* Create index pattern / create_index_pattern/lib => typescript
  • Loading branch information
mattkime authored Feb 5, 2020
1 parent 736ed90 commit 0855f12
Show file tree
Hide file tree
Showing 21 changed files with 283 additions and 229 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -279,13 +279,12 @@ export class StepIndexPattern extends Component {

render() {
const { isIncludingSystemIndices, allIndices } = this.props;
const { query, partialMatchedIndices, exactMatchedIndices } = this.state;
const { partialMatchedIndices, exactMatchedIndices } = this.state;

const matchedIndices = getMatchedIndices(
allIndices,
partialMatchedIndices,
exactMatchedIndices,
query,
isIncludingSystemIndices
);

Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,9 @@
* under the License.
*/

import { canAppendWildcard } from '../can_append_wildcard';
import { canAppendWildcard } from './can_append_wildcard';

describe('canAppendWildcard', () => {
test('ignores no data', () => {
expect(canAppendWildcard({})).toBeFalsy();
});

test('ignores symbols', () => {
expect(canAppendWildcard('%')).toBeFalsy();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

export const canAppendWildcard = keyPressed => {
export const canAppendWildcard = (keyPressed: string) => {
// If it's not a letter, number or is something longer, reject it
if (!keyPressed || !/[a-z0-9]/i.test(keyPressed) || keyPressed.length !== 1) {
return false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
* under the License.
*/

export function containsIllegalCharacters(pattern, illegalCharacters) {
export function containsIllegalCharacters(pattern: string, illegalCharacters: string[]) {
return illegalCharacters.some(char => pattern.includes(char));
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { containsIllegalCharacters } from '../contains_illegal_characters';
import { containsIllegalCharacters } from './contains_illegal_characters';

describe('containsIllegalCharacters', () => {
it('returns true with illegal characters', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* under the License.
*/

import { ensureMinimumTime } from '../ensure_minimum_time';
import { ensureMinimumTime } from './ensure_minimum_time';

describe('ensureMinimumTime', () => {
it('resolves single promise', async done => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
export const DEFAULT_MINIMUM_TIME_MS = 300;

export async function ensureMinimumTime(
promiseOrPromises,
promiseOrPromises: Promise<any> | Array<Promise<any>>,
minimumTimeMs = DEFAULT_MINIMUM_TIME_MS
) {
let returnValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,14 @@
* under the License.
*/

import { extractTimeFields } from '../extract_time_fields';
import { extractTimeFields } from './extract_time_fields';

describe('extractTimeFields', () => {
it('should handle no date fields', () => {
const fields = [{ type: 'text' }, { type: 'text' }];
const fields = [
{ type: 'text', name: 'name' },
{ type: 'text', name: 'name' },
];

expect(extractTimeFields(fields)).toEqual([
{ display: `The indices which match this index pattern don't contain any time fields.` },
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
*/

import { i18n } from '@kbn/i18n';
import { IFieldType } from '../../../../../../../../../plugins/data/public';

export function extractTimeFields(fields) {
export function extractTimeFields(fields: IFieldType[]) {
const dateFields = fields.filter(field => field.type === 'date');
const label = i18n.translate('kbn.management.createIndexPattern.stepTime.noTimeFieldsLabel', {
defaultMessage: "The indices which match this index pattern don't contain any time fields.",
Expand Down
Loading

0 comments on commit 0855f12

Please sign in to comment.