mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
This commit is contained in:
parent
59b716db72
commit
fb52647084
2 changed files with 14 additions and 11 deletions
|
@ -28,6 +28,7 @@ import { EuiDescriptionListProps } from '@elastic/eui/src/components/description
|
|||
import { ModelItemFull } from './models_list';
|
||||
import { useMlKibana } from '../../../../../contexts/kibana';
|
||||
import { timeFormatter } from '../../../../../../../common/util/date_utils';
|
||||
import { isDefined } from '../../../../../../../common/types/guards';
|
||||
|
||||
interface ExpandedRowProps {
|
||||
item: ModelItemFull;
|
||||
|
@ -81,6 +82,7 @@ export const ExpandedRow: FC<ExpandedRowProps> = ({ item }) => {
|
|||
|
||||
function formatToListItems(items: Record<string, any>): EuiDescriptionListProps['listItems'] {
|
||||
return Object.entries(items)
|
||||
.filter(([, value]) => isDefined(value))
|
||||
.map(([title, value]) => {
|
||||
if (title in formatterDictionary) {
|
||||
return {
|
||||
|
@ -102,12 +104,9 @@ export const ExpandedRow: FC<ExpandedRowProps> = ({ item }) => {
|
|||
{JSON.stringify(value, null, 2)}
|
||||
</EuiCodeBlock>
|
||||
) : (
|
||||
value
|
||||
value.toString()
|
||||
),
|
||||
};
|
||||
})
|
||||
.filter(({ description: d }) => {
|
||||
return d !== undefined;
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,7 @@ import { timeFormatter } from '../../../../../../../common/util/date_utils';
|
|||
import { ListingPageUrlState } from '../../../../../../../common/types/common';
|
||||
import { usePageUrlState } from '../../../../../util/url_state';
|
||||
import { BUILT_IN_MODEL_TAG } from '../../../../../../../common/constants/data_frame_analytics';
|
||||
import { useTableSettings } from '../analytics_list/use_table_settings';
|
||||
|
||||
type Stats = Omit<TrainedModelStat, 'model_id'>;
|
||||
|
||||
|
@ -90,12 +91,6 @@ export const ModelsList: FC = () => {
|
|||
);
|
||||
|
||||
const searchQueryText = pageState.queryText ?? '';
|
||||
const setSearchQueryText = useCallback(
|
||||
(value) => {
|
||||
updatePageState({ queryText: value });
|
||||
},
|
||||
[updatePageState]
|
||||
);
|
||||
|
||||
const canDeleteDataFrameAnalytics = capabilities.ml.canDeleteDataFrameAnalytics as boolean;
|
||||
|
||||
|
@ -521,13 +516,19 @@ export const ModelsList: FC = () => {
|
|||
}
|
||||
: undefined;
|
||||
|
||||
const { onTableChange, pagination, sorting } = useTableSettings<ModelItem>(
|
||||
items,
|
||||
pageState,
|
||||
updatePageState
|
||||
);
|
||||
|
||||
const search: EuiSearchBarProps = {
|
||||
query: searchQueryText,
|
||||
onChange: (searchChange) => {
|
||||
if (searchChange.error !== null) {
|
||||
return false;
|
||||
}
|
||||
setSearchQueryText(searchChange.queryText);
|
||||
updatePageState({ queryText: searchChange.queryText, pageIndex: 0 });
|
||||
return true;
|
||||
},
|
||||
box: {
|
||||
|
@ -572,6 +573,9 @@ export const ModelsList: FC = () => {
|
|||
rowProps={(item) => ({
|
||||
'data-test-subj': `mlModelsTableRow row-${item.model_id}`,
|
||||
})}
|
||||
pagination={pagination}
|
||||
onTableChange={onTableChange}
|
||||
sorting={sorting}
|
||||
/>
|
||||
</div>
|
||||
{modelsToDelete.length > 0 && (
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue