-
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.
[ML] AIOps: Link from Explain Log Rate Spikes to Log Pattern Analysis (…
…#155121) Adds table actions to Explain Log Rate Spikes to be able to drill down to Log Pattern Analysis.
- Loading branch information
Showing
23 changed files
with
631 additions
and
132 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
x-pack/plugins/aiops/public/application/utils/url_state.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,45 @@ | ||
/* | ||
* 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 type * as estypes from '@elastic/elasticsearch/lib/api/typesWithBodyKey'; | ||
|
||
import type { Filter, Query } from '@kbn/es-query'; | ||
import { isPopulatedObject } from '@kbn/ml-is-populated-object'; | ||
|
||
import { SEARCH_QUERY_LANGUAGE, SearchQueryLanguage } from './search_utils'; | ||
|
||
const defaultSearchQuery = { | ||
match_all: {}, | ||
}; | ||
|
||
export interface AiOpsPageUrlState { | ||
pageKey: 'AIOPS_INDEX_VIEWER'; | ||
pageUrlState: AiOpsIndexBasedAppState; | ||
} | ||
|
||
export interface AiOpsIndexBasedAppState { | ||
searchString?: Query['query']; | ||
searchQuery?: estypes.QueryDslQueryContainer; | ||
searchQueryLanguage: SearchQueryLanguage; | ||
filters?: Filter[]; | ||
} | ||
|
||
export type AiOpsFullIndexBasedAppState = Required<AiOpsIndexBasedAppState>; | ||
|
||
export const getDefaultAiOpsListState = ( | ||
overrides?: Partial<AiOpsIndexBasedAppState> | ||
): AiOpsFullIndexBasedAppState => ({ | ||
searchString: '', | ||
searchQuery: defaultSearchQuery, | ||
searchQueryLanguage: SEARCH_QUERY_LANGUAGE.KUERY, | ||
filters: [], | ||
...overrides, | ||
}); | ||
|
||
export const isFullAiOpsListState = (arg: unknown): arg is AiOpsFullIndexBasedAppState => { | ||
return isPopulatedObject(arg, Object.keys(getDefaultAiOpsListState())); | ||
}; |
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
62 changes: 62 additions & 0 deletions
62
x-pack/plugins/aiops/public/components/spike_analysis_table/table_action_button.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,62 @@ | ||
/* | ||
* 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, { type FC } from 'react'; | ||
|
||
import { EuiLink, EuiIcon, EuiText, EuiToolTip, type IconType } from '@elastic/eui'; | ||
|
||
interface TableActionButtonProps { | ||
iconType: IconType; | ||
dataTestSubjPostfix: string; | ||
isDisabled: boolean; | ||
label: string; | ||
tooltipText?: string; | ||
onClick: () => void; | ||
} | ||
|
||
export const TableActionButton: FC<TableActionButtonProps> = ({ | ||
iconType, | ||
dataTestSubjPostfix, | ||
isDisabled, | ||
label, | ||
tooltipText, | ||
onClick, | ||
}) => { | ||
const buttonContent = ( | ||
<> | ||
<EuiIcon type={iconType} css={{ marginRight: '8px' }} /> | ||
{label} | ||
</> | ||
); | ||
|
||
const unwrappedButton = !isDisabled ? ( | ||
<EuiLink | ||
data-test-subj={`aiopsTableActionButton${dataTestSubjPostfix} enabled`} | ||
onClick={onClick} | ||
color={'text'} | ||
aria-label={tooltipText} | ||
> | ||
{buttonContent} | ||
</EuiLink> | ||
) : ( | ||
<EuiText | ||
data-test-subj={`aiopsTableActionButton${dataTestSubjPostfix} disabled`} | ||
size="s" | ||
color={'subdued'} | ||
aria-label={tooltipText} | ||
css={{ fontWeight: 500 }} | ||
> | ||
{buttonContent} | ||
</EuiText> | ||
); | ||
|
||
if (tooltipText) { | ||
return <EuiToolTip content={tooltipText}>{unwrappedButton}</EuiToolTip>; | ||
} | ||
|
||
return unwrappedButton; | ||
}; |
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.