Skip to content

Commit

Permalink
perf: Add pam template
Browse files Browse the repository at this point in the history
  • Loading branch information
ZhaoJiSen committed Nov 28, 2024
1 parent b772580 commit 11d40b4
Show file tree
Hide file tree
Showing 9 changed files with 293 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/components/Apps/ResourceActivity/index.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div>
<el-row :gutter="20">
<el-col :md="16" :sm="24">
<el-col :md="16" :sm="24" class="resource-activity">
<IBox :title="title" class="block" v-bind="$attrs">
<el-timeline>
<el-timeline-item
Expand Down
62 changes: 52 additions & 10 deletions src/components/Table/ListTable/TableAction/LeftSide.vue
Original file line number Diff line number Diff line change
@@ -1,25 +1,37 @@
<template>
<DataActions
v-if="hasLeftActions && iActions.length > 0"
:actions="iActions"
class="header-action"
v-bind="$attrs"
/>
<div>
<DataActions
v-if="hasLeftActions && iActions.length > 0"
:actions="iActions"
class="header-action"
v-bind="$attrs"
/>

<Drawer v-if="showDrawer" @close-drawer="handleCloseDrawer">
<component :is="dynamicTemplateComponent" />
</Drawer>
</div>
</template>

<script>
import i18n from '@/i18n/i18n'
import DataActions from '@/components/DataActions/index.vue'
import { createSourceIdCache } from '@/api/common'
import { cleanActions } from './utils'
import { createSourceIdCache } from '@/api/common'
import { getErrorResponseMsg } from '@/utils/common'
import i18n from '@/i18n/i18n'
import Drawer from '@/components/Drawer/index.vue'
import DataActions from '@/components/DataActions/index.vue'
import AccountTemplateCreate from '@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'
const defaultTrue = { type: [Boolean, Function, String], default: true }
const defaultFalse = { type: [Boolean, Function, String], default: false }
export default {
name: 'LeftSide',
components: {
DataActions
Drawer,
DataActions,
AccountTemplateCreate
},
props: {
hasLeftActions: defaultTrue,
Expand Down Expand Up @@ -90,6 +102,8 @@ export default {
data() {
const vm = this
return {
showDrawer: false,
dynamicTemplateComponent: null,
defaultMoreActions: [
{
title: this.$t('DeleteSelected'),
Expand Down Expand Up @@ -194,6 +208,7 @@ export default {
methods: {
handleCreate() {
let route
if (typeof this.createRoute === 'string') {
route = { name: this.createRoute }
route.name = this.createRoute
Expand All @@ -202,14 +217,27 @@ export default {
} else if (typeof this.createRoute === 'object') {
route = this.createRoute
}
this.$log.debug('handle create')
if (this.createInNewPage) {
const { href } = this.$router.resolve(route)
window.open(href, '_blank')
} else {
if (route.isPam) {
this.showDrawer = true
this.dynamicTemplateComponent = route.name
return
}
this.$router.push(route)
}
},
handleCloseDrawer() {
this.showDrawer = false
this.dynamicTemplateComponent = null
},
defaultBulkDeleteCallback({ selectedRows, reloadTable }) {
const msg = this.$t('DeleteWarningMsg') + ' ' + selectedRows.length + ' ' + this.$t('Rows') + ' ?'
const title = this.$tc('Info')
Expand Down Expand Up @@ -248,3 +276,17 @@ export default {
}
}
</script>
<style scoped lang="scss">
::v-deep .ibox {
height: 100% !important;
margin: unset !important;
border: unset !important;
.el-card__body {
padding-top: unset !important;
padding-bottom: unset !important;
height: 100% !important;
}
}
</style>
2 changes: 2 additions & 0 deletions src/components/Table/TableFormatters/DetailFormatter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ export default {
goDetail() {
const detailRoute = this.getDetailRoute()
console.log('%c DEBUG[ detailRoute ]-97:', 'font-size:13px; background:pink; color:#7B68EE;', detailRoute)
if (this.formatterArgs.openInNewPage) {
this.linkClicked = this.formatterArgs.removeColorOnClick
const { href } = this.$router.resolve(detailRoute)
Expand Down
1 change: 1 addition & 0 deletions src/layout/components/Page/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ export default {
::v-deep > div {
margin-bottom: 50px;
height: 100%;
}
}
}
Expand Down
104 changes: 52 additions & 52 deletions src/router/console/accounts.js
Original file line number Diff line number Diff line change
Expand Up @@ -67,57 +67,57 @@ export default [
}
}
]
},
{
path: 'account-template',
component: empty,
redirect: {
name: 'AccountTemplateList'
},
meta: {
title: i18n.t('AccountTemplate'),
app: 'accounts',
icon: 'template',
permissions: ['accounts.view_accounttemplate']
},
children: [
{
path: '',
name: 'AccountTemplateList',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateList'),
meta: {
menuTitle: i18n.t('MenuAccountTemplates'),
title: i18n.t('AccountTemplateList'),
permissions: ['accounts.view_accounttemplate']
}
},
{
path: 'create',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'),
name: 'AccountTemplateCreate',
meta: {
title: i18n.t('CreateAccountTemplate'),
action: 'create'
},
hidden: true
},
{
path: ':id/update',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'),
name: 'AccountTemplateUpdate',
meta: {
title: i18n.t('UpdateAccountTemplate'),
action: 'update'
},
hidden: true
},
{
path: ':id',
component: () => import('@/views/accounts/AccountTemplate/AccountTemplateDetail/index.vue'),
name: 'AccountTemplateDetail',
meta: { title: i18n.t('AccountTemplate') },
hidden: true
}
]
}
// {
// path: 'account-template',
// component: empty,
// redirect: {
// name: 'AccountTemplateList'
// },
// meta: {
// title: i18n.t('AccountTemplate'),
// app: 'accounts',
// icon: 'template',
// permissions: ['accounts.view_accounttemplate']
// },
// children: [
// {
// path: '',
// name: 'AccountTemplateList',
// component: () => import('@/views/accounts/AccountTemplate/AccountTemplateList'),
// meta: {
// menuTitle: i18n.t('MenuAccountTemplates'),
// title: i18n.t('AccountTemplateList'),
// permissions: ['accounts.view_accounttemplate']
// }
// },
// {
// path: 'create',
// component: () => import('@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'),
// name: 'AccountTemplateCreate',
// meta: {
// title: i18n.t('CreateAccountTemplate'),
// action: 'create'
// },
// hidden: true
// },
// {
// path: ':id/update',
// component: () => import('@/views/accounts/AccountTemplate/AccountTemplateCreateUpdate.vue'),
// name: 'AccountTemplateUpdate',
// meta: {
// title: i18n.t('UpdateAccountTemplate'),
// action: 'update'
// },
// hidden: true
// },
// {
// path: ':id',
// component: () => import('@/views/accounts/AccountTemplate/AccountTemplateDetail/index.vue'),
// name: 'AccountTemplateDetail',
// meta: { title: i18n.t('AccountTemplate') },
// hidden: true
// }
// ]
// }
]
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
</el-col>
</el-row>
<el-row :gutter="20">
<el-col :md="15" :sm="24">
<el-col :md="15" :sm="24" class="generic-list-table">
<GenericListTable ref="listTable" :header-actions="headerActions" :table-config="tableConfig" />
</el-col>
<el-col :md="9" :sm="24">
<el-col :md="9" :sm="24" class="quick-actions">
<QuickActions :actions="quickActions" type="primary" />
</el-col>
<ViewSecret
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
<template>
<el-row :gutter="20">
<el-col :md="15" :sm="24">
<el-col :md="15" :sm="24" class="auto-detail-card">
<AutoDetailCard :fields="detailFields" :object="object" :url="url" />
</el-col>
<el-col :md="9" :sm="24">
<el-col :md="9" :sm="24" class="quick-actions">
<QuickActions :actions="quickActions" type="primary" />
</el-col>
</el-row>
Expand Down
Loading

0 comments on commit 11d40b4

Please sign in to comment.