-
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.
[Logs UI] Reference a LogViewConfiguration as Log threshold rule param (
#148897) ## 📓 Summary Closes #120928 These changes allow passing to the log threshold rule executor the logViewId as a parameter, enabling the user to select what LogView the alert should be associated with. It also includes displaying the current LogView name in the rule parameters and the log view reference is handled as a saved object reference. **_Disclaimer_**: The `LogViewSwitcher` component will allow, with another implementation, to switch between the available logViews with the support of the multi-logView concept. It currently renders a read-only expression to tell the user to which logView is the new alert associated. ## 🧪 Testing Navigate to Log UI, click on _Alerts and rules_ on the top-right menu, then _Create rule_, you should see the current log view name in the default expression. It is currently only a label, it'll be a dropdown selector in future. <img width="1502" alt="after" src="https://user-images.githubusercontent.com/34506779/212651986-8c1b4a1d-356d-4966-aa30-f1af3171be72.png"> --------- Co-authored-by: Marco Antonio Ghiani <[email protected]> Co-authored-by: kibanamachine <[email protected]>
- Loading branch information
1 parent
830d9bd
commit ae07320
Showing
17 changed files
with
494 additions
and
43 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
38 changes: 38 additions & 0 deletions
38
...ns/infra/public/alerting/log_threshold/components/expression_editor/log_view_switcher.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 { EuiFlexItem, EuiFlexGroup, EuiExpression, EuiToolTip } from '@elastic/eui'; | ||
import { ResolvedLogView } from '../../../../../common/log_views'; | ||
|
||
const description = i18n.translate('xpack.infra.logs.alertFlyout.logViewDescription', { | ||
defaultMessage: 'Log View', | ||
}); | ||
|
||
interface LogViewSwitcherProps { | ||
logView: ResolvedLogView; | ||
} | ||
|
||
/** | ||
* TODO: this component is called LogViewSwitcher because it will allow, | ||
* in a following implementation, to switch between the available logViews | ||
* with the support of multi-logView concept. | ||
* It currently renders a read-only expression to tell the user to which logView | ||
* is the new alert associated with. | ||
*/ | ||
export const LogViewSwitcher: React.FC<LogViewSwitcherProps> = ({ logView }) => { | ||
return ( | ||
<EuiFlexGroup gutterSize="s"> | ||
<EuiFlexItem grow={false}> | ||
<EuiToolTip content={logView.indices}> | ||
<EuiExpression description={description} value={logView.name} /> | ||
</EuiToolTip> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
); | ||
}; |
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.