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

View File

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

View File

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

View File

@ -13,7 +13,7 @@
// limitations under the License. // limitations under the License.
import { observable, action } from 'mobx'; import { observable, action } from 'mobx';
import { get, isArray } from 'lodash'; import { clone, get, isArray } from 'lodash';
import DataSet from '@antv/data-set'; import DataSet from '@antv/data-set';
import { import {
getRequestUrl, getRequestUrl,
@ -95,7 +95,7 @@ export default class FetchPrometheusStore {
this.deviceKey, this.deviceKey,
this.modifyKeys this.modifyKeys
); );
this.data = [...formatedData]; this.data = clone(formatedData);
if ( if (
isArray(formatedData) && isArray(formatedData) &&
formatedData.length !== 0 && formatedData.length !== 0 &&