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] Remove data frame analytics scss files #199572

Merged
merged 8 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 1 addition & 2 deletions x-pack/plugins/ml/public/application/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
// SASSTODO: Prefix ml selectors instead
.ml-app {
// Sub applications
@import 'data_frame_analytics/index';
@import 'explorer/index'; // SASSTODO: This file needs to be rewritten

// Components
Expand All @@ -16,4 +15,4 @@
@import 'components/job_selector/index';
@import 'components/rule_editor/index'; // SASSTODO: This file overwrites EUI directly

}
}

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const BackToListPanel: FC = () => {
return (
<Fragment>
<EuiCard
className="dfAnalyticsCreationWizard__card"
css={{ width: '300px' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

Use an EUI size variable to calculate this.

icon={<EuiIcon size="xxl" type="list" />}
title={i18n.translate('xpack.ml.dataframe.analytics.create.analyticsListCardTitle', {
defaultMessage: 'Data Frame Analytics',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import type { FC } from 'react';
import React, { Fragment } from 'react';
import { EuiCard, EuiIcon } from '@elastic/eui';
import { EuiCard, EuiIcon, useEuiTheme } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import type { DataFrameAnalysisConfigType } from '@kbn/ml-data-frame-analytics-utils';
import { useMlLink } from '../../../../../contexts/kibana';
Expand All @@ -26,10 +26,14 @@ export const ViewResultsPanel: FC<Props> = ({ jobId, analysisType }) => {
},
});

const {
euiTheme: { size },
} = useEuiTheme();

return (
<Fragment>
<EuiCard
className="dfAnalyticsCreationWizard__card"
css={{ width: `calc(${size.xxl} * 7.5)` }}
icon={<EuiIcon size="xxl" type="visTable" />}
title={i18n.translate('xpack.ml.dataframe.analytics.create.viewResultsCardTitle', {
defaultMessage: 'View Results',
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,17 @@ export const OverallDetails: FC<{
}> = ({ overallDetails }) => (
<EuiFlexGroup alignItems="center" wrap data-test-subj={overallDetails.dataTestSubj}>
{overallDetails.items.map((item) => {
const key = item.title;
if (item.title === 'badge') {
return (
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} key={key}>
<EuiBetaBadge label={item.description} color="subdued" title={item.title} />
</EuiFlexItem>
);
}

return (
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} key={key}>
<EuiFlexGroup gutterSize="xs">
<EuiFlexItem grow={false}>
<EuiDescriptionListDescription className="descriptionListTitle">
Expand Down Expand Up @@ -82,7 +83,7 @@ export const Stats = ({ section }: { section: SectionConfig }) => (
<EuiFlexItem grow={false}>
<EuiFlexGroup>
{section.items.map((item) => (
<EuiFlexItem grow={false}>
<EuiFlexItem grow={false} key={item.title}>
<EuiDescriptionListDescription className="descriptionListTitle">
<EuiText size="xs">{item.title}</EuiText>
</EuiDescriptionListDescription>
Expand Down Expand Up @@ -200,10 +201,10 @@ export const ExpandedRowDetailsPane: FC<ExpandedRowDetailsPaneProps> = ({
</EuiTitle>
<EuiSpacer size="xs" />
{progress.items.map((item) => (
<>
<span key={item.title}>
{item.description}
<EuiSpacer size="s" />
</>
</span>
))}
</EuiFlexItem>
<EuiFlexItem grow={3}>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
* 2.0.
*/

import './expanded_row_messages_pane.scss';

import type { FC } from 'react';
import React, { useState, useEffect, useCallback } from 'react';
import React, { useState, useEffect, useCallback, useMemo } from 'react';
import { useEuiTheme } from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { css } from '@emotion/react';
import { useMlApi } from '../../../../../contexts/kibana';
import { useRefreshAnalyticsList } from '../../../../common';
import { JobMessages } from '../../../../../components/job_messages';
Expand All @@ -23,6 +23,21 @@ interface Props {

export const ExpandedRowMessagesPane: FC<Props> = ({ analyticsId, dataTestSubj }) => {
const mlApi = useMlApi();
const {
euiTheme: { size },
} = useEuiTheme();

const cssOverride = useMemo(
() =>
css({
padding: `0 ${size.s} ${size.s} ${size.s}`,
'.euiTable': {
backgroundColor: 'transparent',
},
}),
[size.s]
);

const [messages, setMessages] = useState<JobMessage[]>([]);
const [isLoading, setIsLoading] = useState(false);
const [errorMessage, setErrorMessage] = useState('');
Expand Down Expand Up @@ -63,7 +78,7 @@ export const ExpandedRowMessagesPane: FC<Props> = ({ analyticsId, dataTestSubj }
useRefreshAnalyticsList({ onRefresh: getMessages });

return (
<div className="mlExpandedRowJobMessages" data-test-subj={dataTestSubj}>
<div data-test-subj={dataTestSubj} css={cssOverride}>
<JobMessages
messages={messages}
loading={isLoading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ enum TASK_STATE_COLOR {
stopping = 'hollow',
}

const badgeStyle = {
maxWidth: '100px',
};

export const getTaskStateBadge = (
state: DataFrameAnalyticsStats['state'],
failureReason?: DataFrameAnalyticsStats['failure_reason']
Expand All @@ -58,22 +62,22 @@ export const getTaskStateBadge = (
if (isDataFrameAnalyticsFailed(state) && failureReason !== undefined) {
return (
<EuiToolTip content={failureReason}>
<EuiBadge className="mlTaskStateBadge" color={color}>
<EuiBadge css={badgeStyle} color={color}>
{state}
</EuiBadge>
</EuiToolTip>
);
}

return (
<EuiBadge className="mlTaskStateBadge" color={color}>
<EuiBadge css={badgeStyle} color={color}>
{state}
</EuiBadge>
);
};

export const getJobTypeBadge = (jobType: string) => (
<EuiBadge className="mlTaskStateBadge" color="hollow">
<EuiBadge css={badgeStyle} color="hollow">
{jobType}
</EuiBadge>
);
Expand Down

This file was deleted.

This file was deleted.

Loading