perf: add update actions and detail formatters to various components

This commit is contained in:
w940853815 2025-02-19 15:33:55 +08:00 committed by w940853815
parent 2558cfa4c2
commit d5099c3a04
6 changed files with 35 additions and 22 deletions

View File

@ -88,6 +88,9 @@ export default {
if (!actions.onCreate) {
actions.onCreate = this.onCreate
}
if (!actions.onUpdate) {
actions.onUpdate = this.onUpdate
}
return actions
},
iTableConfig() {

View File

@ -9,6 +9,7 @@
import { GenericListPage } from '@/layout/components'
import { openTaskPage } from '@/utils/jms'
import ExecutionDetailDialog from '@/views/ops/Execution/ExecutionDetail'
import detailFormatter from '@/components/Table/TableFormatters/DetailFormatter.vue'
export default {
components: {
@ -34,8 +35,10 @@ export default {
},
columnsMeta: {
id: {
formatter(row) {
return row.id.slice(0, 8)
formatter: detailFormatter,
formatterArgs: {
drawer: true,
route: 'ExecutionDetail'
}
},
job: {
@ -77,15 +80,6 @@ export default {
hasDelete: false,
hasClone: false,
extraActions: [
{
title: this.$t('Detail'),
name: 'detail',
type: 'primary',
can: true,
callback: ({ row }) => {
this.$router.push({ name: 'ExecutionDetail', params: { id: row.id }})
}
},
{
title: this.$t('Output'),
name: 'logging',

View File

@ -121,6 +121,12 @@ export default {
})
vm.$refs.ListTable.onCreate()
},
onUpdate: () => {
vm.$router.push({
query: { _type: 'adhoc' }
})
vm.$refs.ListTable.onUpdate()
},
hasRefresh: true,
hasExport: false,
hasImport: false

View File

@ -126,6 +126,12 @@ export default {
vm.$refs.ListTable.onCreate()
}
},
onUpdate: () => {
vm.$router.push({
query: { _type: 'playbook' }
})
vm.$refs.ListTable.onUpdate()
},
showJobRunDialog: false
}
},

View File

@ -82,8 +82,7 @@ export default {
session: {
formatter: DetailFormatter,
formatterArgs: {
openInNewPage: true,
removeColorOnClick: true,
drawer: true,
can: this.$hasPerm('terminal.view_session'),
getTitle() {
return vm.$t('Goto')

View File

@ -10,6 +10,7 @@
<script>
import GenericListPage from '@/layout/components/GenericListPage'
import { DetailFormatter } from '@/components/Table/TableFormatters'
export default {
components: {
@ -47,15 +48,19 @@ export default {
},
user_display: {
label: this.$t('User'),
formatter: function(row) {
const to = {
name: 'UserDetail',
params: { id: row.user.id }
}
if (vm.$hasPerm('users.view_user')) {
return <router-link to={to}>{row.user.name}</router-link>
} else {
return <span>{row.user.name}</span>
formatter: DetailFormatter,
formatterArgs: {
drawer: true,
can: this.$hasPerm('users.view_user'),
getTitle: ({ row }) => { return row.user.name },
getDrawerTitle({ row }) { return row.user.name },
getRoute: ({ row }) => {
return {
name: 'UserDetail',
params: {
id: row.user.id
}
}
}
}
},