Skip to content
This repository has been archived by the owner on Aug 2, 2022. It is now read-only.

Adds support for Kibana 7.9.0 #171

Merged
merged 3 commits into from
Aug 24, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "opendistro-alerting",
"version": "1.9.0.0",
"version": "1.10.0.0",
"description": "Kibana Alerting Plugin",
"main": "index.js",
"license": "Apache-2.0",
"homepage": "https://github.com/opendistro-for-elasticsearch/alerting-kibana-plugin",
"kibana": {
"version": "7.8.0",
"version": "7.9.0",
"templateVersion": "6.3.3"
},
"repository": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ Object {
</h3>
<ul>
<li>
<ForwardRef
<EuiLink
href="https://mustache.github.io/mustache.5.html"
target="_blank"
>
HTML Templates with Mustache.js
</ForwardRef>
</EuiLink>
</li>
</ul>
</EuiText>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ exports[`FormikSwitch renders 1`] = `
class="euiSwitch"
>
<button
aria-labelledby="some_make_id"
aria-labelledby="generated-id"
class="euiSwitch__button"
id="testing"
name="testing"
Expand All @@ -32,7 +32,7 @@ exports[`FormikSwitch renders 1`] = `
</button>
<span
class="euiSwitch__label"
id="some_make_id"
id="generated-id"
/>
</div>
`;
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ Array [
<div
class="echChart"
>
<div
class="echChartBackground"
style="background-color:transparent"
/>
<div
class="echChartStatus"
data-ech-render-complete="false"
Expand All @@ -29,15 +33,7 @@ Array [
/>
<div
class="echContainer"
>
<div
class="echReactiveChart_unavailable"
>
<p>
No data to display
</p>
</div>
</div>
/>
</div>
</div>
</div>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const closeExpression = jest.fn();
const getMountWrapper = (state = false) => (
<Formik
initialValues={FORMIK_INITIAL_VALUES}
render={props => (
render={(props) => (
<WhereExpression
formik={props}
dataTypes={dataTypes}
Expand Down Expand Up @@ -73,8 +73,8 @@ describe('WhereExpression', () => {
.find('[data-test-subj="comboBoxSearchInput"]')
.hostNodes()
.simulate('change', { target: { value: 'cityName' } })
.simulate('keyDown', { keyCode: 40 })
.simulate('keyDown', { keyCode: 13 })
.simulate('keyDown', { key: 'ArrowDown' })
.simulate('keyDown', { key: 'Enter' })
.simulate('blur');

wrapper.update();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ describe('AnomalyDetectors', () => {
expect(wrapper).toMatchSnapshot();
});

test('should be able to select the detector', done => {
test('should be able to select the detector', (done) => {
httpClientMock.post.mockResolvedValueOnce({
data: {
ok: true,
Expand All @@ -72,8 +72,8 @@ describe('AnomalyDetectors', () => {
.find('[data-test-subj="comboBoxSearchInput"]')
.hostNodes()
.simulate('change', { target: { value: 'sample-detector' } })
.simulate('keyDown', { keyCode: 40 })
.simulate('keyDown', { keyCode: 13 });
.simulate('keyDown', { key: 'ArrowDown' })
.simulate('keyDown', { key: 'Enter' });
expect(wrapper.instance().state.values.detectorId).toEqual('sample-id');
done();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import MonitorIndex from './MonitorIndex';
import * as helpers from './utils/helpers';
import { httpClientMock } from '../../../../../test/mocks';

helpers.createReasonableWait = jest.fn(cb => cb());
helpers.createReasonableWait = jest.fn((cb) => cb());
httpClientMock.post.mockResolvedValue({ data: { ok: true, resp: [] } });

function getMountWrapper(customProps = {}) {
Expand Down Expand Up @@ -77,7 +77,7 @@ describe('MonitorIndex', () => {
.find('[data-test-subj="comboBoxSearchInput"]')
.hostNodes()
.simulate('change', { target: { value: ' ' } })
.simulate('keyDown', { keyCode: 13 });
.simulate('keyDown', { key: 'Enter' });

expect(wrapper.find('.euiComboBoxPill')).toHaveLength(0);
});
Expand Down Expand Up @@ -105,36 +105,16 @@ describe('MonitorIndex', () => {
test('returns empty alias/index array for *:', async () => {
const wrapper = getMountWrapper();

expect(
await wrapper
.find(MonitorIndex)
.instance()
.handleQueryAliases('*:')
).toEqual([]);
expect(
await wrapper
.find(MonitorIndex)
.instance()
.handleQueryIndices('*:')
).toEqual([]);
expect(await wrapper.find(MonitorIndex).instance().handleQueryAliases('*:')).toEqual([]);
expect(await wrapper.find(MonitorIndex).instance().handleQueryIndices('*:')).toEqual([]);
});

test('returns empty array for data.ok = false', async () => {
httpClientMock.post.mockResolvedValue({ data: { ok: false } });
const wrapper = getMountWrapper();

expect(
await wrapper
.find(MonitorIndex)
.instance()
.handleQueryAliases('random')
).toEqual([]);
expect(
await wrapper
.find(MonitorIndex)
.instance()
.handleQueryIndices('random')
).toEqual([]);
expect(await wrapper.find(MonitorIndex).instance().handleQueryAliases('random')).toEqual([]);
expect(await wrapper.find(MonitorIndex).instance().handleQueryIndices('random')).toEqual([]);
});
//
test('returns indices/aliases', async () => {
Expand All @@ -146,18 +126,12 @@ describe('MonitorIndex', () => {
});
const wrapper = getMountWrapper();

expect(
await wrapper
.find(MonitorIndex)
.instance()
.handleQueryAliases('l')
).toEqual([{ label: 'logstash', index: 'logstash-0' }]);
expect(
await wrapper
.find(MonitorIndex)
.instance()
.handleQueryIndices('l')
).toEqual([{ health: 'green', status: 'open', label: 'logstash-0' }]);
expect(await wrapper.find(MonitorIndex).instance().handleQueryAliases('l')).toEqual([
{ label: 'logstash', index: 'logstash-0' },
]);
expect(await wrapper.find(MonitorIndex).instance().handleQueryIndices('l')).toEqual([
{ health: 'green', status: 'open', label: 'logstash-0' },
]);
});

test.skip('onBlur sets index to touched', () => {
Expand Down Expand Up @@ -195,8 +169,8 @@ describe('MonitorIndex', () => {
wrapper
.find('[data-test-subj="comboBoxInput"]')
.hostNodes()
.simulate('keyDown', { keyCode: 40 })
.simulate('keyDown', { keyCode: 13 });
.simulate('keyDown', { key: 'ArrowDown' })
.simulate('keyDown', { key: 'Enter' });

expect(wrapper.instance().state.values.index).toEqual([{ label: 'logstash-0' }]);
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,15 +127,15 @@ exports[`Message renders 1`] = `
</div>
<div
class="euiFormRow"
id="testing-id-row"
id="generated-id-row"
style="max-width:100%"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label"
for="testing-id"
for="generated-id"
>
Message preview
</label>
Expand All @@ -145,7 +145,7 @@ exports[`Message renders 1`] = `
>
<textarea
class="euiTextArea euiTextArea--resizeVertical euiTextArea--fullWidth read-only-text-area"
id="testing-id"
id="generated-id"
placeholder="Preview of mustache template"
readonly=""
rows="6"
Expand All @@ -163,15 +163,15 @@ exports[`Message renders 1`] = `
/>
<div
class="euiFormRow"
id="testing-id-row"
id="generated-id-row"
style="max-width:100%"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label"
for="testing-id"
for="generated-id"
>
<div>
<span
Expand Down Expand Up @@ -201,7 +201,7 @@ exports[`Message renders 1`] = `
>
<div
class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--directionColumn euiFlexGroup--responsive"
id="testing-id"
id="generated-id"
>
<div
class="euiFlexItem euiFlexItem--flexGrowZero"
Expand Down Expand Up @@ -237,14 +237,14 @@ exports[`Message renders 1`] = `
>
<div
class="euiFormRow"
id="testing-id-row"
id="generated-id-row"
>
<div
class="euiFormRow__labelWrapper"
>
<label
class="euiFormLabel euiFormRow__label"
for="testing-id"
for="generated-id"
>
Throttle actions to only trigger every
</label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ describe('TriggerExpressions', () => {
wrapper.update();
expect(openExpression).toHaveBeenCalled();
expect(wrapper.find(TriggerExpressions).state().openedStates[Expressions.THRESHOLD]).toBe(true);
await new Promise(res => setTimeout(() => res()));
await new Promise((res) => setTimeout(() => res()));
button.simulate('keyDown', { keyCode: 27 });
wrapper.update();
expect(closeExpression).toHaveBeenCalled();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,12 +154,11 @@ exports[`DashboardControls renders 1`] = `
class="euiFlexItem euiFlexItem--flexGrowZero"
style="justify-content:center"
>
<div
<nav
class="euiPagination"
role="group"
>
<button
aria-label="Previous page"
aria-label="Previous page, 1"
class="euiButtonIcon euiButtonIcon--text"
data-test-subj="pagination-button-previous"
type="button"
Expand All @@ -168,38 +167,52 @@ exports[`DashboardControls renders 1`] = `
EuiIconMock
</div>
</button>
<button
aria-label="Page 1 of 2"
class="euiButtonEmpty euiButtonEmpty--text euiButtonEmpty--xSmall euiPaginationButton euiPaginationButton--hideOnMobile"
data-test-subj="pagination-button-0"
type="button"
<ul
class="euiPagination__list"
>
<span
class="euiButtonEmpty__content"
<li
class="euiPagination__item"
>
<span
class="euiButtonEmpty__text"
>
1
</span>
</span>
</button>
<button
aria-label="Page 2 of 2"
class="euiButtonEmpty euiButtonEmpty--text euiButtonEmpty--xSmall euiPaginationButton euiPaginationButton-isActive euiPaginationButton--hideOnMobile"
data-test-subj="pagination-button-1"
type="button"
>
<span
class="euiButtonEmpty__content"
<button
aria-label="Page 1 of 2"
class="euiButtonEmpty euiButtonEmpty--text euiButtonEmpty--xSmall euiPaginationButton euiPaginationButton--hideOnMobile"
data-test-subj="pagination-button-0"
type="button"
>
<span
class="euiButtonEmpty__content"
>
<span
class="euiButtonEmpty__text"
>
1
</span>
</span>
</button>
</li>
<li
class="euiPagination__item"
>
<span
class="euiButtonEmpty__text"
>
2
</span>
</span>
</button>
<button
aria-current="true"
aria-label="Page 2 of 2"
class="euiButtonEmpty euiButtonEmpty--text euiButtonEmpty--xSmall euiPaginationButton euiPaginationButton-isActive euiPaginationButton--hideOnMobile"
data-test-subj="pagination-button-1"
disabled=""
type="button"
>
<span
class="euiButtonEmpty__content"
>
<span
class="euiButtonEmpty__text"
>
2
</span>
</span>
</button>
</li>
</ul>
<button
aria-label="Next page"
class="euiButtonIcon euiButtonIcon--text"
Expand All @@ -211,7 +224,7 @@ exports[`DashboardControls renders 1`] = `
EuiIconMock
</div>
</button>
</div>
</nav>
</div>
</div>
`;
Loading