mirror of
https://github.com/jumpserver/lina.git
synced 2025-08-06 17:25:03 +00:00
perf: change secret
This commit is contained in:
parent
fc08f54394
commit
057bb73405
@ -31,7 +31,7 @@ export default {
|
|||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/assets/`,
|
url: `/api/v1/assets/automation/${this.object.id}/assets/`,
|
||||||
columns: [
|
columns: [
|
||||||
'name', 'ip', 'delete_action'
|
'name', 'ip', 'delete_action'
|
||||||
],
|
],
|
||||||
@ -51,7 +51,7 @@ export default {
|
|||||||
formatter: DeleteActionFormatter,
|
formatter: DeleteActionFormatter,
|
||||||
onDelete: function(col, row, cellValue, reload) {
|
onDelete: function(col, row, cellValue, reload) {
|
||||||
this.$axios.patch(
|
this.$axios.patch(
|
||||||
`/api/v1/xpack/change-auth-plan/plan/${this.object.id}/asset/remove/`,
|
`/api/v1/assets/automation/${this.object.id}/asset/remove/`,
|
||||||
{ assets: [row.id] }
|
{ assets: [row.id] }
|
||||||
).then(res => {
|
).then(res => {
|
||||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||||
@ -84,7 +84,7 @@ export default {
|
|||||||
return this.object.assets.indexOf(row.id) === -1
|
return this.object.assets.indexOf(row.id) === -1
|
||||||
},
|
},
|
||||||
performAdd: (items, that) => {
|
performAdd: (items, that) => {
|
||||||
const relationUrl = `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/asset/add/`
|
const relationUrl = `/api/v1/assets/automation/${this.object.id}/asset/add/`
|
||||||
const data = {
|
const data = {
|
||||||
assets: items
|
assets: items
|
||||||
}
|
}
|
||||||
@ -108,7 +108,7 @@ export default {
|
|||||||
disabled: this.$store.getters.currentOrgIsRoot,
|
disabled: this.$store.getters.currentOrgIsRoot,
|
||||||
hasObjectsId: this.object.nodes,
|
hasObjectsId: this.object.nodes,
|
||||||
performAdd: (items, that) => {
|
performAdd: (items, that) => {
|
||||||
const relationUrl = `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/nodes/?action=add`
|
const relationUrl = `/api/v1/assets/automation/${this.object.id}/nodes/?action=add`
|
||||||
const nodes = items.map(v => v.value)
|
const nodes = items.map(v => v.value)
|
||||||
const iHasObjects = that.iHasObjects.map(v => v.value)
|
const iHasObjects = that.iHasObjects.map(v => v.value)
|
||||||
const data = {
|
const data = {
|
||||||
@ -126,7 +126,7 @@ export default {
|
|||||||
const data = {
|
const data = {
|
||||||
nodes: [item.value]
|
nodes: [item.value]
|
||||||
}
|
}
|
||||||
const relationUrl = `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/nodes/?action=remove`
|
const relationUrl = `/api/v1/assets/automation/${this.object.id}/nodes/?action=remove`
|
||||||
return this.$axios.patch(relationUrl, data)
|
return this.$axios.patch(relationUrl, data)
|
||||||
},
|
},
|
||||||
onDeleteSuccess: (obj, that) => {
|
onDeleteSuccess: (obj, that) => {
|
||||||
|
@ -28,25 +28,17 @@ export default {
|
|||||||
computed: {
|
computed: {
|
||||||
detailItems() {
|
detailItems() {
|
||||||
return [
|
return [
|
||||||
{
|
|
||||||
key: this.$t('xpack.ChangeAuthPlan.Username'),
|
|
||||||
value: this.object.username
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
|
key: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
|
||||||
value: this.object.assets_amount
|
value: this.object.snapshot.asset_amount
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
|
key: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
|
||||||
value: this.object.nodes_amount
|
value: this.object.snapshot.node_amount
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
|
key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
|
||||||
value: this.object.password_strategy_display
|
value: this.object.trigger_display
|
||||||
},
|
|
||||||
{
|
|
||||||
key: this.$t('xpack.ChangeAuthPlan.TimeDelta'),
|
|
||||||
value: this.object.timedelta.toFixed(2) + 's'
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.DateStart'),
|
key: this.$t('xpack.ChangeAuthPlan.DateStart'),
|
||||||
|
@ -19,12 +19,11 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const vm = this
|
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: `/api/v1/assets/change-secret-records/?execution_id=${this.object.id}`,
|
url: `/api/v1/assets/change-secret-records/?execution_id=${this.object.id}`,
|
||||||
columns: [
|
columns: [
|
||||||
'username', 'asset', 'is_success', 'timedelta', 'date_start', 'reason_display', 'actions'
|
'asset', 'account', 'date_started', 'date_finished', 'status', 'error'
|
||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
asset: {
|
asset: {
|
||||||
@ -33,12 +32,28 @@ export default {
|
|||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
can: this.$hasPerm('assets.view_asset'),
|
can: this.$hasPerm('assets.view_asset'),
|
||||||
getTitle({ row }) {
|
getTitle({ row }) {
|
||||||
return row.asset_info.name
|
return row.asset.name
|
||||||
},
|
},
|
||||||
getRoute({ row }) {
|
getRoute({ row }) {
|
||||||
return {
|
return {
|
||||||
name: 'AssetDetail',
|
name: 'AssetDetail',
|
||||||
params: { id: row.asset }
|
params: { id: row.asset.id }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
account: {
|
||||||
|
label: this.$t('users.Username'),
|
||||||
|
formatter: DetailFormatter,
|
||||||
|
formatterArgs: {
|
||||||
|
can: this.$hasPerm('assets.view_account'),
|
||||||
|
getTitle({ row }) {
|
||||||
|
return row.account.name
|
||||||
|
},
|
||||||
|
getRoute({ row }) {
|
||||||
|
return {
|
||||||
|
name: 'AssetDetail',
|
||||||
|
params: { id: row.account.id }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -55,28 +70,6 @@ export default {
|
|||||||
},
|
},
|
||||||
reason_display: {
|
reason_display: {
|
||||||
label: this.$t('xpack.AccountBackupPlan.Reason')
|
label: this.$t('xpack.AccountBackupPlan.Reason')
|
||||||
},
|
|
||||||
actions: {
|
|
||||||
formatterArgs: {
|
|
||||||
hasDelete: false,
|
|
||||||
hasUpdate: false,
|
|
||||||
hasClone: false,
|
|
||||||
extraActions: [
|
|
||||||
{
|
|
||||||
name: 'retry',
|
|
||||||
type: 'info',
|
|
||||||
title: this.$t('xpack.ChangeAuthPlan.Retry'),
|
|
||||||
can: vm.$hasPerm('xpack.change_changeauthplantask'),
|
|
||||||
callback: function({ row, tableData }) {
|
|
||||||
this.$axios.put(
|
|
||||||
`/api/v1/assets/change-secret-records/${row.id}/`,
|
|
||||||
).then(res => {
|
|
||||||
window.open(`/#/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
|
|
||||||
})
|
|
||||||
}.bind(this)
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -21,6 +21,7 @@ export default {
|
|||||||
return {
|
return {
|
||||||
execution: { id: '' },
|
execution: { id: '' },
|
||||||
config: {
|
config: {
|
||||||
|
url: '/api/v1/assets/automation-executions/',
|
||||||
activeMenu: 'ChangeAuthPlanExecutionInfo',
|
activeMenu: 'ChangeAuthPlanExecutionInfo',
|
||||||
actions: {
|
actions: {
|
||||||
hasUpdate: false,
|
hasUpdate: false,
|
||||||
@ -30,12 +31,12 @@ export default {
|
|||||||
{
|
{
|
||||||
title: this.$t('common.BasicInfo'),
|
title: this.$t('common.BasicInfo'),
|
||||||
name: 'ChangeAuthPlanExecutionInfo',
|
name: 'ChangeAuthPlanExecutionInfo',
|
||||||
hidden: () => !this.$hasPerm('xpack.view_changeauthplanexecution')
|
hidden: () => !this.$hasPerm('assets.view_automationexecution')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('xpack.ChangeAuthPlan.TaskList'),
|
title: this.$t('xpack.ChangeAuthPlan.TaskList'),
|
||||||
name: 'ChangeAuthPlanExecutionTaskList',
|
name: 'ChangeAuthPlanExecutionTaskList',
|
||||||
hidden: () => !this.$hasPerm('xpack.view_changeauthplantask')
|
hidden: () => !this.$hasPerm('assets.view_changesecretrecord')
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
getTitle: this.getExecutionTitle
|
getTitle: this.getExecutionTitle
|
||||||
|
@ -18,41 +18,32 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
|
console.log('this', this)
|
||||||
return {
|
return {
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: `/api/v1/xpack/change-auth-plan/plan-execution/?plan_id=${this.object.id}`,
|
url: `/api/v1/assets/automation-executions/?automation_id=${this.object.id}`,
|
||||||
columns: [
|
columns: [
|
||||||
'username', 'assets_amount', 'nodes_amount', 'result_summary', 'password_strategy_display',
|
'asset_amount', 'node_amount', 'status',
|
||||||
'timedelta', 'trigger_display', 'date_start', 'actions'
|
'trigger_display', 'date_start', 'actions'
|
||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
username: {
|
asset_amount: {
|
||||||
label: this.$t('xpack.ChangeAuthPlan.Username')
|
|
||||||
},
|
|
||||||
assets_amount: {
|
|
||||||
label: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
|
label: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
|
||||||
width: '80px'
|
|
||||||
},
|
|
||||||
nodes_amount: {
|
|
||||||
label: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
|
|
||||||
width: '80px'
|
|
||||||
},
|
|
||||||
result_summary: {
|
|
||||||
label: this.$t('xpack.ChangeAuthPlan.Result'),
|
|
||||||
width: '80px',
|
width: '80px',
|
||||||
showOverflowTooltip: true,
|
|
||||||
formatter: function(row) {
|
formatter: function(row) {
|
||||||
const summary = <div>
|
return <span>{ row.snapshot.asset_amount }</span>
|
||||||
<span class='text-primary'>{row.result_summary.succeed}</span>/
|
|
||||||
<span class='text-danger'>{row.result_summary.failed}</span>/
|
|
||||||
<span>{row.result_summary.total}</span>
|
|
||||||
</div>
|
|
||||||
return summary
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
password_strategy_display: {
|
node_amount: {
|
||||||
label: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
|
label: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
|
||||||
width: '220px',
|
width: '80px',
|
||||||
|
formatter: function(row) {
|
||||||
|
return <span>{ row.snapshot.node_amount }</span>
|
||||||
|
}
|
||||||
|
},
|
||||||
|
status: {
|
||||||
|
label: this.$t('xpack.ChangeAuthPlan.Result'),
|
||||||
|
width: '80px',
|
||||||
showOverflowTooltip: true
|
showOverflowTooltip: true
|
||||||
},
|
},
|
||||||
timedelta: {
|
timedelta: {
|
||||||
|
@ -34,12 +34,12 @@ export default {
|
|||||||
attrs: {
|
attrs: {
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
label: this.$t('xpack.ChangeAuthPlan.Execute'),
|
label: this.$t('xpack.ChangeAuthPlan.Execute'),
|
||||||
disabled: !this.$hasPerm('xpack.add_changeauthplanexecution')
|
disabled: !this.$hasPerm('assets.add_automationexecution')
|
||||||
},
|
},
|
||||||
callbacks: {
|
callbacks: {
|
||||||
click: function() {
|
click: function() {
|
||||||
this.$axios.post(
|
this.$axios.post(
|
||||||
`/api/v1/xpack/change-auth-plan/plan-execution/`,
|
`/api/v1/assets/automation-executions/`,
|
||||||
{ 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(`/#/ops/celery/task/${res.task}/log/`, '_blank', 'toolbar=yes, width=900, height=600')
|
||||||
@ -59,19 +59,19 @@ export default {
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.Username'),
|
key: this.$t('xpack.ChangeAuthPlan.Username'),
|
||||||
value: this.object.username
|
value: this.object.accounts.join(', ')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
|
key: this.$t('xpack.ChangeAuthPlan.AssetAmount'),
|
||||||
value: this.object.assets_amount
|
value: this.object.assets.length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
|
key: this.$t('xpack.ChangeAuthPlan.NodeAmount'),
|
||||||
value: this.object.nodes_amount
|
value: this.object.nodes.length
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
|
key: this.$t('xpack.ChangeAuthPlan.PasswordStrategy'),
|
||||||
value: this.object.password_strategy_display
|
value: this.object.secret_strategy.label
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
key: this.$t('xpack.ChangeAuthPlan.RegularlyPerform'),
|
key: this.$t('xpack.ChangeAuthPlan.RegularlyPerform'),
|
||||||
|
@ -24,21 +24,22 @@ export default {
|
|||||||
plan: { name: '', username: '', comment: '' },
|
plan: { name: '', username: '', comment: '' },
|
||||||
config: {
|
config: {
|
||||||
activeMenu: 'ChangeAuthPlanInfo',
|
activeMenu: 'ChangeAuthPlanInfo',
|
||||||
|
url: '/api/v1/assets/change-secret-automations/',
|
||||||
submenu: [
|
submenu: [
|
||||||
{
|
{
|
||||||
title: this.$t('common.BasicInfo'),
|
title: this.$t('common.BasicInfo'),
|
||||||
name: 'ChangeAuthPlanInfo',
|
name: 'ChangeAuthPlanInfo',
|
||||||
hidden: () => !this.$hasPerm('xpack.view_changeauthplan')
|
hidden: () => !this.$hasPerm('assets.view_changesecretautomation')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('xpack.ChangeAuthPlan.AssetAndNode'),
|
title: this.$t('xpack.ChangeAuthPlan.AssetAndNode'),
|
||||||
name: 'ChangeAuthPlanAsset',
|
name: 'ChangeAuthPlanAsset',
|
||||||
hidden: () => !this.$hasPerm('xpack.change_changeauthplan')
|
hidden: () => !this.$hasPerm('assets.change_changesecretautomation')
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
title: this.$t('xpack.ChangeAuthPlan.ExecutionList'),
|
title: this.$t('xpack.ChangeAuthPlan.ExecutionList'),
|
||||||
name: 'ChangeAuthPlanExecutionList',
|
name: 'ChangeAuthPlanExecutionList',
|
||||||
hidden: () => !this.$hasPerm('xpack.view_changeauthplanexecution')
|
hidden: () => !this.$hasPerm('assets.view_automationexecution')
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,10 @@ export default {
|
|||||||
callback: function({ row }) {
|
callback: function({ row }) {
|
||||||
this.$axios.post(
|
this.$axios.post(
|
||||||
`/api/v1/assets/automation-executions/`,
|
`/api/v1/assets/automation-executions/`,
|
||||||
{ plan: row.id }
|
{
|
||||||
|
automation: row.id,
|
||||||
|
type: row.type
|
||||||
|
}
|
||||||
).then(res => {
|
).then(res => {
|
||||||
openTaskPage(res['task'])
|
openTaskPage(res['task'])
|
||||||
})
|
})
|
||||||
|
@ -126,8 +126,7 @@ export const getFields = () => {
|
|||||||
},
|
},
|
||||||
accounts: {
|
accounts: {
|
||||||
label: i18n.t('common.Username'),
|
label: i18n.t('common.Username'),
|
||||||
component: TagInput,
|
component: TagInput
|
||||||
helpText: i18n.t('xpack.ChangeAuthPlan.HelpText.UsernameOfCreateUpdatePage')
|
|
||||||
},
|
},
|
||||||
secret: {
|
secret: {
|
||||||
hidden: ({ secret_strategy, secret_type }) => (secret_strategy !== 'specific' || secret_type !== 'password')
|
hidden: ({ secret_strategy, secret_type }) => (secret_strategy !== 'specific' || secret_type !== 'password')
|
||||||
|
Loading…
Reference in New Issue
Block a user