Skip to content

Commit

Permalink
Merge branch 'master' into reporting/unskip-screenshot-tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Sep 23, 2020
2 parents 3426aa7 + a00b3ee commit f4226ee
Show file tree
Hide file tree
Showing 394 changed files with 47,686 additions and 55,188 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<!-- Do not edit this file. It is automatically generated by API Documenter. -->

[Home](./index.md) &gt; [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) &gt; [IndexPatternsService](./kibana-plugin-plugins-data-public.indexpatternsservice.md) &gt; [getIdsWithTitle](./kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md)

## IndexPatternsService.getIdsWithTitle property

Get list of index pattern ids with titles

<b>Signature:</b>

```typescript
getIdsWithTitle: (refresh?: boolean) => Promise<Array<{
id: string;
title: string;
}>>;
```
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export declare class IndexPatternsService
| [getFieldsForIndexPattern](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforindexpattern.md) | | <code>(indexPattern: IndexPattern &#124; IndexPatternSpec, options?: GetFieldsOptions) =&gt; Promise&lt;any&gt;</code> | Get field list by providing an index patttern (or spec) |
| [getFieldsForWildcard](./kibana-plugin-plugins-data-public.indexpatternsservice.getfieldsforwildcard.md) | | <code>(options?: GetFieldsOptions) =&gt; Promise&lt;any&gt;</code> | Get field list by providing { pattern } |
| [getIds](./kibana-plugin-plugins-data-public.indexpatternsservice.getids.md) | | <code>(refresh?: boolean) =&gt; Promise&lt;string[]&gt;</code> | Get list of index pattern ids |
| [getIdsWithTitle](./kibana-plugin-plugins-data-public.indexpatternsservice.getidswithtitle.md) | | <code>(refresh?: boolean) =&gt; Promise&lt;Array&lt;{</code><br/><code> id: string;</code><br/><code> title: string;</code><br/><code> }&gt;&gt;</code> | Get list of index pattern ids with titles |
| [getTitles](./kibana-plugin-plugins-data-public.indexpatternsservice.gettitles.md) | | <code>(refresh?: boolean) =&gt; Promise&lt;string[]&gt;</code> | Get list of index pattern titles |
| [refreshFields](./kibana-plugin-plugins-data-public.indexpatternsservice.refreshfields.md) | | <code>(indexPattern: IndexPattern) =&gt; Promise&lt;void&gt;</code> | Refresh field list for a given index pattern |
| [savedObjectToSpec](./kibana-plugin-plugins-data-public.indexpatternsservice.savedobjecttospec.md) | | <code>(savedObject: SavedObject&lt;IndexPatternAttributes&gt;) =&gt; IndexPatternSpec</code> | Converts index pattern saved object to index pattern spec |
Expand Down
Binary file removed docs/management/images/add_remote_cluster.png
Binary file not shown.
Binary file removed docs/management/images/auto_follow_pattern.png
Binary file not shown.
Binary file not shown.
Binary file removed docs/management/images/remote-clusters-list-view.png
Binary file not shown.
80 changes: 0 additions & 80 deletions docs/management/managing-ccr.asciidoc

This file was deleted.

50 changes: 0 additions & 50 deletions docs/management/managing-remote-clusters.asciidoc

This file was deleted.

12 changes: 12 additions & 0 deletions docs/redirects.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,15 @@ This content has moved to the <<development-rbac, Security>> page.
== TSVB

This page was deleted. See <<tsvb>>.

[role="exclude",id="managing-cross-cluster-replication"]
== Cross-Cluster Replication

This content has moved. See
{ref}/ccr-getting-started.html[Set up cross-cluster replication].

[role="exclude",id="working-remote-clusters"]
== Remote clusters

This content has moved. See
{ref}/ccr-getting-started.html#ccr-getting-started-remote-cluster[Connect to a remote cluster].
8 changes: 2 additions & 6 deletions docs/user/management.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,12 @@ years of historical data in combination with your raw data.
| {ref}/transforms.html[Transforms]
|Use transforms to pivot existing {es} indices into summarized or entity-centric indices.

| <<managing-cross-cluster-replication, Cross-Cluster Replication>>
| {ref}/ccr-getting-started.html[Cross-Cluster Replication]
|Replicate indices on a remote cluster and copy them to a follower index on a local cluster.
This is important for
disaster recovery. It also keeps data local for faster queries.

| <<working-remote-clusters, Remote Clusters>>
| {ref}/ccr-getting-started.html#ccr-getting-started-remote-cluster[Remote Clusters]
|Manage your remote clusters for use with cross-cluster search and cross-cluster replication.
You can add and remove remote clusters, and check their connectivity.
|===
Expand Down Expand Up @@ -180,8 +180,6 @@ include::{kib-repo-dir}/management/alerting/connector-management.asciidoc[]

include::{kib-repo-dir}/management/managing-beats.asciidoc[]

include::{kib-repo-dir}/management/managing-ccr.asciidoc[]

include::{kib-repo-dir}/management/index-lifecycle-policies/intro-to-lifecycle-policies.asciidoc[]

include::{kib-repo-dir}/management/index-lifecycle-policies/create-policy.asciidoc[]
Expand All @@ -200,8 +198,6 @@ include::{kib-repo-dir}/management/managing-licenses.asciidoc[]

include::{kib-repo-dir}/management/numeral.asciidoc[]

include::{kib-repo-dir}/management/managing-remote-clusters.asciidoc[]

include::{kib-repo-dir}/management/rollups/create_and_manage_rollups.asciidoc[]

include::{kib-repo-dir}/management/managing-saved-objects.asciidoc[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,25 @@ export class IndexPatternsService {
return this.savedObjectsCache.map((obj) => obj?.attributes?.title);
};

/**
* Get list of index pattern ids with titles
* @param refresh Force refresh of index pattern list
*/
getIdsWithTitle = async (
refresh: boolean = false
): Promise<Array<{ id: string; title: string }>> => {
if (!this.savedObjectsCache || refresh) {
await this.refreshSavedObjectsCache();
}
if (!this.savedObjectsCache) {
return [];
}
return this.savedObjectsCache.map((obj) => ({
id: obj?.id,
title: obj?.attributes?.title,
}));
};

/**
* Clear index pattern list cache
* @param id optionally clear a single id
Expand Down
4 changes: 4 additions & 0 deletions src/plugins/data/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -1381,6 +1381,10 @@ export class IndexPatternsService {
// Warning: (ae-forgotten-export) The symbol "GetFieldsOptions" needs to be exported by the entry point index.d.ts
getFieldsForWildcard: (options?: GetFieldsOptions) => Promise<any>;
getIds: (refresh?: boolean) => Promise<string[]>;
getIdsWithTitle: (refresh?: boolean) => Promise<Array<{
id: string;
title: string;
}>>;
getTitles: (refresh?: boolean) => Promise<string[]>;
refreshFields: (indexPattern: IndexPattern) => Promise<void>;
savedObjectToSpec: (savedObject: SavedObject<IndexPatternAttributes>) => IndexPatternSpec;
Expand Down
3 changes: 2 additions & 1 deletion test/functional/apps/discover/_inspector.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@ export default function ({ getService, getPageObjects }) {
return hitsCountStatsRow[STATS_ROW_VALUE_INDEX];
}

describe('inspect', () => {
// FLAKY: https://github.com/elastic/kibana/issues/39842
describe.skip('inspect', () => {
before(async () => {
await esArchiver.loadIfNeeded('logstash_functional');
await esArchiver.load('discover');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

export { mockHistory, mockLocation } from './react_router_history.mock';
export { mockKibanaContext } from './kibana_context.mock';
export { mockLicenseContext } from './license_context.mock';
export { mockLicensingValues } from './licensing_logic.mock';
export { mockHttpValues } from './http_logic.mock';
export { mockFlashMessagesValues, mockFlashMessagesActions } from './flash_messages_logic.mock';
export { mockAllValues, mockAllActions, setMockValues } from './kea.mock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,17 @@
*/

/**
* Combine all shared mock values/actions into a single obj
*
* NOTE: These variable names MUST start with 'mock*' in order for
* Jest to accept its use within a jest.mock()
*/
import { mockLicensingValues } from './licensing_logic.mock';
import { mockHttpValues } from './http_logic.mock';
import { mockFlashMessagesValues, mockFlashMessagesActions } from './flash_messages_logic.mock';

export const mockAllValues = {
...mockLicensingValues,
...mockHttpValues,
...mockFlashMessagesValues,
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

import { licensingMock } from '../../../../licensing/public/mocks';

export const mockLicenseContext = {
export const mockLicensingValues = {
license: licensingMock.createLicense(),
hasPlatinumLicense: false,
hasGoldLicense: false,
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@ import { getContext, resetContext } from 'kea';
import { I18nProvider } from '@kbn/i18n/react';
import { KibanaContext } from '../';
import { mockKibanaContext } from './kibana_context.mock';
import { LicenseContext } from '../shared/licensing';
import { mockLicenseContext } from './license_context.mock';

/**
* This helper mounts a component with all the contexts/providers used
Expand All @@ -34,9 +32,7 @@ export const mountWithContext = (children: React.ReactNode, context?: object) =>
return mount(
<I18nProvider>
<KibanaContext.Provider value={{ ...mockKibanaContext, ...context }}>
<LicenseContext.Provider value={{ ...mockLicenseContext, ...context }}>
<Provider store={store}>{children}</Provider>
</LicenseContext.Provider>
<Provider store={store}>{children}</Provider>
</KibanaContext.Provider>
</I18nProvider>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,10 @@
* Jest to accept its use within a jest.mock()
*/
import { mockKibanaContext } from './kibana_context.mock';
import { mockLicenseContext } from './license_context.mock';

jest.mock('react', () => ({
...(jest.requireActual('react') as object),
useContext: jest.fn(() => ({ ...mockKibanaContext, ...mockLicenseContext })),
useContext: jest.fn(() => ({ ...mockKibanaContext })),
useEffect: jest.fn((fn) => fn()), // Calls on mount/every update - use mount for more complex behavior
}));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,11 @@ describe('EngineOverview', () => {

describe('when on a platinum license', () => {
it('renders a 2nd meta engines table & makes a 2nd meta engines API call', async () => {
const wrapper = await mountWithAsyncContext(<EngineOverview />, {
license: { type: 'platinum', isActive: true },
setMockValues({
hasPlatinumLicense: true,
http: { ...mockHttpValues.http, get: mockApi },
});
const wrapper = await mountWithAsyncContext(<EngineOverview />);

expect(wrapper.find(EngineTable)).toHaveLength(2);
expect(mockApi).toHaveBeenNthCalledWith(2, '/api/app_search/engines', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* you may not use this file except in compliance with the Elastic License.
*/

import React, { useContext, useEffect, useState } from 'react';
import React, { useEffect, useState } from 'react';
import { useValues } from 'kea';
import {
EuiPageContent,
Expand All @@ -19,7 +19,7 @@ import { SetAppSearchChrome as SetPageChrome } from '../../../shared/kibana_chro
import { SendAppSearchTelemetry as SendTelemetry } from '../../../shared/telemetry';
import { FlashMessages } from '../../../shared/flash_messages';
import { HttpLogic } from '../../../shared/http';
import { LicenseContext, ILicenseContext, hasPlatinumLicense } from '../../../shared/licensing';
import { LicensingLogic } from '../../../shared/licensing';

import { EngineIcon } from './assets/engine_icon';
import { MetaEngineIcon } from './assets/meta_engine_icon';
Expand All @@ -40,7 +40,7 @@ interface ISetEnginesCallbacks {

export const EngineOverview: React.FC = () => {
const { http } = useValues(HttpLogic);
const { license } = useContext(LicenseContext) as ILicenseContext;
const { hasPlatinumLicense } = useValues(LicensingLogic);

const [isLoading, setIsLoading] = useState(true);
const [engines, setEngines] = useState([]);
Expand Down Expand Up @@ -72,13 +72,13 @@ export const EngineOverview: React.FC = () => {
}, [enginesPage]);

useEffect(() => {
if (hasPlatinumLicense(license)) {
if (hasPlatinumLicense) {
const params = { type: 'meta', pageIndex: metaEnginesPage };
const callbacks = { setResults: setMetaEngines, setResultsTotal: setMetaEnginesTotal };

setEnginesData(params, callbacks);
}
}, [license, metaEnginesPage]);
}, [hasPlatinumLicense, metaEnginesPage]);

if (isLoading) return <LoadingState />;
if (!engines.length) return <EmptyState />;
Expand Down
Loading

0 comments on commit f4226ee

Please sign in to comment.