mirror of
https://github.com/jumpserver/lina.git
synced 2025-09-19 17:54:37 +00:00
Merge branch 'dev' of github.com:jumpserver/lina into dev
This commit is contained in:
@@ -209,6 +209,7 @@ export default {
|
||||
if (!parentNode) {
|
||||
return
|
||||
}
|
||||
this.zTree.expandNode(parentNode, true, false, true, false)
|
||||
// http://localhost/api/v1/assets/nodes/85aa4ee2-0bd9-41db-9079-aa3646448d0c/children/
|
||||
const url = `${this.treeSetting.nodeUrl}${parentNode.meta.node.id}/children/`
|
||||
this.$axios.post(url, {}).then(data => {
|
||||
|
@@ -16,7 +16,7 @@ export default {
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
onDelete(col, row, cellValue, reload) {
|
||||
defaultOnDelete(col, row, cellValue, reload) {
|
||||
const url = col.deleteUrl + cellValue
|
||||
this.$axios.delete(url).then(res => {
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
@@ -25,6 +25,13 @@ export default {
|
||||
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
|
||||
})
|
||||
},
|
||||
onDelete(col, row, cellValue, reload) {
|
||||
if (col.onDelete && typeof col.onDelete === 'function') {
|
||||
col.onDelete(col, row, cellValue, reload)
|
||||
} else {
|
||||
this.defaultOnDelete(col, row, cellValue, reload)
|
||||
}
|
||||
},
|
||||
iCanDelete() {
|
||||
return this.col.objects.indexOf(this.cellValue) === -1
|
||||
}
|
||||
|
@@ -130,11 +130,7 @@ export default {
|
||||
items.map(v => {
|
||||
newData.push(v.value)
|
||||
})
|
||||
return this.$axios.patch(relationUrl, { nodes: newData }).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
return this.$axios.patch(relationUrl, { nodes: newData })
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const itemId = item.value
|
||||
@@ -146,11 +142,7 @@ export default {
|
||||
}
|
||||
})
|
||||
const relationUrl = `/api/v1/assets/assets/${this.object.id}/`
|
||||
return this.$axios.patch(relationUrl, { nodes: newData }).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
return this.$axios.patch(relationUrl, { nodes: newData })
|
||||
}
|
||||
},
|
||||
labelConfig: {
|
||||
|
@@ -55,11 +55,7 @@ export default {
|
||||
items.map(v => {
|
||||
newData.push(v.value)
|
||||
})
|
||||
return this.$axios.patch(relationUrl, { system_users: newData }).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
return this.$axios.patch(relationUrl, { system_users: newData })
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const itemId = item.value
|
||||
@@ -71,11 +67,7 @@ export default {
|
||||
}
|
||||
})
|
||||
const relationUrl = `/api/v1/assets/cmd-filters/${this.object.id}/`
|
||||
return this.$axios.patch(relationUrl, { system_users: newData }).then(res => {
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + err))
|
||||
})
|
||||
return this.$axios.patch(relationUrl, { system_users: newData })
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -127,21 +127,13 @@ export default {
|
||||
node: v.value
|
||||
}
|
||||
})
|
||||
return this.$axios.post(relationUrl, data).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
return this.$axios.post(relationUrl, data)
|
||||
},
|
||||
performDelete: (item) => {
|
||||
const itemId = item.value
|
||||
const objectId = this.object.id
|
||||
const relationUrl = `/api/v1/assets/system-users-nodes-relations/?systemuser=${objectId}&node=${itemId}`
|
||||
return this.$axios.delete(relationUrl).then(res => {
|
||||
this.$message.success(this.$t('common.updateSuccessMsg'))
|
||||
}).catch(err => {
|
||||
this.$message.error(this.$t('common.updateErrorMsg' + ' ' + err))
|
||||
})
|
||||
return this.$axios.delete(relationUrl)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -14,6 +14,7 @@
|
||||
import ListTable from '@/components/ListTable/index'
|
||||
import RelationCard from '@/components/RelationCard/index'
|
||||
import AssetRelationCard from '@/components/AssetRelationCard'
|
||||
import { DeleteActionFormatter } from '@/components/ListTable/formatters'
|
||||
|
||||
export default {
|
||||
name: 'ChangeAuthPlanAsset',
|
||||
@@ -32,8 +33,29 @@ export default {
|
||||
tableConfig: {
|
||||
url: `/api/v1/xpack/change-auth-plan/plan/${this.object.id}/assets/`,
|
||||
columns: [
|
||||
'hostname', 'ip'
|
||||
'hostname', 'ip', 'delete_action'
|
||||
],
|
||||
columnsMeta: {
|
||||
delete_action: {
|
||||
prop: 'id',
|
||||
label: this.$t('common.Actions'),
|
||||
align: 'center',
|
||||
width: 150,
|
||||
objects: this.object.assets,
|
||||
formatter: DeleteActionFormatter,
|
||||
onDelete: function(col, row, cellValue, reload) {
|
||||
this.$axios.patch(
|
||||
`/api/v1/xpack/change-auth-plan/plan/${this.object.id}/asset/remove/`,
|
||||
{ assets: [row.id] }
|
||||
).then(res => {
|
||||
this.$message.success(this.$t('common.deleteSuccessMsg'))
|
||||
reload()
|
||||
}).catch(error => {
|
||||
this.$message.error(this.$t('common.deleteErrorMsg' + ' ' + error))
|
||||
})
|
||||
}.bind(this)
|
||||
}
|
||||
},
|
||||
tableAttrs: {
|
||||
border: false
|
||||
}
|
||||
|
@@ -20,6 +20,16 @@ export default {
|
||||
],
|
||||
url: '/api/v1/xpack/cloud/accounts/',
|
||||
fieldsMeta: {
|
||||
access_key_id: {
|
||||
rules: [
|
||||
{ required: this.$route.meta.action === 'create', message: this.$t('common.fieldRequiredError') }
|
||||
]
|
||||
},
|
||||
access_key_secret: {
|
||||
rules: [
|
||||
{ required: this.$route.meta.action === 'create', message: this.$t('common.fieldRequiredError') }
|
||||
]
|
||||
}
|
||||
},
|
||||
updateSuccessNextRoute: { name: 'CloudCenter' },
|
||||
createSuccessNextRoute: { name: 'CloudCenter' }
|
||||
|
Reference in New Issue
Block a user