|
4 | 4 | * you may not use this file except in compliance with the Elastic License. |
5 | 5 | */ |
6 | 6 |
|
| 7 | +import './_classification_exploration.scss'; |
| 8 | + |
7 | 9 | import React, { FC, useState, useEffect, Fragment } from 'react'; |
8 | 10 | import { i18n } from '@kbn/i18n'; |
9 | 11 | import { FormattedMessage } from '@kbn/i18n/react'; |
@@ -45,8 +47,6 @@ import { |
45 | 47 | getTrailingControlColumns, |
46 | 48 | } from './column_data'; |
47 | 49 |
|
48 | | -const defaultPanelWidth = 500; |
49 | | - |
50 | 50 | interface Props { |
51 | 51 | jobConfig: DataFrameAnalyticsConfig; |
52 | 52 | jobStatus?: DATA_FRAME_TASK_STATE; |
@@ -103,7 +103,6 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery }) |
103 | 103 | const [docsCount, setDocsCount] = useState<null | number>(null); |
104 | 104 | const [error, setError] = useState<null | string>(null); |
105 | 105 | const [dataSubsetTitle, setDataSubsetTitle] = useState<SUBSET_TITLE>(SUBSET_TITLE.ENTIRE); |
106 | | - const [panelWidth, setPanelWidth] = useState<number>(defaultPanelWidth); |
107 | 106 | // Column visibility |
108 | 107 | const [visibleColumns, setVisibleColumns] = useState(() => |
109 | 108 | columns.map(({ id }: { id: string }) => id) |
@@ -167,24 +166,6 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery }) |
167 | 166 | } |
168 | 167 | }; |
169 | 168 |
|
170 | | - const resizeHandler = () => { |
171 | | - const tablePanelWidth: number = |
172 | | - document.getElementById('mlDataFrameAnalyticsTableResultsPanel')?.clientWidth || |
173 | | - defaultPanelWidth; |
174 | | - // Keep the evaluate panel width slightly smaller than the results table |
175 | | - // to ensure results table can resize correctly. Temporary workaround DataGrid issue with flex |
176 | | - const newWidth = tablePanelWidth - 8; |
177 | | - setPanelWidth(newWidth); |
178 | | - }; |
179 | | - |
180 | | - useEffect(() => { |
181 | | - window.addEventListener('resize', resizeHandler); |
182 | | - resizeHandler(); |
183 | | - return () => { |
184 | | - window.removeEventListener('resize', resizeHandler); |
185 | | - }; |
186 | | - }, []); |
187 | | - |
188 | 169 | useEffect(() => { |
189 | 170 | if (confusionMatrixData.length > 0) { |
190 | 171 | const { columns: derivedColumns, columnData } = getColumnData(confusionMatrixData); |
@@ -309,7 +290,7 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery }) |
309 | 290 | return ( |
310 | 291 | <EuiPanel |
311 | 292 | data-test-subj="mlDFAnalyticsClassificationExplorationEvaluatePanel" |
312 | | - style={{ width: `${panelWidth}px` }} |
| 293 | + className="mlDataFrameAnalyticsClassification" |
313 | 294 | > |
314 | 295 | <EuiFlexGroup direction="column" gutterSize="s"> |
315 | 296 | <EuiFlexItem> |
@@ -392,13 +373,15 @@ export const EvaluatePanel: FC<Props> = ({ jobConfig, jobStatus, searchQuery }) |
392 | 373 | )} |
393 | 374 | {/* BEGIN TABLE ELEMENTS */} |
394 | 375 | <EuiFlexItem grow={false}> |
395 | | - <EuiFlexGroup gutterSize="s" style={{ paddingLeft: '5%', paddingRight: '5%' }}> |
396 | | - <EuiFlexItem grow={false} style={{ minWidth: '70px' }}> |
397 | | - <EuiText |
398 | | - size="xs" |
399 | | - color="subdued" |
400 | | - className="mlDataFrameAnalyticsClassification__actualLabel" |
401 | | - > |
| 376 | + <EuiFlexGroup |
| 377 | + gutterSize="s" |
| 378 | + className="mlDataFrameAnalyticsClassification__confusionMatrix" |
| 379 | + > |
| 380 | + <EuiFlexItem |
| 381 | + grow={false} |
| 382 | + className="mlDataFrameAnalyticsClassification__actualLabel" |
| 383 | + > |
| 384 | + <EuiText size="xs" color="subdued"> |
402 | 385 | <FormattedMessage |
403 | 386 | id="xpack.ml.dataframe.analytics.classificationExploration.confusionMatrixActualLabel" |
404 | 387 | defaultMessage="Actual label" |
|
0 commit comments