Skip to content

Commit 89549d4

Browse files
committed
Fix another type issue
1 parent c49e5ea commit 89549d4

File tree

1 file changed

+31
-4
lines changed
  • x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes

1 file changed

+31
-4
lines changed

x-pack/plugins/infra/public/pages/metrics/inventory_view/components/node_details/tabs/processes/index.tsx

Lines changed: 31 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
import React, { useMemo, useState } from 'react';
88
import { i18n } from '@kbn/i18n';
9-
import { EuiSearchBar, EuiSpacer, Query } from '@elastic/eui';
9+
import { EuiSearchBar, EuiSpacer, EuiEmptyPrompt, EuiButton, Query } from '@elastic/eui';
1010
import { useProcessList } from '../../../../hooks/use_process_list';
1111
import { TabContent, TabProps } from '../shared';
1212
import { STATE_NAMES } from './states';
@@ -17,17 +17,44 @@ const TabComponent = ({ currentTime, node, nodeType, options }: TabProps) => {
1717
const [searchFilter, setSearchFilter] = useState<Query>(EuiSearchBar.Query.MATCH_ALL);
1818

1919
const hostTerm = useMemo(() => {
20-
const field = options.fields[nodeType];
20+
const field =
21+
options.fields && Reflect.has(options.fields, nodeType)
22+
? Reflect.get(options.fields, nodeType)
23+
: nodeType;
2124
return { [field]: node.name };
2225
}, [options, node, nodeType]);
2326

24-
const { loading, error, response } = useProcessList(
27+
const { loading, error, response, makeRequest: reload } = useProcessList(
2528
hostTerm,
2629
'metricbeat-*',
27-
options.fields?.timestamp,
30+
options.fields!.timestamp,
2831
currentTime
2932
);
3033

34+
if (error) {
35+
return (
36+
<TabContent>
37+
<EuiEmptyPrompt
38+
iconType="tableDensityNormal"
39+
title={
40+
<h4>
41+
{i18n.translate('xpack.infra.metrics.nodeDetails.processListError', {
42+
defaultMessage: 'Unable to show process data',
43+
})}
44+
</h4>
45+
}
46+
actions={
47+
<EuiButton color="primary" fill onClick={reload}>
48+
{i18n.translate('xpack.infra.metrics.nodeDetails.processListRetry', {
49+
defaultMessage: 'Try again',
50+
})}
51+
</EuiButton>
52+
}
53+
/>
54+
</TabContent>
55+
);
56+
}
57+
3158
return (
3259
<TabContent>
3360
<SummaryTable isLoading={loading} processList={response ?? []} />

0 commit comments

Comments
 (0)