diff --git a/packages/business/src/locale/lang/en.js b/packages/business/src/locale/lang/en.js index 2bed168f97..43c5ba1220 100644 --- a/packages/business/src/locale/lang/en.js +++ b/packages/business/src/locale/lang/en.js @@ -1114,5 +1114,10 @@ export default { 'Are you sure to clear the check condition that the index field is empty? ', packages_business_components_conditionbox_suoyinziduanwei: 'The index field is empty', packages_business_components_conditionbox_yijianqingchusuo: - 'One key to clear the condition that the index field is empty' + 'One key to clear the condition that the index field is empty', + packages_business_external_storage_list_yanzhengfuwuduan: 'Verify server certificate', + packages_business_external_storage_list_siyaomima: 'Private key password', + packages_business_external_storage_list_kehuduansiyao: 'Client private key', + packages_business_external_storage_list_zhengshubanfaji: 'Certificate Authority', + packages_business_external_storage_list_shiyongTls: 'Connect using TLS/SSL' } diff --git a/packages/business/src/locale/lang/zh-CN.js b/packages/business/src/locale/lang/zh-CN.js index 4efa676572..a85ad973fd 100644 --- a/packages/business/src/locale/lang/zh-CN.js +++ b/packages/business/src/locale/lang/zh-CN.js @@ -1063,5 +1063,10 @@ export default { packages_business_shared_cache_list_qingxianxiugaiwai: '外存不存在,请先修改外存配置后,再启动。', packages_business_components_conditionbox_shifouquerenqing: '是否确认清除索引字段为空的校验条件?', packages_business_components_conditionbox_suoyinziduanwei: '索引字段为空', - packages_business_components_conditionbox_yijianqingchusuo: '一键清除索引字段为空的条件' + packages_business_components_conditionbox_yijianqingchusuo: '一键清除索引字段为空的条件', + packages_business_external_storage_list_yanzhengfuwuduan: '验证服务端证书', + packages_business_external_storage_list_siyaomima: '私钥密码', + packages_business_external_storage_list_kehuduansiyao: '客户端私钥', + packages_business_external_storage_list_zhengshubanfaji: '证书颁发机构', + packages_business_external_storage_list_shiyongTls: '使用 TLS/SSL 连接' } diff --git a/packages/business/src/locale/lang/zh-TW.js b/packages/business/src/locale/lang/zh-TW.js index 05b5194a49..733d540024 100644 --- a/packages/business/src/locale/lang/zh-TW.js +++ b/packages/business/src/locale/lang/zh-TW.js @@ -1055,5 +1055,10 @@ export default { packages_business_shared_cache_list_qingxianxiugaiwai: '外存不存在,請先修改外存配置後,再啟動。', packages_business_components_conditionbox_shifouquerenqing: '是否確認清除索引字段為空的校驗條件? ', packages_business_components_conditionbox_suoyinziduanwei: '索引字段為空', - packages_business_components_conditionbox_yijianqingchusuo: '一鍵清除索引字段為空的條件' + packages_business_components_conditionbox_yijianqingchusuo: '一鍵清除索引字段為空的條件', + packages_business_external_storage_list_yanzhengfuwuduan: '驗證服務端證書', + packages_business_external_storage_list_siyaomima: '私鑰密碼', + packages_business_external_storage_list_kehuduansiyao: '客戶端私鑰', + packages_business_external_storage_list_zhengshubanfaji: '證書頒發機構', + packages_business_external_storage_list_shiyongTls: '使用 TLS/SSL 連接' } diff --git a/packages/business/src/views/external-storage/List.vue b/packages/business/src/views/external-storage/List.vue index 1b30675a63..a4f7713d4c 100644 --- a/packages/business/src/views/external-storage/List.vue +++ b/packages/business/src/views/external-storage/List.vue @@ -95,6 +95,15 @@ resize="none" > + + + @@ -154,9 +163,10 @@ import { externalStorageApi } from '@tap/api' import { TablePage, EXTERNAL_STORAGE_TYPE_MAP } from '@tap/business' import { FilterBar, Drawer } from '@tap/component' import { openUrl } from '@tap/shared' +import { SchemaToForm } from '@tap/form' export default { - components: { TablePage, FilterBar, Drawer }, + components: { TablePage, FilterBar, Drawer, SchemaToForm }, data() { return { loading: false, @@ -188,8 +198,10 @@ export default { details: '', info: [], labelWidth: '120px', + schemaLabelWidth: 120, showUsingTaskDialog: false, - usingTasks: [] + usingTasks: [], + schemaData: null } }, computed: { @@ -207,6 +219,76 @@ export default { this.getFilterItems() const { locale } = this.$i18n this.labelWidth = locale === 'en' ? '220px' : '120px' + this.schemaLabelWidth = locale === 'en' ? 220 : 120 + this.schemaData = { + type: 'object', + properties: { + ssl: { + default: false, + 'x-decorator': 'FormItem', + 'x-component': 'Switch', + 'x-reactions': [ + { + fulfill: { + state: { + visible: '{{$self.value===true}}' + } + }, + target: '*(sslKey,sslPass,sslValidate)' + } + ], + 'x-component-props': { + optionType: 'button' + }, + type: 'boolean', + title: i18n.t('packages_business_external_storage_list_shiyongTls'), + 'x-index': 80 + }, + sslCA: { + 'x-decorator': 'FormItem', + 'x-component': 'TextFileReader', + type: 'string', + title: i18n.t('packages_business_external_storage_list_zhengshubanfaji'), + 'x-index': 120, + fileNameField: 'sslCAFile', + required: true + }, + sslKey: { + 'x-decorator': 'FormItem', + 'x-component': 'TextFileReader', + type: 'string', + title: i18n.t('packages_business_external_storage_list_kehuduansiyao'), + 'x-index': 90, + fileNameField: 'sslKeyFile', + required: true + }, + sslPass: { + 'x-decorator': 'FormItem', + 'x-component': 'Password', + type: 'string', + title: i18n.t('packages_business_external_storage_list_siyaomima'), + 'x-index': 100 + }, + sslValidate: { + 'x-decorator': 'FormItem', + 'x-component': 'Switch', + show: false, + 'x-reactions': [ + { + fulfill: { + state: { + visible: '{{$self.value===true}}' + } + }, + target: 'sslCA' + } + ], + type: 'boolean', + title: i18n.t('packages_business_external_storage_list_yanzhengfuwuduan'), + 'x-index': 110 + } + } + } }, methods: { getFilterItems() { @@ -281,37 +363,45 @@ export default { submit() { this.$refs.form.validate(async valid => { if (valid) { - this.loading = true - let { id, name, type, uri, defaultStorage } = this.form - let params = { - id, - name, - type, - uri, - defaultStorage - } - const catchFunc = () => { - this.loading = false - } - if (id) { - await externalStorageApi - .updateById(id, params) - .then(() => { - this.table.fetch() - this.dialogVisible = false - this.loading = false - }) - .catch(catchFunc) - } else { - await externalStorageApi - .post(params) - .then(() => { - this.table.fetch() - this.dialogVisible = false - this.loading = false - }) - .catch(catchFunc) - } + const schemaFormInstance = this.$refs.schemaToForm.getForm?.() + schemaFormInstance?.validate().then(async () => { + let formValues = this.$refs.schemaToForm?.getFormValues?.() + + this.loading = true + let { id, name, type, uri, defaultStorage } = this.form + let params = Object.assign( + { + id, + name, + type, + uri, + defaultStorage + }, + formValues + ) + const catchFunc = () => { + this.loading = false + } + if (id) { + await externalStorageApi + .updateById(id, params) + .then(() => { + this.table.fetch() + this.dialogVisible = false + this.loading = false + }) + .catch(catchFunc) + } else { + await externalStorageApi + .post(params) + .then(() => { + this.table.fetch() + this.dialogVisible = false + this.loading = false + }) + .catch(catchFunc) + } + }) } }) }, @@ -445,4 +535,11 @@ export default { } } } +.scheme-to-form { + ::v-deep { + .formily-element-form-item { + margin-bottom: 18px; + } + } +}