Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: some bugs in 1230iterration #166

Merged
merged 1 commit into from
Dec 14, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/components/Charts/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ function LineChart(props: IProps, ref) {
items.map(item => {
let value = item.value;
if (options.valueType === VALUE_TYPE.numberSecond) {
value = `${value}/s`;
value = `${Math.round(+value * 100) / 100}/s`;
}
return {
...item,
Expand Down
2 changes: 1 addition & 1 deletion src/components/DashboardCard/LineCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ function LineCard(props: IProps) {
}, [loading, chartRef.current]);

useEffect(() => {
if (baseLine && chartRef.current) {
if (baseLine != undefined && chartRef.current) {
chartRef.current.updateBaseline(baseLine);
}
}, [baseLine, chartRef.current]);
Expand Down
8 changes: 1 addition & 7 deletions src/components/Service/ServiceCardEdit/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ function ServiceCardEdit(props: IProps) {

const handlePanelConfigUpdate = (values: any) => {
const { period, space, metric, aggregation, baseLine } = values;
// const metricTypeList = curServiceMetricItems.find(
// item => item.metric === metric,
// )?.aggregations;
// const metricType = metricTypeList?.find(
// type => type === aggregation,
// );
const _config = cloneDeep(panelConfig);
_config[editType][editIndex] = {
period,
Expand All @@ -54,7 +48,7 @@ function ServiceCardEdit(props: IProps) {
space,
};
onPanelConfigUpdate(_config);
localStorage.setItem('panelConfig', JSON.stringify(_config));
// localStorage.setItem('panelConfig', JSON.stringify(_config));
onClose();
};

Expand Down
1 change: 1 addition & 0 deletions src/pages/MachineDashboard/Cards/DiskCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const mapState = (state: IRootState) => {
const { aliasConfig } = state.app;

const { instanceList } = metricsFilterValues;

return {
// According to type, only the detail increases total
diskUsageDetails: diskStat
Expand Down
2 changes: 1 addition & 1 deletion src/pages/MachineDashboard/Detail/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ function Detail(props: IProps) {
})
}
Promise.all(metricCharts.map((chart, i) => {
if (curMetricOptions.find(m => m.metric === chart.metric.metric)) {
if (curMetricOptions.length === 0 || curMetricOptions.find(m => m.metric === chart.metric.metric)) {
return getPromise(chart);
} else {
return Promise.resolve(dataSources[i]);
Expand Down
9 changes: 5 additions & 4 deletions src/store/models/service.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createModel } from '@rematch/core';
import _ from 'lodash';
import serviceApi from '@/config/service';
import { IPanelConfig, IServicePanelConfig, ServiceMetricsPanelValue, ServiceName } from '@/utils/interface';
import { IPanelConfig, ServiceMetricsPanelValue } from '@/utils/interface';
import { DEFAULT_SERVICE_PANEL_CONFIG } from '@/utils/service';
import { getProperStep } from '@/utils/dashboard';
import { unique } from '@/utils';
Expand All @@ -17,9 +17,10 @@ interface IState {
export function SereviceModelWrapper(serviceApi) {
return createModel({
state: {
panelConfig: localStorage.getItem('panelConfig')
? JSON.parse(localStorage.getItem('panelConfig')!)
: DEFAULT_SERVICE_PANEL_CONFIG,
// panelConfig: localStorage.getItem('panelConfig')
// ? JSON.parse(localStorage.getItem('panelConfig')!)
// : DEFAULT_SERVICE_PANEL_CONFIG,
panelConfig: DEFAULT_SERVICE_PANEL_CONFIG,
instanceList: [],
metricsFilterValues: InitMetricsFilterValues
},
Expand Down