From 4178e771604f03f50243d6a8d8d06475efee4768 Mon Sep 17 00:00:00 2001 From: liugq Date: Sun, 26 Sep 2021 14:21:59 +0800 Subject: [PATCH] console bug fixed and update cluster status --- web/src/components/GlobalHeader/DropdownItem.tsx | 8 ++++---- web/src/components/GlobalHeader/DropdownSelect.js | 2 +- .../components/kibana/console/components/ConsoleInput.tsx | 8 ++++---- .../console/hooks/use_send_current_request_to_es/index.ts | 1 + web/src/pages/Alerting/pages/Home/Home.js | 7 ------- web/src/pages/Alerting/pages/Main/Main.js | 7 +++++++ web/src/pages/Alerting/pages/Overview/Overview.js | 4 ++-- web/src/pages/System/Cluster/Index.js | 8 ++++---- 8 files changed, 23 insertions(+), 22 deletions(-) diff --git a/web/src/components/GlobalHeader/DropdownItem.tsx b/web/src/components/GlobalHeader/DropdownItem.tsx index 77765975..49655cab 100644 --- a/web/src/components/GlobalHeader/DropdownItem.tsx +++ b/web/src/components/GlobalHeader/DropdownItem.tsx @@ -1,6 +1,6 @@ import {Icon} from 'antd'; import styles from './DropdownSelect.less'; -import {HealthStatusCircle, ClusterHealthStatus} from '@/components/infini/health_status_circle' +import {HealthStatusCircle} from '@/components/infini/health_status_circle' export interface ClusterItem { id: string @@ -10,8 +10,8 @@ export interface ClusterItem { } export interface ClusterStatus { - cluster_available: boolean - health_status: ClusterHealthStatus + available: boolean + health: any nodes_count: number } @@ -30,7 +30,7 @@ export const DropdownItem = ({ }:props)=>{ return
- {clusterStatus?.cluster_available ? : } + {clusterStatus?.available ? : } {clusterItem?.name}
{clusterItem?.version}
diff --git a/web/src/components/GlobalHeader/DropdownSelect.js b/web/src/components/GlobalHeader/DropdownSelect.js index 0649d0b5..7c98db2b 100644 --- a/web/src/components/GlobalHeader/DropdownSelect.js +++ b/web/src/components/GlobalHeader/DropdownSelect.js @@ -128,7 +128,7 @@ class DropdownSelect extends React.Component{ type="caret-down"/> */} - {cstatus?.cluster_available ? : } + {cstatus?.available ? : } diff --git a/web/src/components/kibana/console/components/ConsoleInput.tsx b/web/src/components/kibana/console/components/ConsoleInput.tsx index 3fa955ee..0eee7447 100644 --- a/web/src/components/kibana/console/components/ConsoleInput.tsx +++ b/web/src/components/kibana/console/components/ConsoleInput.tsx @@ -41,11 +41,10 @@ const SendRequestButton = (props: any) => { const sendCurrentRequestToES = useSendCurrentRequestToES(); const saveCurrentTextObject = useSaveCurrentTextObject(); - const {sendCurrentRequestToESRef, saveCurrentTextObjectRef} = props; + const {saveCurrentTextObjectRef} = props; useEffect(()=>{ - sendCurrentRequestToESRef.current = sendCurrentRequestToES saveCurrentTextObjectRef.current = saveCurrentTextObject - }, [sendCurrentRequestToESRef, saveCurrentTextObjectRef]) + }, [saveCurrentTextObjectRef]) return ( @@ -87,6 +86,7 @@ const ConsoleInputUI = ({clusterID, initialText}:ConsoleInputProps) => { const sendCurrentRequestToESRef = useRef(()=>{}); const saveCurrentTextObjectRef = useRef((content:string)=>{}); + sendCurrentRequestToESRef.current = useSendCurrentRequestToES(); const {services:{settings}} = useServicesContext(); @@ -168,7 +168,7 @@ const ConsoleInputUI = ({clusterID, initialText}:ConsoleInputProps) => { ref={editorActionsRef} > - + { const { services: { history }, clusterID } = useServicesContext(); return useCallback(async () => { + console.log(clusterID) try { const editor = registry.getInputEditor(); const requests = await editor.getRequestsInRange(); diff --git a/web/src/pages/Alerting/pages/Home/Home.js b/web/src/pages/Alerting/pages/Home/Home.js index f4bac654..a8221edb 100644 --- a/web/src/pages/Alerting/pages/Home/Home.js +++ b/web/src/pages/Alerting/pages/Home/Home.js @@ -22,7 +22,6 @@ import Monitors from '../Monitors/containers/Monitors'; import DestinationsList from '../Destinations/containers/DestinationsList'; import { formatMessage } from 'umi/locale'; import {AlertOverview} from '../Dashboard/containers/AlertOverview'; -import Overview from '../Overview/Overview'; const getSelectedTabId = (pathname) => { if (pathname.includes('monitors')) return 'monitors'; @@ -123,12 +122,6 @@ export default class Home extends Component { notifications={notifications} /> )} - /> - ( - - )} /> + ( + + )} + /> ( diff --git a/web/src/pages/Alerting/pages/Overview/Overview.js b/web/src/pages/Alerting/pages/Overview/Overview.js index d8fbbb33..6971c261 100644 --- a/web/src/pages/Alerting/pages/Overview/Overview.js +++ b/web/src/pages/Alerting/pages/Overview/Overview.js @@ -86,10 +86,10 @@ export default (props)=>{
- + } - const status = clusterStatus[val].health_status; + const status = clusterStatus[val].health?.status; return } @@ -83,13 +83,13 @@ class Index extends React.Component { },{ title: '节点数', dataIndex: 'id', - key: 'mode_count', + key: 'number_of_nodes', render: (val)=>{ const {clusterStatus} = this.props; if(!clusterStatus || !clusterStatus[val]){ return } - return clusterStatus[val].nodes_count; + return clusterStatus[val].health?.number_of_nodes; } },{ title: '集群地址',