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
2 changes: 2 additions & 0 deletions frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
"Details": "Details"
},
"variables": {
"please_select_date": "Please select a date",
"number_variable_error": "Please enter the correct numerical range.",
"built_in": "Built-in",
"normal_value": "Normal value",
"​​cannot_be_empty": "Variable values ​​cannot be empty.",
Expand Down
4 changes: 3 additions & 1 deletion frontend/src/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"return_to_view": "화면으로 돌아가기"
},
"variables": {
"please_select_date": "날짜를 선택하십시오",
"number_variable_error": "올바른 숫자 범위를 입력하십시오.",
"built_in": "내장형",
"normal_value": "정상값",
"​​cannot_be_empty": "변수 값은 비어 있을 수 없습니다.",
Expand Down Expand Up @@ -943,4 +945,4 @@
"to_doc": "API 보기",
"trigger_limit": "최대 {0}개의 API 키 생성 지원"
}
}
}
2 changes: 2 additions & 0 deletions frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
"return_to_view": "返回查看"
},
"variables": {
"please_select_date": "请选择日期",
"number_variable_error": "请输入正确的数值范围",
"built_in": "已内置",
"normal_value": "常规值",
"​​cannot_be_empty": "变量值不能为空",
Expand Down
1 change: 1 addition & 0 deletions frontend/src/views/chat/ExecutionDetails.vue
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ defineExpose({
border: 1px solid #dee0e3;
padding: 16px;
margin-bottom: 8px;
cursor: pointer;

.header {
display: flex;
Expand Down
24 changes: 11 additions & 13 deletions frontend/src/views/system/user/User.vue
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,9 @@
v-for="item in variables"
:key="item.id"
:label="item.name"
:disabled="
state.form.system_variables.map((ele: any) => ele.variableId).includes(item.id)
"
:value="item.id"
>
<div style="width: 100%; display: flex; align-items: center">
Expand Down Expand Up @@ -434,27 +437,25 @@
>
</el-option>
</el-select>
<el-input
<el-input-number
v-else-if="
variableValueMap[state.form.system_variables[index].variableId].var_type ===
'number'
"
v-model.number="state.form.system_variables[index].variableValue"
style="width: 236px"
:placeholder="$t('variables.please_enter_value')"
autocomplete="off"
maxlength="50"
clearable
max="10000000000000000"
controls-position="right"
/>
<el-date-picker
v-else
v-model="state.form.system_variables[index].variableValues"
type="daterange"
style="max-width: 236px"
type="date"
style="width: 236px"
value-format="YYYY-MM-DD"
range-separator=""
:start-placeholder="$t('variables.start_date')"
:end-placeholder="$t('variables.end_date')"
:placeholder="$t('variables.please_select_date')"
/>
<el-tooltip
:offset="14"
Expand Down Expand Up @@ -1096,12 +1097,9 @@ const validateSystemVariables = () => {

if (obj.var_type === 'datetime') {
const [min, max] = obj.value
const [minVal, maxVal] = ele.variableValues
if (
+new Date(minVal) > +new Date(max) ||
+new Date(maxVal) < +new Date(min) ||
+new Date(maxVal) > +new Date(max) ||
+new Date(minVal) < +new Date(min)
+new Date(ele.variableValues) > +new Date(max) ||
+new Date(ele.variableValues) < +new Date(min)
) {
ElMessage.error(
t('variables.1_to_100_de', {
Expand Down
20 changes: 19 additions & 1 deletion frontend/src/views/system/variables/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,12 @@ const validateValue = (_: any, value: any, callback: any) => {
}
return
}
if (value.some((ele: any) => ele === '')) {
if (var_type === 'datetime') {
if (value === null) {
callback(new Error(t('datasource.please_enter') + t('common.empty') + t('variables.date')))
}
}
if (value.some((ele: any) => ele === '' || ele === null)) {
callback(
new Error(
t('datasource.please_enter') +
Expand Down Expand Up @@ -237,6 +242,17 @@ const saveHandler = () => {
obj.value = [...new Set(obj.value)]
}

if (obj.var_type === 'number') {
const [min = 0, max = 0] = obj.value
if (min > max) {
ElMessage({
type: 'error',
message: t('variables.number_variable_error'),
})
return
}
}

variablesApi.save(obj).then(() => {
ElMessage({
type: 'success',
Expand Down Expand Up @@ -553,12 +569,14 @@ const handleCurrentChange = (val: number) => {
v-model.number="pageForm.value[0]"
:placeholder="$t('variables.please_enter_value')"
clearable
max="10000000000000000"
controls-position="right"
/>
<span class="ed-range-separator separator"></span>
<el-input-number
v-model.number="pageForm.value[1]"
:placeholder="$t('variables.please_enter_value')"
max="10000000000000000"
clearable
controls-position="right"
/>
Expand Down