mirror of
https://github.com/dataease/dataease.git
synced 2026-05-15 05:22:13 +08:00
refactor(仪表板、数据大屏): 优化可视化资源树非发布状态查询权限
This commit is contained in:
@@ -154,6 +154,7 @@ public class XpackShareManage {
|
||||
Long uid = AuthUtils.getUser().getUserId();
|
||||
QueryWrapper<Object> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("s.creator", uid);
|
||||
queryWrapper.ne("v.status", 0);
|
||||
if (StringUtils.isNotBlank(request.getType())) {
|
||||
BusiResourceEnum busiResourceEnum = BusiResourceEnum.valueOf(request.getType().toUpperCase());
|
||||
if (ObjectUtils.isEmpty(busiResourceEnum)) {
|
||||
|
||||
@@ -158,7 +158,7 @@ public class CoreVisualizationManage {
|
||||
visualizationInfo.setId(id);
|
||||
}
|
||||
visualizationInfo.setDeleteFlag(DataVisualizationConstants.DELETE_FLAG.AVAILABLE);
|
||||
visualizationInfo.setStatus(CommonConstants.DV_STATUS.UNPUBLISHED);
|
||||
visualizationInfo.setStatus(visualizationInfo.getStatus());
|
||||
visualizationInfo.setCreateBy(AuthUtils.getUser().getUserId().toString());
|
||||
visualizationInfo.setUpdateBy(AuthUtils.getUser().getUserId().toString());
|
||||
visualizationInfo.setCreateTime(System.currentTimeMillis());
|
||||
|
||||
@@ -112,6 +112,7 @@ public class VisualizationStoreManage {
|
||||
if (StringUtils.isNotBlank(info)) {
|
||||
queryWrapper.notExists(String.format(info, "s.resource_id"));
|
||||
}
|
||||
queryWrapper.ne("v.status", 0);
|
||||
queryWrapper.orderBy(true, request.isAsc(), "v.update_time");
|
||||
Page<StorePO> page = new Page<>(goPage, pageSize);
|
||||
return coreStoreExtMapper.query(page, queryWrapper);
|
||||
|
||||
@@ -424,6 +424,9 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
snapshotMapper.deleteById(request.getId());
|
||||
visualizationInfo.setNodeType(DataVisualizationConstants.NODE_TYPE.LEAF);
|
||||
}
|
||||
// 文件夹走默认发布 非文件夹默认未发布
|
||||
visualizationInfo.setStatus(DataVisualizationConstants.NODE_TYPE.FOLDER.equals(visualizationInfo.getNodeType())
|
||||
? CommonConstants.DV_STATUS.PUBLISHED : CommonConstants.DV_STATUS.UNPUBLISHED);
|
||||
Long newDvId = coreVisualizationManage.innerSave(visualizationInfo);
|
||||
request.setId(newDvId);
|
||||
// 还原ID信息
|
||||
@@ -590,6 +593,9 @@ public class DataVisualizationServer implements DataVisualizationApi {
|
||||
|
||||
@Override
|
||||
public List<BusiNodeVO> tree(BusiNodeRequest request) {
|
||||
if (StringUtils.isEmpty(request.getResourceTable())) {
|
||||
request.setResourceTable(CommonConstants.RESOURCE_TABLE.SNAPSHOT);
|
||||
}
|
||||
String busiFlag = request.getBusiFlag();
|
||||
if (busiFlag.equals("dashboard-dataV")) {
|
||||
BusiNodeRequest requestDv = new BusiNodeRequest();
|
||||
|
||||
@@ -254,7 +254,7 @@
|
||||
data_visualization_info
|
||||
WHERE
|
||||
data_visualization_info.delete_flag = 0
|
||||
AND node_type = 'leaf') dvResource
|
||||
AND node_type = 'leaf' and data_visualization_info.status != 0 ) dvResource
|
||||
LEFT JOIN core_store ON dvResource.id = core_store.resource_id
|
||||
AND core_store.uid = #{uid}
|
||||
INNER JOIN core_opt_recent ON dvResource.resource_id = core_opt_recent.resource_id
|
||||
|
||||
@@ -15,4 +15,5 @@ export interface BusiTreeRequest {
|
||||
leaf?: boolean
|
||||
weight?: number
|
||||
sortType?: string
|
||||
resourceTable?: string
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ const optInit = (type, data: BusiTreeNode, exec, parentSelect = false, attachPar
|
||||
filterText.value = ''
|
||||
dialogTitle.value = getDialogTitle(exec) + ('rename' === exec ? optSource : '')
|
||||
resourceFormNameLabel.value = (exec === 'move' ? '' : optSource) + t('visualization.name')
|
||||
const request = { busiFlag: curCanvasType.value, leaf: false, weight: 7 }
|
||||
const request = { busiFlag: curCanvasType.value, leaf: false, resourceTable: 'core', weight: 7 }
|
||||
if (['newFolder'].includes(exec)) {
|
||||
resourceForm.name = ''
|
||||
} else if ('copy' === exec) {
|
||||
|
||||
@@ -308,21 +308,11 @@ const nodeClick = (data: BusiTreeNode, node) => {
|
||||
}
|
||||
}
|
||||
|
||||
const filterTreeData = nodes => {
|
||||
if (props.resourceTable === 'snapshot') {
|
||||
return nodes
|
||||
.filter(node => node.extraFlag1 !== 0) // 过滤当前层
|
||||
.map(node => ({
|
||||
...node,
|
||||
children: node.children ? filterTreeData(node.children) : [] // 递归过滤子节点
|
||||
}))
|
||||
} else {
|
||||
return nodes
|
||||
}
|
||||
}
|
||||
|
||||
const getTree = async () => {
|
||||
const request = { busiFlag: curCanvasType.value } as BusiTreeRequest
|
||||
const request = {
|
||||
busiFlag: curCanvasType.value,
|
||||
resourceTable: props.resourceTable
|
||||
} as BusiTreeRequest
|
||||
const isDashboard = curCanvasType.value == 'dashboard'
|
||||
await interactiveStore.setInteractive(request)
|
||||
const interactiveData = isDashboard ? interactiveStore.getPanel : interactiveStore.getScreen
|
||||
@@ -340,12 +330,12 @@ const getTree = async () => {
|
||||
let curSortType = sortList[Number(wsCache.get('TreeSort-backend')) ?? 1].value
|
||||
curSortType = wsCache.get(`TreeSort-${curCanvasType.value}`) ?? curSortType
|
||||
if (nodeData.length && nodeData[0]['id'] === '0' && nodeData[0]['name'] === 'root') {
|
||||
state.originResourceTree = filterTreeData(nodeData[0]['children'] || [])
|
||||
state.originResourceTree = nodeData[0]['children'] || []
|
||||
sortTypeChange(curSortType)
|
||||
afterTreeInit()
|
||||
return
|
||||
}
|
||||
state.originResourceTree = filterTreeData(nodeData)
|
||||
state.originResourceTree = nodeData
|
||||
sortTypeChange(curSortType)
|
||||
afterTreeInit()
|
||||
}
|
||||
|
||||
@@ -121,6 +121,7 @@ const initOpenHandler = newWindow => {
|
||||
placement="top"
|
||||
>
|
||||
<el-icon
|
||||
v-if="dvInfo.status !== 0"
|
||||
class="custom-icon hover-icon"
|
||||
@click="executeStore"
|
||||
:style="{ color: favorited ? '#FFC60A' : '#646A73' }"
|
||||
|
||||
@@ -21,5 +21,5 @@ public class BusiNodeRequest implements Serializable {
|
||||
|
||||
private String sortType;
|
||||
|
||||
private String resourceTable = CommonConstants.RESOURCE_TABLE.CORE;
|
||||
private String resourceTable;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user