Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion web/src/common/src/DatePicker/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ const DatePicker = (props) => {
const [reloadLoading, setReloadLoading] = useState(false)
const onRefreshClick = () => {
setReloadLoading(true)
onRefresh && onRefresh({ start, end });
onRefresh && onRefresh({ start, end, refresh: true });
setTimeout(()=>{
setReloadLoading(false)
}, 1000)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export default (props) => {
queryParams={queryParams}
timeout={timeout}
className={styles.lineWrapper}
height={150}
formatMetric={(metric) => {
if (!metric) return metric;
let units = "";
Expand Down
29 changes: 19 additions & 10 deletions web/src/components/Overview/Monitor/index.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState, useMemo, useEffect, useCallback } from "react";
import { Card, Tabs, Breadcrumb, Button, BackTop, Empty } from "antd";
import { Card, Tabs, Breadcrumb, Button, BackTop, Empty, Spin } from "antd";
import { calculateBounds } from "@/components/vendor/data/common/query/timefilter";
import { formatter } from "@/utils/format";
import moment from "moment";
Expand Down Expand Up @@ -66,6 +66,7 @@ const Monitor = (props) => {
timeInterval: formatTimeInterval(param?.timeInterval),
timeout: formatTimeout(param?.timeout) || localStorage.getItem(TIMEOUT_CACHE_KEY) || '120s',
param: param,
refresh: true
})
);

Expand All @@ -76,7 +77,7 @@ const Monitor = (props) => {
setParam({ ...param, timeRange: state.timeRange, timeInterval: state.timeInterval, timeout: state.timeout });
}, [state.timeRange, state.timeInterval, state.timeout]);

const handleTimeChange = useCallback(({ start, end, timeInterval, timeout }) => {
const handleTimeChange = useCallback(({ start, end, timeInterval, timeout, refresh }) => {
const bounds = calculateBounds({
from: start,
to: end,
Expand All @@ -93,9 +94,9 @@ const Monitor = (props) => {
timeFormatter: formatter.dates(intDay),
},
timeInterval: timeInterval || state.timeInterval,
timeout: timeout || state.timeout
timeout: timeout || state.timeout,
refresh
});
setSpinning(true);
}, [state])

const onInfoChange = (info) => {
Expand All @@ -112,6 +113,12 @@ const Monitor = (props) => {
return monitor_configs?.node_stats?.enabled === false && monitor_configs?.index_stats?.enabled === false
}, [JSON.stringify(selectedCluster?.monitor_configs)])

console.log("spinning")
console.log(spinning)
console.log("state.refresh")
console.log(state.refresh)


return (
<div>
<BreadcrumbList data={breadcrumbList} />
Expand Down Expand Up @@ -165,12 +172,14 @@ const Monitor = (props) => {
>
{panes.map((pane) => (
<TabPane tab={pane.title} key={pane.key}>
<StatisticBar
setSpinning={setSpinning}
onInfoChange={onInfoChange}
{...state}
{...extraParams}
/>
<Spin spinning={spinning && !!state.refresh}>
<StatisticBar
setSpinning={setSpinning}
onInfoChange={onInfoChange}
{...state}
{...extraParams}
/>
</Spin>
<div style={{ marginTop: 15 }}>
{checkPaneParams({
...state,
Expand Down
2 changes: 1 addition & 1 deletion web/src/lib/hooks/use_fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const DEFAULT_OPTIONS = {
};

export default function useFetch(url, options = {}, dependencies = [], runInInit = true) {
const { returnRawResponse, noticeable, ...rest } = options
const { returnRawResponse, noticeable, ...rest } = options || {}
return useAsync(() => {
return request(url, { ...DEFAULT_OPTIONS, ...rest }, returnRawResponse, noticeable);
}, dependencies, runInInit);
Expand Down
53 changes: 16 additions & 37 deletions web/src/pages/Platform/Overview/Cluster/Monitor/advanced.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,27 @@ import QueueMetric from "../../components/queue_metric";
import { ESPrefix } from "@/services/common";
import { SearchEngines } from "@/lib/search_engines";

const timezone = "local";

export default ({
selectedCluster,
clusterID,
timeRange,
handleTimeChange,
timezone,
bucketSize,
timeout,
refresh,
}) => {

const tabProps = {
clusterID,
timeRange,
handleTimeChange,
timezone,
bucketSize,
timeout,
refresh
}

const isVersionGTE6 = useMemo(() => {
if ([SearchEngines.Easysearch, SearchEngines.Opensearch].includes(selectedCluster?.distribution)) return true;
const main = selectedCluster?.version?.split('.')[0]
Expand Down Expand Up @@ -56,12 +66,8 @@ export default ({
})}
>
<ClusterMetric
timezone={timezone}
timeRange={timeRange}
handleTimeChange={handleTimeChange}
{...tabProps}
fetchUrl={`${ESPrefix}/${clusterID}/cluster_metrics`}
bucketSize={bucketSize}
timeout={timeout}
metrics={[
'cluster_health',
'index_throughput',
Expand All @@ -84,14 +90,9 @@ export default ({
})}
>
<NodeMetric
clusterID={clusterID}
timezone={timezone}
timeRange={timeRange}
handleTimeChange={handleTimeChange}
{...tabProps}
param={param}
setParam={setParam}
bucketSize={bucketSize}
timeout={timeout}
metrics={[
[
"operations",
Expand Down Expand Up @@ -231,14 +232,9 @@ export default ({
})}
>
<IndexMetric
clusterID={clusterID}
timezone={timezone}
timeRange={timeRange}
handleTimeChange={handleTimeChange}
{...tabProps}
param={param}
setParam={setParam}
bucketSize={bucketSize}
timeout={timeout}
metrics={[
[
"operations",
Expand Down Expand Up @@ -314,14 +310,9 @@ export default ({
})}
>
<QueueMetric
clusterID={clusterID}
timezone={timezone}
timeRange={timeRange}
handleTimeChange={handleTimeChange}
{...tabProps}
param={param}
setParam={setParam}
bucketSize={bucketSize}
timeout={timeout}
metrics={[
isVersionGTE6 ? [
"thread_pool_write",
Expand Down Expand Up @@ -397,18 +388,6 @@ export default ({
].filter((item) => !!item)}
/>
</Tabs.TabPane>
{/* <Tabs.TabPane
key="storage"
tab={formatMessage({
id: "cluster.monitor.queue.storage",
})}
>
<StorageMetric
clusterID={clusterID}
timezone={timezone}
timeRange={timeRange}
/>
</Tabs.TabPane> */}
</Tabs>
);
}
5 changes: 3 additions & 2 deletions web/src/pages/Platform/Overview/Cluster/Monitor/overview.jsx
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
import ClusterMetric from "../../components/cluster_metric";
import { ESPrefix } from "@/services/common";

const timezone = "local";

export default ({
clusterID,
timeRange,
handleTimeChange,
bucketSize,
timeout,
timezone,
refresh
}) => {
return (
<ClusterMetric
timezone={timezone}
timeRange={timeRange}
timeout={timeout}
refresh={refresh}
handleTimeChange={handleTimeChange}
overview={1}
fetchUrl={`${ESPrefix}/${clusterID}/cluster_metrics`}
Expand Down
7 changes: 4 additions & 3 deletions web/src/pages/Platform/Overview/Indices/Monitor/advanced.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ import { useState } from "react";
import StatisticBar from "./statistic_bar";
import IndexMetric from "../../components/index_metric";

const timezone = "local";

export default ({
clusterID,
indexName,
timeRange,
handleTimeChange,
shardID,
bucketSize,
timeout
timezone,
timeout,
refresh,
}) => {
const [param, setParam] = useState({
show_top: false,
Expand All @@ -28,6 +28,7 @@ export default ({
shardID={shardID}
bucketSize={bucketSize}
timeout={timeout}
refresh={refresh}
metrics={[
[
"operations",
Expand Down
7 changes: 4 additions & 3 deletions web/src/pages/Platform/Overview/Indices/Monitor/overview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import { ESPrefix } from "@/services/common";
import StatisticBar from "./statistic_bar";
import ClusterMetric from "../../components/cluster_metric";

const timezone = "local";

export default ({
isAgent,
clusterID,
Expand All @@ -12,7 +10,9 @@ export default ({
handleTimeChange,
shardID,
bucketSize,
timeout
timezone,
timeout,
refresh
}) => {
let url = `${ESPrefix}/${clusterID}/index/${indexName}/metrics`;
if(shardID){
Expand All @@ -27,6 +27,7 @@ export default ({
fetchUrl={url}
bucketSize={bucketSize}
timeout={timeout}
refresh={refresh}
metrics={[
"index_health",
"index_throughput",
Expand Down
28 changes: 14 additions & 14 deletions web/src/pages/Platform/Overview/Node/Monitor/advanced.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,28 @@ import QueueMetric from "../../components/queue_metric";
import { formatMessage } from "umi/locale";
import { SearchEngines } from "@/lib/search_engines";

const timezone = "local";

export default ({
selectedCluster,
clusterID,
nodeID,
timeRange,
handleTimeChange,
timezone,
bucketSize,
timeout,
refresh,
}) => {

const tabProps = {
clusterID,
timeRange,
handleTimeChange,
timezone,
bucketSize,
timeout,
refresh
}

const isVersionGTE6 = useMemo(() => {
if ([SearchEngines.Easysearch, SearchEngines.Opensearch].includes(selectedCluster?.distribution)) return true;
const main = selectedCluster?.version?.split('.')[0]
Expand Down Expand Up @@ -59,14 +69,9 @@ export default ({
})}
>
<NodeMetric
clusterID={clusterID}
timezone={timezone}
timeRange={timeRange}
handleTimeChange={handleTimeChange}
{...tabProps}
param={param}
setParam={setParam}
bucketSize={bucketSize}
timeout={timeout}
metrics={[
[
"operations",
Expand Down Expand Up @@ -206,14 +211,9 @@ export default ({
})}
>
<QueueMetric
clusterID={clusterID}
timezone={timezone}
timeRange={timeRange}
handleTimeChange={handleTimeChange}
{...tabProps}
param={param}
setParam={setParam}
bucketSize={bucketSize}
timeout={timeout}
metrics={[
isVersionGTE6 ? [
"thread_pool_write",
Expand Down
5 changes: 3 additions & 2 deletions web/src/pages/Platform/Overview/Node/Monitor/overview.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,24 @@ import StatisticBar from "./statistic_bar";
import ClusterMetric from "../../components/cluster_metric";
import { useMemo } from "react";

const timezone = "local";

export default ({
isAgent,
clusterID,
nodeID,
timeRange,
handleTimeChange,
bucketSize,
timezone,
timeout,
refresh
}) => {

return (
<ClusterMetric
timezone={timezone}
timeRange={timeRange}
timeout={timeout}
refresh={refresh}
handleTimeChange={handleTimeChange}
overview={1}
fetchUrl={`${ESPrefix}/${clusterID}/node/${nodeID}/metrics`}
Expand Down
Loading
Loading