From a070ecd94e95ca09ad45ee0eb32b44b96b53dfe2 Mon Sep 17 00:00:00 2001 From: zhuyue Date: Wed, 8 Dec 2021 15:57:56 +0800 Subject: [PATCH] fix: Fix for monitor page 1. fix for object data of formatedData 2. fix for evictions 3. fix for chart modal Change-Id: I757387714a1088647538870e80615662f830ac1e --- src/components/PrometheusChart/ChartCard.jsx | 10 +--------- src/components/PrometheusChart/metricDict.js | 1 + .../PrometheusChart/store/BaseMonitorStore.js | 2 +- .../PrometheusChart/store/FetchPrometheusStore.js | 4 ++-- 4 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/components/PrometheusChart/ChartCard.jsx b/src/components/PrometheusChart/ChartCard.jsx index 1988f8e6..710fed43 100644 --- a/src/components/PrometheusChart/ChartCard.jsx +++ b/src/components/PrometheusChart/ChartCard.jsx @@ -77,14 +77,6 @@ const ChartCard = (props) => { ); }; - const getModalCardsParams = (store) => { - const pa = {}; - if (params && Object.keys(params).includes('hostname')) { - pa.hostname = store.node.metric.hostname; - } - return pa; - }; - const ModalContent = observer(() => (
{ {...props} currentRange={store.currentRange} interval={store.interval} - params={getModalCardsParams(store)} isModal /> )} {...BaseContentConfig} + renderNodeSelect={false} />
)); diff --git a/src/components/PrometheusChart/metricDict.js b/src/components/PrometheusChart/metricDict.js index e353d013..9892cd9b 100644 --- a/src/components/PrometheusChart/metricDict.js +++ b/src/components/PrometheusChart/metricDict.js @@ -408,6 +408,7 @@ const metricDict = { }, evictions: { url: ['memcached_slab_items_evicted_unfetched_total'], + finalFormatFunc: [(url) => `sum(${url})`], }, itemsInCache: { url: ['memcached_items_total'], diff --git a/src/components/PrometheusChart/store/BaseMonitorStore.js b/src/components/PrometheusChart/store/BaseMonitorStore.js index 27e46bdb..55ad04c2 100644 --- a/src/components/PrometheusChart/store/BaseMonitorStore.js +++ b/src/components/PrometheusChart/store/BaseMonitorStore.js @@ -94,7 +94,7 @@ export default class BaseMonitorStore { this.nodes = result; this.node = this.nodes[0] || { metric: { - hostname: '', + instance: '', }, }; this.isLoading = false; diff --git a/src/components/PrometheusChart/store/FetchPrometheusStore.js b/src/components/PrometheusChart/store/FetchPrometheusStore.js index 1876b963..ad34a2d1 100644 --- a/src/components/PrometheusChart/store/FetchPrometheusStore.js +++ b/src/components/PrometheusChart/store/FetchPrometheusStore.js @@ -13,7 +13,7 @@ // limitations under the License. import { observable, action } from 'mobx'; -import { get, isArray } from 'lodash'; +import { clone, get, isArray } from 'lodash'; import DataSet from '@antv/data-set'; import { getRequestUrl, @@ -95,7 +95,7 @@ export default class FetchPrometheusStore { this.deviceKey, this.modifyKeys ); - this.data = [...formatedData]; + this.data = clone(formatedData); if ( isArray(formatedData) && formatedData.length !== 0 &&