Skip to content

Commit

Permalink
[INLONG-11416][Dashboard] Data synchronization corrects the display p…
Browse files Browse the repository at this point in the history
…roblem of uncommitted data (#11424)
  • Loading branch information
wohainilaodou authored Oct 28, 2024
1 parent fd80e03 commit c2391b7
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const { I18nMap, I18n } = DataWithBackend;
const { FieldList, FieldDecorator } = RenderRow;
const { ColumnList, ColumnDecorator } = RenderList;

const format = 'HH:mm';
export const format = 'HH:mm';
const conventionalTimeFormat = 'YYYY-MM-DD HH:mm';

export class SyncDefaultInfo implements DataWithBackend, RenderRow, RenderList {
Expand Down
38 changes: 28 additions & 10 deletions inlong-dashboard/src/ui/pages/SynchronizeDetail/Info/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ import { useFormContent } from './config';
import { CommonInterface } from '../common';
import { State } from '@/core/stores';
import dayjs from 'dayjs';
import { format } from '@/plugins/sync/common/SyncDefaultInfo';

type Props = CommonInterface;

Expand All @@ -52,7 +53,11 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly, isCreate }: Props, ref)
form.setFieldValue('scheduleType', 0);
form.setFieldValue('scheduleUnit', 'H');
}
}, [form, isCreate]);
if (isUpdate) {
form.setFieldValue('scheduleType', 0);
form.setFieldValue('scheduleUnit', 'H');
}
}, [form, isCreate, isUpdate]);

const isUpdateStream = useMemo(() => {
return !!inlongStreamId;
Expand All @@ -61,15 +66,27 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly, isCreate }: Props, ref)
const { data, run: getData } = useRequest(`/group/get/${inlongGroupId}`, {
ready: isUpdate,
refreshDeps: [inlongGroupId],
formatResult: data => ({
...data,
inCharges: data.inCharges.split(','),
time: [
dayjs(dayjs(data?.startTime), conventionalTimeFormat),
dayjs(dayjs(data?.endTime), conventionalTimeFormat),
],
delayTime: convertMinutesToDelayTime(data.delayTime),
}),
formatResult: data => {
if (data.inlongGroupMode === 1) {
return {
...data,
scheduleType: 0,
scheduleUnit: 'H',
scheduleInterval: 0,
delayTime: dayjs('00:00', format),
selfDepend: 0,
};
}
return {
...data,
inCharges: data.inCharges.split(','),
time: [
dayjs(dayjs(data?.startTime), conventionalTimeFormat),
dayjs(dayjs(data?.endTime), conventionalTimeFormat),
],
delayTime: convertMinutesToDelayTime(data.delayTime),
};
},
onSuccess: data => {
setMqType(data.mqType);
form.setFieldsValue(data);
Expand Down Expand Up @@ -214,6 +231,7 @@ const Comp = ({ inlongGroupId, inlongStreamId, readonly, isCreate }: Props, ref)
onValuesChange={(c, values) => setMqType(values.mqType)}
useMaxWidth={1400}
col={14}
labelWrap
/>

{!isCreate && !readonly && (
Expand Down

0 comments on commit c2391b7

Please sign in to comment.