diff --git a/assets/javascripts/discourse/components/param-input-form.gjs b/assets/javascripts/discourse/components/param-input-form.gjs
index 4b28313d..fa09833d 100644
--- a/assets/javascripts/discourse/components/param-input-form.gjs
+++ b/assets/javascripts/discourse/components/param-input-form.gjs
@@ -100,46 +100,34 @@ function validationOf(info) {
}
}
+const components = {
+ int:
+ <@field.Input @type="number" name={{@info.identifier}} />
+ ,
+ boolean: <@field.Checkbox name={{@info.identifier}} />,
+ boolean_three: BooleanThree,
+ category_id: CategoryIdInput, // TODO
+ user_id: UserIdInput,
+ user_list: UserListInput,
+ group_list: GroupInput,
+ date:
+ <@field.Input @type="date" name={{@info.identifier}} />
+ ,
+ time:
+ <@field.Input @type="time" name={{@info.identifier}} />
+ ,
+ datetime:
+ <@field.Input @type="datetime-local" name={{@info.identifier}} />
+ ,
+ default: <@field.Input name={{@info.identifier}} />,
+};
+
function componentOf(info) {
let type = layoutMap[info.type] || "generic";
if (info.nullable && type === "boolean") {
type = "boolean_three";
}
- switch (type) {
- case "int":
- return
- <@field.Input @type="number" name={{@info.identifier}} />
- ;
- case "boolean":
- return <@field.Checkbox name={{@info.identifier}} />;
- case "boolean_three":
- return BooleanThree;
- case "category_id":
- // TODO
- return CategoryIdInput;
- case "user_id":
- return UserIdInput;
- case "user_list":
- return UserListInput;
- case "group_list":
- return GroupInput;
- case "date":
- return
- <@field.Input @type="date" name={{@info.identifier}} />
- ;
- case "time":
- return
- <@field.Input @type="time" name={{@info.identifier}} />
- ;
- case "datetime":
- return
- <@field.Input @type="datetime-local" name={{@info.identifier}} />
- ;
- case "bigint":
- case "string":
- default:
- return <@field.Input name={{@info.identifier}} />;
- }
+ return components[type] || components.default;
}
export default class ParamInputForm extends Component {