feat:2.5.0
1. 权限调整 2. 新增组详情
This commit is contained in:
parent
b7a1af4b04
commit
f4b27b5e06
@ -0,0 +1,17 @@
|
||||
package com.aizuda.easy.retry.template.datasource.persistence.dataobject;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author: xiaowoniu
|
||||
* @date : 2022-04-23 10:39
|
||||
* @since : 2.5.0
|
||||
*/
|
||||
@Data
|
||||
public class ActivePodQuantityResponseDO {
|
||||
|
||||
private Long total;
|
||||
|
||||
private Integer nodeType;
|
||||
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
package com.aizuda.easy.retry.template.datasource.persistence.mapper;
|
||||
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@ -16,4 +17,6 @@ public interface ServerNodeMapper extends BaseMapper<ServerNode> {
|
||||
|
||||
int deleteByExpireAt(@Param("endTime") LocalDateTime endTime);
|
||||
|
||||
List<ActivePodQuantityResponseDO> countActivePod(@Param("namespaceId") String namespaceId);
|
||||
|
||||
}
|
||||
|
@ -33,4 +33,9 @@
|
||||
delete from server_node
|
||||
where expire_at <= #{endTime,jdbcType=TIMESTAMP}
|
||||
</delete>
|
||||
<select id="countActivePod" resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT node_type as nodeType, count(*) as total
|
||||
from server_node
|
||||
GROUP BY node_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -34,4 +34,10 @@
|
||||
delete from server_node
|
||||
where expire_at <= #{endTime,jdbcType=TIMESTAMP}
|
||||
</delete>
|
||||
<select id="countActivePod"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT node_type as nodeType, count(*) as total
|
||||
from server_node
|
||||
GROUP BY node_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -1,40 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.aizuda.easy.retry.template.datasource.persistence.mapper.ServerNodeMapper">
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode">
|
||||
<id column="id" jdbcType="BIGINT" property="id" />
|
||||
<result column="group_name" jdbcType="VARCHAR" property="groupName" />
|
||||
<result column="host_id" jdbcType="VARCHAR" property="hostId" />
|
||||
<result column="host_ip" jdbcType="VARCHAR" property="hostIp" />
|
||||
<result column="host_port" jdbcType="INTEGER" property="hostPort" />
|
||||
<result column="expire_at" jdbcType="TIMESTAMP" property="expireAt" />
|
||||
<result column="node_type" jdbcType="TINYINT" property="nodeType" />
|
||||
<result column="context_path" jdbcType="VARCHAR" property="contextPath" />
|
||||
<result column="ext_attrs" jdbcType="VARCHAR" property="extAttrs" />
|
||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt" />
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
<insert id="insertOrUpdate" parameterType="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode" useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES (#{groupName}, #{hostId}, #{hostIp}, #{hostPort},
|
||||
#{expireAt}, #{nodeType}, #{extAttrs}, #{contextPath}, #{createDt})
|
||||
ON CONFLICT (host_id, host_ip) DO UPDATE SET
|
||||
group_name = EXCLUDED.group_name,
|
||||
host_id = EXCLUDED.host_id,
|
||||
host_ip = EXCLUDED.host_ip,
|
||||
host_port = EXCLUDED.host_port,
|
||||
expire_at = EXCLUDED.expire_at,
|
||||
node_type = EXCLUDED.node_type,
|
||||
ext_attrs = EXCLUDED.ext_attrs,
|
||||
context_path = EXCLUDED.context_path,
|
||||
create_dt = EXCLUDED.create_dt
|
||||
</insert>
|
||||
<delete id="deleteByExpireAt">
|
||||
delete from server_node
|
||||
where expire_at <= #{endTime,jdbcType=TIMESTAMP}
|
||||
</delete>
|
||||
<resultMap id="BaseResultMap" type="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode">
|
||||
<id column="id" jdbcType="BIGINT" property="id"/>
|
||||
<result column="group_name" jdbcType="VARCHAR" property="groupName"/>
|
||||
<result column="host_id" jdbcType="VARCHAR" property="hostId"/>
|
||||
<result column="host_ip" jdbcType="VARCHAR" property="hostIp"/>
|
||||
<result column="host_port" jdbcType="INTEGER" property="hostPort"/>
|
||||
<result column="expire_at" jdbcType="TIMESTAMP" property="expireAt"/>
|
||||
<result column="node_type" jdbcType="TINYINT" property="nodeType"/>
|
||||
<result column="context_path" jdbcType="VARCHAR" property="contextPath"/>
|
||||
<result column="ext_attrs" jdbcType="VARCHAR" property="extAttrs"/>
|
||||
<result column="create_dt" jdbcType="TIMESTAMP" property="createDt"/>
|
||||
<result column="update_dt" jdbcType="TIMESTAMP" property="updateDt"/>
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
id, group_name, context_path, host_id, host_ip, host_port, expire_at, node_type,create_dt,update_dt
|
||||
</sql>
|
||||
<insert id="insertOrUpdate" parameterType="com.aizuda.easy.retry.template.datasource.persistence.po.ServerNode"
|
||||
useGeneratedKeys="true" keyProperty="id">
|
||||
INSERT INTO server_node (group_name, host_id, host_ip, host_port,
|
||||
expire_at, node_type, ext_attrs, context_path, create_dt)
|
||||
VALUES (#{groupName}, #{hostId}, #{hostIp}, #{hostPort},
|
||||
#{expireAt}, #{nodeType}, #{extAttrs}, #{contextPath}, #{createDt})
|
||||
ON CONFLICT (host_id, host_ip) DO UPDATE SET expire_at = EXCLUDED.expire_at
|
||||
|
||||
</insert>
|
||||
<delete id="deleteByExpireAt">
|
||||
delete
|
||||
from server_node
|
||||
where expire_at <= #{endTime,jdbcType=TIMESTAMP}
|
||||
</delete>
|
||||
<select id="countActivePod"
|
||||
resultType="com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO">
|
||||
SELECT node_type as nodeType, count(*) as total
|
||||
from server_node
|
||||
GROUP BY node_type
|
||||
</select>
|
||||
</mapper>
|
||||
|
@ -43,13 +43,13 @@ public class GroupConfigController {
|
||||
return groupConfigService.addGroup(systemUser, groupConfigRequestVO);
|
||||
}
|
||||
|
||||
@LoginRequired
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@PutMapping("")
|
||||
public Boolean updateGroup(@RequestBody @Validated GroupConfigRequestVO groupConfigRequestVO) {
|
||||
return groupConfigService.updateGroup(groupConfigRequestVO);
|
||||
}
|
||||
|
||||
@LoginRequired
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@PutMapping("status")
|
||||
public Boolean updateGroupStatus(@RequestBody @Validated GroupConfigRequestVO groupConfigRequestVO) {
|
||||
String groupName = groupConfigRequestVO.getGroupName();
|
||||
@ -81,19 +81,19 @@ public class GroupConfigController {
|
||||
return groupConfigService.getAllGroupNameList();
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@LoginRequired
|
||||
@GetMapping("/partition")
|
||||
public Integer getTotalPartition() {
|
||||
// 组分区从0开始,所以是最大值减一
|
||||
return systemProperties.getTotalPartition() - 1;
|
||||
@GetMapping("/on-line/pods/{groupName}")
|
||||
public List<String> getOnlinePods(@PathVariable("groupName") String groupName) {
|
||||
return groupConfigService.getOnlinePods(groupName);
|
||||
}
|
||||
|
||||
@LoginRequired
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@GetMapping("/partition-table/list")
|
||||
public List<Integer> getTablePartitionList() {
|
||||
// https://gitee.com/aizuda/easy-retry/issues/I8DAMH
|
||||
List<String> tableList = jdbcTemplate.queryForList("SHOW TABLES LIKE 'retry_task_%'", String.class);
|
||||
return tableList.stream().map(ReUtil::getFirstNumber).filter(i -> !Objects.isNull(i) && i <= systemProperties.getTotalPartition()).distinct().collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
package com.aizuda.easy.retry.server.web.controller;
|
||||
|
||||
import com.aizuda.easy.retry.server.web.annotation.LoginRequired;
|
||||
import com.aizuda.easy.retry.server.web.annotation.RoleEnum;
|
||||
import com.aizuda.easy.retry.server.web.model.base.PageResult;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceQueryVO;
|
||||
import com.aizuda.easy.retry.server.web.model.request.NamespaceRequestVO;
|
||||
@ -23,26 +25,31 @@ public class NamespaceController {
|
||||
@Autowired
|
||||
private NamespaceService namespaceService;
|
||||
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@PostMapping
|
||||
public Boolean saveNamespace(@RequestBody @Validated NamespaceRequestVO namespaceRequestVO) {
|
||||
return namespaceService.saveNamespace(namespaceRequestVO);
|
||||
}
|
||||
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@PutMapping
|
||||
public Boolean updateNamespace(@RequestBody @Validated NamespaceRequestVO namespaceRequestVO) {
|
||||
return namespaceService.updateNamespace(namespaceRequestVO);
|
||||
}
|
||||
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@GetMapping("list")
|
||||
public PageResult<List<NamespaceResponseVO>> getNamespacePage(NamespaceQueryVO queryVO) {
|
||||
return namespaceService.getNamespacePage(queryVO);
|
||||
}
|
||||
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@DeleteMapping("{id}")
|
||||
public Boolean deleteNamespace(@PathVariable("id") Long id) {
|
||||
return namespaceService.deleteNamespace(id);
|
||||
}
|
||||
|
||||
@LoginRequired(role = RoleEnum.ADMIN)
|
||||
@GetMapping("/all")
|
||||
public List<NamespaceResponseVO> getAllNamespace() {
|
||||
return namespaceService.getAllNamespace();
|
||||
|
@ -28,4 +28,5 @@ public interface GroupConfigService {
|
||||
|
||||
List<String> getAllGroupNameList();
|
||||
|
||||
List<String> getOnlinePods(String groupName);
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ import com.aizuda.easy.retry.server.common.dto.ServerNodeExtAttrs;
|
||||
import com.aizuda.easy.retry.server.common.register.ServerRegister;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.DispatchQuantityResponseVOConverter;
|
||||
import com.aizuda.easy.retry.server.web.service.convert.SceneQuantityRankResponseVOConverter;
|
||||
import com.aizuda.easy.retry.server.web.util.UserSessionUtils;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.ActivePodQuantityResponseDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.DispatchQuantityResponseDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.dataobject.SceneQuantityRankResponseDO;
|
||||
import com.aizuda.easy.retry.template.datasource.persistence.mapper.RetryTaskLogMapper;
|
||||
@ -32,6 +34,7 @@ import com.aizuda.easy.retry.server.web.model.response.SceneQuantityRankResponse
|
||||
import com.aizuda.easy.retry.server.web.model.response.TaskQuantityResponseVO;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.PageDTO;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Sets;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -107,9 +110,15 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
public ActivePodQuantityResponseVO countActivePod() {
|
||||
|
||||
ActivePodQuantityResponseVO activePodQuantityResponseVO = new ActivePodQuantityResponseVO();
|
||||
activePodQuantityResponseVO.setTotal(serverNodeMapper.selectCount(null));
|
||||
activePodQuantityResponseVO.setServerTotal(serverNodeMapper.selectCount(new LambdaQueryWrapper<ServerNode>().eq(ServerNode::getNodeType, NodeTypeEnum.SERVER.getType())));
|
||||
activePodQuantityResponseVO.setClientTotal(serverNodeMapper.selectCount(new LambdaQueryWrapper<ServerNode>().eq(ServerNode::getNodeType, NodeTypeEnum.CLIENT.getType())));
|
||||
|
||||
List<ActivePodQuantityResponseDO> activePodQuantityDO = serverNodeMapper.countActivePod(UserSessionUtils.currentUserSession().getNamespaceId());
|
||||
Map<Integer, Long> map = activePodQuantityDO.stream().collect(Collectors.toMap(ActivePodQuantityResponseDO::getNodeType, ActivePodQuantityResponseDO::getTotal));
|
||||
Long clientTotal = map.getOrDefault(NodeTypeEnum.CLIENT.getType(), 0L);
|
||||
Long serverTotal = map.getOrDefault(NodeTypeEnum.SERVER.getType(), 0L);
|
||||
activePodQuantityResponseVO.setServerTotal(serverTotal);
|
||||
activePodQuantityResponseVO.setClientTotal(clientTotal);
|
||||
|
||||
activePodQuantityResponseVO.setTotal(clientTotal + serverTotal);
|
||||
|
||||
return activePodQuantityResponseVO;
|
||||
}
|
||||
@ -181,6 +190,9 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
PageDTO<ServerNode> pageDTO = new PageDTO<>(queryVO.getPage(), queryVO.getSize());
|
||||
|
||||
LambdaQueryWrapper<ServerNode> serverNodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
serverNodeLambdaQueryWrapper.in(ServerNode::getNamespaceId, Lists.newArrayList(
|
||||
UserSessionUtils.currentUserSession().getNamespaceId(), ServerRegister.NAMESPACE_ID
|
||||
));
|
||||
if (StrUtil.isNotBlank(queryVO.getGroupName())) {
|
||||
serverNodeLambdaQueryWrapper.eq(ServerNode::getGroupName, queryVO.getGroupName());
|
||||
}
|
||||
@ -206,13 +218,13 @@ public class DashBoardServiceImpl implements DashBoardService {
|
||||
}
|
||||
|
||||
ServerNodeExtAttrs serverNodeExtAttrs = JsonUtil
|
||||
.parseObject(serverNodeResponseVO.getExtAttrs(), ServerNodeExtAttrs.class);
|
||||
.parseObject(serverNodeResponseVO.getExtAttrs(), ServerNodeExtAttrs.class);
|
||||
|
||||
try {
|
||||
|
||||
// 从远程节点取
|
||||
String format = MessageFormat
|
||||
.format(URL, serverNodeResponseVO.getHostIp(), serverNodeExtAttrs.getWebPort().toString());
|
||||
.format(URL, serverNodeResponseVO.getHostIp(), serverNodeExtAttrs.getWebPort().toString());
|
||||
Result<List<Integer>> result = restTemplate.getForObject(format, Result.class);
|
||||
List<Integer> data = result.getData();
|
||||
if (!CollectionUtils.isEmpty(data)) {
|
||||
|
@ -183,12 +183,6 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
records);
|
||||
|
||||
for (GroupConfigResponseVO groupConfigResponseVO : responseVOList) {
|
||||
List<ServerNode> serverNodes = serverNodeMapper.selectList(
|
||||
new LambdaQueryWrapper<ServerNode>().eq(ServerNode::getGroupName,
|
||||
groupConfigResponseVO.getGroupName()));
|
||||
groupConfigResponseVO.setOnlinePodList(
|
||||
serverNodes.stream().map(serverNode -> serverNode.getHostIp() + ":" + serverNode.getHostPort())
|
||||
.collect(Collectors.toList()));
|
||||
Optional.ofNullable(IdGeneratorMode.modeOf(groupConfigResponseVO.getIdGeneratorMode()))
|
||||
.ifPresent(idGeneratorMode -> {
|
||||
groupConfigResponseVO.setIdGeneratorModeName(idGeneratorMode.getDesc());
|
||||
@ -302,4 +296,14 @@ public class GroupConfigServiceImpl implements GroupConfigService {
|
||||
return groupConfigs.stream().map(GroupConfig::getGroupName).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getOnlinePods(String groupName) {
|
||||
List<ServerNode> serverNodes = serverNodeMapper.selectList(
|
||||
new LambdaQueryWrapper<ServerNode>()
|
||||
.eq(ServerNode::getNamespaceId, UserSessionUtils.currentUserSession().getNamespaceId())
|
||||
.eq(ServerNode::getGroupName, groupName));
|
||||
return serverNodes.stream().map(serverNode -> serverNode.getHostIp() + ":" + serverNode.getHostPort())
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -39,6 +39,8 @@ public class NamespaceServiceImpl implements NamespaceService {
|
||||
namespace.setName(namespaceRequestVO.getName());
|
||||
if (StrUtil.isBlank(namespaceRequestVO.getUniqueId())) {
|
||||
namespace.setUniqueId(IdUtil.simpleUUID());
|
||||
} else {
|
||||
namespace.setUniqueId(namespaceRequestVO.getUniqueId());
|
||||
}
|
||||
return 1 == namespaceMapper.insert(namespace);
|
||||
}
|
||||
|
@ -12,6 +12,7 @@ const api = {
|
||||
groupConfigByGroupName: `/group`,
|
||||
allGroupNameList: `/group/all/group-name/list`,
|
||||
allGroupConfigList: `/group/all/group-config/list`,
|
||||
onlinePods: `/group/on-line/pods/`,
|
||||
retryTaskPage: '/retry-task/list',
|
||||
retryTaskById: '/retry-task/',
|
||||
saveRetryTask: '/retry-task',
|
||||
@ -58,6 +59,13 @@ const api = {
|
||||
|
||||
export default api
|
||||
|
||||
export function onlinePods (parameter) {
|
||||
return request({
|
||||
url: api.onlinePods + parameter,
|
||||
method: 'get'
|
||||
})
|
||||
}
|
||||
|
||||
export function allGroupConfigList (data) {
|
||||
return request({
|
||||
url: api.allGroupConfigList,
|
||||
|
@ -42,22 +42,40 @@ export const asyncRouterMap = [
|
||||
path: '/namespace',
|
||||
name: 'namespace',
|
||||
component: () => import('@/views/namespace/NamespaceList'),
|
||||
meta: { title: '命名空间', icon: 'team', permission: ['group'] }
|
||||
meta: { title: '命名空间', icon: 'team', permission: ['namespace'] }
|
||||
},
|
||||
// profile
|
||||
{
|
||||
path: '/basic-config-list',
|
||||
name: 'basicConfigList',
|
||||
component: () => import('@/views/config/GroupList'),
|
||||
meta: { title: '组管理', icon: 'team', permission: ['group'] }
|
||||
},
|
||||
{
|
||||
path: '/basic-config',
|
||||
name: 'basicConfig',
|
||||
hidden: true,
|
||||
component: () => import('@/views/config/basicConfigForm/BasicConfigForm'),
|
||||
meta: { title: '基础信息配置', hidden: true, hideChildrenInMenu: true, icon: 'profile', permission: ['basicConfig'] }
|
||||
path: '/group',
|
||||
name: 'GroupConfigList',
|
||||
component: RouteView,
|
||||
hideChildrenInMenu: true,
|
||||
redirect: '/group/list',
|
||||
meta: { title: '组管理', hideChildrenInMenu: true, icon: 'team', permission: ['group'] },
|
||||
children: [
|
||||
{
|
||||
path: '/group/list',
|
||||
name: 'basicConfigList',
|
||||
component: () => import('@/views/config/GroupList'),
|
||||
meta: { title: '组配置列表', hidden: true, icon: 'team', permission: ['group'] }
|
||||
},
|
||||
{
|
||||
path: '/group/config',
|
||||
name: 'GroupConfig',
|
||||
hidden: true,
|
||||
component: () => import('@/views/config/basicConfigForm/BasicConfigForm'),
|
||||
meta: { title: '组信息配置', hidden: true, hideChildrenInMenu: true, icon: 'profile', permission: ['group'] }
|
||||
},
|
||||
{
|
||||
path: '/group/info',
|
||||
name: 'GroupInfo',
|
||||
hidden: true,
|
||||
component: () => import('@/views/config/GroupInfo'),
|
||||
meta: { title: '组配置详情', hidden: true, hideChildrenInMenu: true, icon: 'profile', permission: ['group'] }
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
path: '/retry',
|
||||
name: 'RetryTask',
|
||||
|
@ -27,18 +27,13 @@ function plugin (Vue) {
|
||||
const [permission, action] = permissions.split('.')
|
||||
const permissionList = _this.$store.getters.roles.permissions
|
||||
|
||||
const actionList = permissionList.find((val) => {
|
||||
return permissionList.find((val) => {
|
||||
return val.permissionId === permission
|
||||
}).actionList
|
||||
if (actionList) {
|
||||
return actionList.findIndex((val) => {
|
||||
}).actionList.findIndex((val) => {
|
||||
console.log(val)
|
||||
console.log(action)
|
||||
return val === action
|
||||
}) > -1
|
||||
} else {
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -72,10 +72,11 @@ const user = {
|
||||
role.permissions = result.role.permissions
|
||||
role.permissions.map(per => {
|
||||
if (per.actionEntitySet != null && per.actionEntitySet.length > 0) {
|
||||
const action = per.actionEntitySet.map(action => {
|
||||
per.actionList = (per.actionEntitySet || {}).map(action => {
|
||||
return action.action
|
||||
})
|
||||
per.actionList = action
|
||||
} else {
|
||||
per.actionList = []
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -1,255 +1,155 @@
|
||||
|
||||
const commonAdmin = [
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: [
|
||||
{
|
||||
action: 'add',
|
||||
describe: '新增',
|
||||
defaultCheck: false
|
||||
},
|
||||
{
|
||||
action: 'edit',
|
||||
describe: '更新',
|
||||
defaultCheck: false
|
||||
},
|
||||
{
|
||||
action: 'stop',
|
||||
describe: '停止',
|
||||
defaultCheck: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'user',
|
||||
permissionName: '用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'userForm',
|
||||
permissionName: '新增或更新用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'basicConfig',
|
||||
permissionName: '基础信息配置'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'namespace',
|
||||
permissionName: '命名空间'
|
||||
}
|
||||
]
|
||||
const retryAdmin = [
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryTask',
|
||||
permissionName: '任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryDeadLetter',
|
||||
permissionName: '死信队列管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryLog',
|
||||
permissionName: '重试日志管理'
|
||||
}
|
||||
]
|
||||
const jobAdmin = [
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'job',
|
||||
permissionName: '定时任务管理',
|
||||
actionEntitySet: [
|
||||
{
|
||||
action: 'del',
|
||||
describe: '新增',
|
||||
defaultCheck: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
}
|
||||
]
|
||||
|
||||
const commonUser = [
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: []
|
||||
}
|
||||
]
|
||||
const retryUser = [
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryTask',
|
||||
permissionName: '任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryDeadLetter',
|
||||
permissionName: '死信队列管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryLog',
|
||||
permissionName: '重试日志管理'
|
||||
}
|
||||
]
|
||||
const jobUser = [
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'job',
|
||||
permissionName: '定时任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
}
|
||||
]
|
||||
|
||||
const permissionsConfig = {
|
||||
RETRY: {
|
||||
1: [
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: []
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryTask',
|
||||
permissionName: '任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryDeadLetter',
|
||||
permissionName: '死信队列管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryLog',
|
||||
permissionName: '重试日志管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'basicConfig',
|
||||
permissionName: '基础信息配置'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: [
|
||||
{
|
||||
action: 'add',
|
||||
describe: '新增',
|
||||
defaultCheck: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'user',
|
||||
permissionName: '用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'userForm',
|
||||
permissionName: '新增或更新用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryTask',
|
||||
permissionName: '任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryDeadLetter',
|
||||
permissionName: '死信队列管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryLog',
|
||||
permissionName: '重试日志管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'basicConfig',
|
||||
permissionName: '基础信息配置'
|
||||
}
|
||||
]
|
||||
1: [...retryUser, ...commonUser],
|
||||
2: [...retryAdmin, ...commonAdmin]
|
||||
},
|
||||
JOB: {
|
||||
1: [
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: []
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'job',
|
||||
permissionName: '定时任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: [
|
||||
{
|
||||
action: 'add',
|
||||
describe: '新增',
|
||||
defaultCheck: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'user',
|
||||
permissionName: '用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'userForm',
|
||||
permissionName: '新增或更新用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'job',
|
||||
permissionName: '定时任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
}
|
||||
]
|
||||
1: [...jobUser, ...commonUser],
|
||||
2: [...jobAdmin, ...commonAdmin]
|
||||
},
|
||||
ALL: {
|
||||
1: [
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: []
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryTask',
|
||||
permissionName: '任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryDeadLetter',
|
||||
permissionName: '死信队列管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'retryLog',
|
||||
permissionName: '重试日志管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'basicConfig',
|
||||
permissionName: '基础信息配置'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'job',
|
||||
permissionName: '定时任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
}
|
||||
],
|
||||
2: [
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'group',
|
||||
permissionName: '组配置',
|
||||
actionEntitySet: [
|
||||
{
|
||||
action: 'add',
|
||||
describe: '新增',
|
||||
defaultCheck: false
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'user',
|
||||
permissionName: '用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'userForm',
|
||||
permissionName: '新增或更新用户'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'dashboard',
|
||||
permissionName: '看板'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryTask',
|
||||
permissionName: '任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryDeadLetter',
|
||||
permissionName: '死信队列管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'retryLog',
|
||||
permissionName: '重试日志管理'
|
||||
},
|
||||
{
|
||||
roleId: 2,
|
||||
permissionId: 'basicConfig',
|
||||
permissionName: '基础信息配置'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'job',
|
||||
permissionName: '定时任务管理'
|
||||
},
|
||||
{
|
||||
roleId: 1,
|
||||
permissionId: 'jobBatch',
|
||||
permissionName: '任务批次'
|
||||
}
|
||||
]
|
||||
1: [...retryUser, ...jobUser, ...commonUser],
|
||||
2: [...retryAdmin, ...jobAdmin, ...commonAdmin]
|
||||
}
|
||||
}
|
||||
|
||||
|
101
frontend/src/views/config/GroupInfo.vue
Normal file
101
frontend/src/views/config/GroupInfo.vue
Normal file
@ -0,0 +1,101 @@
|
||||
<template>
|
||||
<div>
|
||||
<page-header-wrapper @back="() => $router.replace('/group/list')" style="margin: -24px -1px 0" v-if="showHeader">
|
||||
<div></div>
|
||||
</page-header-wrapper>
|
||||
<a-card :bordered="false" v-if="groupInfo !==null ">
|
||||
<a-descriptions title="通用配置" :column="column" bordered>
|
||||
<a-descriptions-item label="组名称">
|
||||
{{ groupInfo.groupName }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="状态">
|
||||
<a-tag :color="groupStatus[groupInfo.groupStatus].color">
|
||||
{{ groupStatus[groupInfo.groupStatus].name }}
|
||||
</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="版本">
|
||||
{{ groupInfo.version }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="描述" span="3">
|
||||
{{ groupInfo.description }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="OnLine机器" span="3">
|
||||
<a-tag color="blue" v-for="item in podInfo" :key="item">
|
||||
{{ item }}
|
||||
</a-tag>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
<br/>
|
||||
<a-descriptions title="重试配置" :column="column" bordered>
|
||||
<a-descriptions-item label="ID生成模式">
|
||||
<a-tag :color="idGeneratorMode[groupInfo.idGeneratorMode].color">
|
||||
{{ idGeneratorMode[groupInfo.idGeneratorMode].name }}
|
||||
</a-tag>
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="分区">
|
||||
{{ groupInfo.groupPartition }}
|
||||
</a-descriptions-item>
|
||||
<a-descriptions-item label="初始化场景">
|
||||
<a-tag :color="initScene[groupInfo.initScene].color">
|
||||
{{ initScene[groupInfo.initScene].name }}
|
||||
</a-tag>
|
||||
</a-descriptions-item>
|
||||
</a-descriptions>
|
||||
</a-card>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { getGroupConfigByGroupName, onlinePods } from '@/api/manage'
|
||||
import enums from '@/utils/retryEnum'
|
||||
|
||||
export default {
|
||||
name: 'GroupInfo',
|
||||
components: {
|
||||
},
|
||||
props: {
|
||||
showHeader: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
},
|
||||
column: {
|
||||
type: Number,
|
||||
default: 3
|
||||
}
|
||||
},
|
||||
data () {
|
||||
return {
|
||||
groupInfo: null,
|
||||
podInfo: [],
|
||||
initScene: enums.initScene,
|
||||
groupStatus: enums.groupStatus,
|
||||
idGeneratorMode: enums.idGenMode
|
||||
}
|
||||
},
|
||||
created () {
|
||||
const groupName = this.$route.query.groupName
|
||||
if (groupName) {
|
||||
this.groupConfigDetail(groupName)
|
||||
} else {
|
||||
if (this.showHeader) {
|
||||
this.$router.push({ path: '/404' })
|
||||
}
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
groupConfigDetail (groupName) {
|
||||
getGroupConfigByGroupName(groupName).then(res => {
|
||||
this.groupInfo = res.data
|
||||
})
|
||||
|
||||
onlinePods(groupName).then(res => {
|
||||
this.podInfo = res.data
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style scoped lang='less'>
|
||||
|
||||
</style>
|
@ -39,8 +39,8 @@
|
||||
:rowSelection="options.rowSelection"
|
||||
:scroll="{ x: 1600 }"
|
||||
>
|
||||
<span slot="serial" slot-scope="text, record">
|
||||
{{ record.id }}
|
||||
<span slot="groupName" slot-scope="text, record">
|
||||
<a href="#" @click="handlerOpenDrawer(record)">{{ text }}</a>
|
||||
</span>
|
||||
<span slot="groupStatus" slot-scope="text">
|
||||
<a-tag :color="groupStatus[text].color">
|
||||
@ -59,19 +59,35 @@
|
||||
</span>
|
||||
<span slot="action" slot-scope="text, record">
|
||||
<template>
|
||||
<a @click="handleEdit(record)">编辑</a>
|
||||
<a-divider type="vertical" />
|
||||
<a @click="handleInfo(record)">详情</a>
|
||||
<a-divider type="vertical"/>
|
||||
<a @click="handleEdit(record)" v-if="$auth('group.edit')">编辑</a>
|
||||
<a-divider type="vertical" v-if="$auth('group.edit')"/>
|
||||
<a-popconfirm
|
||||
:title="record.groupStatus === 1 ? '是否停用?': '是否启用?'"
|
||||
ok-text="确定"
|
||||
cancel-text="取消"
|
||||
@confirm="handleEditStatus(record)"
|
||||
v-if="$auth('group.stop')"
|
||||
>
|
||||
<a href="javascript:;">{{ record.groupStatus === 1 ? '停用': '启用' }}</a>
|
||||
</a-popconfirm>
|
||||
</template>
|
||||
</span>
|
||||
</s-table>
|
||||
|
||||
<Drawer
|
||||
title="组配置详情"
|
||||
placement="right"
|
||||
:width="800"
|
||||
:visibleAmplify="true"
|
||||
:visible="openDrawer"
|
||||
@closeDrawer="onClose"
|
||||
@handlerAmplify="handleInfo"
|
||||
>
|
||||
<group-info ref="groupInfoRef" :showHeader="false" :column="1"/>
|
||||
</Drawer>
|
||||
|
||||
</a-card>
|
||||
</template>
|
||||
|
||||
@ -79,13 +95,16 @@
|
||||
|
||||
import AInput from 'ant-design-vue/es/input/Input'
|
||||
import { getGroupConfigForPage, updateGroupStatus } from '@/api/manage'
|
||||
import { STable } from '@/components'
|
||||
import { Drawer, STable } from '@/components'
|
||||
import moment from 'moment'
|
||||
import GroupInfo from '@/views/config/GroupInfo.vue'
|
||||
const enums = require('@/utils/retryEnum')
|
||||
|
||||
export default {
|
||||
name: 'TableListWrapper',
|
||||
components: {
|
||||
GroupInfo,
|
||||
Drawer,
|
||||
AInput,
|
||||
STable
|
||||
},
|
||||
@ -97,13 +116,11 @@ export default {
|
||||
queryParam: {},
|
||||
// 表头
|
||||
columns: [
|
||||
{
|
||||
title: '#',
|
||||
scopedSlots: { customRender: 'serial' }
|
||||
},
|
||||
{
|
||||
title: '名称',
|
||||
dataIndex: 'groupName'
|
||||
dataIndex: 'groupName',
|
||||
scopedSlots: { customRender: 'groupName' }
|
||||
|
||||
},
|
||||
{
|
||||
title: '状态',
|
||||
@ -139,11 +156,6 @@ export default {
|
||||
title: '描述',
|
||||
dataIndex: 'description'
|
||||
},
|
||||
{
|
||||
title: 'OnLine机器',
|
||||
dataIndex: 'onlinePodList',
|
||||
customRender: (text) => text.toString()
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
dataIndex: 'action',
|
||||
@ -173,7 +185,9 @@ export default {
|
||||
},
|
||||
initScene: enums.initScene,
|
||||
groupStatus: enums.groupStatus,
|
||||
idGeneratorMode: enums.idGenMode
|
||||
idGeneratorMode: enums.idGenMode,
|
||||
currentShowRecord: null,
|
||||
openDrawer: false
|
||||
}
|
||||
},
|
||||
created () {
|
||||
@ -181,10 +195,14 @@ export default {
|
||||
},
|
||||
methods: {
|
||||
handleNew () {
|
||||
this.$router.push('/basic-config')
|
||||
this.$router.push('/group/config')
|
||||
},
|
||||
handleEdit (record) {
|
||||
this.$router.push({ path: '/basic-config', query: { groupName: record.groupName } })
|
||||
this.$router.push({ path: '/group/config', query: { groupName: record.groupName } })
|
||||
},
|
||||
handleInfo (record) {
|
||||
record = record || this.currentShowRecord
|
||||
this.$router.push({ path: '/group/info', query: { groupName: record.groupName } })
|
||||
},
|
||||
toggleAdvanced () {
|
||||
this.advanced = !this.advanced
|
||||
@ -205,6 +223,17 @@ export default {
|
||||
this.$refs.table.refresh()
|
||||
}
|
||||
})
|
||||
},
|
||||
handlerOpenDrawer (record) {
|
||||
this.currentShowRecord = record
|
||||
this.openDrawer = true
|
||||
setTimeout(() => {
|
||||
this.$refs.groupInfoRef.groupConfigDetail(record.groupName)
|
||||
}, 200)
|
||||
},
|
||||
onClose () {
|
||||
this.openDrawer = false
|
||||
this.currentShowRecord = null
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
<template>
|
||||
<div>
|
||||
<page-header-wrapper content="配置组、场景、通知配置" @back="() => $router.go(-1)" style="margin: -24px -1px 0">
|
||||
<page-header-wrapper content="配置组" @back="() => $router.go(-1)" style="margin: -24px -1px 0">
|
||||
<div></div>
|
||||
</page-header-wrapper>
|
||||
<a-card class="card" :bordered="false">
|
||||
|
@ -150,6 +150,7 @@
|
||||
ok-text="删除"
|
||||
cancel-text="取消"
|
||||
@confirm="handleDel(record)"
|
||||
v-if="$auth('job.del')"
|
||||
>
|
||||
<a href="javascript:;" v-if="record.jobStatus === 0">删除</a>
|
||||
</a-popconfirm>
|
||||
|
@ -7,11 +7,10 @@
|
||||
v-decorator="['id']" />
|
||||
</a-form-item>
|
||||
<a-form-item
|
||||
label="唯一标识"
|
||||
v-if="isEdit">
|
||||
label="唯一标识(默认UUID)">
|
||||
<a-input
|
||||
placeholder="唯一标识"
|
||||
disabled
|
||||
:disabled="isEdit"
|
||||
v-decorator="[
|
||||
'uniqueId',
|
||||
{rules: [{ required: false, message: '请输入空间名称', whitespace: true}]}
|
||||
|
Loading…
Reference in New Issue
Block a user