Merge pull request #72 from jumpserver/i18n_bai

I18n change auth plan
This commit is contained in:
BaiJiangJie
2020-05-29 18:43:21 +08:00
committed by GitHub
10 changed files with 157 additions and 140 deletions

View File

@@ -690,6 +690,11 @@
"assetAndNode": "资产或节点", "assetAndNode": "资产或节点",
"Success": "成功", "Success": "成功",
"ChangeAuthPlan": { "ChangeAuthPlan": {
"Asset": "资产",
"Success": "成功",
"AssetAndNode": "资产和节点",
"AssetAmount": "资产数量",
"NodeAmount": "节点数量",
"ChangeAuthPlan": "改密计划", "ChangeAuthPlan": "改密计划",
"ChangeAuthPlanCreate": "创建改密计划", "ChangeAuthPlanCreate": "创建改密计划",
"ChangeAuthPlanUpdate": "更新改密计划", "ChangeAuthPlanUpdate": "更新改密计划",
@@ -701,12 +706,14 @@
"Username": "用户名", "Username": "用户名",
"PasswordStrategy": "密码策略", "PasswordStrategy": "密码策略",
"PasswordLength": "密码长度", "PasswordLength": "密码长度",
"Execute": "执行",
"ExecutionTimes": "执行次数",
"Timer": "定时执行",
"CyclePerform": "周期执行", "CyclePerform": "周期执行",
"RegularlyPerform": "定期执行", "RegularlyPerform": "定期执行",
"DateJoined": "创建日期", "DateJoined": "创建日期",
"DateUpdated": "更新日期", "DateUpdated": "更新日期",
"ManualRunPlan": "手动执行计划", "ManualExecutePlan": "手动执行计划",
"Run": "执行",
"addAsset": "添加资产", "addAsset": "添加资产",
"addNode": "添加节点", "addNode": "添加节点",
"Result": "结果", "Result": "结果",
@@ -714,7 +721,12 @@
"DateStart": "开始日期", "DateStart": "开始日期",
"Detail": "详情", "Detail": "详情",
"Log": "日志", "Log": "日志",
"Retry": "重试" "Retry": "重试",
"HelpText": {
"UsernameOfCreateUpdatePage": "目标主机上用户的用户名;如果已️存在,修改用户密码;如果不存在,添加用户并设置密码;",
"CrontabOfCreateUpdatePage": "例如:每周日 03:05 执行 <5 3 * * 0> <br/> 使用5位 Linux crontab 表达式 <分 时 日 月 星期> <a href=\"https://tool.lu/crontab/\" target=\"_blank\">在线工具</a> <br/> 如果同时设置了定期执行和周期执行,优先使用定期执行",
"IntervalOfCreateUpdatePage": "单位:时"
}
}, },
"Corporation": "公司", "Corporation": "公司",
"Edition": "版本", "Edition": "版本",

View File

@@ -31,7 +31,7 @@ export default {
}, },
fieldsMeta: { fieldsMeta: {
username: { username: {
helpText: '用户名为将要修改的资产上的用户的用户名。如果用户存在,则修改密码;如果用户不存在,则创建用户。' helpText: this.$t('xpack.ChangeAuthPlan.HelpText.UsernameOfCreateUpdatePage')
}, },
assets: { assets: {
type: 'assetSelect', type: 'assetSelect',
@@ -78,21 +78,15 @@ export default {
hidden: (formValue) => { hidden: (formValue) => {
return formValue.is_periodic === false return formValue.is_periodic === false
}, },
helpText: '' + helpText: this.$t('xpack.ChangeAuthPlan.HelpText.CrontabOfCreateUpdatePage')
'eg每周日 03:05 执行 <5 3 * * 0>' +
'<br/>' +
'使用5位 Linux crontab 表达式 <分 时 日 月 星期> ' +
'<a href="https://tool.lu/crontab/" target="_blank">在线工具</a>' +
'<br/>' +
'如果同时设置了定期执行和周期执行,优先使用定期执行' +
''
}, },
interval: { interval: {
label: this.$t('xpack.ChangeAuthPlan.CyclePerform'), label: this.$t('xpack.ChangeAuthPlan.CyclePerform'),
hidden: (formValue) => { hidden: (formValue) => {
return formValue.is_periodic === false return formValue.is_periodic === false
}, },
helpText: '(单位: 时)' helpText: this.$t('xpack.ChangeAuthPlan.HelpText.IntervalOfCreateUpdatePage')
// helpText: '(单位: 时)'
} }
} }
} }

View File

@@ -39,15 +39,15 @@ export default {
} }
}, },
headerActions: { headerActions: {
hasSearch: true,
hasRefresh: true,
hasLeftActions: true,
hasRightActions: true,
hasExport: false, hasExport: false,
hasImport: false, hasImport: false,
hasRefresh: false,
hasCreate: false, hasCreate: false,
hasBulkDelete: false, hasBulkDelete: false,
hasBulkUpdate: false, hasBulkUpdate: false
hasLeftActions: false,
hasSearch: false,
hasRightActions: false
}, },
assetRelationConfig: { assetRelationConfig: {
icon: 'fa-edit', icon: 'fa-edit',
@@ -84,11 +84,10 @@ export default {
return this.$axios.patch(relationUrl, data) return this.$axios.patch(relationUrl, data)
}, },
onAddSuccess: (objects, that) => { onAddSuccess: (objects, that) => {
this.$log.debug('Select value', that.select2.value)
that.iHasObjects = [...that.iHasObjects, ...objects] that.iHasObjects = [...that.iHasObjects, ...objects]
that.$refs.select2.clearSelected() that.$refs.select2.clearSelected()
this.$message.success(this.$t('common.updateSuccessMsg')) this.$message.success(this.$t('common.updateSuccessMsg'))
setTimeout(() => location.reload(), 500) this.$refs.listTable.reloadTable()
}, },
performDelete: (item) => { performDelete: (item) => {
const nodes = this.object.nodes const nodes = this.object.nodes
@@ -105,11 +104,10 @@ export default {
that.iHasObjects.splice(theRemoveIndex, 1) that.iHasObjects.splice(theRemoveIndex, 1)
while (that.select2.disabledValues.indexOf(obj.value) !== -1) { while (that.select2.disabledValues.indexOf(obj.value) !== -1) {
const i = that.select2.disabledValues.indexOf(obj.value) const i = that.select2.disabledValues.indexOf(obj.value)
this.$log.debug('disabled values remove index: ', i)
that.select2.disabledValues.splice(i, 1) that.select2.disabledValues.splice(i, 1)
} }
this.$message.success(this.$t('common.deleteSuccessMsg')) this.$message.success(this.$t('common.deleteSuccessMsg'))
setTimeout(() => location.reload(), 500) this.$refs.listTable.reloadTable()
} }
} }
} }

View File

@@ -32,11 +32,11 @@ export default {
value: this.object.username value: this.object.username
}, },
{ {
key: this.$t('xpack.Asset'), key: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
value: this.object.assets_amount value: this.object.assets_amount
}, },
{ {
key: this.$t('xpack.Node'), key: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
value: this.object.nodes_amount value: this.object.nodes_amount
}, },
{ {

View File

@@ -26,23 +26,23 @@ export default {
], ],
columnsMeta: { columnsMeta: {
asset: { asset: {
label: this.$t('xpack.Asset'), label: this.$t('xpack.ChangeAuthPlan.Asset'),
formatter: function(row, column, cellValue, index) { formatter: function(row, column, cellValue, index) {
const url = `/assets/assets/${cellValue}` const url = `/assets/assets/${cellValue}`
return <router-link to={ url } >{ row.asset_info.hostname }</router-link> return <router-link to={ url } >{ row.asset_info.hostname }</router-link>
} }
}, },
is_success: { is_success: {
label: this.$t('xpack.Success') label: this.$t('xpack.ChangeAuthPlan.Success')
}, },
timedelta: { timedelta: {
label: this.$t('xpack.ChangeAuthPlan.TimeDelta'), label: this.$t('xpack.ChangeAuthPlan.TimeDelta'),
formatter: function(row) { formatter: function(row) {
return row.timedelta.toFixed(2) + 's' return row.timedelta.toFixed(2) + 's'
} }
}
}, },
actions: { actions: {
prop: 'id',
formatterArgs: { formatterArgs: {
hasDelete: false, hasDelete: false,
hasUpdate: false, hasUpdate: false,
@@ -55,25 +55,24 @@ export default {
this.$axios.put( this.$axios.put(
`/api/v1/xpack/change-auth-plan/plan-execution-subtask/${cellValue}/`, `/api/v1/xpack/change-auth-plan/plan-execution-subtask/${cellValue}/`,
).then(res => { ).then(res => {
window.open(`/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600') window.open(`/core/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
}) })
}.bind(this) }.bind(this)
} }
] ]
} }
} }
}
}, },
headerActions: { headerActions: {
hasSearch: true,
hasRefresh: true,
hasLeftActions: true,
hasRightActions: true,
hasExport: false, hasExport: false,
hasImport: false, hasImport: false,
hasRefresh: false,
hasCreate: false, hasCreate: false,
hasBulkDelete: false, hasBulkDelete: false,
hasBulkUpdate: false, hasBulkUpdate: false
hasLeftActions: false,
hasSearch: false,
hasRightActions: false
} }
} }
} }

View File

@@ -30,13 +30,17 @@ export default {
label: this.$t('xpack.ChangeAuthPlan.Username') label: this.$t('xpack.ChangeAuthPlan.Username')
}, },
assets_amount: { assets_amount: {
label: this.$t('xpack.Asset') label: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
width: '80px'
}, },
nodes_amount: { nodes_amount: {
label: this.$t('xpack.Node') label: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
width: '80px'
}, },
result_summary: { result_summary: {
label: this.$t('xpack.ChangeAuthPlan.Result'), label: this.$t('xpack.ChangeAuthPlan.Result'),
width: '80px',
showOverflowTooltip: true,
formatter: function(row) { formatter: function(row) {
const summary = <div> const summary = <div>
<span class='text-primary'>{row.result_summary.succeed}</span>/ <span class='text-primary'>{row.result_summary.succeed}</span>/
@@ -47,19 +51,22 @@ export default {
} }
}, },
password_strategy_display: { password_strategy_display: {
label: this.$t('xpack.ChangeAuthPlan.PasswordStrategy') label: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
width: '220px',
showOverflowTooltip: true
}, },
timedelta: { timedelta: {
label: this.$t('xpack.ChangeAuthPlan.TimeDelta'), label: this.$t('xpack.ChangeAuthPlan.TimeDelta'),
width: '80px',
formatter: function(row) { formatter: function(row) {
return row.timedelta.toFixed(2) + 's' return row.timedelta.toFixed(2) + 's'
} }
}, },
date_start: { date_start: {
showOverflowTooltip: true showOverflowTooltip: true
}
}, },
actions: { actions: {
prop: 'id',
formatterArgs: { formatterArgs: {
hasDelete: false, hasDelete: false,
hasUpdate: false, hasUpdate: false,
@@ -69,7 +76,7 @@ export default {
type: 'primary', type: 'primary',
title: this.$t('xpack.ChangeAuthPlan.Log'), title: this.$t('xpack.ChangeAuthPlan.Log'),
callback: function({ cellValue, tableData }) { callback: function({ cellValue, tableData }) {
window.open(`/ops/celery/task/${cellValue}/log/`, '_blank', 'toolbar=yes, width=900, height=600') window.open(`/core/ops/celery/task/${cellValue}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
} }
}, },
{ {
@@ -83,18 +90,17 @@ export default {
] ]
} }
} }
}
}, },
headerActions: { headerActions: {
hasSearch: true,
hasRefresh: true,
hasRightActions: true,
hasLeftActions: true,
hasExport: false, hasExport: false,
hasImport: false, hasImport: false,
hasRefresh: false,
hasCreate: false, hasCreate: false,
hasBulkDelete: false, hasBulkDelete: false,
hasBulkUpdate: false, hasBulkUpdate: false
hasLeftActions: false,
hasSearch: false,
hasRightActions: false
} }
} }
} }

View File

@@ -29,10 +29,10 @@ export default {
return { return {
quickActions: [ quickActions: [
{ {
title: this.$t('xpack.ChangeAuthPlan.ManualRunPlan'), title: this.$t('xpack.ChangeAuthPlan.ManualExecutePlan'),
attrs: { attrs: {
type: 'primary', type: 'primary',
label: this.$t('xpack.ChangeAuthPlan.Run') label: this.$t('xpack.ChangeAuthPlan.Execute')
}, },
callbacks: { callbacks: {
click: function() { click: function() {
@@ -40,7 +40,7 @@ export default {
`/api/v1/xpack/change-auth-plan/plan-execution/`, `/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: this.object.id } { plan: this.object.id }
).then(res => { ).then(res => {
window.open(`/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600') window.open(`/core/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
}) })
}.bind(this) }.bind(this)
} }
@@ -59,6 +59,14 @@ export default {
key: this.$t('xpack.ChangeAuthPlan.Username'), key: this.$t('xpack.ChangeAuthPlan.Username'),
value: this.object.username value: this.object.username
}, },
{
key: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
value: this.object.assets_amount
},
{
key: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
value: this.object.nodes_amount
},
{ {
key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'), key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
value: this.object.password_strategy_display value: this.object.password_strategy_display

View File

@@ -30,7 +30,7 @@ export default {
name: 'ChangeAuthPlanInfo' name: 'ChangeAuthPlanInfo'
}, },
{ {
title: this.$t('xpack.assetAndNode'), title: this.$t('xpack.ChangeAuthPlan.AssetAndNode'),
name: 'ChangeAuthPlanAsset' name: 'ChangeAuthPlanAsset'
}, },
{ {

View File

@@ -20,33 +20,42 @@ export default {
'periodic_display', 'run_times', 'comment', 'actions' 'periodic_display', 'run_times', 'comment', 'actions'
], ],
columnsMeta: { columnsMeta: {
password_strategy_display: {
width: '200px',
showOverflowTooltip: true
},
assets_amount: { assets_amount: {
label: vm.$t('xpack.Asset') label: vm.$t('xpack.ChangeAuthPlan.AssetAmount'),
width: '80px'
}, },
nodes_amount: { nodes_amount: {
label: vm.$t('xpack.Node') label: vm.$t('xpack.ChangeAuthPlan.NodeAmount'),
width: '80px'
},
password_strategy_display: {
label: vm.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
width: '220px',
showOverflowTooltip: true
}, },
periodic_display: { periodic_display: {
showOverflowTooltip: true label: vm.$t('xpack.ChangeAuthPlan.Timer'),
showOverflowTooltip: true,
width: '150px'
},
run_times: {
label: vm.$t('xpack.ChangeAuthPlan.ExecutionTimes'),
width: '80px'
} }
}, },
actions: { actions: {
formatterArgs: { formatterArgs: {
extraActions: [ extraActions: [
{ {
title: vm.$t('xpack.ChangeAuthPlan.Run'), title: vm.$t('xpack.ChangeAuthPlan.Execute'),
name: 'run', name: 'execute',
type: 'info', type: 'info',
callback: function(data) { callback: function(data) {
this.$axios.post( this.$axios.post(
`/api/v1/xpack/change-auth-plan/plan-execution/`, `/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: data.cellValue } { plan: data.cellValue }
).then(res => { ).then(res => {
window.open(`/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600') window.open(`/core/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
}) })
}.bind(this) }.bind(this)
} }
@@ -55,9 +64,9 @@ export default {
} }
}, },
headerActions: { headerActions: {
hasRefresh: true,
hasExport: false, hasExport: false,
hasImport: false, hasImport: false,
hasRefresh: false,
hasBulkDelete: false, hasBulkDelete: false,
hasBulkUpdate: false hasBulkUpdate: false
} }

View File

@@ -76,47 +76,38 @@ export default {
meta: { title: i18n.t('xpack.OrganizationDetail'), activeMenu: '/xpack/orgs' } meta: { title: i18n.t('xpack.OrganizationDetail'), activeMenu: '/xpack/orgs' }
}, },
{ {
path: 'change-auth-plan', path: 'change-auth-plan/plan',
component: empty,
redirect: '/xpack/change-auth-plan/plan',
name: 'ChangeAuthPlan',
meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlan'), activeMenu: '/xpack/change-auth-plan' },
children: [
{
path: 'plan',
component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanList.vue'), component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanList.vue'),
name: 'ChangeAuthPlanList', name: 'ChangeAuthPlanList',
meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlan'), activeMenu: '/xpack/change-auth-plan' } meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlan'), activeMenu: '/xpack/change-auth-plan/plan' }
}, },
{ {
path: 'plan/create', path: 'change-auth-plan/plan/create',
component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue'), component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue'),
name: 'ChangeAuthPlanCreate', name: 'ChangeAuthPlanCreate',
meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlanCreate'), activeMenu: '/xpack/change-auth-plan', action: 'create' }, meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlanCreate'), activeMenu: '/xpack/change-auth-plan/plan', action: 'create' },
hidden: true hidden: true
}, },
{ {
path: 'plan/:id/update', path: 'change-auth-plan/plan/:id/update',
component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue'), component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanCreateUpdate.vue'),
name: 'ChangeAuthPlanUpdate', name: 'ChangeAuthPlanUpdate',
meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlanUpdate'), activeMenu: '/xpack/change-auth-plan', action: 'update' }, meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlanUpdate'), activeMenu: '/xpack/change-auth-plan/plan', action: 'update' },
hidden: true hidden: true
}, },
{ {
path: 'plan/:id', path: 'change-auth-plan/plan/:id',
component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanDetail/index.vue'), component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanDetail/index.vue'),
name: 'ChangeAuthPlanDetail', name: 'ChangeAuthPlanDetail',
meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlan'), activeMenu: '/xpack/change-auth-plan' }, meta: { title: i18n.t('xpack.ChangeAuthPlan.ChangeAuthPlan'), activeMenu: '/xpack/change-auth-plan/plan' },
hidden: true hidden: true
}, },
{ {
path: 'plan-execution/:id', path: 'change-auth-plan/plan-execution/:id',
component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/index.vue'), component: () => import('@/views/xpack/ChangeAuthPlan/ChangeAuthPlanDetail/ChangeAuthPlanExecution/ChangeAuthPlanExecutionDetail/index.vue'),
name: 'ChangeAuthPlanExecutionDetail', name: 'ChangeAuthPlanExecutionDetail',
meta: { title: i18n.t('xpack.ChangeAuthPlan.ExecutionDetail'), activeMenu: '/xpack/change-auth-plan' }, meta: { title: i18n.t('xpack.ChangeAuthPlan.ExecutionDetail'), activeMenu: '/xpack/change-auth-plan/plan' },
hidden: true hidden: true
}
]
}, },
{ {
path: '/cloud', path: '/cloud',