Merge branch 'pam' of github.com:jumpserver/lina into pam

This commit is contained in:
ibuler 2024-12-11 10:09:12 +08:00
commit 9477bfa2c1
4 changed files with 7 additions and 204 deletions

View File

@ -7,6 +7,7 @@ import { GenericCreateUpdatePage } from '@/layout/components'
import { getChangeSecretFields } from '@/views/accounts/AccountChangeSecret/fields'
import { AssetSelect, AutomationParams } from '@/components'
import { periodicMeta } from '@/components/const'
import { TagInput } from '@/components/Form/FormFields'
export default {
name: 'AccountPushCreateUpdate',
@ -92,6 +93,10 @@ export default {
readonly: true
}
},
accounts: {
component: TagInput,
helpText: this.$t('If the account already exists, the ciphertext of the account will be used for push; if the account does not exist, the account will be created according to the filled-in ciphertext and then pushed.')
},
params: {
component: AutomationParams,
label: this.$t('PushParams'),

View File

@ -1,194 +0,0 @@
<template>
<div>
<RecordViewSecret
v-if="showViewSecretDialog"
:url="secretUrl"
:visible.sync="showViewSecretDialog"
/>
<GenericListTable :header-actions="headerActions" :table-config="tableConfig" />
</div>
</template>
<script>
import GenericListTable from '@/layout/components/GenericListTable/index.vue'
import { ActionsFormatter, DetailFormatter } from '@/components/Table/TableFormatters'
import { openTaskPage } from '@/utils/jms'
import RecordViewSecret from '@/components/Apps/ChangeSecret/RecordViewSecret.vue'
export default {
name: 'AccountPushExecutionTaskList',
components: {
RecordViewSecret,
GenericListTable
},
props: {
object: {
type: Object,
required: true,
default: () => ({})
}
},
data() {
const vm = this
return {
secretUrl: '',
showViewSecretDialog: false,
tableConfig: {
url: `/api/v1/accounts/push-account-records/?execution_id=${this.object.id}`,
columns: [
'asset', 'account', 'date_finished', 'is_success', 'error', 'actions'
],
columnsMeta: {
asset: {
label: this.$t('Asset'),
formatter: DetailFormatter,
formatterArgs: {
can: this.$hasPerm('assets.view_asset'),
getTitle({ row }) {
return row.asset.name
},
getRoute({ row }) {
return {
name: 'AssetDetail',
params: { id: row.asset.id }
}
}
}
},
account: {
label: this.$t('Username'),
formatter: DetailFormatter,
formatterArgs: {
can: this.$hasPerm('accounts.view_account'),
getTitle({ row }) {
return row.account.username
},
getRoute({ row }) {
return {
name: 'AssetAccountDetail',
params: { id: row.account.id }
}
}
}
},
is_success: {
label: this.$t('Success'),
formatter: (row) => {
if (row.status === 'pending') {
return <i Class='fa fa fa-spinner fa-spin'/>
}
if (row.is_success) {
return <i Class='fa fa-check text-primary'/>
}
return <i Class='fa fa-times text-danger'/>
}
},
actions: {
formatter: ActionsFormatter,
formatterArgs: {
hasUpdate: false,
hasDelete: false,
hasClone: false,
moreActionsTitle: this.$t('More'),
extraActions: [
{
name: 'View',
title: this.$t('View'),
type: 'primary',
callback: ({ row }) => {
// debugger
vm.secretUrl = `/api/v1/accounts/change-secret-records/${row.id}/secret/`
vm.showViewSecretDialog = false
setTimeout(() => {
vm.showViewSecretDialog = true
})
}
},
{
name: 'Retry',
title: this.$t('Retry'),
can: this.$hasPerm('accounts.add_changesecretexecution'),
type: 'primary',
callback: ({ row }) => {
this.$axios.post(
'/api/v1/accounts/push-account-records/execute/',
{ record_ids: [row.id] }
).then(res => {
openTaskPage(res['task'])
})
}
}
]
}
}
}
},
headerActions: {
hasSearch: true,
hasRefresh: true,
hasLeftActions: true,
hasRightActions: true,
hasExport: false,
hasImport: false,
hasCreate: false,
hasBulkDelete: false,
hasBulkUpdate: false,
searchConfig: {
exclude: ['id', 'status', 'execution'],
options: [
{
label: this.$t('Asset'),
value: 'asset_name'
},
{
label: this.$t('Accounts'),
value: 'account_username'
},
{
value: 'status',
label: this.$t('Status'),
type: 'choice',
children: [
{
default: true,
value: 'success',
label: this.$t('Success')
},
{
value: 'failed',
label: this.$t('Failed')
}
]
}
]
},
extraMoreActions: [
{
name: 'RetrySelected',
title: this.$t('RetrySelected'),
type: 'primary',
fa: 'fa-retweet',
can: ({ selectedRows }) => {
return selectedRows.length > 0 && vm.$hasPerm('accounts.add_changesecretexecution')
},
callback: function({ selectedRows }) {
const ids = selectedRows.map(v => {
return v.id
})
this.$axios.post(
'/api/v1/accounts/change-secret-records/execute/',
{ record_ids: ids }).then(res => {
openTaskPage(res['task'])
})
}.bind(this)
}
]
}
}
}
}
</script>
<style scoped>
</style>

View File

@ -9,13 +9,11 @@
<script>
import { GenericDetailPage } from '@/layout/components'
import AccountPushExecutionInfo from './AccountPushExecutionInfo.vue'
import AccountPushExecutionTaskList from './AccountPushExecutionTaskList.vue'
export default {
components: {
GenericDetailPage,
AccountPushExecutionInfo,
AccountPushExecutionTaskList
AccountPushExecutionInfo
},
data() {
return {
@ -32,11 +30,6 @@ export default {
title: this.$t('Basic'),
name: 'AccountPushExecutionInfo',
hidden: () => !this.$hasPerm('accounts.view_pushaccountexecution')
},
{
title: this.$t('TaskList'),
name: 'AccountPushExecutionTaskList',
hidden: () => !this.$hasPerm('accounts.view_changesecretrecord')
}
],
getTitle: this.getExecutionTitle

View File

@ -19,8 +19,7 @@ export default {
title: this.$t('AccountPushList'),
name: 'AccountPushList',
hidden: !this.$hasPerm('accounts.view_pushaccountautomation'),
component: () => import('@/views/accounts/AccountPush/AccountPushList.vue'),
helpTip: this.$t('In the push system, if the account already exists, the ciphertext of the account will be used for push; if the account does not exist, the account will be created according to the filled-in ciphertext and then pushed.')
component: () => import('@/views/accounts/AccountPush/AccountPushList.vue')
},
{
title: this.$t('ExecutionList'),