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