Merge pull request #4262 from dataease/pr@dev@fix_relation_delete_tip

fix(血源关系): 删除数据源和数据集时如果没有查看血源关系的权限则不提示跳转
This commit is contained in:
wisonic-s 2023-01-03 17:50:19 +08:00 committed by GitHub
commit 425c001d2d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 20 deletions

View File

@ -545,9 +545,7 @@ import {
isKettleRunning,
alter
} from '@/api/dataset/dataset'
import {
getDatasetRelationship,
} from '@/api/chart/chart.js'
import { getDatasetRelationship } from '@/api/chart/chart.js'
import msgContent from '@/views/system/datasource/MsgContent.vue'
import GroupMoveSelector from './GroupMoveSelector'
@ -556,6 +554,7 @@ import { queryAuthModel } from '@/api/authModel/authModel'
import { engineMode } from '@/api/system/engine'
import _ from 'lodash'
import msgCfm from '@/components/msgCfm/index'
import { checkPermission } from '@/utils/permission'
export default {
name: 'Group',
@ -925,8 +924,14 @@ export default {
}
const { queryType = 'dataset', id } = data
getDatasetRelationship(id).then((res) => {
if (res.data.subRelation?.length) {
if (checkPermission(['relationship:read'])) {
let hasSubRelation = false
await getDatasetRelationship(id).then((res) => {
if (res.data.subRelation?.length) {
hasSubRelation = true
}
})
if (hasSubRelation) {
options.title = this.$t('datasource.delete_this_dataset')
options.link = this.$t('datasource.click_to_check')
options.content = this.$t('datasource.cannot_be_deleted_dataset')
@ -937,8 +942,8 @@ export default {
this.withLink(options, this.$t('commons.delete'))
return
}
this.handlerConfirm(options)
})
}
this.handlerConfirm(options)
},
linkTo(query) {
window.open(this.$router.resolve({

View File

@ -339,13 +339,12 @@ import {
listDriverByType,
updateDriver
} from '@/api/system/datasource'
import {
getDatasourceRelationship,
} from '@/api/chart/chart.js'
import { getDatasourceRelationship } from '@/api/chart/chart.js'
import msgContent from './MsgContent.vue'
import deTextarea from '@/components/deCustomCm/DeTextarea.vue'
import msgCfm from '@/components/msgCfm'
import { checkPermission } from '@/utils/permission'
export default {
name: 'DsTree',
components: { deTextarea },
@ -754,15 +753,17 @@ export default {
}
const { queryType = 'datasource', name: label, id } = datasource
if (this.showView === 'Datasource') {
await this.getDatasourceRelationship({ queryType, label, id })
if (this.treeData.length) {
params.title = this.$t('datasource.this_data_source')
params.link = this.$t('datasource.click_to_check')
params.content = this.$t('datasource.cannot_be_deleted_datasource')
params.templateDel = msgContent
params.linkTo = this.linkTo.bind(this, { queryType, id })
this.withLink(params)
return
if (checkPermission(['relationship:read'])) {
await this.getDatasourceRelationship({ queryType, label, id })
if (this.treeData.length) {
params.title = this.$t('datasource.this_data_source')
params.link = this.$t('datasource.click_to_check')
params.content = this.$t('datasource.cannot_be_deleted_datasource')
params.templateDel = msgContent
params.linkTo = this.linkTo.bind(this, { queryType, id })
this.withLink(params)
return
}
}
}
this.handlerConfirm(params)

View File

@ -340,6 +340,7 @@ export default {
},
queryTypeChange(val) {
this.formInline.dataSourceName = ''
this.dataSourceNameList = []
switch (val) {
case 'datasource':
this.listDatasource()