forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AO] Update the design of Threshold rule creation form (elastic#163313)
## Summary Fixes elastic#162768 Fixes elastic#162544 ### After update <img width="466" alt="Screenshot 2023-08-09 at 17 53 44" src="https://github.com/elastic/kibana/assets/6838659/926f0c9e-ca55-4711-be3a-2da39726caa8">
- Loading branch information
Showing
14 changed files
with
405 additions
and
466 deletions.
There are no files selected for viewing
23 changes: 0 additions & 23 deletions
23
...ability/public/components/threshold/components/__snapshots__/expression_row.test.tsx.snap
This file was deleted.
Oops, something went wrong.
31 changes: 31 additions & 0 deletions
31
...gins/observability/public/components/threshold/components/closable_popover_title.test.tsx
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,31 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import * as React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { ClosablePopoverTitle } from './closable_popover_title'; | ||
|
||
describe('closable popover title', () => { | ||
it('renders with defined options', () => { | ||
const onClose = jest.fn(); | ||
const children = <div className="foo" />; | ||
const wrapper = mount( | ||
<ClosablePopoverTitle onClose={onClose}>{children}</ClosablePopoverTitle> | ||
); | ||
expect(wrapper.contains(<div className="foo" />)).toBeTruthy(); | ||
}); | ||
|
||
it('onClose function gets called', () => { | ||
const onClose = jest.fn(); | ||
const children = <div className="foo" />; | ||
const wrapper = mount( | ||
<ClosablePopoverTitle onClose={onClose}>{children}</ClosablePopoverTitle> | ||
); | ||
wrapper.find('EuiButtonIcon').simulate('click'); | ||
expect(onClose).toHaveBeenCalled(); | ||
}); | ||
}); |
38 changes: 38 additions & 0 deletions
38
...k/plugins/observability/public/components/threshold/components/closable_popover_title.tsx
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,38 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
|
||
import React from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { EuiPopoverTitle, EuiFlexGroup, EuiFlexItem, EuiButtonIcon } from '@elastic/eui'; | ||
|
||
interface ClosablePopoverTitleProps { | ||
children: JSX.Element; | ||
onClose: () => void; | ||
} | ||
|
||
export function ClosablePopoverTitle({ children, onClose }: ClosablePopoverTitleProps) { | ||
return ( | ||
<EuiPopoverTitle> | ||
<EuiFlexGroup alignItems="center" gutterSize="s"> | ||
<EuiFlexItem>{children}</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<EuiButtonIcon | ||
iconType="cross" | ||
color="danger" | ||
aria-label={i18n.translate( | ||
'xpack.observability.thresholdRule.closablePopoverTitle.closeLabel', | ||
{ | ||
defaultMessage: 'Close', | ||
} | ||
)} | ||
onClick={() => onClose()} | ||
/> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</EuiPopoverTitle> | ||
); | ||
} |
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.