Skip to content
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][UX]: Consistent Layout and UI Enhancements for ML Pages #203813

Merged
merged 28 commits into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
6a0d029
anomaly timeline use eui button for add to actions popover
rbrtj Dec 11, 2024
28d27b0
timeseries explorer controls layout update
rbrtj Dec 11, 2024
924c396
log rate analysis use eui button for add to actions popover
rbrtj Dec 11, 2024
a3b2030
log rate analysis use eui button for add to actions popover & auto sa…
rbrtj Dec 11, 2024
02aa1f3
remove unused import
rbrtj Dec 11, 2024
3ae73e8
change point detection use eui button for add to actions popover
rbrtj Dec 11, 2024
0e0f1de
update button colors to text
rbrtj Dec 12, 2024
9960e5c
single metric viewer embeddable color
rbrtj Dec 12, 2024
a0bb316
update buttons to button icon with boxes horizontal icon
rbrtj Dec 12, 2024
18fe658
use size s as default size for add to button
rbrtj Dec 13, 2024
9142f10
keep consistent spaces between controls around ml pages
rbrtj Dec 13, 2024
a0bea28
fix overflowing date picker inside various ml pages
rbrtj Dec 13, 2024
9aa70f6
fix data visualizer layout
rbrtj Dec 13, 2024
63c3193
update toasts
rbrtj Dec 16, 2024
4db66c5
Merge remote-tracking branch 'upstream/main' into ml-add-to-action-ui…
rbrtj Dec 17, 2024
24eaf3d
[CI] Auto-commit changed files from 'node scripts/eslint --no-cache -…
kibanamachine Dec 17, 2024
e9108d6
update anomaly panel menu button
rbrtj Dec 17, 2024
4c193b7
add icons for attachements actions
rbrtj Dec 18, 2024
7f408c6
internationalization for cases toast messages && plural for anomaly c…
rbrtj Dec 19, 2024
cd56f03
timeseriesexplorer detector dropdown min width && wrap controls
rbrtj Dec 19, 2024
dfd2494
Merge remote-tracking branch 'upstream/main' into ml-add-to-action-ui…
rbrtj Dec 19, 2024
847d00e
different message for change point table and chart attachments && plu…
rbrtj Dec 19, 2024
d73ab5d
revert accidentaly removed comment
rbrtj Dec 19, 2024
7f47fad
rename titles variable to cases_toast_messages_titles
rbrtj Dec 19, 2024
e679f8e
data visualizer view revert time range selector id
rbrtj Dec 19, 2024
c9bf590
update cases functional tests to respect new toast title
rbrtj Dec 19, 2024
1368a37
update more tests to respect new toast title
rbrtj Dec 19, 2024
f54f968
Merge branch 'main' into ml-add-to-action-ui-update
rbrtj Dec 23, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,6 @@ interface DatePickerWrapperProps {
/**
* Boolean flag to set use of flex group wrapper
*/
flexGroup?: boolean;
/**
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like you accidentaly removed the comment for the next prop and not flexGroup.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, done in: #d73ab5d

* Boolean flag to disable the date picker
*/
isDisabled?: boolean;
/**
* Boolean flag to force change from 'Refresh' to 'Update' state
Expand Down Expand Up @@ -123,7 +119,6 @@ export const DatePickerWrapper: FC<DatePickerWrapperProps> = (props) => {
isLoading = false,
showRefresh,
width,
flexGroup = true,
isDisabled = false,
needsUpdate,
onRefresh,
Expand Down Expand Up @@ -363,6 +358,8 @@ export const DatePickerWrapper: FC<DatePickerWrapperProps> = (props) => {
</>
);

const flexGroup = !isTimeRangeSelectorEnabled || isAutoRefreshOnly === true;

const wrapped = flexGroup ? (
<EuiFlexGroup gutterSize="s" alignItems="center">
{flexItems}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ export const FullTimeRangeSelector: FC<FullTimeRangeSelectorProps> = (props) =>
}, [frozenDataPreference, showFrozenDataTierChoice]);

return (
<EuiFlexGroup responsive={false} gutterSize="xs">
<EuiFlexGroup responsive={false} gutterSize="s">
<EuiToolTip content={buttonTooltip}>
<EuiButton
isDisabled={disabled}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,6 @@ export const PageHeader: FC<PageHeaderProps> = ({ onRefresh, needsUpdate }) => {
isAutoRefreshOnly={!hasValidTimeField}
showRefresh={!hasValidTimeField}
width="full"
flexGroup={!hasValidTimeField}
onRefresh={onRefresh}
needsUpdate={needsUpdate}
/>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
EuiPanel,
EuiProgress,
EuiSpacer,
EuiTitle,
} from '@elastic/eui';

import { type Filter, FilterStateStore, type Query, buildEsQuery } from '@kbn/es-query';
Expand All @@ -37,7 +36,6 @@ import { useStorage } from '@kbn/ml-local-storage';
import type { SavedSearch } from '@kbn/saved-search-plugin/public';
import { SEARCH_QUERY_LANGUAGE, type SearchQueryLanguage } from '@kbn/ml-query-utils';
import { kbnTypeToSupportedType } from '../../../common/util/field_types_utils';
import { useCurrentEuiTheme } from '../../../common/hooks/use_current_eui_theme';
import {
DV_FROZEN_TIER_PREFERENCE,
DV_RANDOM_SAMPLER_PREFERENCE,
Expand Down Expand Up @@ -108,8 +106,6 @@ export interface IndexDataVisualizerViewProps {
}

export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVisualizerProps) => {
const euiTheme = useCurrentEuiTheme();

const [savedRandomSamplerPreference, saveRandomSamplerPreference] = useStorage<
DVKey,
DVStorageMapped<typeof DV_RANDOM_SAMPLER_PREFERENCE>
Expand Down Expand Up @@ -515,49 +511,40 @@ export const IndexDataVisualizerView: FC<IndexDataVisualizerViewProps> = (dataVi
paddingSize="none"
>
<EuiPageTemplate.Section>
<EuiPageTemplate.Header data-test-subj="dataVisualizerPageHeader" css={dvPageHeader}>
<EuiFlexGroup
data-test-subj="dataViewTitleHeader"
direction="row"
alignItems="center"
css={{ padding: `${euiTheme.euiSizeS} 0`, marginRight: `${euiTheme.euiSize}` }}
>
<EuiTitle size={'s'}>
<h2>{currentDataView.getName()}</h2>
</EuiTitle>
<DataVisualizerDataViewManagement currentDataView={currentDataView} />
</EuiFlexGroup>

{isWithinLargeBreakpoint ? <EuiSpacer size="m" /> : null}
<EuiFlexGroup
alignItems="center"
justifyContent="flexEnd"
gutterSize="s"
data-test-subj="dataVisualizerTimeRangeSelectorSection"
>
{hasValidTimeField ? (
<EuiFlexItem grow={false}>
<FullTimeRangeSelector
frozenDataPreference={frozenDataPreference}
setFrozenDataPreference={setFrozenDataPreference}
dataView={currentDataView}
query={undefined}
disabled={false}
timefilter={timefilter}
/>
</EuiFlexItem>
) : null}
<EuiFlexItem grow={false}>
<DatePickerWrapper
isAutoRefreshOnly={!hasValidTimeField}
showRefresh={!hasValidTimeField}
width="full"
needsUpdate={queryNeedsUpdate}
onRefresh={handleRefresh}
<EuiPageTemplate.Header
data-test-subj="dataVisualizerPageHeader"
css={dvPageHeader}
pageTitle={
<>
{currentDataView.getName()}
{/* TODO: This management section shouldn't live inside the header */}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you planning on doing this in this PR?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can tackle it, but it would be nice to find a different place for this menu to reside.
Otherwise, it's being wrapped within an <h1> tag, which doesn't seem right.
If @joana-cps suggests a better location for the button, we can definitely move it outside the header.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that we need to find a different place for this menu. We can do this in a separate issue.

<DataVisualizerDataViewManagement currentDataView={currentDataView} />
</>
}
rightSideGroupProps={{
gutterSize: 's',
'data-test-subj': 'dataComparisonTimeRangeSelectorSection',
}}
rightSideItems={[
<DatePickerWrapper
isAutoRefreshOnly={!hasValidTimeField}
showRefresh={!hasValidTimeField}
width="full"
needsUpdate={queryNeedsUpdate}
onRefresh={handleRefresh}
/>,
hasValidTimeField && (
<FullTimeRangeSelector
frozenDataPreference={frozenDataPreference}
setFrozenDataPreference={setFrozenDataPreference}
dataView={currentDataView}
query={undefined}
disabled={false}
timefilter={timefilter}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiPageTemplate.Header>
),
]}
/>
<EuiSpacer size="m" />

<EuiFlexGroup gutterSize="m" direction={isWithinLargeBreakpoint ? 'column' : 'row'}>
Expand Down
15 changes: 15 additions & 0 deletions x-pack/platform/plugins/shared/aiops/public/cases/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
/*
* 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.
*/

/**
* Titles for the cases toast messages
*/
export const TITLES = {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggest to make this a bit more specific like CASES_TOAST_MESSAGES_TITLES.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, done in: #7f47fad

CHANGE_POINT_DETECTION: 'Change point detection',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these be internationalized?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Change point chart might be better here. Change point chart added to case

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in: #7f408c6

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry I'd forgotten that it's possible to multi-select charts to add to a case - can a plural condition be added for Change point chart / Change point charts?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added plural for Change point charts.
Also Change point table message when the table view is selected in: #847d00e

LOG_RATE_ANALYSIS: 'Log rate analysis',
PATTERN_ANALYSIS: 'Log pattern analysis',
};
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
import { useChangePointResults } from './use_change_point_agg_request';
import { useSplitFieldCardinality } from './use_split_field_cardinality';
import { ViewTypeSelector } from './view_type_selector';
import { TITLES } from '../../cases/constants';

const selectControlCss = { width: '350px' };

Expand Down Expand Up @@ -215,7 +216,10 @@ const FieldPanel: FC<FieldPanelProps> = ({
progress,
} = useChangePointResults(fieldConfig, requestParams, combinedQuery, splitFieldCardinality);

const openCasesModalCallback = useCasesModal(EMBEDDABLE_CHANGE_POINT_CHART_TYPE);
const openCasesModalCallback = useCasesModal(
EMBEDDABLE_CHANGE_POINT_CHART_TYPE,
TITLES.CHANGE_POINT_DETECTION
);

const selectedPartitions = useMemo(() => {
return (selectedChangePoints[panelIndex] ?? []).map((v) => v.group?.value as string);
Expand Down Expand Up @@ -513,42 +517,37 @@ const FieldPanel: FC<FieldPanelProps> = ({

return (
<EuiPanel paddingSize="s" hasBorder hasShadow={false} data-test-subj={dataTestSubj}>
<EuiFlexGroup alignItems={'center'} justifyContent={'spaceBetween'} gutterSize={'s'}>
<EuiFlexGroup alignItems={'flexStart'} justifyContent={'spaceBetween'} gutterSize={'s'}>
<EuiFlexItem grow={false}>
<EuiFlexGroup alignItems={'center'} gutterSize={'s'}>
<EuiFlexItem grow={false}>
<EuiButtonIcon
data-test-subj="aiopsChangePointDetectionExpandConfigButton"
iconType={isExpanded ? 'arrowDown' : 'arrowRight'}
onClick={setIsExpanded.bind(null, (prevState) => !prevState)}
aria-label={i18n.translate('xpack.aiops.changePointDetection.expandConfigLabel', {
defaultMessage: 'Expand configuration',
})}
/>
</EuiFlexItem>
<EuiFlexItem grow={false}>
<FieldsControls fieldConfig={fieldConfig} onChange={onChange}>
<EuiFlexItem
css={{ visibility: progress === null ? 'hidden' : 'visible' }}
grow={true}
>
<EuiProgress
label={
<FormattedMessage
id="xpack.aiops.changePointDetection.progressBarLabel"
defaultMessage="Fetching change points"
/>
}
value={progress ?? 0}
max={100}
valueText
size="m"
<EuiButtonIcon
data-test-subj="aiopsChangePointDetectionExpandConfigButton"
iconType={isExpanded ? 'arrowDown' : 'arrowRight'}
onClick={setIsExpanded.bind(null, (prevState) => !prevState)}
aria-label={i18n.translate('xpack.aiops.changePointDetection.expandConfigLabel', {
defaultMessage: 'Expand configuration',
})}
size="s"
/>
</EuiFlexItem>

<EuiFlexItem>
<FieldsControls fieldConfig={fieldConfig} onChange={onChange} data-test-subj="blablabla">
<EuiFlexItem {...(progress === null && { css: { display: 'none' } })} grow={true}>
<EuiProgress
label={
<FormattedMessage
id="xpack.aiops.changePointDetection.progressBarLabel"
defaultMessage="Fetching change points"
/>
<EuiSpacer size="s" />
</EuiFlexItem>
</FieldsControls>
}
value={progress ?? 0}
max={100}
valueText
size="m"
/>
<EuiSpacer size="s" />
</EuiFlexItem>
</EuiFlexGroup>
</FieldsControls>
</EuiFlexItem>

<EuiFlexItem grow={false}>
Expand All @@ -565,8 +564,11 @@ const FieldPanel: FC<FieldPanelProps> = ({
defaultMessage: 'Context menu',
}
)}
iconType="boxesHorizontal"
color="text"
display="base"
size="s"
isSelected={isActionMenuOpen}
iconType="boxesHorizontal"
onClick={setIsActionMenuOpen.bind(null, !isActionMenuOpen)}
/>
}
Expand Down Expand Up @@ -679,7 +681,7 @@ export const FieldsControls: FC<PropsWithChildren<FieldsControlsProps>> = ({
}
theme={theme}
>
<EuiFlexGroup alignItems={'center'} responsive={true} wrap={true} gutterSize={'m'}>
<EuiFlexGroup alignItems={'center'} responsive={true} wrap={true} gutterSize={'s'}>
<EuiFlexItem grow={false} css={{ width: '200px' }}>
<FunctionPicker value={fieldConfig.fn} onChange={(v) => onChangeFn('fn', v)} />
</EuiFlexItem>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import type { PatternAnalysisEmbeddableState } from '../../embeddables/pattern_a
import type { RandomSamplerOption, RandomSamplerProbability } from './sampling_menu/random_sampler';
import { useCasesModal } from '../../hooks/use_cases_modal';
import { useAiopsAppContext } from '../../hooks/use_aiops_app_context';
import { TITLES } from '../../cases/constants';

const SavedObjectSaveModalDashboard = withSuspense(LazySavedObjectSaveModalDashboard);

Expand Down Expand Up @@ -66,7 +67,10 @@ export const AttachmentsMenu = ({
update: false,
};

const openCasesModalCallback = useCasesModal(EMBEDDABLE_PATTERN_ANALYSIS_TYPE);
const openCasesModalCallback = useCasesModal(
EMBEDDABLE_PATTERN_ANALYSIS_TYPE,
TITLES.PATTERN_ANALYSIS
);

const timeRange = useTimeRangeUpdates();

Expand Down Expand Up @@ -218,8 +222,11 @@ export const AttachmentsMenu = ({
defaultMessage: 'Attachments',
}
)}
iconType="boxesHorizontal"
size="m"
color="text"
display="base"
isSelected={isActionMenuOpen}
iconType="boxesHorizontal"
onClick={() => setIsActionMenuOpen(!isActionMenuOpen)}
/>
}
Expand Down
Loading