-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b178de1
commit 2274cd4
Showing
29 changed files
with
1,293 additions
and
12 deletions.
There are no files selected for viewing
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
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
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,16 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { resolve } from 'path'; | ||
|
||
export const advancedUiActions = (kibana: any) => | ||
new kibana.Plugin({ | ||
id: 'advanced_ui_actions', | ||
publicDir: resolve(__dirname, 'public'), | ||
uiExports: { | ||
hacks: 'plugins/advanced_ui_actions/np_ready/public/shim/index', | ||
}, | ||
}); |
9 changes: 9 additions & 0 deletions
9
x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/kibana.json
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,9 @@ | ||
{ | ||
"id": "advanced_ui_actions", | ||
"version": "kibana", | ||
"requiredPlugins": [ | ||
"embeddable" | ||
], | ||
"server": false, | ||
"ui": true | ||
} |
40 changes: 40 additions & 0 deletions
40
.../legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.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,40 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
import { canInheritTimeRange } from './can_inherit_time_range'; | ||
import { | ||
HelloWorldEmbeddable, | ||
HelloWorldContainer, | ||
} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public/lib/test_samples'; | ||
import { TimeRangeEmbeddable, TimeRangeContainer } from './test_helpers'; | ||
|
||
test('canInheritTimeRange returns false if embeddable is inside container without a time range', () => { | ||
const embeddable = new TimeRangeEmbeddable( | ||
{ id: '1234', timeRange: { from: 'noxw-15m', to: 'now' } }, | ||
new HelloWorldContainer({ id: '123', panels: {} }, (() => null) as any) | ||
); | ||
|
||
expect(canInheritTimeRange(embeddable)).toBe(false); | ||
}); | ||
|
||
test('canInheritTimeRange returns false if embeddable is without a time range', () => { | ||
const embeddable = new HelloWorldEmbeddable( | ||
{ id: '1234' }, | ||
new HelloWorldContainer({ id: '123', panels: {} }, (() => null) as any) | ||
); | ||
// @ts-ignore | ||
expect(canInheritTimeRange(embeddable)).toBe(false); | ||
}); | ||
|
||
test('canInheritTimeRange returns true if embeddable is inside a container with a time range', () => { | ||
const embeddable = new TimeRangeEmbeddable( | ||
{ id: '1234', timeRange: { from: 'noxw-15m', to: 'now' } }, | ||
new TimeRangeContainer( | ||
{ id: '123', panels: {}, timeRange: { from: 'noxw-15m', to: 'now' } }, | ||
(() => null) as any | ||
) | ||
); | ||
expect(canInheritTimeRange(embeddable)).toBe(true); | ||
}); |
27 changes: 27 additions & 0 deletions
27
x-pack/legacy/plugins/advanced_ui_actions/public/np_ready/public/can_inherit_time_range.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,27 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License; | ||
* you may not use this file except in compliance with the Elastic License. | ||
*/ | ||
|
||
import { TimeRange } from '../../../../../../../src/plugins/data/public'; | ||
import { | ||
Embeddable, | ||
IContainer, | ||
ContainerInput, | ||
} from '../../../../../../../src/legacy/core_plugins/embeddable_api/public/np_ready/public'; | ||
import { TimeRangeInput } from './custom_time_range_action'; | ||
|
||
interface ContainerTimeRangeInput extends ContainerInput<TimeRangeInput> { | ||
timeRange: TimeRange; | ||
} | ||
|
||
export function canInheritTimeRange(embeddable: Embeddable<TimeRangeInput>) { | ||
if (!embeddable.parent) { | ||
return false; | ||
} | ||
|
||
const parent = embeddable.parent as IContainer<TimeRangeInput, ContainerTimeRangeInput>; | ||
|
||
return parent.getInput().timeRange !== undefined; | ||
} |
Oops, something went wrong.