Skip to content

Commit

Permalink
fix: metric unit layout (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
xigongdaEricyang authored Oct 31, 2022
1 parent 1b771ef commit 4cc63d6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
7 changes: 5 additions & 2 deletions src/pages/MachineDashboard/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function Detail(props: IProps) {

useEffect(() => {
updateChart();
}, [metricsFilterValues.instanceList, dataSources])
}, [metricsFilterValues.instanceList, dataSources, curMetricOptions])

useEffect(() => () => {
if (pollingTimer) {
Expand Down Expand Up @@ -173,6 +173,9 @@ function Detail(props: IProps) {
const values = data.map(d => d.value) as number[];
const maxNum = values.length > 0 ? Math.floor(Math.max(...values) * 100) / 100 : undefined;
const minNum = values.length > 0 ? Math.floor(Math.min(...values) * 100) / 100 : undefined;
if (chart.metric.metric === 'disk_writebytes') {
debugger;
}
chart.chartRef.updateDetailChart({
type,
valueType: chart.metric.valueType,
Expand Down Expand Up @@ -250,7 +253,7 @@ function Detail(props: IProps) {
<div className='chart-content'>
<LineChart
baseLine={metricChart.baseLine}
options={{ padding: [10, 70, 70, 70] }}
// options={{ padding: [10, 70, 70, 70] }}
ref={ref => metricChart.chartRef = ref}
renderChart={renderChart(i)}
/>
Expand Down
4 changes: 2 additions & 2 deletions src/pages/ServiceDashboard/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ function ServiceDetail(props: IProps) {
useEffect(() => {
if (dataSources.length === 0) return;
updateChart();
}, [metricsFilterValues.instanceList, dataSources])
}, [metricsFilterValues.instanceList, dataSources, curMetricOptions])

const asyncGetMetricsData = async () => {
const { timeRange, period, space, metricType } = metricsFilterValues;
Expand Down Expand Up @@ -355,7 +355,7 @@ function ServiceDetail(props: IProps) {
<div className='chart-content'>
<LineChart
// baseLine={metricChart.baseLine}
options={{ padding: [20, 20, 60, 50] }}
// options={{ padding: [20, 20, 60, 50] }}
ref={ref => metricChart.chartRef = ref}
renderChart={renderChart(i)}
/>
Expand Down

0 comments on commit 4cc63d6

Please sign in to comment.