perf: i18n System Settings -> General,Org,Notifications

This commit is contained in:
Bai
2024-05-20 18:39:12 +08:00
parent cee00b0382
commit 2ffcf7bd26
17 changed files with 77 additions and 172 deletions

View File

@@ -6,7 +6,7 @@
<div style="height: 100%"> <div style="height: 100%">
<el-tabs <el-tabs
v-if="tabIndices.length > 0" v-if="tabIndices.length > 1"
slot="submenu" slot="submenu"
v-model="iActiveMenu" v-model="iActiveMenu"
class="page-submenu" class="page-submenu"

View File

@@ -24,7 +24,7 @@ export default {
name: 'Basic', name: 'Basic',
component: () => import('@/views/settings/Basic'), component: () => import('@/views/settings/Basic'),
meta: { meta: {
title: i18n.t('Basic'), title: i18n.t('BasicSettings'),
icon: 'basic', icon: 'basic',
permissions: ['settings.view_setting'] permissions: ['settings.view_setting']
} }
@@ -414,7 +414,7 @@ export default {
path: '/settings/tasks', path: '/settings/tasks',
component: empty, component: empty,
meta: { meta: {
title: i18n.t('TaskList'), title: i18n.t('SystemTasks'),
icon: 'tasks', icon: 'tasks',
permissions: ['ops.view_celerytask'] permissions: ['ops.view_celerytask']
}, },
@@ -424,7 +424,7 @@ export default {
name: 'TaskList', name: 'TaskList',
component: () => import('@/views/settings/Task/index.vue'), component: () => import('@/views/settings/Task/index.vue'),
meta: { meta: {
title: i18n.t('TaskList'), title: i18n.t('SystemTasks'),
permissions: ['ops.view_celerytask'] permissions: ['ops.view_celerytask']
} }
}, },

View File

@@ -20,7 +20,7 @@ export default {
[ [
this.$t('Basic'), this.$t('Basic'),
[ [
'FORGOT_PASSWORD_URL', 'LOGIN_REDIRECT_MSG_ENABLED' 'EMAIL_SUFFIX', 'FORGOT_PASSWORD_URL', 'LOGIN_REDIRECT_MSG_ENABLED'
] ]
] ]
], ],

View File

@@ -24,25 +24,13 @@ export default {
data() { data() {
return { return {
fields: [ fields: [
[ [this.$t('Basic'), ['SITE_URL']], // 'USER_GUIDE_URL',]
this.$t('BasicInfo'), [ [this.$t('Navigation'), ['HELP_DOCUMENT_URL', 'HELP_SUPPORT_URL']]
'SITE_URL' // 'USER_GUIDE_URL',
]
],
[this.$t('NavHelp'), [
'HELP_DOCUMENT_URL', 'HELP_SUPPORT_URL'
]]
], ],
fieldsMeta: { fieldsMeta: {
SITE_URL: { SITE_URL: {
rules: [rules.Required] rules: [rules.Required],
}, helpText: this.$t('SiteURLTip')
HELP_DOCUMENT_URL: {
helpText: this.$t('HelpDocumentTip')
},
HELP_SUPPORT_URL: {
helpText: this.$t('HelpSupportTip')
} }
}, },
successUrl: { name: 'Basic' }, successUrl: { name: 'Basic' },

View File

@@ -1,11 +1,11 @@
<template> <template>
<div> <div>
<el-button size="mini" type="primary" @click="visible = !visible"> {{ $t("Setting") }} </el-button> <el-button size="mini" type="primary" icon="el-icon-setting" @click="visible = !visible"> {{ $t("Settings...") }} </el-button>
<Dialog <Dialog
v-if="visible" v-if="visible"
:show-cancel="false" :show-cancel="false"
:show-confirm="false" :show-confirm="false"
:title="$tc('CreateUserSetting')" :title="$tc('Template')"
:visible.sync="visible" :visible.sync="visible"
width="70%" width="70%"
@confirm="onConfirm()" @confirm="onConfirm()"
@@ -21,7 +21,7 @@ import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm
import { Dialog } from '@/components' import { Dialog } from '@/components'
export default { export default {
name: 'EmailContent', name: 'EmailTemplate',
components: { components: {
GenericCreateUpdateForm, GenericCreateUpdateForm,
Dialog Dialog
@@ -30,8 +30,12 @@ export default {
return { return {
visible: false, visible: false,
fields: [ fields: [
'EMAIL_CUSTOM_USER_CREATED_SUBJECT', 'EMAIL_CUSTOM_USER_CREATED_HONORIFIC', [this.$t('General'), ['EMAIL_SUBJECT_PREFIX']],
'EMAIL_CUSTOM_USER_CREATED_BODY' [this.$t('User creation'),
[
'EMAIL_CUSTOM_USER_CREATED_SUBJECT', 'EMAIL_CUSTOM_USER_CREATED_HONORIFIC', 'EMAIL_CUSTOM_USER_CREATED_BODY'
]
]
], ],
successUrl: { name: 'Settings', params: { activeMenu: 'EmailContent' }}, successUrl: { name: 'Settings', params: { activeMenu: 'EmailContent' }},
fieldsMeta: { fieldsMeta: {

View File

@@ -1,94 +0,0 @@
<template>
<div>
<el-button size="mini" type="primary" @click="visible = !visible"> {{ $t("Setting") }} </el-button>
<Dialog
v-if="visible"
:destroy-on-close="true"
:show-cancel="false"
:show-confirm="false"
:title="$tc('SMTP')"
:visible.sync="visible"
width="70%"
@confirm="onConfirm()"
>
<GenericCreateUpdateForm v-bind="$data" />
</Dialog>
</div>
</template>
<script>
import GenericCreateUpdateForm from '@/layout/components/GenericCreateUpdateForm/index.vue'
import { Dialog } from '@/components'
import { UpdateToken } from '@/components/Form/FormFields'
export default {
name: 'SMTP',
components: {
GenericCreateUpdateForm,
Dialog
},
data() {
return {
visible: false,
encryptedFields: ['EMAIL_HOST_PASSWORD'],
fields: [
[
this.$t('BasicInfo'),
[
'EMAIL_PROTOCOL', 'EMAIL_HOST', 'EMAIL_PORT', 'EMAIL_HOST_USER',
'EMAIL_HOST_PASSWORD', 'EMAIL_USE_SSL', 'EMAIL_USE_TLS'
]
]
],
successUrl: { name: 'Settings', params: { activeMenu: 'EmailContent' }},
fieldsMeta: {
EMAIL_PORT: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
EMAIL_HOST_PASSWORD: {
component: UpdateToken
},
'EMAIL_CUSTOM_USER_CREATED_BODY': {
el: {
type: 'textarea',
rows: 3
}
},
EMAIL_USE_SSL: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
EMAIL_USE_TLS: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
}
},
url: '/api/v1/settings/setting/?category=email',
submitMethod() {
return 'patch'
},
onConfirm() {
},
cleanFormValue(data) {
if (!data['EMAIL_HOST_PASSWORD']) {
delete data['EMAIL_HOST_PASSWORD']
}
if (data['EMAIL_USE_SSL'] === null) {
delete data['EMAIL_USE_SSL']
}
if (data['EMAIL_USE_TLS'] === null) {
delete data['EMAIL_USE_TLS']
}
if (data['EMAIL_PORT'] === null) {
delete data['EMAIL_PORT']
}
return data
}
}
},
methods: {}
}
</script>
<style scoped>
</style>

View File

@@ -6,15 +6,14 @@
v-bind="$data" v-bind="$data"
/> />
</IBox> </IBox>
</template> </template>
<script> <script>
import { IBox } from '@/components' import { IBox } from '@/components'
import { GenericCreateUpdateForm } from '@/layout/components' import { GenericCreateUpdateForm } from '@/layout/components'
import { testEmailSetting } from '@/api/settings' import { testEmailSetting } from '@/api/settings'
import EmailContent from './EmailContent.vue' import EmailTemplate from './EmailTemplate.vue'
import SMTP from './SMTP.vue' import { UpdateToken } from '@/components/Form/FormFields'
import rules from '@/components/Form/DataForm/rules' import rules from '@/components/Form/DataForm/rules'
export default { export default {
@@ -26,39 +25,41 @@ export default {
data() { data() {
const vm = this const vm = this
return { return {
encryptedFields: ['EMAIL_HOST_PASSWORD'],
fields: [ fields: [
[ [this.$t('Server'), [
this.$t('Server'), 'EMAIL_PROTOCOL',
[ 'EMAIL_HOST',
'SMTP' 'EMAIL_PORT',
] 'EMAIL_HOST_USER',
], 'EMAIL_HOST_PASSWORD',
[ 'EMAIL_FROM',
this.$t('MailSend'), 'EMAIL_USE_SSL',
[ 'EMAIL_USE_TLS'
'EMAIL_FROM', 'EMAIL_SUBJECT_PREFIX'
]
],
[
this.$t('EmailContent'),
[
'CREATE_USER_MSG'
]
],
[
this.$t('Other'),
[
'EMAIL_RECIPIENT', 'EMAIL_SUFFIX'
]
] ]
],
[this.$t('Other'), ['CREATE_USER_MSG']],
[this.$t('Test'), ['EMAIL_RECIPIENT']]
], ],
fieldsMeta: { fieldsMeta: {
EMAIL_PORT: {
hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
},
EMAIL_HOST_PASSWORD: {
component: UpdateToken
},
EMAIL_HOST_USER: { EMAIL_HOST_USER: {
rules: [ rules: [
rules.EmailCheck, rules.EmailCheck,
rules.Required rules.Required
] ]
}, },
EMAIL_CUSTOM_USER_CREATED_BODY: {
el: {
type: 'textarea',
rows: 3
}
},
EMAIL_FROM: { EMAIL_FROM: {
rules: [ rules: [
rules.EmailCheck rules.EmailCheck
@@ -69,13 +70,16 @@ export default {
rules.EmailCheck rules.EmailCheck
] ]
}, },
CREATE_USER_MSG: { EMAIL_USE_SSL: {
label: this.$t('CreateUserSetting'), hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
component: EmailContent
}, },
SMTP: { EMAIL_USE_TLS: {
label: this.$t('SMTP'), hidden: (formValue) => formValue.EMAIL_PROTOCOL !== 'smtp'
component: SMTP },
CREATE_USER_MSG: {
label: this.$t('EmailTemplate'),
component: EmailTemplate,
helpTip: this.$t('EmailTemplateHelpTip')
} }
}, },
hasDetailInMsg: false, hasDetailInMsg: false,
@@ -104,6 +108,9 @@ export default {
if (data[key] === null) { if (data[key] === null) {
delete data[key] delete data[key]
} }
if (!data['EMAIL_HOST_PASSWORD']) {
delete data['EMAIL_HOST_PASSWORD']
}
} }
) )
return data return data

View File

@@ -1,6 +1,6 @@
<template> <template>
<div> <div>
<el-button size="mini" type="primary" @click="visible=true">{{ $t('Setting') }}</el-button> <el-button size="mini" type="primary" icon="el-icon-setting" @click="visible=true">{{ $t('Settings...') }}</el-button>
<Dialog <Dialog
v-if="visible" v-if="visible"
:destroy-on-close="true" :destroy-on-close="true"

View File

@@ -39,14 +39,14 @@ export default {
], ],
fields: [ fields: [
[ [
this.$t('BasicInfo'), this.$t('Basic'),
[ [
'CMPP2_HOST', 'CMPP2_PORT', 'CMPP2_SP_ID', 'CMPP2_SP_SECRET', 'CMPP2_SRC_ID', 'CMPP2_SERVICE_ID', 'CMPP2_HOST', 'CMPP2_PORT', 'CMPP2_SP_ID', 'CMPP2_SP_SECRET', 'CMPP2_SRC_ID', 'CMPP2_SERVICE_ID',
'CMPP2_VERIFY_SIGN_NAME', 'CMPP2_VERIFY_TEMPLATE_CODE' 'CMPP2_VERIFY_SIGN_NAME', 'CMPP2_VERIFY_TEMPLATE_CODE'
] ]
], ],
[ [
this.$t('Other'), this.$t('Test'),
[ [
'SMS_TEST_PHONE' 'SMS_TEST_PHONE'
] ]

View File

@@ -37,19 +37,19 @@ export default {
], ],
fields: [ fields: [
[ [
this.$t('BasicInfo'), this.$t('Basic'),
[ [
'ALIBABA_ACCESS_KEY_ID', 'ALIBABA_ACCESS_KEY_SECRET' 'ALIBABA_ACCESS_KEY_ID', 'ALIBABA_ACCESS_KEY_SECRET'
] ]
], ],
[ [
this.$t('VerifySignTmpl'), this.$t('Template'),
[ [
'ALIBABA_VERIFY_SIGN_NAME', 'ALIBABA_VERIFY_TEMPLATE_CODE' 'ALIBABA_VERIFY_SIGN_NAME', 'ALIBABA_VERIFY_TEMPLATE_CODE'
] ]
], ],
[ [
this.$t('Other'), this.$t('Test'),
[ [
'SMS_TEST_PHONE' 'SMS_TEST_PHONE'
] ]

View File

@@ -37,13 +37,13 @@ export default {
], ],
fields: [ fields: [
[ [
this.$t('BasicInfo'), this.$t('Basic'),
[ [
'CUSTOM_SMS_URL', 'CUSTOM_SMS_REQUEST_METHOD', 'CUSTOM_SMS_API_PARAMS' 'CUSTOM_SMS_URL', 'CUSTOM_SMS_REQUEST_METHOD', 'CUSTOM_SMS_API_PARAMS'
] ]
], ],
[ [
this.$t('Other'), this.$t('Test'),
[ [
'SMS_TEST_PHONE' 'SMS_TEST_PHONE'
] ]

View File

@@ -41,7 +41,7 @@ export default {
], ],
fields: [ fields: [
[ [
this.$t('Other'), this.$t('Test'),
[ [
'SMS_TEST_PHONE' 'SMS_TEST_PHONE'
] ]

View File

@@ -39,19 +39,19 @@ export default {
], ],
fields: [ fields: [
[ [
this.$t('BasicInfo'), this.$t('Basic'),
[ [
'HUAWEI_APP_KEY', 'HUAWEI_APP_SECRET', 'HUAWEI_SMS_ENDPOINT' 'HUAWEI_APP_KEY', 'HUAWEI_APP_SECRET', 'HUAWEI_SMS_ENDPOINT'
] ]
], ],
[ [
this.$t('VerifySignTmpl'), this.$t('Template'),
[ [
'HUAWEI_SIGN_CHANNEL_NUM', 'HUAWEI_VERIFY_SIGN_NAME', 'HUAWEI_VERIFY_TEMPLATE_CODE' 'HUAWEI_SIGN_CHANNEL_NUM', 'HUAWEI_VERIFY_SIGN_NAME', 'HUAWEI_VERIFY_TEMPLATE_CODE'
] ]
], ],
[ [
this.$t('Other'), this.$t('Test'),
[ [
'SMS_TEST_PHONE' 'SMS_TEST_PHONE'
] ]

View File

@@ -37,19 +37,19 @@ export default {
], ],
fields: [ fields: [
[ [
this.$t('BasicInfo'), this.$t('Basic'),
[ [
'TENCENT_SECRET_ID', 'TENCENT_SECRET_KEY', 'TENCENT_SDKAPPID' 'TENCENT_SECRET_ID', 'TENCENT_SECRET_KEY', 'TENCENT_SDKAPPID'
] ]
], ],
[ [
this.$t('VerifySignTmpl'), this.$t('Template'),
[ [
'TENCENT_VERIFY_SIGN_NAME', 'TENCENT_VERIFY_TEMPLATE_CODE' 'TENCENT_VERIFY_SIGN_NAME', 'TENCENT_VERIFY_TEMPLATE_CODE'
] ]
], ],
[ [
this.$t('Other'), this.$t('Test'),
[ [
'SMS_TEST_PHONE' 'SMS_TEST_PHONE'
] ]

View File

@@ -30,7 +30,7 @@ export default {
] ]
], ],
[ [
this.$t('SMSProvider'), [ this.$t('Provider'), [
'ALIYUN', 'QCLOUD', 'HUAWEICLOUD', 'CMPP2', 'SMSCustom', 'SMSFileCustom' 'ALIYUN', 'QCLOUD', 'HUAWEICLOUD', 'CMPP2', 'SMSCustom', 'SMSFileCustom'
] ]
] ]

View File

@@ -36,7 +36,7 @@
<el-table-column :label="$tc('Actions')" width="200"> <el-table-column :label="$tc('Actions')" width="200">
<template v-slot="scope"> <template v-slot="scope">
<el-button v-if="!scope.row.children" type="small" @click="onOpenDialog(scope.row)"> <el-button v-if="!scope.row.children" type="small" @click="onOpenDialog(scope.row)">
{{ $t('ChangeReceiver') }} {{ $t('EditRecipient') }}
</el-button> </el-button>
</template> </template>
</el-table-column> </el-table-column>
@@ -45,7 +45,7 @@
<SelectDialog <SelectDialog
v-if="dialogVisible" v-if="dialogVisible"
:selected-users="dialogSelectedUsers" :selected-users="dialogSelectedUsers"
:title="$tc('ChangeReceiver')" :title="$tc('EditRecipient')"
:visible.sync="dialogVisible" :visible.sync="dialogVisible"
@cancel="dialogVisible=false" @cancel="dialogVisible=false"
@submit="onDialogSelectSubmit" @submit="onDialogSelectSubmit"

View File

@@ -3,7 +3,7 @@
<GenericListPage :header-actions="headerActions" :table-config="tableConfig" /> <GenericListPage :header-actions="headerActions" :table-config="tableConfig" />
<Dialog <Dialog
:show-buttons="false" :show-buttons="false"
:title="$tc('Setting')" :title="$tc('General')"
:visible.sync="visible" :visible.sync="visible"
> >
<GenericCreateUpdateForm v-bind="form" @submitSuccess="visible=false" /> <GenericCreateUpdateForm v-bind="form" @submitSuccess="visible=false" />
@@ -110,7 +110,7 @@ export default {
canCreate: this.$hasPerm('orgs.add_organization'), canCreate: this.$hasPerm('orgs.add_organization'),
extraActions: [ extraActions: [
{ {
title: this.$t('Setting'), title: this.$t('Settings...'),
icon: 'el-icon-setting', icon: 'el-icon-setting',
callback: () => { callback: () => {
this.visible = true this.visible = true