mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 01:11:07 +00:00
perf: 优化全局组织 (#621)
* feat: 默认组织改为实体组织 * perf: 优化在root组织下,应不能创建 * perf: 优化全局组织 * perf: 优化组织选择 Co-authored-by: ibuler <ibuler@qq.com>
This commit is contained in:
15
src/api/orgs.js
Normal file
15
src/api/orgs.js
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
export function getOrgDetail(oid) {
|
||||||
|
return request({
|
||||||
|
url: `/api/v1/orgs/orgs/current/?oid=${oid}`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getCurrentOrg() {
|
||||||
|
return request({
|
||||||
|
url: `/api/v1/orgs/orgs/current/`,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
@@ -16,6 +16,7 @@ export default {
|
|||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
hasCreate: defaultTrue,
|
hasCreate: defaultTrue,
|
||||||
|
canCreate: defaultTrue,
|
||||||
hasBulkDelete: defaultTrue,
|
hasBulkDelete: defaultTrue,
|
||||||
hasBulkUpdate: defaultFalse,
|
hasBulkUpdate: defaultFalse,
|
||||||
hasLeftActions: defaultTrue,
|
hasLeftActions: defaultTrue,
|
||||||
@@ -66,7 +67,7 @@ export default {
|
|||||||
title: this.$t('common.Create'),
|
title: this.$t('common.Create'),
|
||||||
type: 'primary',
|
type: 'primary',
|
||||||
has: this.hasCreate,
|
has: this.hasCreate,
|
||||||
can: true,
|
can: this.canCreate,
|
||||||
callback: this.handleCreate
|
callback: this.handleCreate
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
|
@@ -28,6 +28,9 @@ export default {
|
|||||||
},
|
},
|
||||||
hasTips: false,
|
hasTips: false,
|
||||||
tipStatus(val, vm) {
|
tipStatus(val, vm) {
|
||||||
|
if (!val) {
|
||||||
|
return vm.$t('assets.Unknown')
|
||||||
|
}
|
||||||
if (val.status === 0) {
|
if (val.status === 0) {
|
||||||
return vm.$t('assets.Unreachable')
|
return vm.$t('assets.Unreachable')
|
||||||
} else if (val.status === 1) {
|
} else if (val.status === 1) {
|
||||||
@@ -55,6 +58,9 @@ export default {
|
|||||||
return this.formatterArgs.tipStatus(this.cellValue, vm)
|
return this.formatterArgs.tipStatus(this.cellValue, vm)
|
||||||
},
|
},
|
||||||
tipTime() {
|
tipTime() {
|
||||||
|
if (!this.cellValue) {
|
||||||
|
return ''
|
||||||
|
}
|
||||||
return toSafeLocalDateStr(this.cellValue.datetime)
|
return toSafeLocalDateStr(this.cellValue.datetime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -42,21 +42,20 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
|
||||||
dataTable() {
|
dataTable() {
|
||||||
return this.$refs.dataTable.$refs.dataTable
|
return this.$refs.dataTable.$refs.dataTable
|
||||||
},
|
},
|
||||||
hasCreateAction() {
|
// hasCreateAction() {
|
||||||
const hasLeftAction = this.headerActions.hasLeftActions
|
// const hasLeftAction = this.headerActions.hasLeftActions
|
||||||
if (hasLeftAction === false) {
|
// if (hasLeftAction === false) {
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
const hasCreate = this.headerActions.hasCreate
|
// const hasCreate = this.headerActions.hasCreate
|
||||||
if (hasCreate === false) {
|
// if (hasCreate === false) {
|
||||||
return false
|
// return false
|
||||||
}
|
// }
|
||||||
return true
|
// return true
|
||||||
},
|
// },
|
||||||
iTableConfig() {
|
iTableConfig() {
|
||||||
const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery })
|
const config = deepmerge(this.tableConfig, { extraQuery: this.extraQuery })
|
||||||
this.$log.debug('Header actions', this.headerActions)
|
this.$log.debug('Header actions', this.headerActions)
|
||||||
|
@@ -1,16 +1,16 @@
|
|||||||
<template>
|
<template>
|
||||||
<Page v-bind="$attrs">
|
<Page v-bind="$attrs">
|
||||||
<ListTable ref="ListTable" v-bind="$attrs" />
|
<GenericListTable ref="ListTable" v-bind="$attrs" />
|
||||||
</Page>
|
</Page>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import Page from '@/layout/components/Page'
|
import Page from '@/layout/components/Page'
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
export default {
|
export default {
|
||||||
name: 'GenericListPage',
|
name: 'GenericListPage',
|
||||||
components: {
|
components: {
|
||||||
Page, ListTable
|
Page, GenericListTable
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
32
src/layout/components/GenericListTable/index.vue
Normal file
32
src/layout/components/GenericListTable/index.vue
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
<template>
|
||||||
|
<ListTable v-bind="iAttrs" v-on="$listeners" />
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import ListTable from '@/components/ListTable/index'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
|
export default {
|
||||||
|
name: 'GenericListTable',
|
||||||
|
components: {
|
||||||
|
ListTable
|
||||||
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['currentOrgIsRoot']),
|
||||||
|
iAttrs() {
|
||||||
|
const attrs = _.cloneDeep(this.$attrs)
|
||||||
|
const canCreate = _.get(attrs, 'header-actions.canCreate', null)
|
||||||
|
this.$log.debug('Can create: ', canCreate)
|
||||||
|
if (canCreate === null && this.currentOrgIsRoot) {
|
||||||
|
_.set(attrs, 'header-actions.canCreate', false)
|
||||||
|
}
|
||||||
|
// attrs.headerActions.can
|
||||||
|
// console.log()
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<style scoped>
|
||||||
|
|
||||||
|
</style>
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<Page>
|
<Page>
|
||||||
<el-alert v-if="helpMessage" type="success"> {{ helpMessage }} </el-alert>
|
<el-alert v-if="helpMessage" type="success"> {{ helpMessage }} </el-alert>
|
||||||
<TreeTable ref="TreeTable" :table-config="tableConfig" :header-actions="headerActions" :tree-setting="treeSetting">
|
<TreeTable ref="TreeTable" :table-config="tableConfig" :header-actions="iHeaderActions" :tree-setting="treeSetting">
|
||||||
<template #table>
|
<template #table>
|
||||||
<slot name="table" />
|
<slot name="table" />
|
||||||
</template>
|
</template>
|
||||||
@@ -15,6 +15,7 @@
|
|||||||
<script>
|
<script>
|
||||||
import Page from '@/layout/components/Page'
|
import Page from '@/layout/components/Page'
|
||||||
import TreeTable from '@/components/TreeTable'
|
import TreeTable from '@/components/TreeTable'
|
||||||
|
import { mapGetters } from 'vuex'
|
||||||
export default {
|
export default {
|
||||||
name: 'GenericTreeListPage',
|
name: 'GenericTreeListPage',
|
||||||
components: {
|
components: {
|
||||||
@@ -27,6 +28,17 @@ export default {
|
|||||||
default: null
|
default: null
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
...mapGetters(['currentOrgIsRoot']),
|
||||||
|
iHeaderActions() {
|
||||||
|
const attrs = _.cloneDeep(this.headerActions)
|
||||||
|
const canCreate = _.get(attrs, 'canCreate', null)
|
||||||
|
if (canCreate === null && this.currentOrgIsRoot) {
|
||||||
|
_.set(attrs, 'canCreate', false)
|
||||||
|
}
|
||||||
|
return attrs
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
hideRMenu() {
|
hideRMenu() {
|
||||||
this.$refs.TreeTable.hideRMenu()
|
this.$refs.TreeTable.hideRMenu()
|
||||||
|
@@ -3,6 +3,8 @@ const getters = {
|
|||||||
device: state => state.app.device,
|
device: state => state.app.device,
|
||||||
token: state => state.users.token,
|
token: state => state.users.token,
|
||||||
currentOrg: state => state.users.currentOrg,
|
currentOrg: state => state.users.currentOrg,
|
||||||
|
currentOrgIsDefault: state => state.users.currentOrg.is_default,
|
||||||
|
currentOrgIsRoot: state => state.users.currentOrg.is_root,
|
||||||
currentRole: state => state.users.currentRole,
|
currentRole: state => state.users.currentRole,
|
||||||
userAdminOrgList: state => state.users.orgs,
|
userAdminOrgList: state => state.users.orgs,
|
||||||
currentUser: state => state.users.profile,
|
currentUser: state => state.users.profile,
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
import { hasUUID, BASE_URL } from '@/utils/common'
|
import { hasUUID, BASE_URL } from '@/utils/common'
|
||||||
|
import { getOrgDetail } from '@/api/orgs'
|
||||||
import store from '@/store'
|
import store from '@/store'
|
||||||
|
|
||||||
|
const DEFAULT_ORG_ID = '00000000-0000-0000-0000-000000000001'
|
||||||
|
// const ROOT_ORG_ID = '00000000-0000-0000-0000-000000000000'
|
||||||
|
|
||||||
function getPropOrg() {
|
function getPropOrg() {
|
||||||
const userAdminOrgList = store.getters.userAdminOrgList
|
const userAdminOrgList = store.getters.userAdminOrgList
|
||||||
let defaultOrg = userAdminOrgList.find((item) => item.id === '')
|
const defaultOrg = userAdminOrgList.find((item) => item.id === DEFAULT_ORG_ID)
|
||||||
if (defaultOrg) {
|
|
||||||
return defaultOrg
|
|
||||||
}
|
|
||||||
defaultOrg = userAdminOrgList.find((item) => item.id === 'DEFAULT')
|
|
||||||
if (defaultOrg) {
|
if (defaultOrg) {
|
||||||
return defaultOrg
|
return defaultOrg
|
||||||
}
|
}
|
||||||
@@ -19,14 +19,14 @@ function change2PropOrg() {
|
|||||||
setTimeout(() => changeOrg(org.id), 100)
|
setTimeout(() => changeOrg(org.id), 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOrgIdMapper() {
|
// function getOrgIdMapper() {
|
||||||
const mapper = {}
|
// const mapper = {}
|
||||||
const userAdminOrgList = store.getters.userAdminOrgList
|
// const userAdminOrgList = store.getters.userAdminOrgList
|
||||||
userAdminOrgList.forEach((v) => {
|
// userAdminOrgList.forEach((v) => {
|
||||||
mapper[v.id] = v
|
// mapper[v.id] = v
|
||||||
})
|
// })
|
||||||
return mapper
|
// return mapper
|
||||||
}
|
// }
|
||||||
|
|
||||||
function hasCurrentOrgPermission() {
|
function hasCurrentOrgPermission() {
|
||||||
const currentOrg = store.getters.currentOrg
|
const currentOrg = store.getters.currentOrg
|
||||||
@@ -37,7 +37,7 @@ function hasCurrentOrgPermission() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function changeOrg(orgId) {
|
async function changeOrg(orgId) {
|
||||||
const org = getOrgIdMapper()[orgId]
|
const org = await getOrgDetail(orgId)
|
||||||
if (!org) {
|
if (!org) {
|
||||||
console.debug('Error: org not found')
|
console.debug('Error: org not found')
|
||||||
} else {
|
} else {
|
||||||
|
@@ -6,6 +6,7 @@ import 'nprogress/nprogress.css' // progress bar style
|
|||||||
import { getTokenFromCookie } from '@/utils/auth'
|
import { getTokenFromCookie } from '@/utils/auth'
|
||||||
import rolec from '@/utils/role'
|
import rolec from '@/utils/role'
|
||||||
import orgUtil from '@/utils/org'
|
import orgUtil from '@/utils/org'
|
||||||
|
import { getCurrentOrg } from '@/api/orgs'
|
||||||
|
|
||||||
const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
|
const whiteList = ['/login', process.env.VUE_APP_LOGIN_PATH] // no redirect whitelist
|
||||||
let initial = false
|
let initial = false
|
||||||
@@ -52,22 +53,29 @@ async function getPublicSetting({ to, from, next }) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function refreshCurrentOrg() {
|
||||||
|
getCurrentOrg().then(org => {
|
||||||
|
store.dispatch('users/setCurrentOrg', org)
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
async function changeCurrentOrgIfNeed({ to, from, next }) {
|
async function changeCurrentOrgIfNeed({ to, from, next }) {
|
||||||
await store.dispatch('users/getInOrgs')
|
await store.dispatch('users/getInOrgs')
|
||||||
const adminOrgs = store.getters.userAdminOrgList
|
const adminOrgs = store.getters.userAdminOrgList
|
||||||
if (!adminOrgs || adminOrgs.length === 0) {
|
if (!adminOrgs || adminOrgs.length === 0) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
await refreshCurrentOrg()
|
||||||
const currentOrg = store.getters.currentOrg
|
const currentOrg = store.getters.currentOrg
|
||||||
if (!currentOrg || typeof currentOrg !== 'object') {
|
if (!currentOrg || typeof currentOrg !== 'object') {
|
||||||
// console.log('Not has current org')
|
// console.log('Not has current org')
|
||||||
orgUtil.change2PropOrg()
|
orgUtil.change2PropOrg()
|
||||||
return reject('change prop org')
|
return reject('Change prop org')
|
||||||
}
|
}
|
||||||
if (!orgUtil.hasCurrentOrgPermission()) {
|
if (!orgUtil.hasCurrentOrgPermission()) {
|
||||||
console.debug('Not has current org permission')
|
console.debug('Not has current org permission')
|
||||||
orgUtil.change2PropOrg()
|
orgUtil.change2PropOrg()
|
||||||
return reject('change prop org')
|
return reject('Change prop org')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -125,6 +125,9 @@ export default {
|
|||||||
2: 'fa-circle text-warning'
|
2: 'fa-circle text-warning'
|
||||||
},
|
},
|
||||||
typeChange: function(val) {
|
typeChange: function(val) {
|
||||||
|
if (!val) {
|
||||||
|
return 2
|
||||||
|
}
|
||||||
return val.status
|
return val.status
|
||||||
},
|
},
|
||||||
hasTips: true
|
hasTips: true
|
||||||
@@ -160,6 +163,7 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
headerActions: {
|
headerActions: {
|
||||||
|
// canCreate: false,
|
||||||
createRoute: {
|
createRoute: {
|
||||||
name: 'AssetCreate',
|
name: 'AssetCreate',
|
||||||
query: this.$route.query
|
query: this.$route.query
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Rules',
|
name: 'Rules',
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
GenericListTable
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
|
@@ -1,6 +1,6 @@
|
|||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
<Dialog
|
<Dialog
|
||||||
v-if="dialogVisible"
|
v-if="dialogVisible"
|
||||||
:title="this.$t('assets.TestGatewayTestConnection')"
|
:title="this.$t('assets.TestGatewayTestConnection')"
|
||||||
@@ -29,12 +29,12 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable/index'
|
import GenericListTable from '@/layout/components/GenericListTable/index'
|
||||||
import DisplayFormatter from '@/components/ListTable/formatters/DisplayFormatter'
|
import DisplayFormatter from '@/components/ListTable/formatters/DisplayFormatter'
|
||||||
import Dialog from '@/components/Dialog'
|
import Dialog from '@/components/Dialog'
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ListTable,
|
GenericListTable,
|
||||||
Dialog
|
Dialog
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
|
@@ -26,7 +26,7 @@ export default {
|
|||||||
ips_or_not: true,
|
ips_or_not: true,
|
||||||
apply_date_expired: date_expired,
|
apply_date_expired: date_expired,
|
||||||
apply_date_start: date_start,
|
apply_date_start: date_start,
|
||||||
org_id: 'DEFAULT',
|
org_id: '00000000-0000-0000-0000-000000000001',
|
||||||
type: 'apply_application',
|
type: 'apply_application',
|
||||||
apply_actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file']
|
apply_actions: ['all', 'connect', 'updownload', 'upload_file', 'download_file']
|
||||||
},
|
},
|
||||||
|
@@ -29,7 +29,10 @@ export default {
|
|||||||
},
|
},
|
||||||
fields: [
|
fields: [
|
||||||
[this.$t('users.Account'), ['name', 'username', 'email', 'groups']],
|
[this.$t('users.Account'), ['name', 'username', 'email', 'groups']],
|
||||||
[this.$t('users.Authentication'), ['password_strategy', 'update_password', 'password', 'set_public_key', 'public_key', 'mfa_level', 'source']],
|
[this.$t('users.Authentication'), [
|
||||||
|
'password_strategy', 'update_password', 'password', 'set_public_key',
|
||||||
|
'public_key', 'mfa_level', 'source'
|
||||||
|
]],
|
||||||
[this.$t('users.Secure'), ['role', 'org_roles', 'date_expired']],
|
[this.$t('users.Secure'), ['role', 'org_roles', 'date_expired']],
|
||||||
[this.$t('common.Other'), ['phone', 'wechat', 'comment']]
|
[this.$t('common.Other'), ['phone', 'wechat', 'comment']]
|
||||||
],
|
],
|
||||||
@@ -80,7 +83,7 @@ export default {
|
|||||||
role: {
|
role: {
|
||||||
label: this.$t('users.SuperRole'),
|
label: this.$t('users.SuperRole'),
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return !this.currentOrgIsDefault && this.publicSettings.role === 'Admin'
|
return !this.currentOrgIsRoot && this.publicSettings.role === 'Admin'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
org_roles: {
|
org_roles: {
|
||||||
@@ -88,7 +91,7 @@ export default {
|
|||||||
label: this.$t('users.OrgRole'),
|
label: this.$t('users.OrgRole'),
|
||||||
component: RoleCheckbox,
|
component: RoleCheckbox,
|
||||||
hidden: () => {
|
hidden: () => {
|
||||||
return (!this.publicSettings.XPACK_LICENSE_IS_VALID)
|
return !this.publicSettings.XPACK_LICENSE_IS_VALID
|
||||||
},
|
},
|
||||||
el: {
|
el: {
|
||||||
disabled: false,
|
disabled: false,
|
||||||
@@ -109,13 +112,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['publicSettings', 'currentOrg']),
|
...mapGetters(['publicSettings', 'currentOrgIsRoot'])
|
||||||
currentOrgIsDefault() {
|
|
||||||
return this.currentOrg.id === 'DEFAULT' || this.currentOrg.id === ''
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (this.currentOrgIsDefault) {
|
if (this.currentOrgIsRoot) {
|
||||||
this.fieldsMeta.org_roles.el.disabled = true
|
this.fieldsMeta.org_roles.el.disabled = true
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@@ -64,7 +64,7 @@ export default {
|
|||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
hasDelete: () => this.currentOrgIsDefault,
|
hasDelete: () => this.currentOrgIsRoot,
|
||||||
canUpdate: function(row, cellValue) {
|
canUpdate: function(row, cellValue) {
|
||||||
return row.can_update
|
return row.can_update
|
||||||
},
|
},
|
||||||
@@ -76,7 +76,7 @@ export default {
|
|||||||
title: this.$t('users.Remove'),
|
title: this.$t('users.Remove'),
|
||||||
name: 'remove',
|
name: 'remove',
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
has: () => !this.currentOrgIsDefault,
|
has: () => !this.currentOrgIsRoot,
|
||||||
can: function(row, cellValue) {
|
can: function(row, cellValue) {
|
||||||
return row.can_delete
|
return row.can_delete
|
||||||
},
|
},
|
||||||
@@ -89,6 +89,7 @@ export default {
|
|||||||
},
|
},
|
||||||
headerActions: {
|
headerActions: {
|
||||||
hasBulkDelete: false,
|
hasBulkDelete: false,
|
||||||
|
canCreate: true,
|
||||||
extraActions: [
|
extraActions: [
|
||||||
{
|
{
|
||||||
name: this.$t('users.InviteUser'),
|
name: this.$t('users.InviteUser'),
|
||||||
@@ -197,13 +198,10 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
...mapGetters(['currentOrg', 'currentUser', 'device']),
|
...mapGetters(['currentOrgIsRoot', 'currentUser', 'device'])
|
||||||
currentOrgIsDefault() {
|
|
||||||
return this.currentOrg.id === 'DEFAULT' || this.currentOrg.id === ''
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
if (!this.currentOrgIsDefault) {
|
if (!this.currentOrgIsRoot) {
|
||||||
this.headerActions.extraMoreActions[0].title = this.$t(
|
this.headerActions.extraMoreActions[0].title = this.$t(
|
||||||
'common.removeSelected'
|
'common.removeSelected'
|
||||||
)
|
)
|
||||||
@@ -240,7 +238,7 @@ export default {
|
|||||||
},
|
},
|
||||||
bulkDeleteCallback({ selectedRows, reloadTable }) {
|
bulkDeleteCallback({ selectedRows, reloadTable }) {
|
||||||
let msgPrefix = this.$t('common.deleteWarningMsg')
|
let msgPrefix = this.$t('common.deleteWarningMsg')
|
||||||
if (!this.currentOrgIsDefault) {
|
if (!this.currentOrgIsRoot) {
|
||||||
msgPrefix = this.$t('common.removeWarningMsg')
|
msgPrefix = this.$t('common.removeWarningMsg')
|
||||||
}
|
}
|
||||||
const msg =
|
const msg =
|
||||||
@@ -264,13 +262,13 @@ export default {
|
|||||||
done()
|
done()
|
||||||
reloadTable()
|
reloadTable()
|
||||||
let successMsg = this.$t('common.bulkDeleteSuccessMsg')
|
let successMsg = this.$t('common.bulkDeleteSuccessMsg')
|
||||||
if (!this.currentOrgIsDefault) {
|
if (!this.currentOrgIsRoot) {
|
||||||
successMsg = this.$t('common.bulkRemoveSuccessMsg')
|
successMsg = this.$t('common.bulkRemoveSuccessMsg')
|
||||||
}
|
}
|
||||||
this.$message.success(successMsg)
|
this.$message.success(successMsg)
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
// let errorMsg = this.$t('common.bulkDeleteErrorMsg')
|
// let errorMsg = this.$t('common.bulkDeleteErrorMsg')
|
||||||
// if (!this.currentOrgIsDefault) {
|
// if (!this.currentOrgIsRoot) {
|
||||||
// errorMsg = this.$t('common.bulkRemoveErrorMsg')
|
// errorMsg = this.$t('common.bulkRemoveErrorMsg')
|
||||||
// }
|
// }
|
||||||
// this.$message.error(errorMsg + error)
|
// this.$message.error(errorMsg + error)
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :md="14" :sm="24">
|
<el-col :md="14" :sm="24">
|
||||||
<ListTable ref="listTable" :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable ref="listTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="10" :sm="24">
|
<el-col :md="10" :sm="24">
|
||||||
<AssetRelationCard type="primary" v-bind="assetRelationConfig" />
|
<AssetRelationCard type="primary" v-bind="assetRelationConfig" />
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable/index'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
import RelationCard from '@/components/RelationCard/index'
|
import RelationCard from '@/components/RelationCard/index'
|
||||||
import AssetRelationCard from '@/components/AssetRelationCard'
|
import AssetRelationCard from '@/components/AssetRelationCard'
|
||||||
import { DeleteActionFormatter } from '@/components/ListTable/formatters'
|
import { DeleteActionFormatter } from '@/components/ListTable/formatters'
|
||||||
@@ -19,7 +19,7 @@ import { DeleteActionFormatter } from '@/components/ListTable/formatters'
|
|||||||
export default {
|
export default {
|
||||||
name: 'ChangeAuthPlanAsset',
|
name: 'ChangeAuthPlanAsset',
|
||||||
components: {
|
components: {
|
||||||
ListTable, RelationCard, AssetRelationCard
|
GenericListTable, RelationCard, AssetRelationCard
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChangeAuthPlanExecutionTaskList',
|
name: 'ChangeAuthPlanExecutionTaskList',
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
GenericListTable
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'ChangeAuthPlanExecution',
|
name: 'ChangeAuthPlanExecution',
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
GenericListTable
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
|
@@ -1,15 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script type="text/jsx">
|
<script type="text/jsx">
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
import { ACCOUNT_PROVIDER_ATTRS_MAP, aliyun, aws_china, aws_international, huaweicloud, qcloud, azure, vmware } from '../const'
|
import { ACCOUNT_PROVIDER_ATTRS_MAP, aliyun, aws_china, aws_international, huaweicloud, qcloud, azure, vmware } from '../const'
|
||||||
import { BooleanFormatter, DetailFormatter } from '@/components/ListTable/formatters'
|
import { BooleanFormatter, DetailFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
GenericListTable
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const vm = this
|
const vm = this
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable ref="GenericListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable/index'
|
import GenericListTable from '@/layout/components/GenericListTable/index'
|
||||||
import { DateFormatter } from '@/components/ListTable/formatters'
|
import { DateFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'AssetList',
|
name: 'AssetList',
|
||||||
components: { ListTable },
|
components: { GenericListTable },
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
type: Object,
|
type: Object,
|
||||||
@@ -63,7 +63,7 @@ export default {
|
|||||||
this.$axios.delete(`/api/v1/xpack/cloud/sync-instance-tasks/${this.object.id}/released-assets/`).then(
|
this.$axios.delete(`/api/v1/xpack/cloud/sync-instance-tasks/${this.object.id}/released-assets/`).then(
|
||||||
res => {
|
res => {
|
||||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||||
this.$refs.ListTable.reloadTable()
|
this.$refs.GenericListTable.reloadTable()
|
||||||
}
|
}
|
||||||
).catch(() => {
|
).catch(() => {
|
||||||
this.$message.error(this.$t('common.deleteErrorMsg'))
|
this.$message.error(this.$t('common.deleteErrorMsg'))
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable ref="GenericListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable/index'
|
import GenericListTable from '@/layout/components/GenericListTable/index'
|
||||||
import { ActionsFormatter, DateFormatter } from '@/components/ListTable/formatters'
|
import { ActionsFormatter, DateFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'HistoryList',
|
name: 'HistoryList',
|
||||||
components: { ListTable },
|
components: { GenericListTable },
|
||||||
props: {
|
props: {
|
||||||
object: {
|
object: {
|
||||||
type: Object,
|
type: Object,
|
||||||
|
@@ -1,14 +1,14 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
import { DetailFormatter } from '@/components/ListTable/formatters'
|
import { DetailFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
GenericListTable
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const vm = this
|
const vm = this
|
||||||
|
@@ -1,13 +1,13 @@
|
|||||||
<template>
|
<template>
|
||||||
<ListTable :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
components: {
|
components: {
|
||||||
ListTable
|
GenericListTable
|
||||||
},
|
},
|
||||||
data() {
|
data() {
|
||||||
const vm = this
|
const vm = this
|
||||||
|
@@ -1,7 +1,7 @@
|
|||||||
<template>
|
<template>
|
||||||
<el-row :gutter="20">
|
<el-row :gutter="20">
|
||||||
<el-col :md="14" :sm="24">
|
<el-col :md="14" :sm="24">
|
||||||
<ListTable ref="ListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
<GenericListTable ref="GenericListTable" :table-config="tableConfig" :header-actions="headerActions" />
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col :md="10" :sm="24">
|
<el-col :md="10" :sm="24">
|
||||||
<RelationCard type="primary" v-bind="memberRelationConfig">
|
<RelationCard type="primary" v-bind="memberRelationConfig">
|
||||||
@@ -14,14 +14,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ListTable from '@/components/ListTable'
|
import GenericListTable from '@/layout/components/GenericListTable'
|
||||||
import RelationCard from '@/components/RelationCard'
|
import RelationCard from '@/components/RelationCard'
|
||||||
import { DeleteActionFormatter } from '@/components/ListTable/formatters'
|
import { DeleteActionFormatter } from '@/components/ListTable/formatters'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'OrganizationMembershipList',
|
name: 'OrganizationMembershipList',
|
||||||
components: {
|
components: {
|
||||||
ListTable,
|
GenericListTable,
|
||||||
RelationCard
|
RelationCard
|
||||||
},
|
},
|
||||||
props: {
|
props: {
|
||||||
@@ -108,7 +108,7 @@ export default {
|
|||||||
that.iHasObjects = [...that.iHasObjects, ...objects]
|
that.iHasObjects = [...that.iHasObjects, ...objects]
|
||||||
that.$refs.select2.clearSelected()
|
that.$refs.select2.clearSelected()
|
||||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||||
this.$refs.ListTable.reloadTable()
|
this.$refs.GenericListTable.reloadTable()
|
||||||
window.location.reload()
|
window.location.reload()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -53,8 +53,11 @@ export default {
|
|||||||
label: this.$t('xpack.Organization.app_perms_amount')
|
label: this.$t('xpack.Organization.app_perms_amount')
|
||||||
},
|
},
|
||||||
actions: {
|
actions: {
|
||||||
prop: '',
|
prop: 'id',
|
||||||
formatterArgs: {
|
formatterArgs: {
|
||||||
|
canDelete: function(row, cellValue) {
|
||||||
|
return !row.is_default
|
||||||
|
},
|
||||||
onDelete: function({ row, col, cellValue, reload }) {
|
onDelete: function({ row, col, cellValue, reload }) {
|
||||||
const msg = this.$t('xpack.Organization.DeleteOrgMsg')
|
const msg = this.$t('xpack.Organization.DeleteOrgMsg')
|
||||||
const title = this.$t('xpack.Organization.DeleteOrgTitle')
|
const title = this.$t('xpack.Organization.DeleteOrgTitle')
|
||||||
|
@@ -7,7 +7,7 @@ import GenericCreateUpdatePage from '@/layout/components/GenericCreateUpdatePage
|
|||||||
import Uploadkey from '@/components/UploadKey'
|
import Uploadkey from '@/components/UploadKey'
|
||||||
import Select2 from '@/components/Select2'
|
import Select2 from '@/components/Select2'
|
||||||
export default {
|
export default {
|
||||||
name: 'AdminUserCreateUpdate',
|
name: 'VaultCreate',
|
||||||
components: {
|
components: {
|
||||||
GenericCreateUpdatePage
|
GenericCreateUpdatePage
|
||||||
},
|
},
|
||||||
|
@@ -82,7 +82,7 @@ import * as queryUtil from '@/components/DataTable/compenents/el-data-table/util
|
|||||||
import { mapGetters } from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'Vault',
|
name: 'VaultList',
|
||||||
components: {
|
components: {
|
||||||
GenericTreeListPage,
|
GenericTreeListPage,
|
||||||
AssetUserTable,
|
AssetUserTable,
|
||||||
|
Reference in New Issue
Block a user