diff --git a/ui/src/api/type/function-lib.ts b/ui/src/api/type/function-lib.ts index fcc660368..2c5efe254 100644 --- a/ui/src/api/type/function-lib.ts +++ b/ui/src/api/type/function-lib.ts @@ -1,10 +1,11 @@ interface functionLibData { id?: String - name: String - desc: String + name?: String + desc?: String code?: String - permission_type: 'PRIVATE' | 'PUBLIC' + permission_type?: 'PRIVATE' | 'PUBLIC' input_field_list?: Array + is_active?: Boolean } export type { functionLibData } diff --git a/ui/src/views/application/index.vue b/ui/src/views/application/index.vue index 913a4836d..839f9b81b 100644 --- a/ui/src/views/application/index.vue +++ b/ui/src/views/application/index.vue @@ -222,7 +222,7 @@ onMounted(() => { .status-tag { position: absolute; right: 16px; - top: 20px; + top: 13px; } } .dropdown-custom-switch { diff --git a/ui/src/views/dataset/index.vue b/ui/src/views/dataset/index.vue index 4cc161389..001a1eca4 100644 --- a/ui/src/views/dataset/index.vue +++ b/ui/src/views/dataset/index.vue @@ -198,7 +198,7 @@ onMounted(() => { .delete-button { position: absolute; right: 12px; - top: 18px; + top: 13px; height: auto; } .footer-content { diff --git a/ui/src/views/function-lib/component/FunctionFormDrawer.vue b/ui/src/views/function-lib/component/FunctionFormDrawer.vue index 15d49c52f..92da6eeb9 100644 --- a/ui/src/views/function-lib/component/FunctionFormDrawer.vue +++ b/ui/src/views/function-lib/component/FunctionFormDrawer.vue @@ -19,7 +19,7 @@ placeholder="请输入函数名称" maxlength="64" show-word-limit - @blur="form.name = form.name.trim()" + @blur="form.name = form.name?.trim()" /> @@ -30,10 +30,10 @@ maxlength="128" show-word-limit :autosize="{ minRows: 3 }" - @blur="form.desc = form.desc.trim()" + @blur="form.desc = form.desc?.trim()" /> - + @@ -207,7 +207,8 @@ watch(visible, (bool) => { }) const rules = reactive({ - name: [{ required: true, message: '请输入函数名称', trigger: 'blur' }] + name: [{ required: true, message: '请输入函数名称', trigger: 'blur' }], + permission_type: [{ required: true, message: '请选择', trigger: 'change' }] }) function openCodemirrorDialog() { diff --git a/ui/src/views/function-lib/index.vue b/ui/src/views/function-lib/index.vue index 636a84334..8f1cee664 100644 --- a/ui/src/views/function-lib/index.vue +++ b/ui/src/views/function-lib/index.vue @@ -11,7 +11,11 @@ clearable /> -
+
- +
+ 公用 + 私有 +
@@ -89,6 +107,7 @@ const paginationConfig = reactive({ const searchValue = ref('') const title = ref('') +const changeStateloading = ref(false) function openCreateDialog(data?: any) { title.value = data ? '编辑函数' : '创建函数' @@ -102,6 +121,33 @@ function searchHandle() { getList() } +function changeState(bool: Boolean, row: any) { + if (!bool) { + MsgConfirm( + `是否禁用函数:${row.name} ?`, + `禁用后,引用了该函数的应用提问时会报错 ,请谨慎操作。`, + { + confirmButtonText: '禁用', + confirmButtonClass: 'danger' + } + ) + .then(() => { + const obj = { + is_active: bool + } + functionLibApi.putFunctionLib(row.id, obj, changeStateloading).then((res) => {}) + }) + .catch(() => { + row.is_active = true + }) + } else { + const obj = { + is_active: bool + } + functionLibApi.putFunctionLib(row.id, obj, changeStateloading).then((res) => {}) + } +} + function deleteFunctionLib(row: any) { MsgConfirm( `是否删除函数:${row.name} ?`, @@ -155,4 +201,13 @@ onMounted(() => { getList() }) - +