Skip to content

Commit

Permalink
Merge branch '7.x' into backport/7.x/pr-77910
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 28, 2020
2 parents 58f9f07 + cfc65dd commit 0685949
Show file tree
Hide file tree
Showing 71 changed files with 932 additions and 304 deletions.
4 changes: 2 additions & 2 deletions docs/developer/advanced/development-basepath.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ You can set this explicitly using `server.basePath` in <<settings>>.

Use the server.rewriteBasePath setting to tell {kib} if it should remove the basePath from requests it receives, and to prevent a deprecation warning at startup. This setting cannot end in a slash (/).

If you want to turn off the basepath when in development mode, start {kib} with the `--no-basepath` flag
If you want to turn off the basepath when in development mode, start {kib} with the `--no-base-path` flag

[source,bash]
----
yarn start --no-basepath
yarn start --no-base-path
----


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Add scripted field to field list
<b>Signature:</b>

```typescript
addScriptedField(name: string, script: string, fieldType?: string, lang?: string): Promise<void>;
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
```

## Parameters
Expand All @@ -19,7 +19,6 @@ addScriptedField(name: string, script: string, fieldType?: string, lang?: string
| name | <code>string</code> | |
| script | <code>string</code> | |
| fieldType | <code>string</code> | |
| lang | <code>string</code> | |

<b>Returns:</b>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export declare class IndexPattern implements IIndexPattern
| Method | Modifiers | Description |
| --- | --- | --- |
| [addScriptedField(name, script, fieldType, lang)](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) | | Add scripted field to field list |
| [addScriptedField(name, script, fieldType)](./kibana-plugin-plugins-data-public.indexpattern.addscriptedfield.md) | | Add scripted field to field list |
| [getAggregationRestrictions()](./kibana-plugin-plugins-data-public.indexpattern.getaggregationrestrictions.md) | | |
| [getAsSavedObjectBody()](./kibana-plugin-plugins-data-public.indexpattern.getassavedobjectbody.md) | | Returns index pattern as saved object body for saving |
| [getComputedFields()](./kibana-plugin-plugins-data-public.indexpattern.getcomputedfields.md) | | |
Expand All @@ -53,7 +53,6 @@ export declare class IndexPattern implements IIndexPattern
| [getSourceFiltering()](./kibana-plugin-plugins-data-public.indexpattern.getsourcefiltering.md) | | Get the source filtering configuration for that index. |
| [getTimeField()](./kibana-plugin-plugins-data-public.indexpattern.gettimefield.md) | | |
| [isTimeBased()](./kibana-plugin-plugins-data-public.indexpattern.istimebased.md) | | |
| [isTimeBasedWildcard()](./kibana-plugin-plugins-data-public.indexpattern.istimebasedwildcard.md) | | |
| [isTimeNanosBased()](./kibana-plugin-plugins-data-public.indexpattern.istimenanosbased.md) | | |
| [isUnsupportedTimePattern()](./kibana-plugin-plugins-data-public.indexpattern.isunsupportedtimepattern.md) | | |
| [popularizeField(fieldName, unit)](./kibana-plugin-plugins-data-public.indexpattern.popularizefield.md) | | |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Add scripted field to field list
<b>Signature:</b>

```typescript
addScriptedField(name: string, script: string, fieldType?: string, lang?: string): Promise<void>;
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
```

## Parameters
Expand All @@ -19,7 +19,6 @@ addScriptedField(name: string, script: string, fieldType?: string, lang?: string
| name | <code>string</code> | |
| script | <code>string</code> | |
| fieldType | <code>string</code> | |
| lang | <code>string</code> | |

<b>Returns:</b>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export declare class IndexPattern implements IIndexPattern
| Method | Modifiers | Description |
| --- | --- | --- |
| [addScriptedField(name, script, fieldType, lang)](./kibana-plugin-plugins-data-server.indexpattern.addscriptedfield.md) | | Add scripted field to field list |
| [addScriptedField(name, script, fieldType)](./kibana-plugin-plugins-data-server.indexpattern.addscriptedfield.md) | | Add scripted field to field list |
| [getAggregationRestrictions()](./kibana-plugin-plugins-data-server.indexpattern.getaggregationrestrictions.md) | | |
| [getAsSavedObjectBody()](./kibana-plugin-plugins-data-server.indexpattern.getassavedobjectbody.md) | | Returns index pattern as saved object body for saving |
| [getComputedFields()](./kibana-plugin-plugins-data-server.indexpattern.getcomputedfields.md) | | |
Expand All @@ -53,7 +53,6 @@ export declare class IndexPattern implements IIndexPattern
| [getSourceFiltering()](./kibana-plugin-plugins-data-server.indexpattern.getsourcefiltering.md) | | Get the source filtering configuration for that index. |
| [getTimeField()](./kibana-plugin-plugins-data-server.indexpattern.gettimefield.md) | | |
| [isTimeBased()](./kibana-plugin-plugins-data-server.indexpattern.istimebased.md) | | |
| [isTimeBasedWildcard()](./kibana-plugin-plugins-data-server.indexpattern.istimebasedwildcard.md) | | |
| [isTimeNanosBased()](./kibana-plugin-plugins-data-server.indexpattern.istimenanosbased.md) | | |
| [isUnsupportedTimePattern()](./kibana-plugin-plugins-data-server.indexpattern.isunsupportedtimepattern.md) | | |
| [popularizeField(fieldName, unit)](./kibana-plugin-plugins-data-server.indexpattern.popularizefield.md) | | |
Expand Down
3 changes: 1 addition & 2 deletions docs/getting-started/tutorial-define-index.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ index named `shakespeare,` and the accounts data set, which has an index named
. In the *Index pattern name* field, enter `shakes*`.
+
[role="screenshot"]
image::images/tutorial-pattern-1.png[shakes* index patterns]
image::images/tutorial-pattern-1.png[Image showing how to enter shakes* in Index Pattern Name field]

. Click *Next step*.

Expand All @@ -48,4 +48,3 @@ contains the time series data.
image::images/tutorial_index_patterns.png[All tutorial index patterns]



Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,7 @@ describe('IndexPattern', () => {
await indexPattern.addScriptedField(
scriptedField.name,
scriptedField.script,
scriptedField.type,
'lang'
scriptedField.type
);

const scriptedFields = indexPattern.getScriptedFields();
Expand All @@ -206,7 +205,7 @@ describe('IndexPattern', () => {
const scriptedField = last(scriptedFields) as any;
expect.assertions(1);
try {
await indexPattern.addScriptedField(scriptedField.name, "'new script'", 'string', 'lang');
await indexPattern.addScriptedField(scriptedField.name, "'new script'", 'string');
} catch (e) {
expect(e).toBeInstanceOf(DuplicateField);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,7 @@ export class IndexPattern implements IIndexPattern {
* @param fieldType
* @param lang
*/
async addScriptedField(
name: string,
script: string,
fieldType: string = 'string',
lang: string = 'painless'
) {
async addScriptedField(name: string, script: string, fieldType: string = 'string') {
const scriptedFields = this.getScriptedFields();
const names = _.map(scriptedFields, 'name');

Expand All @@ -252,7 +247,7 @@ export class IndexPattern implements IIndexPattern {
script,
type: fieldType,
scripted: true,
lang,
lang: 'painless',
aggregatable: true,
searchable: true,
count: 0,
Expand Down Expand Up @@ -345,13 +340,9 @@ export class IndexPattern implements IIndexPattern {
return timeField && timeField.esTypes && timeField.esTypes.indexOf('date_nanos') !== -1;
}

isTimeBasedWildcard(): boolean {
return this.isTimeBased() && this.isWildcard();
}

getTimeField() {
if (!this.timeFieldName || !this.fields || !this.fields.getByName) return undefined;
return this.fields.getByName(this.timeFieldName) || undefined;
return this.fields.getByName(this.timeFieldName);
}

getFieldByName(name: string): IndexPatternField | undefined {
Expand All @@ -363,13 +354,6 @@ export class IndexPattern implements IIndexPattern {
return this.typeMeta?.aggs;
}

/**
* Does this index pattern title include a '*'
*/
private isWildcard() {
return _.includes(this.title, '*');
}

/**
* Returns index pattern as saved object body for saving
*/
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ export type IMetricAggType = MetricAggType;
export class IndexPattern implements IIndexPattern {
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
constructor({ spec, savedObjectsClient, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
addScriptedField(name: string, script: string, fieldType?: string, lang?: string): Promise<void>;
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
// (undocumented)
fieldFormatMap: Record<string, any>;
// (undocumented)
Expand Down Expand Up @@ -1163,8 +1163,6 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
isTimeBased(): boolean;
// (undocumented)
isTimeBasedWildcard(): boolean;
// (undocumented)
isTimeNanosBased(): boolean;
// (undocumented)
isUnsupportedTimePattern(): boolean;
Expand Down
4 changes: 1 addition & 3 deletions src/plugins/data/server/server.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,7 @@ export type IMetricAggType = MetricAggType;
export class IndexPattern implements IIndexPattern {
// Warning: (ae-forgotten-export) The symbol "IndexPatternDeps" needs to be exported by the entry point index.d.ts
constructor({ spec, savedObjectsClient, fieldFormats, shortDotsEnable, metaFields, }: IndexPatternDeps);
addScriptedField(name: string, script: string, fieldType?: string, lang?: string): Promise<void>;
addScriptedField(name: string, script: string, fieldType?: string): Promise<void>;
// (undocumented)
fieldFormatMap: Record<string, any>;
// Warning: (ae-forgotten-export) The symbol "IIndexPatternFieldList" needs to be exported by the entry point index.d.ts
Expand Down Expand Up @@ -702,8 +702,6 @@ export class IndexPattern implements IIndexPattern {
// (undocumented)
isTimeBased(): boolean;
// (undocumented)
isTimeBasedWildcard(): boolean;
// (undocumented)
isTimeNanosBased(): boolean;
// (undocumented)
isUnsupportedTimePattern(): boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ const appServices = {
api: apiService,
notifications: notificationServiceMock.createSetupContract(),
history,
urlGenerators: {
getUrlGenerator: jest.fn().mockReturnValue({
createUrl: jest.fn(),
}),
},
};

export const setupEnvironment = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,20 @@ const registerHttpRequestMockHelpers = (server: SinonFakeServer) => {
]);
};

const setFetchDocumentsResponse = (response?: HttpResponse, error?: any) => {
const status = error ? error.status || 400 : 200;
const body = error ? JSON.stringify(error.body) : JSON.stringify(response);

server.respondWith('GET', '/api/ingest_pipelines/documents/:index/:id', [
status,
{ 'Content-Type': 'application/json' },
body,
]);
};

return {
setSimulatePipelineResponse,
setFetchDocumentsResponse,
};
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ const appServices = {
notifications: notificationServiceMock.createSetupContract(),
history,
uiSettings: {},
urlGenerators: {
getUrlGenerator: jest.fn().mockReturnValue({
createUrl: jest.fn(),
}),
},
};

const testBedSetup = registerTestBed<TestSubject>(
Expand Down Expand Up @@ -180,6 +185,20 @@ const createActions = (testBed: TestBed<TestSubject>) => {
});
component.update();
},

async toggleDocumentsAccordion() {
await act(async () => {
find('addDocumentsAccordion').simulate('click');
});
component.update();
},

async clickAddDocumentButton() {
await act(async () => {
find('addDocumentButton').simulate('click');
});
component.update();
},
};
};

Expand Down Expand Up @@ -229,4 +248,8 @@ type TestSubject =
| 'configurationTab'
| 'outputTab'
| 'processorOutputTabContent'
| 'addDocumentsAccordion'
| 'addDocumentButton'
| 'addDocumentError'
| 'addDocumentSuccess'
| string;
Loading

0 comments on commit 0685949

Please sign in to comment.