Skip to content

Beautiful Open-Source Form Builder

Refactor FormIntegrationsRequest and enhance IntegrationWrapper component

JhumanJ80fd49624092
diff --git a/api/app/Http/Requests/Integration/FormIntegrationsRequest.php b/api/app/Http/Requests/Integration/FormIntegrationsRequest.php
index d4aa76b3e..70b269743 100644
--- a/api/app/Http/Requests/Integration/FormIntegrationsRequest.php
+++ b/api/app/Http/Requests/Integration/FormIntegrationsRequest.php
@@ -50,11 +50,6 @@ class FormIntegrationsRequest extends FormRequest
'data' => [
'present',
'array',
- function ($attribute, $value, $fail) {
- if (empty($value)) {
- $fail('The data field cannot be empty.');
- }
- }
],
'status' => ['required', Rule::in([FormIntegration::STATUS_ACTIVE, FormIntegration::STATUS_INACTIVE])],
'logic' => [new IntegrationLogicRule()],
diff --git a/client/components/open/integrations/components/IntegrationWrapper.vue b/client/components/open/integrations/components/IntegrationWrapper.vue
index 5c58f5ddf..ad7b013a6 100644
--- a/client/components/open/integrations/components/IntegrationWrapper.vue
+++ b/client/components/open/integrations/components/IntegrationWrapper.vue
@@ -37,20 +37,28 @@
</div>
<div class="flex-grow">
<h3 class="font-semibold">
- Logic
+ {{ hasLogic ? 'Logic configured' : 'Add logic' }}
</h3>
<p class="text-neutral-500 text-xs">
- Only run integration when a condition is met
+ {{ hasLogic ? 'Conditions control when integration runs' : 'Set conditions for when to run' }}
</p>
</div>
</div>
</template>
- <condition-editor
- ref="filter-editor"
- v-model="modelValue.logic"
- class="mt-4 rounded-md integration-logic"
- :form="form"
- />
+
+
+ <p class="text-xs font-medium text-gray-600 mb-2 mt-4">When should this integration run?</p>
+ <p class="text-neutral-500 text-xs mb-3">
+ Set <span class="font-semibold">conditions that control when this integration executes</span>. Leave empty to always run.
+ </p>
+ <div class="p-3 border border-gray-200 rounded-lg bg-gray-50/50 mt-4">
+ <condition-editor
+ ref="filter-editor"
+ v-model="modelValue.logic"
+ class="integration-logic"
+ :form="form"
+ />
+ </div>
</collapse>
</div>
</slot>
@@ -78,6 +86,13 @@ const statusToggle = computed({
props.modelValue.status = value ? 'active' : 'inactive'
}
})
+
+const hasLogic = computed(() => {
+ return props.modelValue.logic && (
+ props.modelValue.logic.children?.length > 0 ||
+ props.modelValue.logic.identifier
+ )
+})
</script>
<style lang="scss">