diff --git a/package.json b/package.json index 3b5d897a8..7552d82bb 100644 --- a/package.json +++ b/package.json @@ -38,7 +38,7 @@ "krry-transfer": "^1.7.3", "less": "^3.10.3", "less-loader": "^5.0.0", - "lodash": "^4.17.15", + "lodash": "^4.17.21", "lodash.clonedeep": "^4.5.0", "lodash.frompairs": "^4.0.1", "lodash.get": "^4.4.2", @@ -50,8 +50,8 @@ "lodash.set": "^4.3.2", "lodash.topairs": "^4.3.0", "lodash.values": "^4.3.0", - "moment": "^2.29.1", - "moment-parseformat": "^3.0.0", + "moment": "^2.29.4", + "moment-parseformat": "^4.0.0", "normalize.css": "7.0.0", "npm": "^7.8.0", "nprogress": "0.2.0", diff --git a/src/components/DataForm/rules/index.js b/src/components/DataForm/rules/index.js index 5b3a91e18..d7baeda9b 100644 --- a/src/components/DataForm/rules/index.js +++ b/src/components/DataForm/rules/index.js @@ -45,3 +45,20 @@ export const JsonRequired = { } } } + +export const JsonRequiredUserNameMapped = { + required: true, + trigger: 'change', + validator: (rule, value, callback) => { + try { + JSON.parse(value) + const hasUserName = _.map(JSON.parse(value), (value) => value) + if (!hasUserName.includes('username')) { + callback(new Error(i18n.t('common.requiredHasUserNameMapped'))) + } + callback() + } catch (e) { + callback(new Error(i18n.t('common.InvalidJson'))) + } + } +} diff --git a/src/components/FormFields/UploadKey.vue b/src/components/FormFields/UploadKey.vue index e45ba2fba..81697c686 100644 --- a/src/components/FormFields/UploadKey.vue +++ b/src/components/FormFields/UploadKey.vue @@ -50,7 +50,7 @@ export default { const reader = new FileReader() reader.onload = function() { let result = this.result - if (vm.toFormat === 'object') { + if (vm.toFormat === 'object' && vm.fileName.endsWith('.json')) { result = JSON.parse(result) } vm.$emit('input', result) diff --git a/src/i18n/langs/en.json b/src/i18n/langs/en.json index 727a1a54b..e029aa0b2 100644 --- a/src/i18n/langs/en.json +++ b/src/i18n/langs/en.json @@ -267,6 +267,12 @@ "IPLoginLimit": "IP login limit", "Setting": "Setting", "Certificate": "Certificate", + "CACertificate": "CA Certificate", + "ClientCertificate": "Client certificate", + "CertificateKey": "Certificate key file", + "AllowInvalidCert": "Allow invalid cert", + "UseSSL": "Use SSL/TLS", + "SecretKey": "Secret key", "Scope": "Type", "Builtin": "Builtin", "DateCreated": "Date created", @@ -408,6 +414,7 @@ "disableSelected": "Disable selected", "disableSuccessMsg": "Disable success", "fieldRequiredError": "This field is required", + "requiredHasUserNameMapped": "The mapping of the username field must be included, such as {'uid': 'username'}", "getErrorMsg": "Get failed", "fileType": "File type", "Status": "Status", @@ -424,6 +431,7 @@ "downloadImportTemplateMsg": "Download import template", "downloadUpdateTemplateMsg": "Download update template", "onlyCSVFilesTips": "Only csv supported", + "ImportFail": "Import fail", "updateSuccessMsg": "Update success, total: {count}", "dragUploadFileInfo": "Drag file here or click here to upload", "uploadCsvLth10MHelpText": "csv/xlsx files with a size less than 10M", @@ -771,7 +779,7 @@ "OperateLog": "Operation Logs", "PasswordChangeLog": "Password Update Logs", "Perms": "Permissions", - "PersonalInformationImprovement": "PersonalInformationImprovement", + "PersonalInformationImprovement": "Personal information improvement", "PlatformCreate": "Platform create", "PlatformDetail": "Platform detail", "PlatformList": "Platforms", @@ -925,6 +933,9 @@ "SMS": "SMS", "AlibabaCloud": "Alibaba cloud", "TencentCloud": "Tencent cloud", + "HuaweiCloud": "Huawei cloud", + "SignChannelNum": "Signature Channel Number", + "AppEndpoint": "App access address", "CMPP2": "CMPP v2.0", "VerifySignTmpl": "Verification code template", "Radius": "Radius", @@ -1407,9 +1418,11 @@ "IPNetworkSegment": "Ip Network Segment", "Aliyun": "Ali Cloud", "Qcloud": "Tencent Cloud", + "QcloudLighthouse": "Tencent Cloud(Lighthouse)", "QingyunPrivatecloud": "Qingyun Private Cloud", "HuaweiPrivatecloud": "Huawei Private Cloud", "OpenStack": "OpenStack", + "CTYunPrivate": "CTYun Private Cloud", "GCP": "Google Cloud Platform", "FC": "Fusion Compute", "LAN": "LAN", diff --git a/src/i18n/langs/ja.json b/src/i18n/langs/ja.json index a417185cf..cb1a25815 100644 --- a/src/i18n/langs/ja.json +++ b/src/i18n/langs/ja.json @@ -272,6 +272,12 @@ "IPLoginLimit": "IPログイン制限", "Setting": "設定", "Certificate": "証明書", + "CACertificate": "CA 証明書", + "ClientCertificate": "クライアント証明書", + "CertificateKey": "証明書秘密鍵ファイル", + "AllowInvalidCert": "証明書チェックを無視する", + "UseSSL": "使う SSL/TLS", + "SecretKey": "鍵", "Scope": "カテゴリ", "Builtin": "内蔵", "DateCreated": "作成日", @@ -417,6 +423,7 @@ "disableSelected": "選択した無効", "disableSuccessMsg": "成功を無効にする", "fieldRequiredError": "このフィールドは必須項目です", + "requiredHasUserNameMapped": "usernameフィールドのマッピングを含める必要があります, {'uid':'username'}など", "getErrorMsg": "の取得に失敗しました", "MFAErrorMsg": "MFAエラーです。チェックしてください", "Total": "合計", @@ -435,6 +442,7 @@ "downloadImportTemplateMsg": "作成テンプレートのダウンロード", "downloadUpdateTemplateMsg": "更新テンプレートのダウンロード", "onlyCSVFilesTips": "Csvファイルのインポートのみサポート", + "ImportFail": "インポートに失敗しました", "updateSuccessMsg": "更新のインポートに成功しました。合計:{count}", "uploadCsvLth10MHelpText": "Csv/xlsxのみアップロードでき、10m以下です", "dragUploadFileInfo": "ここにファイルをドラッグするか、ここをクリックしてアップロードしてください", @@ -944,6 +952,9 @@ "Feature": "機能", "AlibabaCloud": "Alibaba cloud", "TencentCloud": "テンセント雲", + "HuaweiCloud": "ファーウェイ雲", + "SignChannelNum": "サインパス番号", + "AppEndpoint": "アクセスアドレスを適用する", "CMPP2": "CMPP v2.0", "Radius": "Radius", "VerifySignTmpl": "認証コードメールテンプレート", @@ -1450,9 +1461,11 @@ "IPNetworkSegment": "IPネットワークセグメント", "Aliyun": "Alibaba cloud", "Qcloud": "テンセント雲", + "QcloudLighthouse": "テンセント雲(軽量アプリケーションサーバー)", "QingyunPrivatecloud": "青雲プライベートクラウド", "HuaweiPrivatecloud": "ファーウェイプライベートクラウド", "OpenStack": "OpenStack", + "CTYunPrivate": "天翼プライベート・クラウド", "GCP": "Googleクラウド", "FC": "Fusion Compute", "LAN": "ローカルエリアネットワーク", diff --git a/src/i18n/langs/zh.json b/src/i18n/langs/zh.json index d62e81a6c..ed385b041 100644 --- a/src/i18n/langs/zh.json +++ b/src/i18n/langs/zh.json @@ -272,6 +272,12 @@ "IPLoginLimit": "IP 登录限制", "Setting": "设置", "Certificate": "证书", + "CACertificate": "CA 证书", + "ClientCertificate": "客户端证书", + "CertificateKey": "证书秘钥文件", + "AllowInvalidCert": "忽略证书检查", + "UseSSL": "使用 SSL/TLS", + "SecretKey": "密钥", "Scope": "类别", "Builtin": "内置", "DateCreated": "创建日期", @@ -417,6 +423,7 @@ "disableSelected": "禁用所选", "disableSuccessMsg": "禁用成功", "fieldRequiredError": "这个字段是必填项", + "requiredHasUserNameMapped": "必须包含 username 字段的映射,如 { 'uid': 'username' }", "getErrorMsg": "获取失败", "MFAErrorMsg": "MFA错误,请检查", "Total": "总共", @@ -435,6 +442,7 @@ "downloadImportTemplateMsg": "下载创建模板", "downloadUpdateTemplateMsg": "下载更新模板", "onlyCSVFilesTips": "仅支持csv文件导入", + "ImportFail": "导入失败", "updateSuccessMsg": "导入更新成功,总共:{count}", "uploadCsvLth10MHelpText": "只能上传 csv/xlsx, 且不超过 10M", "dragUploadFileInfo": "将文件拖到此处,或点击此处上传", @@ -945,6 +953,9 @@ "Feature": "功能", "AlibabaCloud": "阿里云", "TencentCloud": "腾讯云", + "HuaweiCloud": "华为云", + "SignChannelNum": "签名通道号", + "AppEndpoint": "应用接入地址", "CMPP2": "CMPP v2.0", "Radius": "Radius", "VerifySignTmpl": "验证码短信模板", @@ -1451,8 +1462,10 @@ "IPNetworkSegment": "IP网段", "Aliyun": "阿里云", "Qcloud": "腾讯云", + "QcloudLighthouse": "腾讯云(轻量应用服务器)", "QingyunPrivatecloud": "青云私有云", "HuaweiPrivatecloud": "华为私有云", + "CTYunPrivate": "天翼私有云", "OpenStack": "OpenStack", "GCP": "谷歌云", "FC": "Fusion Compute", diff --git a/src/layout/components/GenericCreateUpdateForm/index.vue b/src/layout/components/GenericCreateUpdateForm/index.vue index 9e1ebd4e3..30d1ff131 100644 --- a/src/layout/components/GenericCreateUpdateForm/index.vue +++ b/src/layout/components/GenericCreateUpdateForm/index.vue @@ -233,6 +233,10 @@ export default { encryptedFields: { type: Array, default: () => ['password', 'token', 'private_key'] + }, + needGetObjectDetail: { + type: Boolean, + default: true } }, data() { @@ -312,7 +316,7 @@ export default { }, async getFormValue() { const cloneFrom = this.$route.query['clone_from'] - if (!this.isUpdateMethod() && !cloneFrom) { + if ((!this.isUpdateMethod() && !cloneFrom) || !this.needGetObjectDetail) { return Object.assign(this.form, this.initial) } let object = this.object diff --git a/src/layout/components/GenericUpdateFormDialog/index.vue b/src/layout/components/GenericUpdateFormDialog/index.vue index afb48965e..6dfd20857 100644 --- a/src/layout/components/GenericUpdateFormDialog/index.vue +++ b/src/layout/components/GenericUpdateFormDialog/index.vue @@ -97,6 +97,7 @@ export default { getDefaultFormSetting() { const vm = this return { + needGetObjectDetail: false, submitMethod: () => 'patch', cleanFormValue: (value) => { const filterValue = {} diff --git a/src/store/modules/users.js b/src/store/modules/users.js index 3069a71cd..ed34a2079 100644 --- a/src/store/modules/users.js +++ b/src/store/modules/users.js @@ -72,6 +72,9 @@ const mutations = { }, ADD_WORKBENCH_ORGS(state, org) { state.workbenchOrgs.push(org) + }, + SET_IS_FIRST_LOGIN(state, flag) { + state.profile.is_first_login = flag } } @@ -140,6 +143,9 @@ const actions = { const usingOrgs = mapper[viewName] || state.consoleOrgs Vue.$log.debug('Set using orgs: ', viewName, usingOrgs) commit('SET_USING_ORGS', usingOrgs) + }, + ifFirstLogin({ commit }, flag) { + commit('SET_IS_FIRST_LOGIN', flag) } } diff --git a/src/views/applications/DatabaseApp/DatabaseAppCreateUpdate.vue b/src/views/applications/DatabaseApp/DatabaseAppCreateUpdate.vue index e23d79849..91ff1a7c9 100644 --- a/src/views/applications/DatabaseApp/DatabaseAppCreateUpdate.vue +++ b/src/views/applications/DatabaseApp/DatabaseAppCreateUpdate.vue @@ -5,6 +5,7 @@ + + diff --git a/src/views/settings/SMS/index.vue b/src/views/settings/SMS/index.vue index 6e46d57c3..bc25436af 100644 --- a/src/views/settings/SMS/index.vue +++ b/src/views/settings/SMS/index.vue @@ -6,6 +6,7 @@ import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage' import SMSAlibaba from './SMSAlibaba' import SMSTencent from './SMSTencent' +import SMSHuawei from './SMSHuawei' import CMPP2 from './CMPP2' export default { @@ -24,7 +25,7 @@ export default { ], [ this.$t('setting.SMSProvider'), [ - 'ALIYUN', 'QCLOUD', 'CMPP2' + 'ALIYUN', 'QCLOUD', 'HUAWEICLOUD', 'CMPP2' ] ] ], @@ -43,6 +44,13 @@ export default { return form['SMS_BACKEND'] !== 'tencent' } }, + HUAWEICLOUD: { + label: this.$t('setting.HuaweiCloud'), + component: SMSHuawei, + hidden: (form) => { + return form['SMS_BACKEND'] !== 'huawei' + } + }, CMPP2: { label: this.$t('setting.CMPP2'), component: CMPP2, diff --git a/src/views/settings/Tools.vue b/src/views/settings/Tools.vue index 36142eaaf..dcbd9fb60 100644 --- a/src/views/settings/Tools.vue +++ b/src/views/settings/Tools.vue @@ -1,27 +1,38 @@ @@ -95,20 +106,19 @@ export default { } - diff --git a/yarn.lock b/yarn.lock index 50e08f9a2..705a01d3f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -6883,7 +6883,7 @@ lodash@4.17.11: version "4.17.11" resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.11.tgz#b39ea6229ef607ecd89e2c8df12536891cac9b8d" -lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.3.0: +lodash@^4.17.10, lodash@^4.17.11, lodash@^4.17.12, lodash@^4.17.13, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17.19, lodash@^4.17.21, lodash@^4.17.3, lodash@^4.17.4, lodash@^4.3.0: version "4.17.21" resolved "https://registry.npm.taobao.org/lodash/download/lodash-4.17.21.tgz?cache=0&sync_timestamp=1613835817439&other_urls=https%3A%2F%2Fregistry.npm.taobao.org%2Flodash%2Fdownload%2Flodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha1-Z5WRxWTDv/quhFTPCz3zcMPWkRw= @@ -7381,16 +7381,21 @@ mockjs@1.0.1-beta3: dependencies: commander "*" -moment-parseformat@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/moment-parseformat/-/moment-parseformat-3.0.0.tgz#3a1dc438b4bc073b7e93cc298cfb6c5daac26dba" - integrity sha512-dVgXe6b6DLnv4CHG7a1zUe5mSXaIZ3c6lSHm/EKeVeQI2/4pwe0VRde8OyoCE1Ro2lKT5P6uT9JElF7KDLV+jw== +moment-parseformat@^4.0.0: + version "4.0.0" + resolved "https://registry.npmmirror.com/moment-parseformat/-/moment-parseformat-4.0.0.tgz#44cffc3b3be3b3d033475869fbfa9066abb66cb0" + integrity sha512-0V4ICKnI1npglqrMSDK2y8WxOdN79DkMoIexzY3P+jr2wNfbB4J81BgjFfHsj18wBsV7FdKCWyCHcezzH0xlyg== -moment@^2.19.2, moment@^2.29.1: +moment@^2.19.2: version "2.29.2" resolved "https://registry.yarnpkg.com/moment/-/moment-2.29.2.tgz#00910c60b20843bcba52d37d58c628b47b1f20e4" integrity sha512-UgzG4rvxYpN15jgCmVJwac49h9ly9NurikMWGPdVxm8GZD6XjkKPxDTjQQ43gtGgnV3X0cAyWDdP2Wexoquifg== +moment@^2.29.4: + version "2.29.4" + resolved "https://registry.npmmirror.com/moment/-/moment-2.29.4.tgz#3dbe052889fe7c1b2ed966fcb3a77328964ef108" + integrity sha512-5LC9SOxjSc2HF6vO2CyuTDNivEdoz2IvyJJGj6X8DJ0eFyfszE0QiEd+iXmBvUP3WHxSjFH/vIsA0EN00cgr8w== + move-concurrently@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/move-concurrently/-/move-concurrently-1.0.1.tgz#be2c005fda32e0b29af1f05d7c4b33214c701f92"