fix(web): hide duplicate connection mode control (#2621)

* fix(web): hide duplicate connection mode control

* fix(web): restore event processor guide target

---------

Co-authored-by: RockChinQ <[email protected]>
This commit is contained in:
Dongchuan Fu
2026-10-09 00:35:00 +08:00
committed by GitHub
co-authored by RockChinQ
parent ec3a396f1d
commit 4c7592887d
5 changed files with 46 additions and 2 deletions
@@ -31,7 +31,10 @@ export default function PluginProcessorSettings({
},
});
return (
<div className="w-[20rem] max-w-[calc(100vw-8rem)]">
<div
id="event-processor-component"
className="w-[20rem] max-w-[calc(100vw-8rem)]"
>
<RunnerSelect
usage="event"
options={options}
@@ -567,6 +567,14 @@ const BotForm = forwardRef<BotFormHandle, BotFormProps>(function BotForm(
[adapterNameToDynamicConfigMap, currentAdapter],
);
const connectionModeControllerNames = useMemo(() => {
if (supportedConnectionModes.length <= 1) return [];
const webhookField = dynamicFormConfigList.find(
(item) => item.type === DynamicFormItemType.WEBHOOK_URL,
);
return webhookField?.show_if?.field ? [webhookField.show_if.field] : [];
}, [dynamicFormConfigList, supportedConnectionModes.length]);
const botGuideSteps = useMemo<GuidedTourStep[]>(() => {
const steps: GuidedTourStep[] = [];
@@ -1155,6 +1163,7 @@ const BotForm = forwardRef<BotFormHandle, BotFormProps>(function BotForm(
<div data-guide="bot-adapter-parameters">
<DynamicFormComponent
itemConfigList={dynamicFormConfigList}
hiddenItemNames={connectionModeControllerNames}
initialValues={currentAdapterConfig}
onSubmit={(values) => {
form.setValue('adapter_config', values, {
@@ -441,6 +441,7 @@ export default function DynamicFormComponent({
systemContext,
onValidate,
renderItem,
hiddenItemNames,
}: {
itemConfigList: IDynamicFormItemSchema[];
onSubmit?: (val: object) => unknown;
@@ -463,6 +464,8 @@ export default function DynamicFormComponent({
formValues: Record<string, unknown>;
setFormValue: (name: string, value: unknown) => void;
}) => ReactNode | undefined;
/** Fields retained in form state but omitted from the rendered form. */
hiddenItemNames?: readonly string[];
}) {
const isInitialMount = useRef(true);
const previousInitialValues = useRef(initialValues);
@@ -628,6 +631,7 @@ export default function DynamicFormComponent({
externalDependentValues={externalDependentValues}
systemContext={systemContext}
renderItem={renderItem}
hiddenItemNames={hiddenItemNames}
/>
);
}
@@ -661,6 +665,7 @@ function DynamicFormFieldList({
externalDependentValues,
systemContext,
renderItem,
hiddenItemNames,
}: DynamicFormFieldsProps) {
type FormValues = Record<string, any>;
const { t, i18n } = useTranslation();
@@ -725,6 +730,8 @@ function DynamicFormFieldList({
/>
{itemConfigList.map((config, index) => {
if (hiddenItemNames?.includes(config.name)) return null;
// Create a normalized config with type converted to frontend format
const normalizedConfig = {
...config,