Skip to content

Commit

Permalink
[ML] Updates icons for Machine Learning embeddable dashboard panel ty…
Browse files Browse the repository at this point in the history
…pes (elastic#191718)

## Summary

Updates icons in ML embeddable dashboard panel types.


![image](https://github.com/user-attachments/assets/6c20bde7-121b-4ce8-a659-a59d4fcfbf61)\

Also updates other links to the Single Metric Viewer to use the new
`singleMetricViewer` icon.

Fixes elastic#187730
  • Loading branch information
rbrtj authored Sep 3, 2024
1 parent 6b1cac9 commit 73f15a1
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 37 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export function createAddChangePointChartAction(
},
],
order: 10,
getIconType: () => 'machineLearningApp',
getIconType: () => 'changePointDetection',
getDisplayName: () =>
i18n.translate('xpack.aiops.embeddableChangePointChartDisplayName', {
defaultMessage: 'Change point detection',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ export function createAddFieldStatsTableAction(
id: 'create-field-stats-table',
grouping: COMMON_VISUALIZATION_GROUPING,
order: 10,
getIconType: () => 'inspect',
getIconType: () => 'fieldStatistics',
getDisplayName: () =>
i18n.translate('xpack.dataVisualizer.fieldStatistics.displayName', {
defaultMessage: 'Field statistics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -558,7 +558,7 @@ class AnnotationsTableUI extends Component {
);
},
enabled: (annotation) => isTimeSeriesViewJob(this.getJob(annotation.job_id)),
icon: 'visLine',
icon: 'singleMetricViewer',
type: 'icon',
onClick: (annotation) => this.openSingleMetricView(annotation),
'data-test-subj': `mlAnnotationsActionOpenInSingleMetricViewer`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -819,7 +819,7 @@ export const LinksMenuUI = (props: LinksMenuProps) => {
items.push(
<EuiContextMenuItem
key="view_series"
icon="visLine"
icon="singleMetricViewer"
onClick={() => {
closePopover();
viewSeries();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const AnomalyResultsViewSelector: FC<Props> = ({ viewId, selectedJobs })
: i18n.translate('xpack.ml.anomalyResultsViewSelector.singleMetricViewerLabel', {
defaultMessage: 'View results in the Single Metric Viewer',
}),
iconType: 'visLine',
iconType: 'singleMetricViewer',
value: ML_PAGES.SINGLE_METRIC_VIEWER,
'data-test-subj': 'mlAnomalyResultsViewSelectorSingleMetricViewer',
isDisabled: viewId === 'explorer' && isSingleMetricViewerDisabled,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export const FieldStatsInfoButton = ({
data-test-subj={`mlInspectFieldStatsButton-${field.id}`}
disabled={disabled === true}
size="xs"
iconType="inspect"
iconType="fieldStatistics"
css={{ color: isEmpty ? themeVars.euiTheme.euiColorDisabled : undefined }}
onClick={(ev: React.MouseEvent<HTMLButtonElement>) => {
if (ev.type === 'click') {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ function ExplorerChartContainer({
{/* eslint-disable-next-line @elastic/eui/href-or-on-click */}
<EuiButtonEmpty
iconSide="right"
iconType="visLine"
iconType="singleMetricViewer"
size="xs"
href={explorerSeriesLink}
onClick={addToRecentlyAccessed}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ export function ResultLinks({ jobs }) {
>
<EuiButtonIcon
href={timeSeriesExplorerLink}
iconType="visLine"
iconType="singleMetricViewer"
aria-label={openJobsInSingleMetricViewerText}
isDisabled={singleMetricEnabled === false || jobActionsDisabled === true}
data-test-subj="mlOpenJobsInSingleMetricViewerButton"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ export class ForecastsTable extends Component {
this.props.job.blocked !== undefined ||
forecast.forecast_status !== FORECAST_REQUEST_STATE.FINISHED
}
iconType="visLine"
iconType="singleMetricViewer"
aria-label={viewForecastAriaLabel}
data-test-subj="mlJobListForecastTabOpenSingleMetricViewButton"
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function getColumns(viewForecast) {
return (
<EuiButtonIcon
onClick={() => viewForecast(forecast.forecast_id)}
iconType="visLine"
iconType="singleMetricViewer"
aria-label={viewForecastAriaLabel}
/>
);
Expand Down
4 changes: 1 addition & 3 deletions x-pack/plugins/ml/public/ui_actions/create_anomaly_chart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,7 @@ export function createAddAnomalyChartsPanelAction(
},
],
order: 30,
getIconType(): string {
return 'visLine';
},
getIconType: () => 'anomalyChart',
getDisplayName: () =>
i18n.translate('xpack.ml.components.mlAnomalyExplorerEmbeddable.displayName', {
defaultMessage: 'Anomaly chart',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export function createAddSingleMetricViewerPanelAction(
},
],
order: 20,
getIconType: () => 'visLine',
getIconType: () => 'singleMetricViewer',
getDisplayName: () =>
i18n.translate('xpack.ml.components.singleMetricViewerEmbeddable.displayName', {
defaultMessage: 'Single metric viewer',
Expand Down
23 changes: 1 addition & 22 deletions x-pack/plugins/ml/public/ui_actions/create_swim_lane.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
* 2.0.
*/

import React from 'react';
import { i18n } from '@kbn/i18n';
import type { PresentationContainer } from '@kbn/presentation-containers';
import type { EmbeddableApiContext } from '@kbn/presentation-publishing';
Expand Down Expand Up @@ -43,27 +42,7 @@ export function createAddSwimlanePanelAction(
},
],
order: 40,
// @ts-expect-error getIconType is typed as string, but EuiIcon accepts ReactComponent for custom icons.
// See https://github.com/elastic/kibana/issues/184643
getIconType: () => (iconProps) =>
(
<svg
width="16"
height="16"
viewBox="0 0 16 16"
xmlns="http://www.w3.org/2000/svg"
{...iconProps}
>
<path
d="M1 5V1H5V5H1ZM4 4V2H2V4H4ZM6 5V1H10V5H6ZM9 4V2H7V4H9ZM11 5V1H15V5H11ZM12 4H14V2H12V4ZM1 10V6H5V10H1ZM4 9V7H2V9H4ZM6 10V6H10V10H6ZM9 9V7H7V9H9ZM11 10V6H15V10H11ZM14 9V7H12V9H14ZM1 15V11H5V15H1ZM2 14H4V12H2V14ZM6 15V11H10V15H6ZM7 14H9V12H7V14ZM11 15V11H15V15H11ZM12 14H14V12H12V14Z"
fill="currentColor"
/>
<rect width="4" height="4" transform="translate(6 1)" fill="currentColor" />
<rect width="4" height="4" transform="translate(11 6)" fill="currentColor" />
<rect width="4" height="4" transform="translate(6 6)" fill="currentColor" />
<rect width="4" height="4" transform="translate(1 11)" fill="currentColor" />
</svg>
),
getIconType: () => 'anomalySwimLane',
getDisplayName: () =>
i18n.translate('xpack.ml.components.jobAnomalyScoreEmbeddable.displayName', {
defaultMessage: 'Anomaly swim lane',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ export function createOpenInSingleMetricViewerAction(
type: OPEN_IN_SINGLE_METRIC_VIEWER_ACTION,
order: 100,
getIconType(): string {
return 'visLine';
return 'singleMetricViewer';
},
getDisplayName() {
return i18n.translate('xpack.ml.actions.openInSingleMetricViewerTitle', {
Expand Down

0 comments on commit 73f15a1

Please sign in to comment.