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
7 changes: 6 additions & 1 deletion packages/business/src/locale/lang/en.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
7 changes: 6 additions & 1 deletion packages/business/src/locale/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 连接'
}
7 changes: 6 additions & 1 deletion packages/business/src/locale/lang/zh-TW.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 連接'
}
163 changes: 130 additions & 33 deletions packages/business/src/views/external-storage/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,15 @@
resize="none"
></ElInput>
</ElFormItem>

<SchemaToForm
v-if="form.type === 'mongodb'"
ref="schemaToForm"
:schema="schemaData"
:colon="true"
:label-width="schemaLabelWidth"
></SchemaToForm>

<ElFormItem :label="$t('packages_business_external_storage_list_sheweimoren')">
<ElSwitch v-model="form.defaultStorage"></ElSwitch>
</ElFormItem>
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -188,8 +198,10 @@ export default {
details: '',
info: [],
labelWidth: '120px',
schemaLabelWidth: 120,
showUsingTaskDialog: false,
usingTasks: []
usingTasks: [],
schemaData: null
}
},
computed: {
Expand All @@ -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() {
Expand Down Expand Up @@ -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)
}
})
}
})
},
Expand Down Expand Up @@ -445,4 +535,11 @@ export default {
}
}
}
.scheme-to-form {
::v-deep {
.formily-element-form-item {
margin-bottom: 18px;
}
}
}
</style>