mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-25 22:36:23 +00:00
Merge branch 'pam' of github.com:jumpserver/lina into pam
This commit is contained in:
@@ -1,85 +1,141 @@
|
|||||||
<template>
|
<template>
|
||||||
<HomeCard :table-config="tableConfig" v-bind="cardConfig" />
|
<div>
|
||||||
|
<RecordViewSecret
|
||||||
|
v-if="showViewSecretDialog"
|
||||||
|
:url="secretUrl"
|
||||||
|
:visible.sync="showViewSecretDialog"
|
||||||
|
/>
|
||||||
|
<HomeCard ref="HomeCard" :table-config="tableConfig" v-bind="cardConfig" />
|
||||||
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import HomeCard from '@/views/workbench/myhome/components/HomeCard.vue'
|
import HomeCard from '@/views/workbench/myhome/components/HomeCard.vue'
|
||||||
|
import { ActionsFormatter, DetailFormatter } from '@/components/Table/TableFormatters'
|
||||||
|
import { openTaskPage } from '@/utils/jms'
|
||||||
|
import RecordViewSecret from '@/components/Apps/ChangeSecret/RecordViewSecret.vue'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
|
RecordViewSecret,
|
||||||
HomeCard
|
HomeCard
|
||||||
},
|
},
|
||||||
|
props: {
|
||||||
|
days: {
|
||||||
|
type: [Number, String],
|
||||||
|
default: '7'
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
const vm = this
|
const vm = this
|
||||||
return {
|
return {
|
||||||
|
showViewSecretDialog: false,
|
||||||
cardConfig: {
|
cardConfig: {
|
||||||
title: '改密失败账号'
|
title: '改密失败账号'
|
||||||
},
|
},
|
||||||
tableConfig: {
|
tableConfig: {
|
||||||
url: '/api/v1/terminal/my-sessions/?limit=5',
|
url: `/api/v1/accounts/change-secret-records/dashboard/?days=${this.days}`,
|
||||||
columns: [
|
columns: [
|
||||||
'id', 'asset', 'account', 'remote_addr', 'protocol'
|
'asset', 'account', 'date_finished', 'is_success', 'error', 'actions'
|
||||||
],
|
],
|
||||||
columnsMeta: {
|
columnsMeta: {
|
||||||
id: {
|
asset: {
|
||||||
prop: 'id',
|
label: this.$t('Asset'),
|
||||||
align: 'center',
|
formatter: DetailFormatter,
|
||||||
formatter: function(row, column, cellValue, index) {
|
formatterArgs: {
|
||||||
const label = index + 1
|
can: this.$hasPerm('assets.view_asset'),
|
||||||
const route = { to: { name: 'SessionDetail', params: { id: row.id }}}
|
getTitle({ row }) {
|
||||||
if (vm.$hasPerm('terminal.view_session')) {
|
return row.asset.name
|
||||||
return <router-link {...{ attrs: route }} >{label}</router-link>
|
},
|
||||||
} else {
|
getRoute({ row }) {
|
||||||
return label
|
return {
|
||||||
|
name: 'AssetDetail',
|
||||||
|
params: { id: row.asset.id }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
asset: {
|
|
||||||
'min-width': 200,
|
|
||||||
label: this.$t('Asset')
|
|
||||||
},
|
|
||||||
account: {
|
account: {
|
||||||
'min-width': 100
|
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 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
},
|
},
|
||||||
command_amount: {
|
is_success: {
|
||||||
align: 'center',
|
label: this.$t('Success'),
|
||||||
label: this.$t('Command')
|
formatter: (row) => {
|
||||||
},
|
if (row.status === 'pending') {
|
||||||
remote_addr: {
|
return <i Class='fa fa fa-spinner fa-spin'/>
|
||||||
width: 180,
|
}
|
||||||
label: this.$t('RemoteAddr')
|
if (row.is_success) {
|
||||||
},
|
return <i Class='fa fa-check text-primary'/>
|
||||||
protocol: {
|
}
|
||||||
width: 100,
|
return <i Class='fa fa-times text-danger'/>
|
||||||
label: this.$t('Protocol'),
|
}
|
||||||
el: {
|
|
||||||
disabled: false
|
|
||||||
},
|
|
||||||
sortable: false
|
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
align: 'center',
|
formatter: ActionsFormatter,
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
|
hasUpdate: false,
|
||||||
hasDelete: false,
|
hasDelete: false,
|
||||||
hasClone: false,
|
hasClone: false,
|
||||||
hasUpdate: false,
|
moreActionsTitle: this.$t('More'),
|
||||||
extraActions: [
|
extraActions: [
|
||||||
{
|
{
|
||||||
name: 'connect',
|
name: 'View',
|
||||||
icon: 'fa-desktop',
|
title: this.$t('View'),
|
||||||
plain: true,
|
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
can: ({ row }) => row.is_active,
|
|
||||||
callback: ({ row }) => {
|
callback: ({ row }) => {
|
||||||
window.open(`/luna/?login_to=${row.asset_id}&login_account=${row.account_id}`, '_blank')
|
// 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/change-secret-records/execute/',
|
||||||
|
{ record_ids: [row.id] }
|
||||||
|
).then(res => {
|
||||||
|
openTaskPage(res['task'])
|
||||||
|
})
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'ignoreFail',
|
||||||
|
title: this.$t('ignoreFail'),
|
||||||
|
can: this.$hasPerm('accounts.view_changesecretrecord'),
|
||||||
|
type: 'primary',
|
||||||
|
callback: ({ row }) => {
|
||||||
|
this.$axios.patch(
|
||||||
|
`/api/v1/accounts/change-secret-records/${row.id}/ignore-fail/`,
|
||||||
|
).then(res => {
|
||||||
|
this.$message.success(this.$tc('UpdateSuccessMsg'))
|
||||||
|
this.$refs.HomeCard.$refs.ListTable.reloadTable()
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
hasSelection: false,
|
|
||||||
paginationSize: 10
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -18,19 +18,16 @@
|
|||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
<el-row type="flex" :gutter="20">
|
<el-row type="flex" :gutter="24">
|
||||||
<el-col :span="12" style="margin-top: 2rem">
|
|
||||||
<FailedAccountSummary />
|
|
||||||
</el-col>
|
|
||||||
<el-col :span="12" style="margin-top: 2rem">
|
|
||||||
<FailedAccountSummary />
|
|
||||||
</el-col>
|
|
||||||
</el-row>
|
|
||||||
|
|
||||||
<el-row type="flex" style="flex-direction: column">
|
<el-col :span="14">
|
||||||
<el-col :span="24">
|
<FailedAccountSummary :days="days" class="failed-account-summary" />
|
||||||
|
</el-col>
|
||||||
|
|
||||||
|
<el-col :span="10">
|
||||||
<AccountSummary class="account-summary" :days="days" />
|
<AccountSummary class="account-summary" :days="days" />
|
||||||
</el-col>
|
</el-col>
|
||||||
|
|
||||||
</el-row>
|
</el-row>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
@@ -77,4 +74,14 @@ export default {
|
|||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.failed-account-summary {
|
||||||
|
height: 100%;
|
||||||
|
margin-top: 16px;
|
||||||
|
|
||||||
|
::v-deep #HomeCard .el-card.no-border {
|
||||||
|
height: 100%;
|
||||||
|
margin-bottom: unset !important;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
Reference in New Issue
Block a user