forked from github/dataease
Merge pull request #2337 from dataease/pr@dev@fix_log_api
fix: 恢复因为增加日志修改的api
This commit is contained in:
commit
5a7f3f4c6c
@ -7,8 +7,10 @@ import io.dataease.auth.annotation.DePermissions;
|
|||||||
import io.dataease.commons.constants.DePermissionType;
|
import io.dataease.commons.constants.DePermissionType;
|
||||||
import io.dataease.commons.constants.ResourceAuthLevel;
|
import io.dataease.commons.constants.ResourceAuthLevel;
|
||||||
import io.dataease.commons.constants.SysLogConstants;
|
import io.dataease.commons.constants.SysLogConstants;
|
||||||
|
import io.dataease.commons.utils.DeLogUtils;
|
||||||
import io.dataease.controller.dataset.request.DeleteGroupRequest;
|
import io.dataease.controller.dataset.request.DeleteGroupRequest;
|
||||||
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||||
|
import io.dataease.dto.SysLogDTO;
|
||||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||||
import io.dataease.plugins.common.base.domain.DatasetGroup;
|
import io.dataease.plugins.common.base.domain.DatasetGroup;
|
||||||
import io.dataease.service.dataset.DataSetGroupService;
|
import io.dataease.service.dataset.DataSetGroupService;
|
||||||
@ -60,15 +62,12 @@ public class DataSetGroupController {
|
|||||||
|
|
||||||
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
|
@DePermission(type = DePermissionType.DATASET, level = ResourceAuthLevel.DATASET_LEVEL_MANAGE)
|
||||||
@ApiOperation("删除")
|
@ApiOperation("删除")
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete/{id}")
|
||||||
@DeLog(
|
public void delete(@PathVariable String id) throws Exception {
|
||||||
operatetype = SysLogConstants.OPERATE_TYPE.DELETE,
|
DatasetGroup datasetGroup = dataSetGroupService.getScene(id);
|
||||||
sourcetype = SysLogConstants.SOURCE_TYPE.DATASET,
|
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DATASET, id, datasetGroup.getPid(), null, null);
|
||||||
positionIndex = 0,positionKey = "pid",
|
dataSetGroupService.delete(id);
|
||||||
value = "id"
|
DeLogUtils.save(sysLogDTO);
|
||||||
)
|
|
||||||
public void tree(@RequestBody DeleteGroupRequest request) throws Exception {
|
|
||||||
dataSetGroupService.delete(request.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
|
@ -4,7 +4,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
|||||||
import io.dataease.auth.annotation.DeLog;
|
import io.dataease.auth.annotation.DeLog;
|
||||||
import io.dataease.auth.annotation.DePermission;
|
import io.dataease.auth.annotation.DePermission;
|
||||||
import io.dataease.commons.constants.SysLogConstants;
|
import io.dataease.commons.constants.SysLogConstants;
|
||||||
import io.dataease.controller.datasource.request.DeleteDsRequest;
|
import io.dataease.commons.utils.DeLogUtils;
|
||||||
|
import io.dataease.dto.SysLogDTO;
|
||||||
import io.dataease.plugins.common.base.domain.Datasource;
|
import io.dataease.plugins.common.base.domain.Datasource;
|
||||||
import io.dataease.commons.constants.DePermissionType;
|
import io.dataease.commons.constants.DePermissionType;
|
||||||
import io.dataease.commons.constants.ResourceAuthLevel;
|
import io.dataease.commons.constants.ResourceAuthLevel;
|
||||||
@ -14,13 +15,12 @@ import io.dataease.controller.datasource.request.UpdataDsRequest;
|
|||||||
import io.dataease.controller.request.DatasourceUnionRequest;
|
import io.dataease.controller.request.DatasourceUnionRequest;
|
||||||
import io.dataease.controller.request.datasource.ApiDefinition;
|
import io.dataease.controller.request.datasource.ApiDefinition;
|
||||||
import io.dataease.dto.datasource.DBTableDTO;
|
import io.dataease.dto.datasource.DBTableDTO;
|
||||||
import io.dataease.plugins.common.dto.datasource.DataSourceType;
|
|
||||||
import io.dataease.service.datasource.DatasourceService;
|
import io.dataease.service.datasource.DatasourceService;
|
||||||
import io.dataease.dto.DatasourceDTO;
|
import io.dataease.dto.DatasourceDTO;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.apache.commons.lang3.ObjectUtils;
|
||||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
import org.pentaho.di.core.database.DataSourceProviderInterface;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
@ -90,15 +90,14 @@ public class DatasourceController {
|
|||||||
@RequiresPermissions("datasource:read")
|
@RequiresPermissions("datasource:read")
|
||||||
@DePermission(type = DePermissionType.DATASOURCE, level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE, value = "id")
|
@DePermission(type = DePermissionType.DATASOURCE, level = ResourceAuthLevel.DATASOURCE_LEVEL_MANAGE, value = "id")
|
||||||
@ApiOperation("删除数据源")
|
@ApiOperation("删除数据源")
|
||||||
@PostMapping("/delete")
|
@PostMapping("/delete/{datasourceID}")
|
||||||
@DeLog(
|
public ResultHolder deleteDatasource(@PathVariable(value = "datasourceID") String datasourceID) throws Exception {
|
||||||
operatetype = SysLogConstants.OPERATE_TYPE.DELETE,
|
Datasource datasource = datasourceService.get(datasourceID);
|
||||||
sourcetype = SysLogConstants.SOURCE_TYPE.DATASOURCE,
|
SysLogDTO sysLogDTO = DeLogUtils.buildLog(SysLogConstants.OPERATE_TYPE.DELETE, SysLogConstants.SOURCE_TYPE.DATASOURCE, datasourceID, datasource.getType(), null, null);
|
||||||
positionIndex = 0,positionKey = "type",
|
ResultHolder resultHolder = datasourceService.deleteDatasource(datasourceID);
|
||||||
value = "id"
|
if (ObjectUtils.isNotEmpty(resultHolder) && resultHolder.isSuccess())
|
||||||
)
|
DeLogUtils.save(sysLogDTO);
|
||||||
public ResultHolder deleteDatasource(@RequestBody DeleteDsRequest request) throws Exception {
|
return resultHolder;
|
||||||
return datasourceService.deleteDatasource(request.getId());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresPermissions("datasource:read")
|
@RequiresPermissions("datasource:read")
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
package io.dataease.controller.datasource.request;
|
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class DeleteDsRequest implements Serializable {
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "ID",required = true)
|
|
||||||
private String id;
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "类型", required = true)
|
|
||||||
private String type;
|
|
||||||
}
|
|
@ -26,12 +26,11 @@ export function addGroup(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function delGroup(data) {
|
export function delGroup(groupId) {
|
||||||
return request({
|
return request({
|
||||||
url: '/dataset/group/delete',
|
url: '/dataset/group/delete/' + groupId,
|
||||||
loading: true,
|
loading: true,
|
||||||
method: 'post',
|
method: 'post'
|
||||||
data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,12 +61,11 @@ export function editDs(data) {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
export function delDs(data) {
|
export function delDs(id) {
|
||||||
return request({
|
return request({
|
||||||
url: 'datasource/delete',
|
url: 'datasource/delete/' + id,
|
||||||
loading: true,
|
loading: true,
|
||||||
method: 'post',
|
method: 'post'
|
||||||
data
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,8 +461,7 @@ export default {
|
|||||||
cancelButtonText: this.$t('dataset.cancel'),
|
cancelButtonText: this.$t('dataset.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const param = { id: data.id, pid: data.pid }
|
delGroup(data.id).then(response => {
|
||||||
delGroup(param).then(response => {
|
|
||||||
this.$message({
|
this.$message({
|
||||||
type: 'success',
|
type: 'success',
|
||||||
message: this.$t('dataset.delete_success'),
|
message: this.$t('dataset.delete_success'),
|
||||||
|
@ -2,13 +2,12 @@
|
|||||||
<el-col class="tree-style">
|
<el-col class="tree-style">
|
||||||
<el-col>
|
<el-col>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-tabs v-model="showView" @tab-click="changeTab" type="card">
|
<el-tabs v-model="showView" type="card" @tab-click="changeTab">
|
||||||
<el-tab-pane v-for="(item, index) in editableTabs" :key="item.name" :label="item.title" :name="item.name">
|
<el-tab-pane v-for="(item, index) in editableTabs" :key="item.name" :label="item.title" :name="item.name" />
|
||||||
</el-tab-pane>
|
|
||||||
</el-tabs>
|
</el-tabs>
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-button icon="el-icon-plus" type="text" size="mini" style="float: left;" @click="addFolder"/>
|
<el-button icon="el-icon-plus" type="text" size="mini" style="float: left;" @click="addFolder" />
|
||||||
</el-row>
|
</el-row>
|
||||||
<el-row>
|
<el-row>
|
||||||
<el-form>
|
<el-form>
|
||||||
@ -39,16 +38,16 @@
|
|||||||
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
|
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
|
||||||
<span style="display: flex;flex: 1;width: 0;">
|
<span style="display: flex;flex: 1;width: 0;">
|
||||||
<span v-if="data.type !== 'folder' && data.status !== 'Error' && data.status !== 'Warning'">
|
<span v-if="data.type !== 'folder' && data.status !== 'Error' && data.status !== 'Warning'">
|
||||||
<svg-icon icon-class="datasource" class="ds-icon-scene"/>
|
<svg-icon icon-class="datasource" class="ds-icon-scene" />
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.status === 'Error'">
|
<span v-if="data.status === 'Error'">
|
||||||
<svg-icon icon-class="exclamationmark" class="ds-icon-scene"/>
|
<svg-icon icon-class="exclamationmark" class="ds-icon-scene" />
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.status === 'Warning'">
|
<span v-if="data.status === 'Warning'">
|
||||||
<svg-icon icon-class="exclamationmark2" class="ds-icon-scene"/>
|
<svg-icon icon-class="exclamationmark2" class="ds-icon-scene" />
|
||||||
</span>
|
</span>
|
||||||
<span v-if="data.type === 'folder'">
|
<span v-if="data.type === 'folder'">
|
||||||
<i class="el-icon-folder"/>
|
<i class="el-icon-folder" />
|
||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
v-if=" data.status === 'Error'"
|
v-if=" data.status === 'Error'"
|
||||||
@ -109,10 +108,10 @@
|
|||||||
<el-dialog v-dialogDrag :title="dialogTitle" :visible="editDriver" :show-close="false" width="50%" append-to-body>
|
<el-dialog v-dialogDrag :title="dialogTitle" :visible="editDriver" :show-close="false" width="50%" append-to-body>
|
||||||
<el-form ref="driverForm" :model="driverForm" label-position="right" label-width="100px" :rules="rule">
|
<el-form ref="driverForm" :model="driverForm" label-position="right" label-width="100px" :rules="rule">
|
||||||
<el-form-item :label="$t('commons.name')" prop="name">
|
<el-form-item :label="$t('commons.name')" prop="name">
|
||||||
<el-input v-model="driverForm.name"/>
|
<el-input v-model="driverForm.name" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('commons.description')">
|
<el-form-item :label="$t('commons.description')">
|
||||||
<el-input v-model="driverForm.desc"/>
|
<el-input v-model="driverForm.desc" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item :label="$t('datasource.type')" prop="type">
|
<el-form-item :label="$t('datasource.type')" prop="type">
|
||||||
<el-select
|
<el-select
|
||||||
@ -138,14 +137,13 @@
|
|||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
|
|
||||||
|
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-col>
|
</el-col>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
import {mapGetters} from 'vuex'
|
import { mapGetters } from 'vuex'
|
||||||
import i18n from "@/lang";
|
import i18n from '@/lang'
|
||||||
import {
|
import {
|
||||||
listDatasource,
|
listDatasource,
|
||||||
listDatasourceByType,
|
listDatasourceByType,
|
||||||
@ -156,7 +154,7 @@ import {
|
|||||||
delDriver,
|
delDriver,
|
||||||
listDriverByType
|
listDriverByType
|
||||||
} from '@/api/system/datasource'
|
} from '@/api/system/datasource'
|
||||||
import {ApplicationContext} from "@/utils/ApplicationContext";
|
import { ApplicationContext } from '@/utils/ApplicationContext'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'DsTree',
|
name: 'DsTree',
|
||||||
@ -184,11 +182,11 @@ export default {
|
|||||||
},
|
},
|
||||||
disabledModifyType: false,
|
disabledModifyType: false,
|
||||||
rule: {
|
rule: {
|
||||||
name: [{required: true, message: i18n.t('datasource.input_name'), trigger: 'blur'},
|
name: [{ required: true, message: i18n.t('datasource.input_name'), trigger: 'blur' },
|
||||||
{min: 2, max: 50, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur'}],
|
{ min: 2, max: 50, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur' }],
|
||||||
desc: [{required: true, message: i18n.t('datasource.input_name'), trigger: 'blur'},
|
desc: [{ required: true, message: i18n.t('datasource.input_name'), trigger: 'blur' },
|
||||||
{min: 2, max: 200, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur'}],
|
{ min: 2, max: 200, message: i18n.t('datasource.input_limit_2_25', [2, 25]), trigger: 'blur' }],
|
||||||
type: [{required: true, message: i18n.t('datasource.please_choose_type'), trigger: 'blur'}]
|
type: [{ required: true, message: i18n.t('datasource.please_choose_type'), trigger: 'blur' }]
|
||||||
},
|
},
|
||||||
editableTabs: [{
|
editableTabs: [{
|
||||||
title: i18n.t('commons.datasource'),
|
title: i18n.t('commons.datasource'),
|
||||||
@ -215,7 +213,6 @@ export default {
|
|||||||
name: 'Driver'
|
name: 'Driver'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
filterNode(value, data) {
|
filterNode(value, data) {
|
||||||
@ -244,11 +241,11 @@ export default {
|
|||||||
datasourceTypes() {
|
datasourceTypes() {
|
||||||
listDatasourceType().then(res => {
|
listDatasourceType().then(res => {
|
||||||
this.dsTypes = res.data
|
this.dsTypes = res.data
|
||||||
this.dsTypes.forEach(item => {
|
this.dsTypes.forEach(item => {
|
||||||
if(item.isJdbc){
|
if (item.isJdbc) {
|
||||||
this.dsTypesForDriver.push(item)
|
this.dsTypesForDriver.push(item)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
refreshType(datasource) {
|
refreshType(datasource) {
|
||||||
@ -327,7 +324,7 @@ export default {
|
|||||||
this.editDriver = true
|
this.editDriver = true
|
||||||
// this.switchMain(switchMain'DriverForm', {}, this.tData, this.dsTypes)
|
// this.switchMain(switchMain'DriverForm', {}, this.tData, this.dsTypes)
|
||||||
} else {
|
} else {
|
||||||
this.switchMain('DsForm', {type: data.id}, this.tData, this.dsTypes)
|
this.switchMain('DsForm', { type: data.id }, this.tData, this.dsTypes)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
nodeClick(node, data) {
|
nodeClick(node, data) {
|
||||||
@ -336,7 +333,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
clickFileMore(param) {
|
clickFileMore(param) {
|
||||||
const {optType, data} = param
|
const { optType, data } = param
|
||||||
switch (optType) {
|
switch (optType) {
|
||||||
case 'edit':
|
case 'edit':
|
||||||
this.edit(data)
|
this.edit(data)
|
||||||
@ -349,13 +346,13 @@ export default {
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
beforeClickFile(optType, data, node) {
|
beforeClickFile(optType, data, node) {
|
||||||
return {optType, data, node}
|
return { optType, data, node }
|
||||||
},
|
},
|
||||||
edit(row) {
|
edit(row) {
|
||||||
this.switchMain('DsForm', row, this.tData, this.dsTypes)
|
this.switchMain('DsForm', row, this.tData, this.dsTypes)
|
||||||
},
|
},
|
||||||
showInfo(row) {
|
showInfo(row) {
|
||||||
const param = {...row.data, ...{showModel: 'show'}}
|
const param = { ...row.data, ...{ showModel: 'show' }}
|
||||||
if (this.showView === 'Datasource') {
|
if (this.showView === 'Datasource') {
|
||||||
this.switchMain('DsForm', param, this.tData, this.dsTypes)
|
this.switchMain('DsForm', param, this.tData, this.dsTypes)
|
||||||
} else {
|
} else {
|
||||||
@ -368,8 +365,12 @@ export default {
|
|||||||
cancelButtonText: this.$t('commons.cancel'),
|
cancelButtonText: this.$t('commons.cancel'),
|
||||||
type: 'warning'
|
type: 'warning'
|
||||||
}).then(() => {
|
}).then(() => {
|
||||||
const parma = {type: datasource.type, id: datasource.id}
|
let method = delDriver
|
||||||
const method = this.showView === 'Datasource' ? delDs : delDriver
|
let parma = { type: datasource.type, id: datasource.id }
|
||||||
|
if (this.showView === 'Datasource') {
|
||||||
|
method = delDs
|
||||||
|
parma = datasource.id
|
||||||
|
}
|
||||||
method(parma).then(res => {
|
method(parma).then(res => {
|
||||||
if (res.success) {
|
if (res.success) {
|
||||||
this.$success(this.$t('commons.delete_success'))
|
this.$success(this.$t('commons.delete_success'))
|
||||||
@ -437,7 +438,7 @@ export default {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
Reference in New Issue
Block a user