fix: Fix for monitor page

1. fix for object data of formatedData
2. fix for evictions
3. fix for chart modal

Change-Id: I757387714a1088647538870e80615662f830ac1e
This commit is contained in:
zhuyue 2021-12-08 15:57:56 +08:00
parent 1834f92c8a
commit a070ecd94e
4 changed files with 5 additions and 12 deletions

View File

@ -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(() => (
<div style={{ height: 520 }}>
<BaseContent
@ -93,11 +85,11 @@ const ChartCard = (props) => {
{...props}
currentRange={store.currentRange}
interval={store.interval}
params={getModalCardsParams(store)}
isModal
/>
)}
{...BaseContentConfig}
renderNodeSelect={false}
/>
</div>
));

View File

@ -408,6 +408,7 @@ const metricDict = {
},
evictions: {
url: ['memcached_slab_items_evicted_unfetched_total'],
finalFormatFunc: [(url) => `sum(${url})`],
},
itemsInCache: {
url: ['memcached_items_total'],

View File

@ -94,7 +94,7 @@ export default class BaseMonitorStore {
this.nodes = result;
this.node = this.nodes[0] || {
metric: {
hostname: '',
instance: '',
},
};
this.isLoading = false;

View File

@ -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 &&