Skip to content

Commit d0540ff

Browse files
committed
fix: [Trigger] After referencing the event request parameters in the agent parameters of an event trigger, and changing the trigger type to a timed trigger, it becomes impossible to input parameter values.
1 parent 6d0ec9d commit d0540ff

File tree

1 file changed

+53
-7
lines changed

1 file changed

+53
-7
lines changed

ui/src/views/trigger/component/ApplicationParameter.vue

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,11 +125,7 @@
125125
</div>
126126
<el-select
127127
:teleported="false"
128-
v-if="
129-
modelValue['api_input_field_list'][f.field] &&
130-
trigger.trigger_type === 'EVENT' &&
131-
trigger.trigger_setting.body.length
132-
"
128+
v-if="modelValue['api_input_field_list'][f.field] && showSource"
133129
v-model="modelValue['api_input_field_list'][f.field].source"
134130
size="small"
135131
style="width: 85px"
@@ -158,13 +154,63 @@
158154
</el-form>
159155
</template>
160156
<script setup lang="ts">
161-
import { computed, ref } from 'vue'
157+
import { computed, ref, watch } from 'vue'
162158
import { type FormInstance } from 'element-plus'
163159
import { t } from '@/locales'
164160
const applicationParameterFormRef = ref<FormInstance>()
165161
const props = defineProps<{ application?: any; modelValue: any; trigger: any }>()
166162
const emit = defineEmits(['update:modelValue'])
167-
163+
const showSource = computed(() => {
164+
return props.trigger.trigger_type === 'EVENT' && props.trigger.trigger_setting.body.length > 0
165+
})
166+
watch(
167+
() => showSource.value,
168+
() => {
169+
if (!showSource.value) {
170+
const parameter: any = { ...props.modelValue }
171+
base_field_list.value.forEach((f) => {
172+
if (!parameter[f.field]) {
173+
parameter[f.field] = { source: 'custom', value: f.default_value }
174+
} else {
175+
parameter[f.field] = { ...parameter[f.field], source: 'custom' }
176+
}
177+
})
178+
api_input_field_list.value.forEach((f) => {
179+
if (!parameter.api_input_field_list) {
180+
parameter['api_input_field_list'] = {}
181+
}
182+
if (!parameter['api_input_field_list'][f.field]) {
183+
parameter['api_input_field_list'][f.field] = {
184+
source: 'custom',
185+
value: f.default_value ? f.default_value : '',
186+
}
187+
} else {
188+
parameter['api_input_field_list'][f.field] = {
189+
...parameter['api_input_field_list'][f.field],
190+
source: 'custom',
191+
}
192+
}
193+
})
194+
user_input_field_list.value.forEach((f) => {
195+
if (!parameter['user_input_field_list']) {
196+
parameter['user_input_field_list'] = {}
197+
}
198+
if (!parameter['user_input_field_list'][f.field]) {
199+
parameter['user_input_field_list'][f.field] = {
200+
source: 'custom',
201+
value: f.default_value ? f.default_value : '',
202+
}
203+
} else {
204+
parameter['user_input_field_list'][f.field] = {
205+
...parameter['user_input_field_list'][f.field],
206+
source: 'custom',
207+
}
208+
}
209+
})
210+
emit('update:modelValue', { ...parameter })
211+
}
212+
},
213+
)
168214
const options = computed(() => {
169215
if (props.trigger.trigger_type === 'EVENT') {
170216
const body = props.trigger.trigger_setting.body

0 commit comments

Comments
 (0)