Merge branch 'didi:master' into master

This commit is contained in:
lucasun
2022-01-18 14:07:44 +08:00
committed by GitHub
60 changed files with 950 additions and 506 deletions

View File

@@ -1,4 +1,3 @@
import { EChartOption } from 'echarts/lib/echarts';
import moment from 'moment';
import { ICurve } from 'container/common-curve/config';
import { adminMonitor } from 'store/admin-monitor';
@@ -124,7 +123,7 @@ export interface ICurveType {
type: curveType;
title: string;
curves: ICurve[];
parser: (option: ICurve, data: any[]) => EChartOption;
parser: (option: ICurve, data: any[]) => any;
}
export const byteTypeCurves: ICurveType[] = [

View File

@@ -1,5 +1,5 @@
import moment from 'moment';
import { EChartOption } from 'echarts';
import { EChartsOption } from 'echarts';
import { ICurve, ILineData, baseLineLegend, baseLineGrid, baseAxisStyle, noAxis, UNIT_HEIGHT } from 'container/common-curve/config';
import { IClusterMetrics, ISeriesOption } from 'types/base-type';
import { timeFormat } from 'constants/strategy';
@@ -48,20 +48,20 @@ export const getBaseOptions = (option: ICurve, data: ILineData[]) => {
return Number(i.value);
}),
}],
} as EChartOption;
} as EChartsOption;
};
export const parseLine = (option: ICurve, data: ILineData[]): EChartOption => {
export const parseLine = (option: ICurve, data: ILineData[]): EChartsOption => {
return Object.assign({}, getBaseOptions(option, data), {
legend: {
...baseLineLegend,
bottom: '0',
align: 'auto',
},
}) as EChartOption;
}) as EChartsOption;
};
export const parseBrokerMetricOption = (option: ICurve, data: IClusterMetrics[]): EChartOption => {
export const parseBrokerMetricOption = (option: ICurve, data: IClusterMetrics[]): EChartsOption => {
let name;
let series: ISeriesOption[];
data = data || [];

View File

@@ -6,7 +6,7 @@ import { alarm } from 'store/alarm';
import { observer } from 'mobx-react';
import { handlePageBack } from 'lib/utils';
import LineChart, { hasData } from 'component/chart/line-chart';
import { EChartOption } from 'echarts';
import { EChartsOption } from 'echarts';
import { timeFormat } from 'constants/strategy';
import Url from 'lib/url-parser';
import moment = require('moment');
@@ -40,7 +40,7 @@ export class HistoryDetail extends React.Component {
return <div className="no-data-info" style={{ ...style }} key="loading"><Spin /></div>;
}
public renderEchart = (options: EChartOption, loading = false) => {
public renderEchart = (options: EChartsOption, loading = false) => {
const data = hasData(options);
if (loading) return this.renderLoading(400);
if (!data) return this.renderNoData(400);
@@ -51,7 +51,7 @@ export class HistoryDetail extends React.Component {
}
public renderHistoricalTraffic(metric: IMonitorMetric) {
const option = this.getChartOption() as EChartOption;
const option = this.getChartOption() as EChartsOption;
return (
<>

View File

@@ -1,5 +1,4 @@
import { EChartOption } from 'echarts/lib/echarts';
import moment from 'moment';
import { EChartsOption } from 'echarts';
export interface ILineData {
value: number;
@@ -9,7 +8,7 @@ export interface ICurve {
title?: string;
path: string;
colors: string[];
parser?: (option: ICurve, data: ILineData) => EChartOption;
parser?: (option: ICurve, data: ILineData) => EChartsOption;
message?: string;
unit?: string;
api?: any;
@@ -69,13 +68,13 @@ export const noAxis = {
},
};
export const getHight = (options: EChartOption) => {
let grid = options ? options.grid as EChartOption.Grid : null;
export const getHight = (options: any) => {
let grid = options ? options.grid : null;
if (!options || !grid) grid = baseLineGrid;
return Number(grid.height) + getLegendHight(options) + Number(grid.top) + LEGEND_PADDING + UNIT_HEIGHT;
};
export const getLegendHight = (options: EChartOption) => {
export const getLegendHight = (options: any) => {
if (!options) return 0;
if (options.legend.show === false) return 0;
const legendHight = options.legend.textStyle.lineHeight + defaultLegendPadding;

View File

@@ -1,4 +1,4 @@
import { EChartOption } from 'echarts';
import { EChartsOption } from 'echarts';
import { observer } from 'mobx-react';
import React from 'react';
import { curveInfo } from 'store/curve-info';
@@ -10,7 +10,7 @@ import LineChart, { hasData } from 'component/chart/line-chart';
export interface ICommonCurveProps {
options: ICurve;
parser?: (option: ICurve, data: any[]) => EChartOption;
parser?: (option: ICurve, data: any[]) => any;
}
@observer
@@ -41,7 +41,7 @@ export class CommonCurve extends React.Component<ICommonCurveProps> {
fullScreen.show(this.renderCurve(options, loading, true));
}
public renderOpBtns = (options: EChartOption, expand = false) => {
public renderOpBtns = (options: EChartsOption, expand = false) => {
const data = hasData(options);
return (
<div className="charts-op" key="op">
@@ -85,7 +85,7 @@ export class CommonCurve extends React.Component<ICommonCurveProps> {
return <div className="no-data-info" style={{ ...style }} key="loading"><Spin /></div>;
}
public renderEchart = (options: EChartOption, loading = false) => {
public renderEchart = (options: EChartsOption, loading = false) => {
const height = getHight(options);
const data = hasData(options);
@@ -94,7 +94,7 @@ export class CommonCurve extends React.Component<ICommonCurveProps> {
return <LineChart height={height} options={options} key="chart" />;
}
public renderCurve = (options: EChartOption, loading: boolean, expand = false) => {
public renderCurve = (options: any, loading: boolean, expand = false) => {
const data = hasData(options);
return (
<div className="common-chart-wrapper" >

View File

@@ -7,7 +7,7 @@ import { urlPrefix } from 'constants/left-menu';
import { region, IRegionIdcs } from 'store/region';
import logoUrl from '../../assets/image/kafka-logo.png';
import userIcon from '../../assets/image/normal.png';
import weChat from '../../assets/image/wechat.png';
import weChat from '../../assets/image/weChat.png';
import { users } from 'store/users';
import { observer } from 'mobx-react';
import { Link } from 'react-router-dom';