Skip to content

Commit 74e9ee8

Browse files
committed
3827 Additional fixes
1 parent 4391818 commit 74e9ee8

File tree

6 files changed

+684
-12
lines changed

6 files changed

+684
-12
lines changed

server/libs/modules/components/form/src/main/java/com/bytechef/component/form/constant/FormConstants.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,6 @@ public class FormConstants {
3232
public static final String FIELD_TYPE = "fieldType";
3333
public static final String FORM = "form";
3434
public static final String FORM_DESCRIPTION = "formDescription";
35-
// public static final String FORM_PATH = "formPath";
3635
public static final String FORM_TITLE = "formTitle";
3736
public static final String IGNORE_BOTS = "ignoreBots";
3837
public static final String INPUTS = "inputs";
@@ -68,7 +67,7 @@ public int getValue() {
6867
return value;
6968
}
7069

71-
public static FieldType valueOf(int value) {
70+
public static FieldType fromValue(int value) {
7271
for (FieldType fieldType : FieldType.values()) {
7372
if (fieldType.value == value) {
7473
return fieldType;

server/libs/modules/components/form/src/main/java/com/bytechef/component/form/trigger/NewFormRequestTrigger.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,6 @@ public class NewFormRequestTrigger {
9191
.label("Form Description")
9292
.description("A subtitle shown under the form title. Use \n or <br> for line breaks.")
9393
.required(false),
94-
// string(FORM_PATH)
95-
// .label("Form Path")
96-
// .description("Custom slug for the form URL path.")
97-
// .required(false),
9894
string(BUTTON_LABEL)
9995
.label("Button Label")
10096
.description("Label for the submit button.")
@@ -159,7 +155,8 @@ public class NewFormRequestTrigger {
159155
.description("The placeholder text.")
160156
.required(false)
161157
.displayCondition("contains({%s,%s,%s,%s,%s}, fieldType)".formatted(
162-
EMAIL_INPUT, INPUT, NUMBER_INPUT, PASSWORD_INPUT, TEXTAREA)),
158+
EMAIL_INPUT.getValue(), INPUT.getValue(), NUMBER_INPUT.getValue(),
159+
PASSWORD_INPUT.getValue(), TEXTAREA.getValue())),
163160
string(DEFAULT_VALUE)
164161
.label("Default value")
165162
.description("Pre-filled or pre-selected value for compatible fields.")
@@ -185,7 +182,7 @@ public class NewFormRequestTrigger {
185182
.required(true)))
186183
.required(false)
187184
.displayCondition(
188-
"contains({%s,%s}, provider)".formatted(RADIO.getValue(), SELECT.getValue())),
185+
"contains({%s,%s}, fieldType)".formatted(RADIO.getValue(), SELECT.getValue())),
189186
bool(MULTIPLE_CHOICE)
190187
.label("Multiple Choice")
191188
.description("Allow multiple selections.")
@@ -203,7 +200,7 @@ public class NewFormRequestTrigger {
203200
.label("Max selection")
204201
.description("Maximum selections allowed.")
205202
.required(false)
206-
.displayCondition("fieldType == %s".formatted(CHECKBOX.getValue())),
203+
.displayCondition("fieldType == %s".formatted(SELECT.getValue())),
207204
bool(REQUIRED)
208205
.label("Required")
209206
.description("Whether this field is required")
@@ -230,7 +227,7 @@ protected static OutputResponse getOutput(
230227
}
231228

232229
Integer fieldTypeInt = (Integer) input.get(FIELD_TYPE);
233-
FieldType fieldType = valueOf(fieldTypeInt);
230+
FieldType fieldType = fromValue(fieldTypeInt);
234231

235232
ModifiableValueProperty<?, ?> property = switch (fieldType) {
236233
case CHECKBOX -> bool(fieldName);
@@ -253,7 +250,7 @@ protected static OutputResponse getOutput(
253250
return OutputResponse.of(
254251
object()
255252
.properties(
256-
number("submittedAt"),
253+
string("submittedAt"),
257254
object("body")
258255
.properties(properties.toArray(new ModifiableValueProperty[0]))));
259256
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* Copyright 2025 ByteChef
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.bytechef.component.form;
18+
19+
import com.bytechef.test.jsonasssert.JsonFileAssert;
20+
import org.junit.jupiter.api.Test;
21+
22+
/**
23+
* @author Ivica Cardic
24+
*/
25+
public class FormComponentHandlerTest {
26+
27+
@Test
28+
public void testGetDefinition() {
29+
JsonFileAssert.assertEquals("definition/form_v1.json", new FormComponentHandler().getDefinition());
30+
}
31+
}

0 commit comments

Comments
 (0)