mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-16 23:31:29 +00:00
fix: 修复root组织可以创建的问题
fix: 修复全局组织可以clone的问题
This commit is contained in:
@@ -82,7 +82,7 @@ export default {
|
||||
title: this.$t('common.Create'),
|
||||
type: 'primary',
|
||||
has: true,
|
||||
can: true,
|
||||
can: this.canCreate,
|
||||
dropdown: [],
|
||||
callback: this.handleCreate
|
||||
}
|
||||
|
@@ -84,7 +84,9 @@ export default {
|
||||
canUpdate: true, // can set function(row, value)
|
||||
hasDelete: true, // can set function(row, value)
|
||||
canDelete: true,
|
||||
hasClone: true,
|
||||
hasClone: () => {
|
||||
return !this.$store.getters.currentOrgIsRoot
|
||||
},
|
||||
canClone: true,
|
||||
updateRoute: this.$route.name.replace('List', 'Update'),
|
||||
cloneRoute: this.$route.name.replace('List', 'Create'),
|
||||
|
@@ -4,7 +4,7 @@
|
||||
<TreeTable
|
||||
ref="TreeTable"
|
||||
:table-config="tableConfig"
|
||||
:header-actions="headerActions"
|
||||
:header-actions="iHeaderActions"
|
||||
:tree-setting="treeSetting"
|
||||
v-on="$listeners"
|
||||
>
|
||||
@@ -39,6 +39,7 @@ export default {
|
||||
iHeaderActions() {
|
||||
const attrs = _.cloneDeep(this.headerActions)
|
||||
const canCreate = _.get(attrs, 'canCreate', null)
|
||||
// this.$log.debug('Current org: ', this.currentOrg)
|
||||
if (canCreate === null && this.currentOrg && this.currentOrg.is_root) {
|
||||
_.set(attrs, 'canCreate', false)
|
||||
}
|
||||
|
@@ -16,7 +16,7 @@
|
||||
import QuickActions from '@/components/QuickActions/index'
|
||||
import ListTable from '@/components/ListTable'
|
||||
import RelationCard from '@/components/RelationCard'
|
||||
import { BooleanFormatter } from '@/components/ListTable/formatters'
|
||||
import { ChoicesFormatter } from '@/components/ListTable/formatters'
|
||||
|
||||
export default {
|
||||
name: 'AssetList',
|
||||
@@ -44,7 +44,7 @@ export default {
|
||||
},
|
||||
connectivity: {
|
||||
label: this.$t('assets.Reachable'),
|
||||
formatter: BooleanFormatter,
|
||||
formatter: ChoicesFormatter,
|
||||
formatterArgs: {
|
||||
iconChoices: {
|
||||
0: 'fa-times text-danger',
|
||||
|
@@ -67,7 +67,7 @@
|
||||
|
||||
<script>
|
||||
import GenericTreeListPage from '@/layout/components/GenericTreeListPage/index'
|
||||
import { DetailFormatter, ActionsFormatter, BooleanFormatter } from '@/components/ListTable/formatters'
|
||||
import { DetailFormatter, ActionsFormatter, ChoicesFormatter } from '@/components/ListTable/formatters'
|
||||
import $ from '@/utils/jquery-vendor'
|
||||
import Dialog from '@/components/Dialog'
|
||||
import TreeTable from '@/components/TreeTable'
|
||||
@@ -138,7 +138,7 @@ export default {
|
||||
},
|
||||
connectivity: {
|
||||
label: this.$t('assets.Reachable'),
|
||||
formatter: BooleanFormatter,
|
||||
formatter: ChoicesFormatter,
|
||||
formatterArgs: {
|
||||
iconChoices: {
|
||||
0: 'fa-times text-danger',
|
||||
|
@@ -67,60 +67,46 @@ export default {
|
||||
headerActions: {
|
||||
hasBulkDelete: false,
|
||||
hasImport: false,
|
||||
hasCreate: false,
|
||||
moreActionsTitle: this.$t('common.Create'),
|
||||
moreActionsType: 'primary',
|
||||
extraMoreActions: [
|
||||
{
|
||||
name: aliyun,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[aliyun].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(aliyun).bind(this)
|
||||
hasMoreActions: false,
|
||||
moreCreates: {
|
||||
callback: (option) => {
|
||||
vm.$router.push({ name: 'AccountCreate', query: { provider: option.name }})
|
||||
},
|
||||
{
|
||||
name: qcloud,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[qcloud].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(qcloud).bind(this)
|
||||
},
|
||||
{
|
||||
name: aws_china,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[aws_china].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(aws_china).bind(this)
|
||||
},
|
||||
{
|
||||
name: aws_international,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[aws_international].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(aws_international).bind(this)
|
||||
},
|
||||
{
|
||||
name: huaweicloud,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[huaweicloud].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(huaweicloud).bind(this)
|
||||
},
|
||||
{
|
||||
name: azure,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[azure].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(azure).bind(this)
|
||||
},
|
||||
{
|
||||
name: vmware,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[vmware].title,
|
||||
type: 'primary',
|
||||
can: true,
|
||||
callback: this.createAccount(vmware).bind(this)
|
||||
}
|
||||
]
|
||||
dropdown: [
|
||||
{
|
||||
name: aliyun,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[aliyun].title,
|
||||
type: 'primary',
|
||||
can: true
|
||||
},
|
||||
{
|
||||
name: qcloud,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[qcloud].title,
|
||||
type: 'primary',
|
||||
can: true
|
||||
},
|
||||
{
|
||||
name: aws_china,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[aws_china].title
|
||||
},
|
||||
{
|
||||
name: aws_international,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[aws_international].title
|
||||
},
|
||||
{
|
||||
name: huaweicloud,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[huaweicloud].title
|
||||
},
|
||||
{
|
||||
name: azure,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[azure].title
|
||||
},
|
||||
{
|
||||
name: vmware,
|
||||
title: ACCOUNT_PROVIDER_ATTRS_MAP[vmware].title
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
|
Reference in New Issue
Block a user