-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into lens/canvas-functional-test
- Loading branch information
Showing
425 changed files
with
6,405 additions
and
4,704 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
...nt/plugins/data/public/kibana-plugin-plugins-data-public.searchsource.fetch_.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<!-- Do not edit this file. It is automatically generated by API Documenter. --> | ||
|
||
[Home](./index.md) > [kibana-plugin-plugins-data-public](./kibana-plugin-plugins-data-public.md) > [SearchSource](./kibana-plugin-plugins-data-public.searchsource.md) > [fetch$](./kibana-plugin-plugins-data-public.searchsource.fetch_.md) | ||
|
||
## SearchSource.fetch$() method | ||
|
||
Fetch this source from Elasticsearch, returning an observable over the response(s) | ||
|
||
<b>Signature:</b> | ||
|
||
```typescript | ||
fetch$(options?: ISearchOptions): import("rxjs").Observable<import("elasticsearch").SearchResponse<any>>; | ||
``` | ||
|
||
## Parameters | ||
|
||
| Parameter | Type | Description | | ||
| --- | --- | --- | | ||
| options | <code>ISearchOptions</code> | | | ||
|
||
<b>Returns:</b> | ||
|
||
`import("rxjs").Observable<import("elasticsearch").SearchResponse<any>>` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import { Server } from '@hapi/hapi'; | ||
import { reconfigureLogging, setupLogging } from './setup_logging'; | ||
import { LegacyLoggingConfig } from './schema'; | ||
|
||
describe('reconfigureLogging', () => { | ||
test(`doesn't throw an error`, () => { | ||
const server = new Server(); | ||
const config: LegacyLoggingConfig = { | ||
silent: false, | ||
quiet: false, | ||
verbose: true, | ||
events: {}, | ||
dest: '/tmp/foo', | ||
filter: {}, | ||
json: true, | ||
rotate: { | ||
enabled: false, | ||
everyBytes: 0, | ||
keepFiles: 0, | ||
pollingInterval: 0, | ||
usePolling: false, | ||
}, | ||
}; | ||
setupLogging(server, config, 10); | ||
reconfigureLogging(server, { ...config, dest: '/tmp/bar' }, 0); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
60 changes: 60 additions & 0 deletions
60
src/plugins/dashboard/server/usage/find_by_value_embeddables.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import { SavedDashboardPanel730ToLatest } from '../../common'; | ||
import { findByValueEmbeddables } from './find_by_value_embeddables'; | ||
|
||
const visualizationByValue = ({ | ||
embeddableConfig: { | ||
value: 'visualization-by-value', | ||
}, | ||
type: 'visualization', | ||
} as unknown) as SavedDashboardPanel730ToLatest; | ||
|
||
const mapByValue = ({ | ||
embeddableConfig: { | ||
value: 'map-by-value', | ||
}, | ||
type: 'map', | ||
} as unknown) as SavedDashboardPanel730ToLatest; | ||
|
||
const embeddableByRef = ({ | ||
panelRefName: 'panel_ref_1', | ||
} as unknown) as SavedDashboardPanel730ToLatest; | ||
|
||
describe('findByValueEmbeddables', () => { | ||
it('finds the by value embeddables for the given type', async () => { | ||
const savedObjectsResult = { | ||
saved_objects: [ | ||
{ | ||
attributes: { | ||
panelsJSON: JSON.stringify([visualizationByValue, mapByValue, embeddableByRef]), | ||
}, | ||
}, | ||
{ | ||
attributes: { | ||
panelsJSON: JSON.stringify([embeddableByRef, mapByValue, visualizationByValue]), | ||
}, | ||
}, | ||
], | ||
}; | ||
const savedObjectClient = { find: jest.fn().mockResolvedValue(savedObjectsResult) }; | ||
|
||
const maps = await findByValueEmbeddables(savedObjectClient, 'map'); | ||
|
||
expect(maps.length).toBe(2); | ||
expect(maps[0]).toEqual(mapByValue.embeddableConfig); | ||
expect(maps[1]).toEqual(mapByValue.embeddableConfig); | ||
|
||
const visualizations = await findByValueEmbeddables(savedObjectClient, 'visualization'); | ||
|
||
expect(visualizations.length).toBe(2); | ||
expect(visualizations[0]).toEqual(visualizationByValue.embeddableConfig); | ||
expect(visualizations[1]).toEqual(visualizationByValue.embeddableConfig); | ||
}); | ||
}); |
34 changes: 34 additions & 0 deletions
34
src/plugins/dashboard/server/usage/find_by_value_embeddables.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* and the Server Side Public License, v 1; you may not use this file except in | ||
* compliance with, at your election, the Elastic License or the Server Side | ||
* Public License, v 1. | ||
*/ | ||
|
||
import { ISavedObjectsRepository, SavedObjectAttributes } from 'kibana/server'; | ||
import { SavedDashboardPanel730ToLatest } from '../../common'; | ||
|
||
export const findByValueEmbeddables = async ( | ||
savedObjectClient: Pick<ISavedObjectsRepository, 'find'>, | ||
embeddableType: string | ||
) => { | ||
const dashboards = await savedObjectClient.find<SavedObjectAttributes>({ | ||
type: 'dashboard', | ||
}); | ||
|
||
return dashboards.saved_objects | ||
.map((dashboard) => { | ||
try { | ||
return (JSON.parse( | ||
dashboard.attributes.panelsJSON as string | ||
) as unknown) as SavedDashboardPanel730ToLatest[]; | ||
} catch (exception) { | ||
return []; | ||
} | ||
}) | ||
.flat() | ||
.filter((panel) => (panel as Record<string, any>).panelRefName === undefined) | ||
.filter((panel) => panel.type === embeddableType) | ||
.map((panel) => panel.embeddableConfig); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.