-
Notifications
You must be signed in to change notification settings - Fork 8.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[ML] AIOps Log Rate Analysis: adds controls for controlling which columns will be visible #184262
Changes from 7 commits
837278c
fb4ce79
eab8703
72f120e
e782ed5
7f58298
2c85b9c
c2afed2
c1876b9
ec52573
9762710
9fdefb7
79ddbf4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,14 +41,19 @@ import { useLogRateAnalysisStateContext } from '@kbn/aiops-components'; | |
|
||
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context'; | ||
import { useDataSource } from '../../hooks/use_data_source'; | ||
import { | ||
commonColumns, | ||
significantItemColumns, | ||
} from '../log_rate_analysis_results_table/use_columns'; | ||
|
||
import { | ||
getGroupTableItems, | ||
LogRateAnalysisResultsTable, | ||
LogRateAnalysisResultsGroupsTable, | ||
} from '../log_rate_analysis_results_table'; | ||
|
||
import { FieldFilterPopover } from './field_filter_popover'; | ||
import { ItemFilterPopover as FieldFilterPopover } from './item_filter_popover'; | ||
import { ItemFilterPopover as ColumnFilterPopover } from './item_filter_popover'; | ||
import { LogRateAnalysisTypeCallOut } from './log_rate_analysis_type_callout'; | ||
|
||
const groupResultsMessage = i18n.translate( | ||
|
@@ -77,6 +82,37 @@ const groupResultsOnMessage = i18n.translate( | |
); | ||
const resultsGroupedOffId = 'aiopsLogRateAnalysisGroupingOff'; | ||
const resultsGroupedOnId = 'aiopsLogRateAnalysisGroupingOn'; | ||
const fieldFilterHelpText = i18n.translate('xpack.aiops.logRateAnalysis.page.fieldFilterHelpText', { | ||
defaultMessage: | ||
'Deselect non-relevant fields to remove them from groups and click the Apply button to rerun the grouping. Use the search bar to filter the list, then select/deselect multiple fields with the actions below.', | ||
}); | ||
const columnsFilterHelpText = i18n.translate( | ||
'xpack.aiops.logRateAnalysis.page.columnsFilterHelpText', | ||
{ | ||
defaultMessage: 'Configure visible columns.', | ||
} | ||
); | ||
const disabledFieldFilterApplyButtonTooltipContent = i18n.translate( | ||
'xpack.aiops.analysis.fieldSelectorNotEnoughFieldsSelected', | ||
{ | ||
defaultMessage: 'Grouping requires at least 2 fields to be selected.', | ||
} | ||
); | ||
const disabledColumnFilterApplyButtonTooltipContent = i18n.translate( | ||
'xpack.aiops.analysis.columnSelectorNotEnoughColumnsSelected', | ||
{ | ||
defaultMessage: 'At least one column must be selected.', | ||
} | ||
); | ||
const columnSearchAriaLabel = i18n.translate('xpack.aiops.analysis.columnSelectorAriaLabel', { | ||
defaultMessage: 'Filter columns', | ||
}); | ||
const columnsButton = i18n.translate('xpack.aiops.logRateAnalysis.page.columnsFilterButtonLabel', { | ||
defaultMessage: 'Columns', | ||
}); | ||
const fieldsButton = i18n.translate('xpack.aiops.analysis.fieldFilterButtonLabel', { | ||
defaultMessage: 'Filter fields', | ||
}); | ||
|
||
/** | ||
* Interface for log rate analysis results data. | ||
|
@@ -157,6 +193,7 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({ | |
); | ||
const [shouldStart, setShouldStart] = useState(false); | ||
const [toggleIdSelected, setToggleIdSelected] = useState(resultsGroupedOffId); | ||
const [skippedColumns, setSkippedColumns] = useState<string[]>(['p-value']); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It would be nice if this could be There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated in c1876b9 |
||
|
||
const onGroupResultsToggle = (optionId: string) => { | ||
setToggleIdSelected(optionId); | ||
|
@@ -179,6 +216,10 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({ | |
startHandler(true, false); | ||
}; | ||
|
||
const onVisibleColumnsChange = (columns: string[]) => { | ||
setSkippedColumns(columns); | ||
}; | ||
|
||
const { | ||
cancel, | ||
start, | ||
|
@@ -380,10 +421,32 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({ | |
<FieldFilterPopover | ||
disabled={!groupResults || isRunning} | ||
disabledApplyButton={isRunning} | ||
uniqueFieldNames={uniqueFieldNames} | ||
disabledApplyTooltipContent={disabledFieldFilterApplyButtonTooltipContent} | ||
helpText={fieldFilterHelpText} | ||
itemSearchAriaLabel={fieldsButton} | ||
popoverButtonTitle={fieldsButton} | ||
uniqueItemNames={uniqueFieldNames} | ||
onChange={onFieldsFilterChange} | ||
/> | ||
</EuiFlexItem> | ||
<EuiFlexItem grow={false}> | ||
<ColumnFilterPopover | ||
disabled={isRunning} | ||
disabledApplyButton={isRunning} | ||
disabledApplyTooltipContent={disabledColumnFilterApplyButtonTooltipContent} | ||
helpText={columnsFilterHelpText} | ||
itemSearchAriaLabel={columnSearchAriaLabel} | ||
initialSkippedItems={skippedColumns} | ||
popoverButtonTitle={columnsButton} | ||
selectedItemLimit={1} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good catch! Fixed this issue in 7f58298 |
||
uniqueItemNames={ | ||
qn895 marked this conversation as resolved.
Show resolved
Hide resolved
|
||
(groupResults | ||
? Object.values(commonColumns) | ||
: Object.values(significantItemColumns)) as string[] | ||
} | ||
onChange={onVisibleColumnsChange} | ||
/> | ||
</EuiFlexItem> | ||
</ProgressControls> | ||
{showLogRateAnalysisResultsTable && currentAnalysisType !== undefined && ( | ||
<> | ||
|
@@ -481,6 +544,7 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({ | |
> | ||
{showLogRateAnalysisResultsTable && groupResults ? ( | ||
<LogRateAnalysisResultsGroupsTable | ||
skippedColumns={skippedColumns} | ||
significantItems={data.significantItems} | ||
groupTableItems={groupTableItems} | ||
loading={isRunning} | ||
|
@@ -493,6 +557,7 @@ export const LogRateAnalysisResults: FC<LogRateAnalysisResultsProps> = ({ | |
) : null} | ||
{showLogRateAnalysisResultsTable && !groupResults ? ( | ||
<LogRateAnalysisResultsTable | ||
skippedColumns={skippedColumns} | ||
significantItems={data.significantItems} | ||
loading={isRunning} | ||
timeRangeMs={timeRangeMs} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the 'at least one' correct? It seems to require at least two columns.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch - fixed in 72f120e