Merge pull request #2650 from dataease/pr@dev@feat_panel-market

feat: 模板市场增加预览功能并可以直接应用模板
This commit is contained in:
王嘉豪
2022-07-21 11:17:25 +08:00
committed by GitHub
23 changed files with 939 additions and 128 deletions

View File

@@ -4,6 +4,8 @@ import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.dataease.auth.annotation.DePermission;
import io.dataease.auth.annotation.DePermissionProxy;
import io.dataease.auth.annotation.DePermissions;
import io.dataease.auth.service.impl.ExtAuthServiceImpl;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.controller.request.panel.PanelGroupBaseInfoRequest;
import io.dataease.plugins.common.base.domain.PanelGroup;
import io.dataease.commons.constants.DePermissionType;
@@ -17,6 +19,7 @@ import io.dataease.dto.panel.PanelGroupDTO;
import io.dataease.service.panel.PanelGroupService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.pentaho.di.core.util.UUIDUtil;
import springfox.documentation.annotations.ApiIgnore;
import org.apache.shiro.authz.annotation.Logical;
import org.springframework.web.bind.annotation.*;
@@ -39,6 +42,8 @@ public class PanelGroupController {
@Resource
private PanelGroupService panelGroupService;
@Resource
private ExtAuthServiceImpl authService;
@ApiOperation("查询树")
@PostMapping("/tree")
@@ -59,9 +64,15 @@ public class PanelGroupController {
@DePermission(type = DePermissionType.PANEL, value = "pid", level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
}, logical = Logical.AND)
@I18n
public PanelGroup save(@RequestBody PanelGroupRequest request) throws Exception{
public PanelGroupDTO save(@RequestBody PanelGroupRequest request) throws Exception{
String panelId = panelGroupService.save(request);
return findOne(panelId);
PanelGroupDTO result = findOne(panelId);
// 如果新建来源来自模板市场在返回数据中加入父级ID便于跳转展开仪表板树
if(PanelConstants.NEW_PANEL_FROM.NEW_MARKET_TEMPLATE.equals(request.getNewFrom())){
result.setParents(authService.parentResource(panelId,"panel"));
result.setRequestId(UUIDUtil.getUUIDAsString());
}
return result;
}
@ApiOperation("更新")

View File

@@ -33,5 +33,8 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase<Pane
private List<PanelGroupDTO> children;
@ApiModelProperty("视图信息")
private List<Map<String, ChartViewDTO>> viewsInfo;
@ApiModelProperty("父级ID")
private List<String> parents;
@ApiModelProperty("请求ID")
private String requestId;
}

View File

@@ -39,5 +39,47 @@ VALUES ('Mongo 数据源插件', 'default', '0', '0', 'datasource', 'Mongo 数
'1650765903630', 'mongo-backend', 'mongobi');
INSERT INTO `sys_menu` (
`menu_id`,
`pid`,
`sub_count`,
`type`,
`title`,
`name`,
`component`,
`menu_sort`,
`icon`,
`path`,
`i_frame`,
`cache`,
`hidden`,
`permission`,
`create_by`,
`update_by`,
`create_time`,
`update_time`
)
VALUES
(
41,
1,
1,
1,
'模板市场',
'template-market',
'panel/templateMarket/index',
13,
'dashboard',
'panel/templateMarket/index',
0,
0,
0,
'',
NULL,
NULL,
NULL,
1620444227389
);
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateAccessKey', 'dataease', 'text', NULL);
INSERT INTO `system_parameter` (`param_key`, `param_value`, `type`, `sort`) VALUES ('basic.templateMarketUlr', 'https://dataease.io/templates', 'text', 4);