Skip to content

Commit

Permalink
ACL i18n
Browse files Browse the repository at this point in the history
  • Loading branch information
pycook committed Feb 16, 2020
1 parent 616c1df commit 00f1035
Show file tree
Hide file tree
Showing 20 changed files with 298 additions and 189 deletions.
18 changes: 9 additions & 9 deletions cmdb-ui/src/api/cmdb/CITypeAttr.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { axios } from '@/utils/request'

/**
* 获取 ci_type 的属性
* Get CI Type attributes
* @param CITypeName
* @param parameter
* @returns {AxiosPromise}
Expand All @@ -16,7 +16,7 @@ export function getCITypeAttributesByName (CITypeName, parameter) {
}

/**
* 获取 ci_type 的属性
* Get CI Type attributes
* @param CITypeId
* @param parameter
* @returns {AxiosPromise}
Expand All @@ -30,7 +30,7 @@ export function getCITypeAttributesById (CITypeId, parameter) {
}

/**
* 更新属性
* update attribute
* @param attrId
* @param data
* @returns {AxiosPromise}
Expand All @@ -44,7 +44,7 @@ export function updateAttributeById (attrId, data) {
}

/**
* 添加属性
* add attribute
* @param data
* @returns {AxiosPromise}
*/
Expand All @@ -57,7 +57,7 @@ export function createAttribute (data) {
}

/**
* 搜索属性/ 获取所有的属性
* search attributes or get all attributes
* @param data
* @returns {AxiosPromise}
*/
Expand All @@ -70,7 +70,7 @@ export function searchAttributes (params) {
}

/**
* 删除属性
* delete attribute
* @param attrId
* @returns {AxiosPromise}
*/
Expand All @@ -82,7 +82,7 @@ export function deleteAttributesById (attrId) {
}

/**
* 绑定ci_type 属性
* bind attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
Expand All @@ -96,7 +96,7 @@ export function createCITypeAttributes (CITypeId, data) {
}

/**
* 更新ci_type 属性
* update CI Type attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
Expand All @@ -110,7 +110,7 @@ export function updateCITypeAttributesById (CITypeId, data) {
}

/**
* 删除ci_type 属性
* delete CI Type attribute
* @param CITypeId
* @param data
* @returns {AxiosPromise}
Expand Down
2 changes: 2 additions & 0 deletions cmdb-ui/src/components/tools/LangSelect.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ export default {
data () {
return {}
},
inject: ['reload'],
methods: {
SwitchLang (row) {
this.setLang(row.key)
this.reload()
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions cmdb-ui/src/components/tools/UserMenu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
<a-menu-item key="3">
<a href="javascript:;" @click="handleLogout">
<a-icon type="logout"/>
<span>退出登录</span>
<span>{{ $t('login.logout') }}</span>
</a>
</a-menu-item>
</a-menu>
Expand Down Expand Up @@ -67,8 +67,8 @@ export default {
const that = this

this.$confirm({
title: '提示',
content: '真的要注销登录吗 ?',
title: this.$t('tip.warning'),
content: this.$t('login.confirmLogout'),
onOk () {
return that.Logout()
},
Expand Down
2 changes: 1 addition & 1 deletion cmdb-ui/src/layouts/UserLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
</a>
</div>
<div class="desc">
运维资产数据管理
{{ $t('login.subTitle') }}
</div>
</div>

Expand Down
66 changes: 65 additions & 1 deletion cmdb-ui/src/locales/lang/en-US.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default {
delete: 'Delete',
edit: 'Edit',
operate: 'Operation',
close: 'Close',
create: 'Create',
clear: 'Clear',
modify: 'Modify',
Expand All @@ -62,9 +63,11 @@ export default {
deleting: 'Deleting ...',
confirmDelete: 'Confirm deleting ?',
warning: 'Warning',
error: 'Error',
other: 'Other',
requestFailed: 'Request error, please try again later',
pleaseSelect: 'please select'
pleaseSelect: 'please select',
selectAll: 'Select all'
},
ci: {
batchOperate: 'Batch Operation',
Expand Down Expand Up @@ -160,5 +163,66 @@ export default {
newRelationType: 'New Relation Type',
relationTypeNameRequired: 'Please enter a type name',
uniqueFlag: 'unique flag'
},
acl: {
roleList: 'Roles',
permList: 'Permissions',
selectOtherRole: 'Please select another role',
associatedParentRole: 'Associated parent role',
associatedChildRole: 'Associated child role',
associatedSuccess: 'Associated with success',
name: 'Name',
roleName: 'Role Name',
description: 'Desciption',
resourceNameRequired: 'Please enter the resource name',
descriptionTip: 'Please enter description...',
permission: 'Permission',
resourceType: 'Resource Type',
newResource: 'New Resource',
newRole: 'New Role',
newResourceType: 'New Resource Type',
addPermTip: 'Add authorization: ',
add: 'Add',
selectRoleTip: 'Please select the role name. Multiple choices are available!',
selectPermTip: 'Please select permissions. Multiple options are available!',
resourceTypeNameRequired: 'Please enter a type name',
permissionNameRequired: 'Please enter a permission name',
roleNameRequired: 'Please enter a role name',
usernameRequired: 'Please enter a user name',
inheritedFrom: 'Inherited from ',
selectInheritedRoles: 'Select inherited roles',
isAppAdmin: 'Is Application Admin',
username: 'Username',
nickname: 'NickName',
password: 'Password',
department: 'Department',
catalog: 'Team',
email: 'Email',
emailValidate: 'Please enter the correct email address!',
emailRequired: 'Please enter email address',
mobile: 'Mobile phone number',
mobileValidate: 'Please enter the correct mobile phone number',
block: 'Is lock',
newUser: 'New User',
typeName: 'Type name',
viewAuthorization: 'View Authorization',
authorization: 'Authorization',
resourceName: 'Resource Name',
createdAt: 'Creation time',
updatedAt: 'Last modified time',
joinedAt: 'Join time'
},
login: {
subTitle: 'Operation and maintenance resource data management',
loginHeader: 'Account password login',
loginName: 'User name or email address',
loginNameRequired: 'Please enter your account name or email address',
password: 'Password',
passwordRequired: 'Please enter your password',
autoLogin: 'Automatic login',
welcome: 'Welocom',
welcomeBack: 'Welcome back',
confirmLogout: 'Do you really want to logout?',
logout: 'Logout',
}
}
66 changes: 65 additions & 1 deletion cmdb-ui/src/locales/lang/zh-CN.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export default {
delete: '删除',
edit: '编辑',
operate: '操作',
close: '关闭',
create: '创建',
clear: '清空',
modify: '修改',
Expand All @@ -62,9 +63,11 @@ export default {
deleting: '正在删除 ...',
confirmDelete: '真的要删除吗 ?',
warning: '警告',
error: '错误',
other: '其他',
requestFailed: '请求出现错误,请稍后再试',
pleaseSelect: '请选择'
pleaseSelect: '请选择',
selectAll: '全选'
},
ci: {
batchOperate: '批量操作',
Expand Down Expand Up @@ -160,5 +163,66 @@ export default {
newRelationType: '新增关系类型',
relationTypeNameRequired: '请输入类型名',
uniqueFlag: '唯一标识'
},
acl: {
roleList: '角色列表',
permList: '权限列表',
selectOtherRole: '请选择另一个角色',
associatedParentRole: '关联父角色',
associatedChildRole: '关联子角色',
associatedSuccess: '关联成功',
name: '名称',
roleName: '角色名称',
description: '描述',
resourceNameRequired: '请输入资源名',
descriptionTip: '请输入描述信息...',
permission: '权限',
resourceType: '资源类型',
newResource: '新增资源',
newRole: '新增角色',
newResourceType: '新增资源类型',
addPermTip: '添加授权:',
add: '添加',
selectRoleTip: '请选择角色名称,可多选!',
selectPermTip: '请选择权限,可多选!',
resourceTypeNameRequired: '请输入类型名',
permissionNameRequired: '请输入权限名',
roleNameRequired: '请输入角色名',
usernameRequired: '请输入用户名',
inheritedFrom: '继承自',
selectInheritedRoles: '选择继承角色',
isAppAdmin: '是否应用管理员',
username: '用户名',
nickname: '昵称',
password: '密码',
department: '部门',
catalog: '小组',
email: '邮箱',
emailValidate: '请输入正确的邮箱!',
emailRequired: '请输入邮箱',
mobile: '手机号码',
mobileValidate: '请输入正确的手机号码',
block: '是否锁定',
newUser: '新增用户',
typeName: '类型名',
viewAuthorization: '查看授权',
authorization: '授权',
resourceName: '资源名',
createdAt: '创建时间',
updatedAt: '最后修改时间',
joinedAt: '加入时间'
},
login: {
subTitle: '运维资源数据管理',
loginHeader: '账号密码登录',
loginName: '用户名或者邮箱',
loginNameRequired: '请输入帐户名或邮箱地址',
password: '密码',
passwordRequired: '请输入密码',
autoLogin: '自动登录',
welcome: '欢迎',
welcomeBack: '欢迎回来',
confirmLogout: '真的要注销登录吗 ?',
logout: '退出登录',
}
}
16 changes: 8 additions & 8 deletions cmdb-ui/src/views/acl/module/addRoleRelationForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<a-form-item
:label-col="formItemLayout.labelCol"
:wrapper-col="formItemLayout.wrapperCol"
label="角色列表"
:label="$t('acl.roleList')"
>
<a-select name="otherID" :filterOption="filterOption" v-decorator="['otherID', {rules: [{ required: true, message: '请选择另一个角色'}]} ]">
<a-select name="otherID" :filterOption="filterOption" v-decorator="['otherID', {rules: [{ required: true, message: $t('acl.selectOtherRole')}]} ]">
<template v-for="role in allRoles">
<a-select-option v-if="role.id != current_record.id" :key="role.id">{{ role.name }}</a-select-option>
</template>
Expand All @@ -42,8 +42,8 @@
}"
>
<a-button @click="handleAddParent" type="primary" style="margin-right: 1rem">关联父角色</a-button>
<a-button @click="handleAddChild" type="primary" style="margin-right: 1rem">关联子角色</a-button>
<a-button @click="handleAddParent" type="primary" style="margin-right: 1rem">{{ $t('acl.associatedParentRole') }}</a-button>
<a-button @click="handleAddChild" type="primary" style="margin-right: 1rem">{{ $t('acl.associatedChildRole') }}</a-button>
<a-button @click="onClose">{{ $t('button.cancel') }}</a-button>

</div>
Expand All @@ -64,7 +64,7 @@ export default {
},
data () {
return {
drawerTitle: '角色关联',
drawerTitle: this.$t('acl.associatedRole'),
drawerVisible: false,
formLayout: 'vertical',
allRoles: [],
Expand Down Expand Up @@ -144,7 +144,7 @@ export default {
addParent (id, otherID) {
addParentRole(id, otherID)
.then(res => {
this.$message.success(`关联父角色成功`)
this.$message.success(this.$t('acl.associatedSuccess'))
this.handleOk()
this.onClose()
}).catch(err => this.requestFailed(err))
Expand All @@ -153,15 +153,15 @@ export default {
addChild (id, otherID) {
addChildRole(id, otherID)
.then(res => {
this.$message.success(`关联子角色成功`)
this.$message.success(this.$t('acl.associatedSuccess'))
this.handleOk()
this.onClose()
})
.catch(err => this.requestFailed(err))
},

requestFailed (err) {
const msg = ((err.response || {}).data || {}).message || '请求出现错误,请稍后再试'
const msg = ((err.response || {}).data || {}).message || this.$t('tip.requestFailed')
this.$message.error(`${msg}`)
}

Expand Down
Loading

0 comments on commit 00f1035

Please sign in to comment.