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": "资产或节点",
"Success": "成功",
"ChangeAuthPlan": {
"Asset": "资产",
"Success": "成功",
"AssetAndNode": "资产和节点",
"AssetAmount": "资产数量",
"NodeAmount": "节点数量",
"ChangeAuthPlan": "改密计划",
"ChangeAuthPlanCreate": "创建改密计划",
"ChangeAuthPlanUpdate": "更新改密计划",
@@ -701,12 +706,14 @@
"Username": "用户名",
"PasswordStrategy": "密码策略",
"PasswordLength": "密码长度",
"Execute": "执行",
"ExecutionTimes": "执行次数",
"Timer": "定时执行",
"CyclePerform": "周期执行",
"RegularlyPerform": "定期执行",
"DateJoined": "创建日期",
"DateUpdated": "更新日期",
"ManualRunPlan": "手动执行计划",
"Run": "执行",
"ManualExecutePlan": "手动执行计划",
"addAsset": "添加资产",
"addNode": "添加节点",
"Result": "结果",
@@ -714,7 +721,12 @@
"DateStart": "开始日期",
"Detail": "详情",
"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": "公司",
"Edition": "版本",

View File

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

View File

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

View File

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

View File

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

View File

@@ -29,10 +29,10 @@ export default {
return {
quickActions: [
{
title: this.$t('xpack.ChangeAuthPlan.ManualRunPlan'),
title: this.$t('xpack.ChangeAuthPlan.ManualExecutePlan'),
attrs: {
type: 'primary',
label: this.$t('xpack.ChangeAuthPlan.Run')
label: this.$t('xpack.ChangeAuthPlan.Execute')
},
callbacks: {
click: function() {
@@ -40,7 +40,7 @@ export default {
`/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: this.object.id }
).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)
}
@@ -59,6 +59,14 @@ export default {
key: this.$t('xpack.ChangeAuthPlan.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'),
value: this.object.password_strategy_display

View File

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

View File

@@ -20,33 +20,42 @@ export default {
'periodic_display', 'run_times', 'comment', 'actions'
],
columnsMeta: {
password_strategy_display: {
width: '200px',
showOverflowTooltip: true
},
assets_amount: {
label: vm.$t('xpack.Asset')
label: vm.$t('xpack.ChangeAuthPlan.AssetAmount'),
width: '80px'
},
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: {
showOverflowTooltip: true
label: vm.$t('xpack.ChangeAuthPlan.Timer'),
showOverflowTooltip: true,
width: '150px'
},
run_times: {
label: vm.$t('xpack.ChangeAuthPlan.ExecutionTimes'),
width: '80px'
}
},
actions: {
formatterArgs: {
extraActions: [
{
title: vm.$t('xpack.ChangeAuthPlan.Run'),
name: 'run',
title: vm.$t('xpack.ChangeAuthPlan.Execute'),
name: 'execute',
type: 'info',
callback: function(data) {
this.$axios.post(
`/api/v1/xpack/change-auth-plan/plan-execution/`,
{ plan: data.cellValue }
).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)
}
@@ -55,9 +64,9 @@ export default {
}
},
headerActions: {
hasRefresh: true,
hasExport: false,
hasImport: false,
hasRefresh: false,
hasBulkDelete: false,
hasBulkUpdate: false
}

View File

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