Skip to content

Commit eac24a2

Browse files
committed
[app-builder] modify displayType name
1 parent 1c23f9e commit eac24a2

File tree

5 files changed

+22
-22
lines changed

5 files changed

+22
-22
lines changed

app-builder/plugins/aipp-plugin/src/main/java/modelengine/fit/jober/aipp/dto/AppInputParam.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ private static Predicate<Object> createValidator(AppearanceConfig config, String
113113
}
114114

115115
return switch (displayType) {
116-
case "input" -> createStringValidator(config.getStringMaxLength());
117-
case "number" -> createNumberValidator(config.getMinValue(), config.getMaxValue());
116+
case "textInput" -> createStringValidator(config.getStringMaxLength());
117+
case "numberInput" -> createNumberValidator(config.getMinValue(), config.getMaxValue());
118118
case "dropdown" -> createDropdownValidator(config.getOptions());
119119
case "switch" -> createBooleanValidator();
120120
case "multiselect" -> createArrayValidator(config.getOptions());

app-builder/plugins/aipp-plugin/src/test/java/modelengine/fit/jober/aipp/dto/AppInputParamTest.java

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ void shouldThrowExceptionWhenRawParamIsNull() {
9191
void shouldParseInputAppearanceConfig() {
9292
// Given
9393
Map<String, Object> appearance = new HashMap<>();
94-
appearance.put("displayType", "input");
94+
appearance.put("displayType", "textInput");
9595
appearance.put("maxLength", 100);
9696

9797
Map<String, Object> rawParam = new HashMap<>();
@@ -111,7 +111,7 @@ void shouldParseInputAppearanceConfig() {
111111
void shouldParseNumberAppearanceConfig() {
112112
// Given
113113
Map<String, Object> appearance = new HashMap<>();
114-
appearance.put("displayType", "number");
114+
appearance.put("displayType", "numberInput");
115115
appearance.put("minValue", "10.5");
116116
appearance.put("maxValue", "100.99");
117117

@@ -253,7 +253,7 @@ class StringValidatorTest {
253253
@BeforeEach
254254
void setUp() {
255255
Map<String, Object> appearance = new HashMap<>();
256-
appearance.put("displayType", "input");
256+
appearance.put("displayType", "textInput");
257257
appearance.put("maxLength", 10);
258258

259259
Map<String, Object> rawParam = new HashMap<>();
@@ -305,7 +305,7 @@ void shouldFailNonStringTypes() {
305305
void shouldSuccessWithoutMaxLength() {
306306
// Given
307307
Map<String, Object> appearance = new HashMap<>();
308-
appearance.put("displayType", "input");
308+
appearance.put("displayType", "textInput");
309309

310310
Map<String, Object> rawParam = new HashMap<>();
311311
rawParam.put("name", "stringParam");
@@ -329,7 +329,7 @@ class NumberValidatorTest {
329329
@BeforeEach
330330
void setUp() {
331331
Map<String, Object> appearance = new HashMap<>();
332-
appearance.put("displayType", "number");
332+
appearance.put("displayType", "numberInput");
333333
appearance.put("minValue", "10");
334334
appearance.put("maxValue", "100");
335335

@@ -382,7 +382,7 @@ void shouldFailNonNumberTypes() {
382382
void shouldSuccessWithoutMaxLength() {
383383
// Given
384384
Map<String, Object> appearance = new HashMap<>();
385-
appearance.put("displayType", "number");
385+
appearance.put("displayType", "numberInput");
386386

387387
Map<String, Object> rawParam = new HashMap<>();
388388
rawParam.put("name", "numberParam");
@@ -764,7 +764,7 @@ class EdgeCaseTest {
764764
void shouldHandleInvalidNumberFormat() {
765765
// Given
766766
Map<String, Object> appearance = new HashMap<>();
767-
appearance.put("displayType", "number");
767+
appearance.put("displayType", "numberInput");
768768
appearance.put("minValue", "invalid");
769769
appearance.put("maxValue", "also_invalid");
770770

frontend/src/pages/addFlow/components/render-form-item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,12 +121,12 @@ const RenderFormItem = (props) => {
121121
// 有 appearance,走新的 actualType 渲染逻辑
122122
return (
123123
<>
124-
{actualType === 'input' && (
124+
{actualType === 'textInput' && (
125125
<Form.Item name={name} label={getCustomLabel(actualType)} rules={[isRequiredRule]} className='debug-form-item'>
126126
<Input placeholder={t('plsEnter')} maxLength={appearance?.maxLength || 500} showCount onBlur={(e) => handleStringItemBlur(e.target.value)} />
127127
</Form.Item>
128128
)}
129-
{actualType === 'number' && (
129+
{actualType === 'numberInput' && (
130130
<Form.Item name={name} label={getCustomLabel(actualType)} rules={[isRequiredRule, { validator: (_, value) => validateNumber(value, false) }]} className='debug-form-item'>
131131
<InputNumber
132132
style={{ width: '100%' }}

frontend/src/pages/chatPreview/components/send-editor/components/conversation-configuration.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const ConversationConfiguration = ({ appInfo, updateUserContext, chatRunning, is
8585

8686
// 优先使用 displayType 分支渲染
8787
switch (displayType) {
88-
case 'input':
88+
case 'textInput':
8989
return (
9090
<Input
9191
style={{ width: 400 }}
@@ -95,7 +95,7 @@ const ConversationConfiguration = ({ appInfo, updateUserContext, chatRunning, is
9595
onChange={updateData}
9696
/>
9797
);
98-
case 'number':
98+
case 'numberInput':
9999
return (
100100
<InputNumber
101101
style={{ width: 150 }}

frontend/src/pages/configForm/configUi/components/add-input-param.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ const InputParamModal = (props) => {
3636
const { t } = useTranslation();
3737
const [form] = Form.useForm();
3838
const { showModal, setShowModal, onSubmit, mode, modalRef } = props;
39-
const [fieldType, setFieldType] = useState('input');
39+
const [fieldType, setFieldType] = useState('textInput');
4040

4141
// 字段类型配置
4242
const fieldTypes = [
43-
{ value: 'input', label: t('inputType'), icon: <FileTextOutlined />, type: 'String' },
44-
{ value: 'number', label: t('numberType'), icon: <NumberOutlined />, type: 'Number' },
43+
{ value: 'textInput', label: t('inputType'), icon: <FileTextOutlined />, type: 'String' },
44+
{ value: 'numberInput', label: t('numberType'), icon: <NumberOutlined />, type: 'Number' },
4545
{ value: 'dropdown', label: t('dropdownType'), icon: <UnorderedListOutlined />, type: 'String' },
4646
{ value: 'switch', label: t('switchType'), icon: <SwitcherOutlined />, type: 'Boolean' },
4747
{ value: 'multiselect', label: t('multiselectType'), icon: <CheckSquareOutlined />, type: 'Array[String]' },
@@ -66,11 +66,11 @@ const InputParamModal = (props) => {
6666
visible: defaultValue.isVisible,
6767
appearance: defaultValue.appearance,
6868
});
69-
setFieldType(defaultValue.appearance?.displayType || 'input');
69+
setFieldType(defaultValue.appearance?.displayType || 'textInput');
7070
} else if (mode === 'add') {
7171
// 添加模式:重置表单到初始值
7272
form.resetFields();
73-
setFieldType('input');
73+
setFieldType('textInput');
7474
}
7575
}, [showModal, mode]);
7676

@@ -98,7 +98,7 @@ const InputParamModal = (props) => {
9898
isVisible: values.visible,
9999
disableModifiable: false,
100100
appearance: {
101-
displayType: fieldTypeItem?.value || 'input',
101+
displayType: fieldTypeItem?.value || 'textInput',
102102
...values.appearance,
103103
},
104104
};
@@ -143,7 +143,7 @@ const InputParamModal = (props) => {
143143
// 根据字段类型渲染不同的配置项
144144
const renderFieldSpecificOptions = () => {
145145
switch (fieldType) {
146-
case 'input':
146+
case 'textInput':
147147
return (
148148
<>
149149
<Form.Item label={t('maxLength')} name={['appearance', 'maxLength']}>
@@ -236,7 +236,7 @@ const InputParamModal = (props) => {
236236
</>
237237
);
238238

239-
case 'number':
239+
case 'numberInput':
240240
return (
241241
<>
242242
<Row gutter={16}>
@@ -392,7 +392,7 @@ const InputParamModal = (props) => {
392392
form={form}
393393
layout='vertical'
394394
initialValues={{
395-
fieldType: 'input',
395+
fieldType: 'textInput',
396396
required: true,
397397
visible: true,
398398
}}

0 commit comments

Comments
 (0)