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

[INLONG-10449][Dashboard] The field template for selecting a new data #10460

Merged
merged 7 commits into from
Jun 21, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,7 @@ export class GroupDataTemplateInfo implements DataWithBackend, RenderRow, Render
@FieldDecorator({
type: 'input',
initialValue: 0,
hidden: true,
rules: [{ required: true }],
})
@I18n('pages.GroupDataTemplate.Version')
Expand Down
13 changes: 9 additions & 4 deletions inlong-dashboard/src/plugins/streams/common/StreamDefaultInfo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -224,10 +224,15 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
dataSeparator: string;
@FieldDecorator({
type: 'select',
props: {
filterOption: true,
visible: values => {
return !Boolean(values.id);
},
props: values => ({
showSearch: true,
optionFilterProp: 'label',
allowClear: true,
options: {
requestTrigger: ['onOpen', 'onSearch'],
requestTrigger: ['onOpen'],
requestService: keyword => ({
url: '/template/list',
method: 'POST',
Expand All @@ -247,7 +252,7 @@ export class StreamDefaultInfo implements DataWithBackend, RenderRow, RenderList
},
},
},
},
}),
rules: [],
})
@I18n('meta.Stream.SourceDataField.Template')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const Comp: React.FC<Props> = ({ id, templateName, ...modalProps }) => {

const { data: savedData, run: getData } = useRequest(
() => ({
url: `/template/get/`,
url: `/template/get`,
method: 'GET',
params: {
templateName: templateName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ const Comp: React.FC<Props> = ({ inlongGroupId, inlongStreamId, mqType, ...modal
{
manual: true,
onSuccess: result => {
savedData.fieldList = result['fieldList'];
form.setFieldsValue(dataToValues(savedData));
const temp = { ...savedData, fieldList: result.fieldList };
form.setFieldsValue(dataToValues(temp));
},
},
);
Expand Down
Loading