mirror of
https://github.com/jumpserver/lina.git
synced 2026-01-13 19:35:24 +00:00
perf: modify create asset field nodes to node; modify user-detail-tree and workbench-tree
This commit is contained in:
@@ -11,6 +11,7 @@
|
||||
import AssetTreeTable from '@/components/Apps/AssetTreeTable'
|
||||
import { AccountInfoFormatter, DetailFormatter } from '@/components/Table/TableFormatters'
|
||||
import { connectivityMeta } from '@/components/Apps/AccountListTable/const'
|
||||
import { setUrlParam } from '@/utils/common/index'
|
||||
|
||||
export default {
|
||||
name: 'GrantedAssets',
|
||||
@@ -34,7 +35,7 @@ export default {
|
||||
}
|
||||
const initialUrl = vm.tableConfig.initialUrl
|
||||
const nodeId = node.meta.data.id
|
||||
const url = initialUrl.replace('/assets/', `/nodes/${nodeId}/assets/`)
|
||||
const url = setUrlParam(initialUrl, 'node_id', nodeId)
|
||||
vm.tableConfig.url = url
|
||||
}
|
||||
},
|
||||
@@ -70,7 +71,7 @@ export default {
|
||||
showMenu: false,
|
||||
showRefresh: true,
|
||||
showAssets: false,
|
||||
showSearch: false,
|
||||
showSearch: true,
|
||||
url: this.tableUrl,
|
||||
// ?assets=0不显示资产. =1显示资产
|
||||
treeUrl: this.treeUrl,
|
||||
@@ -78,6 +79,9 @@ export default {
|
||||
callback: {
|
||||
onSelected: (event, node) => vm.onSelected(node, vm),
|
||||
refresh: vm.refreshObjectAssetPermission
|
||||
},
|
||||
async: {
|
||||
enable: false
|
||||
}
|
||||
},
|
||||
tableConfig: {
|
||||
|
||||
@@ -61,7 +61,7 @@ export default {
|
||||
updateSuccessNextRoute: this.updateSuccessNextRoute,
|
||||
hasDetailInMsg: false,
|
||||
fields: [
|
||||
[this.$t('Basic'), ['name', 'address', 'platform', 'nodes']],
|
||||
[this.$t('Basic'), ['name', 'address', 'platform', 'node']],
|
||||
[this.$t('Protocol'), ['protocols']],
|
||||
[this.$t('Account'), ['accounts']],
|
||||
[this.$t('Other'), ['directory_services', 'zone', 'labels', 'is_active', 'comment']]
|
||||
@@ -73,8 +73,8 @@ export default {
|
||||
const values = _.cloneDeep(validValues)
|
||||
const submitMethod = id ? 'put' : 'post'
|
||||
|
||||
if (values.nodes && values.nodes.length === 0) {
|
||||
delete values['nodes']
|
||||
if (!values.node) {
|
||||
delete values['node']
|
||||
}
|
||||
|
||||
if (submitMethod === 'put') {
|
||||
@@ -143,15 +143,14 @@ export default {
|
||||
},
|
||||
async setInitial() {
|
||||
const { defaultConfig } = this
|
||||
const { node } = this.$route.query
|
||||
const nodesInitial = node ? [node] : []
|
||||
const { node_id } = this.$route.query
|
||||
const platformId = this.platformID || 'Linux'
|
||||
const url = `/api/v1/assets/platforms/${platformId}/`
|
||||
this.platform = await this.$axios.get(url)
|
||||
const initial = {
|
||||
labels: [],
|
||||
is_active: true,
|
||||
nodes: nodesInitial,
|
||||
node: node_id,
|
||||
platform: parseInt(this.platform.id),
|
||||
protocols: []
|
||||
}
|
||||
|
||||
@@ -148,9 +148,10 @@ export const assetFieldsMeta = (vm, category, type) => {
|
||||
return vm.platform.ds_enabled === false
|
||||
}
|
||||
},
|
||||
nodes: {
|
||||
node: {
|
||||
rules: [rules.RequiredChange],
|
||||
el: {
|
||||
multiple: false,
|
||||
ajax: {
|
||||
url: '/api/v1/assets/nodes/',
|
||||
transformOption: item => {
|
||||
|
||||
@@ -19,7 +19,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
treeUrl: `/api/v1/perms/users/${this.object.id}/nodes/children/tree/`,
|
||||
tableUrl: `/api/v1/perms/users/${this.object.id}/assets/?all=1`,
|
||||
tableUrl: `/api/v1/perms/users/${this.object.id}/assets/`,
|
||||
actions: {
|
||||
has: false
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user