Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion backend/apps/system/crud/assistant.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,8 @@ def get_ds_from_api(self):
cookies[item['key']] = item['value']
if item['target'] == 'param':
param[item['key']] = item['value']
res = requests.get(url=endpoint, params=param, headers=header, cookies=cookies, timeout=10)
timeout = int(config.get('timeout')) if config.get('timeout') else 10
res = requests.get(url=endpoint, params=param, headers=header, cookies=cookies, timeout=timeout)
if res.status_code == 200:
result_json: dict[any] = json.loads(res.text)
if result_json.get('code') == 0 or result_json.get('code') == 200:
Expand Down
25 changes: 25 additions & 0 deletions frontend/src/views/system/embedded/iframe.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const certificateForm = reactive(cloneDeep(defaultCertificateForm))

const defaultUrlForm = {
endpoint: '',
timeout: 10,
encrypt: false,
aes_key: '',
aes_iv: '',
Expand Down Expand Up @@ -342,6 +343,14 @@ const validateCertificate = (_: any, value: any, callback: any) => {
}
}

const validateTimeout = (_: any, value: any, callback: any) => {
if (value === null) {
callback(new Error(t('datasource.please_enter') + t('common.empty') + t('ds.form.timeout')))
} else {
callback()
}
}

const urlRules = {
endpoint: [
{
Expand All @@ -350,6 +359,13 @@ const urlRules = {
trigger: 'blur',
},
],
timeout: [
{
required: true,
validator: validateTimeout,
trigger: 'change',
},
],
certificate: [
{
required: true,
Expand Down Expand Up @@ -799,6 +815,15 @@ const saveHandler = () => {
autocomplete="off"
/>
</el-form-item>
<el-form-item :label="t('ds.form.timeout')" prop="timeout">
<el-input-number
v-model="urlForm.timeout"
clearable
:min="0"
:max="300"
controls-position="right"
/>
</el-form-item>
<el-form-item prop="AES" class="custom-require">
<template #label>
<span class="custom-require_danger">{{ t('embedded.aes_enable') }}</span>
Expand Down
Loading