forked from elastic/kibana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Stack Monitoring] Node Advanced View (elastic#113628)
* add template navigation * implement advanced node view * fix I18N titles
- Loading branch information
1 parent
99431e7
commit adbf25a
Showing
3 changed files
with
88 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
79 changes: 79 additions & 0 deletions
79
x-pack/plugins/monitoring/public/application/pages/elasticsearch/node_advanced_page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import React, { useContext, useState, useCallback } from 'react'; | ||
import { useParams } from 'react-router-dom'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { ItemTemplate } from './item_template'; | ||
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; | ||
import { GlobalStateContext } from '../../global_state_context'; | ||
// @ts-ignore | ||
import { AdvancedNode } from '../../../components/elasticsearch/node/advanced'; | ||
import { ComponentProps } from '../../route_init'; | ||
import { useCharts } from '../../hooks/use_charts'; | ||
|
||
export const ElasticsearchNodeAdvancedPage: React.FC<ComponentProps> = ({ clusters }) => { | ||
const globalState = useContext(GlobalStateContext); | ||
const { zoomInfo, onBrush } = useCharts(); | ||
|
||
const { node }: { node: string } = useParams(); | ||
const { services } = useKibana<{ data: any }>(); | ||
|
||
const clusterUuid = globalState.cluster_uuid; | ||
const ccs = globalState.ccs; | ||
const [data, setData] = useState({} as any); | ||
|
||
const title = i18n.translate('xpack.monitoring.elasticsearch.node.advanced.title', { | ||
defaultMessage: 'Elasticsearch - Nodes - {nodeName} - Advanced', | ||
values: { | ||
nodeName: data?.nodeSummary?.name, | ||
}, | ||
}); | ||
|
||
const pageTitle = i18n.translate('xpack.monitoring.elasticsearch.node.advanced.pageTitle', { | ||
defaultMessage: 'Elasticsearch node: {nodeName}', | ||
values: { | ||
nodeName: data?.nodeSummary?.name, | ||
}, | ||
}); | ||
|
||
const getPageData = useCallback(async () => { | ||
const bounds = services.data?.query.timefilter.timefilter.getBounds(); | ||
const url = `../api/monitoring/v1/clusters/${clusterUuid}/elasticsearch/nodes/${node}`; | ||
|
||
const response = await services.http?.fetch(url, { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
ccs, | ||
timeRange: { | ||
min: bounds.min.toISOString(), | ||
max: bounds.max.toISOString(), | ||
}, | ||
is_advanced: true, | ||
}), | ||
}); | ||
|
||
setData(response); | ||
}, [ccs, clusterUuid, services.data?.query.timefilter.timefilter, services.http, node]); | ||
|
||
return ( | ||
<ItemTemplate | ||
title={title} | ||
pageTitle={pageTitle} | ||
getPageData={getPageData} | ||
id={node} | ||
pageType="nodes" | ||
> | ||
<AdvancedNode | ||
nodeSummary={data.nodeSummary} | ||
alerts={{}} | ||
metrics={data.metrics} | ||
onBrush={onBrush} | ||
zoomInfo={zoomInfo} | ||
/> | ||
</ItemTemplate> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters