Merge remote-tracking branch 'upstream/dev' into spilit
This commit is contained in:
commit
1b9ab88e78
|
|
@ -32,7 +32,6 @@ import org.apache.dolphinscheduler.common.utils.ParameterUtils;
|
|||
import org.apache.dolphinscheduler.common.utils.StringUtils;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
|
|
@ -111,7 +110,7 @@ public class AlertGroupController extends BaseController {
|
|||
public Result list(@ApiIgnore @RequestAttribute(value = Constants.SESSION_USER) User loginUser) {
|
||||
logger.info("login user {}, query all alertGroup",
|
||||
loginUser.getUserName());
|
||||
HashMap<String, Object> result = alertGroupService.queryAlertgroup();
|
||||
Map<String, Object> result = alertGroupService.queryAlertgroup();
|
||||
return returnDataList(result);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,55 +17,21 @@
|
|||
|
||||
package org.apache.dolphinscheduler.api.service;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.utils.PageInfo;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.enums.AlertType;
|
||||
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
|
||||
import org.apache.dolphinscheduler.common.utils.StringUtils;
|
||||
import org.apache.dolphinscheduler.dao.entity.AlertGroup;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
/**
|
||||
* alert group service
|
||||
*/
|
||||
@Service
|
||||
public class AlertGroupService extends BaseService {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AlertGroupService.class);
|
||||
|
||||
@Autowired
|
||||
private AlertGroupMapper alertGroupMapper;
|
||||
public interface AlertGroupService {
|
||||
|
||||
/**
|
||||
* query alert group list
|
||||
*
|
||||
* @return alert group list
|
||||
*/
|
||||
public HashMap<String, Object> queryAlertgroup() {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<AlertGroup> alertGroups = alertGroupMapper.queryAllGroupList();
|
||||
result.put(Constants.DATA_LIST, alertGroups);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
|
||||
return result;
|
||||
}
|
||||
Map<String, Object> queryAlertgroup();
|
||||
|
||||
/**
|
||||
* paging query alarm group list
|
||||
|
|
@ -76,24 +42,7 @@ public class AlertGroupService extends BaseService {
|
|||
* @param pageSize page size
|
||||
* @return alert group list page
|
||||
*/
|
||||
public Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Page<AlertGroup> page = new Page(pageNo, pageSize);
|
||||
IPage<AlertGroup> alertGroupIPage = alertGroupMapper.queryAlertGroupPage(
|
||||
page, searchVal);
|
||||
PageInfo<AlertGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
|
||||
pageInfo.setTotalCount((int) alertGroupIPage.getTotal());
|
||||
pageInfo.setLists(alertGroupIPage.getRecords());
|
||||
result.put(Constants.DATA_LIST, pageInfo);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
|
||||
return result;
|
||||
}
|
||||
Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize);
|
||||
|
||||
/**
|
||||
* create alert group
|
||||
|
|
@ -104,33 +53,7 @@ public class AlertGroupService extends BaseService {
|
|||
* @param alertInstanceIds alertInstanceIds
|
||||
* @return create result code
|
||||
*/
|
||||
public Map<String, Object> createAlertgroup(User loginUser, String groupName, String desc, String alertInstanceIds) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
//only admin can operate
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
AlertGroup alertGroup = new AlertGroup();
|
||||
Date now = new Date();
|
||||
|
||||
alertGroup.setGroupName(groupName);
|
||||
alertGroup.setAlertInstanceIds(alertInstanceIds);
|
||||
alertGroup.setDescription(desc);
|
||||
alertGroup.setCreateTime(now);
|
||||
alertGroup.setUpdateTime(now);
|
||||
alertGroup.setCreateUserId(loginUser.getId());
|
||||
|
||||
// insert
|
||||
int insert = alertGroupMapper.insert(alertGroup);
|
||||
|
||||
if (insert > 0) {
|
||||
putMsg(result, Status.SUCCESS);
|
||||
} else {
|
||||
putMsg(result, Status.CREATE_ALERT_GROUP_ERROR);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
Map<String, Object> createAlertgroup(User loginUser, String groupName, String desc, String alertInstanceIds);
|
||||
|
||||
/**
|
||||
* updateProcessInstance alert group
|
||||
|
|
@ -142,35 +65,7 @@ public class AlertGroupService extends BaseService {
|
|||
* @param alertInstanceIds alertInstanceIds
|
||||
* @return update result code
|
||||
*/
|
||||
public Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, String desc, String alertInstanceIds) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
AlertGroup alertGroup = alertGroupMapper.selectById(id);
|
||||
|
||||
if (alertGroup == null) {
|
||||
putMsg(result, Status.ALERT_GROUP_NOT_EXIST);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
if (StringUtils.isNotEmpty(groupName)) {
|
||||
alertGroup.setGroupName(groupName);
|
||||
}
|
||||
alertGroup.setDescription(desc);
|
||||
alertGroup.setUpdateTime(now);
|
||||
alertGroup.setCreateUserId(loginUser.getId());
|
||||
alertGroup.setAlertInstanceIds(alertInstanceIds);
|
||||
// updateProcessInstance
|
||||
alertGroupMapper.updateById(alertGroup);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
return result;
|
||||
}
|
||||
Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, String desc, String alertInstanceIds);
|
||||
|
||||
/**
|
||||
* delete alert group by id
|
||||
|
|
@ -179,25 +74,7 @@ public class AlertGroupService extends BaseService {
|
|||
* @param id alert group id
|
||||
* @return delete result code
|
||||
*/
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public Map<String, Object> delAlertgroupById(User loginUser, int id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put(Constants.STATUS, false);
|
||||
|
||||
//only admin can operate
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
//check exist
|
||||
AlertGroup alertGroup = alertGroupMapper.selectById(id);
|
||||
if (alertGroup == null) {
|
||||
putMsg(result, Status.ALERT_GROUP_NOT_EXIST);
|
||||
return result;
|
||||
}
|
||||
alertGroupMapper.deleteById(id);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
return result;
|
||||
}
|
||||
Map<String, Object> delAlertgroupById(User loginUser, int id);
|
||||
|
||||
/**
|
||||
* verify group name exists
|
||||
|
|
@ -205,8 +82,5 @@ public class AlertGroupService extends BaseService {
|
|||
* @param groupName group name
|
||||
* @return check result code
|
||||
*/
|
||||
public boolean existGroupName(String groupName) {
|
||||
List<AlertGroup> alertGroup = alertGroupMapper.queryByGroupName(groupName);
|
||||
return CollectionUtils.isNotEmpty(alertGroup);
|
||||
}
|
||||
boolean existGroupName(String groupName);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -16,20 +16,17 @@
|
|||
*/
|
||||
package org.apache.dolphinscheduler.api.service;
|
||||
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.utils.Result;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.enums.UserType;
|
||||
import org.apache.dolphinscheduler.common.utils.HadoopUtils;
|
||||
import org.apache.dolphinscheduler.common.utils.StringUtils;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* base service
|
||||
*/
|
||||
|
|
@ -117,9 +114,9 @@ public class BaseService {
|
|||
* create tenant dir if not exists
|
||||
*
|
||||
* @param tenantCode tenant code
|
||||
* @throws Exception if hdfs operation exception
|
||||
* @throws IOException if hdfs operation exception
|
||||
*/
|
||||
protected void createTenantDirIfNotExists(String tenantCode) throws Exception {
|
||||
protected void createTenantDirIfNotExists(String tenantCode) throws IOException {
|
||||
|
||||
String resourcePath = HadoopUtils.getHdfsResDir(tenantCode);
|
||||
String udfsPath = HadoopUtils.getHdfsUdfDir(tenantCode);
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -0,0 +1,208 @@
|
|||
/*
|
||||
* Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
* contributor license agreements. See the NOTICE file distributed with
|
||||
* this work for additional information regarding copyright ownership.
|
||||
* The ASF licenses this file to You under the Apache License, Version 2.0
|
||||
* (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.apache.dolphinscheduler.api.service.impl;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.service.AlertGroupService;
|
||||
import org.apache.dolphinscheduler.api.service.BaseService;
|
||||
import org.apache.dolphinscheduler.api.utils.PageInfo;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
|
||||
import org.apache.dolphinscheduler.common.utils.StringUtils;
|
||||
import org.apache.dolphinscheduler.dao.entity.AlertGroup;
|
||||
import org.apache.dolphinscheduler.dao.entity.User;
|
||||
import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
|
||||
/**
|
||||
* alert group service impl
|
||||
*/
|
||||
@Service
|
||||
public class AlertGroupServiceImpl extends BaseService implements AlertGroupService {
|
||||
|
||||
@Autowired
|
||||
private AlertGroupMapper alertGroupMapper;
|
||||
|
||||
/**
|
||||
* query alert group list
|
||||
*
|
||||
* @return alert group list
|
||||
*/
|
||||
public Map<String, Object> queryAlertgroup() {
|
||||
|
||||
HashMap<String, Object> result = new HashMap<>();
|
||||
List<AlertGroup> alertGroups = alertGroupMapper.queryAllGroupList();
|
||||
result.put(Constants.DATA_LIST, alertGroups);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* paging query alarm group list
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param searchVal search value
|
||||
* @param pageNo page number
|
||||
* @param pageSize page size
|
||||
* @return alert group list page
|
||||
*/
|
||||
public Map<String, Object> listPaging(User loginUser, String searchVal, Integer pageNo, Integer pageSize) {
|
||||
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
Page<AlertGroup> page = new Page<>(pageNo, pageSize);
|
||||
IPage<AlertGroup> alertGroupIPage = alertGroupMapper.queryAlertGroupPage(
|
||||
page, searchVal);
|
||||
PageInfo<AlertGroup> pageInfo = new PageInfo<>(pageNo, pageSize);
|
||||
pageInfo.setTotalCount((int) alertGroupIPage.getTotal());
|
||||
pageInfo.setLists(alertGroupIPage.getRecords());
|
||||
result.put(Constants.DATA_LIST, pageInfo);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* create alert group
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param groupName group name
|
||||
* @param desc description
|
||||
* @param alertInstanceIds alertInstanceIds
|
||||
* @return create result code
|
||||
*/
|
||||
public Map<String, Object> createAlertgroup(User loginUser, String groupName, String desc, String alertInstanceIds) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
//only admin can operate
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
AlertGroup alertGroup = new AlertGroup();
|
||||
Date now = new Date();
|
||||
|
||||
alertGroup.setGroupName(groupName);
|
||||
alertGroup.setAlertInstanceIds(alertInstanceIds);
|
||||
alertGroup.setDescription(desc);
|
||||
alertGroup.setCreateTime(now);
|
||||
alertGroup.setUpdateTime(now);
|
||||
alertGroup.setCreateUserId(loginUser.getId());
|
||||
|
||||
// insert
|
||||
int insert = alertGroupMapper.insert(alertGroup);
|
||||
|
||||
if (insert > 0) {
|
||||
putMsg(result, Status.SUCCESS);
|
||||
} else {
|
||||
putMsg(result, Status.CREATE_ALERT_GROUP_ERROR);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* updateProcessInstance alert group
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param id alert group id
|
||||
* @param groupName group name
|
||||
* @param desc description
|
||||
* @param alertInstanceIds alertInstanceIds
|
||||
* @return update result code
|
||||
*/
|
||||
public Map<String, Object> updateAlertgroup(User loginUser, int id, String groupName, String desc, String alertInstanceIds) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
AlertGroup alertGroup = alertGroupMapper.selectById(id);
|
||||
|
||||
if (alertGroup == null) {
|
||||
putMsg(result, Status.ALERT_GROUP_NOT_EXIST);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
Date now = new Date();
|
||||
|
||||
if (StringUtils.isNotEmpty(groupName)) {
|
||||
alertGroup.setGroupName(groupName);
|
||||
}
|
||||
alertGroup.setDescription(desc);
|
||||
alertGroup.setUpdateTime(now);
|
||||
alertGroup.setCreateUserId(loginUser.getId());
|
||||
alertGroup.setAlertInstanceIds(alertInstanceIds);
|
||||
alertGroupMapper.updateById(alertGroup);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* delete alert group by id
|
||||
*
|
||||
* @param loginUser login user
|
||||
* @param id alert group id
|
||||
* @return delete result code
|
||||
*/
|
||||
@Transactional(rollbackFor = RuntimeException.class)
|
||||
public Map<String, Object> delAlertgroupById(User loginUser, int id) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
result.put(Constants.STATUS, false);
|
||||
|
||||
//only admin can operate
|
||||
if (isNotAdmin(loginUser, result)) {
|
||||
return result;
|
||||
}
|
||||
//check exist
|
||||
AlertGroup alertGroup = alertGroupMapper.selectById(id);
|
||||
if (alertGroup == null) {
|
||||
putMsg(result, Status.ALERT_GROUP_NOT_EXIST);
|
||||
return result;
|
||||
}
|
||||
alertGroupMapper.deleteById(id);
|
||||
putMsg(result, Status.SUCCESS);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* verify group name exists
|
||||
*
|
||||
* @param groupName group name
|
||||
* @return check result code
|
||||
*/
|
||||
public boolean existGroupName(String groupName) {
|
||||
List<AlertGroup> alertGroup = alertGroupMapper.queryByGroupName(groupName);
|
||||
return CollectionUtils.isNotEmpty(alertGroup);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
|
|
@ -21,9 +21,9 @@ import static org.mockito.ArgumentMatchers.any;
|
|||
import static org.mockito.ArgumentMatchers.eq;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.service.impl.AlertGroupServiceImpl;
|
||||
import org.apache.dolphinscheduler.api.utils.PageInfo;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
import org.apache.dolphinscheduler.common.enums.AlertType;
|
||||
import org.apache.dolphinscheduler.common.enums.UserType;
|
||||
import org.apache.dolphinscheduler.common.utils.CollectionUtils;
|
||||
import org.apache.dolphinscheduler.dao.entity.AlertGroup;
|
||||
|
|
@ -31,7 +31,6 @@ import org.apache.dolphinscheduler.dao.entity.User;
|
|||
import org.apache.dolphinscheduler.dao.mapper.AlertGroupMapper;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
|
@ -54,7 +53,7 @@ public class AlertGroupServiceTest {
|
|||
private static final Logger logger = LoggerFactory.getLogger(AlertGroupServiceTest.class);
|
||||
|
||||
@InjectMocks
|
||||
private AlertGroupService alertGroupService;
|
||||
private AlertGroupServiceImpl alertGroupService;
|
||||
@Mock
|
||||
private AlertGroupMapper alertGroupMapper;
|
||||
|
||||
|
|
@ -64,7 +63,7 @@ public class AlertGroupServiceTest {
|
|||
public void testQueryAlertGroup() {
|
||||
|
||||
Mockito.when(alertGroupMapper.queryAllGroupList()).thenReturn(getList());
|
||||
HashMap<String, Object> result = alertGroupService.queryAlertgroup();
|
||||
Map<String, Object> result = alertGroupService.queryAlertgroup();
|
||||
logger.info(result.toString());
|
||||
List<AlertGroup> alertGroups = (List<AlertGroup>) result.get(Constants.DATA_LIST);
|
||||
Assert.assertTrue(CollectionUtils.isNotEmpty(alertGroups));
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import static org.mockito.ArgumentMatchers.eq;
|
|||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.apache.dolphinscheduler.api.enums.Status;
|
||||
import org.apache.dolphinscheduler.api.service.impl.UsersServiceImpl;
|
||||
import org.apache.dolphinscheduler.api.utils.PageInfo;
|
||||
import org.apache.dolphinscheduler.api.utils.Result;
|
||||
import org.apache.dolphinscheduler.common.Constants;
|
||||
|
|
@ -65,7 +66,7 @@ public class UsersServiceTest {
|
|||
private static final Logger logger = LoggerFactory.getLogger(UsersServiceTest.class);
|
||||
|
||||
@InjectMocks
|
||||
private UsersService usersService;
|
||||
private UsersServiceImpl usersService;
|
||||
@Mock
|
||||
private UserMapper userMapper;
|
||||
@Mock
|
||||
|
|
|
|||
|
|
@ -72,6 +72,17 @@ public class NetUtils {
|
|||
return getAddr(getHost(), port);
|
||||
}
|
||||
|
||||
/**
|
||||
* get host
|
||||
* @return host
|
||||
*/
|
||||
public static String getHost(InetAddress inetAddress) {
|
||||
if (inetAddress != null) {
|
||||
return Constants.KUBERNETES_MODE ? inetAddress.getHostName() : inetAddress.getHostAddress();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static String getHost() {
|
||||
if (HOST_ADDRESS != null) {
|
||||
return HOST_ADDRESS;
|
||||
|
|
@ -79,7 +90,7 @@ public class NetUtils {
|
|||
|
||||
InetAddress address = getLocalAddress();
|
||||
if (address != null) {
|
||||
HOST_ADDRESS = Constants.KUBERNETES_MODE ? address.getHostName() : address.getHostAddress();
|
||||
HOST_ADDRESS = getHost(address);
|
||||
return HOST_ADDRESS;
|
||||
}
|
||||
return Constants.KUBERNETES_MODE ? "localhost" : "127.0.0.1";
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ public class PropertyUtils {
|
|||
/**
|
||||
* @return judge whether resource upload startup
|
||||
*/
|
||||
public static Boolean getResUploadStartupState() {
|
||||
public static boolean getResUploadStartupState() {
|
||||
String resUploadStartupType = PropertyUtils.getUpperCaseString(Constants.RESOURCE_STORAGE_TYPE);
|
||||
ResUploadType resUploadType = ResUploadType.valueOf(resUploadStartupType);
|
||||
return resUploadType == ResUploadType.HDFS || resUploadType == ResUploadType.S3;
|
||||
|
|
|
|||
|
|
@ -17,6 +17,8 @@
|
|||
|
||||
package org.apache.dolphinscheduler.remote.utils;
|
||||
|
||||
import org.apache.dolphinscheduler.common.utils.NetUtils;
|
||||
|
||||
import java.net.InetSocketAddress;
|
||||
|
||||
import io.netty.channel.Channel;
|
||||
|
|
@ -37,7 +39,7 @@ public class ChannelUtils {
|
|||
* @return local address
|
||||
*/
|
||||
public static String getLocalAddress(Channel channel) {
|
||||
return ((InetSocketAddress) channel.localAddress()).getAddress().getHostAddress();
|
||||
return NetUtils.getHost(((InetSocketAddress) channel.localAddress()).getAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -47,7 +49,7 @@ public class ChannelUtils {
|
|||
* @return remote address
|
||||
*/
|
||||
public static String getRemoteAddress(Channel channel) {
|
||||
return ((InetSocketAddress) channel.remoteAddress()).getAddress().getHostAddress();
|
||||
return NetUtils.getHost(((InetSocketAddress) channel.remoteAddress()).getAddress());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -58,7 +60,7 @@ public class ChannelUtils {
|
|||
*/
|
||||
public static Host toAddress(Channel channel) {
|
||||
InetSocketAddress socketAddress = ((InetSocketAddress) channel.remoteAddress());
|
||||
return new Host(socketAddress.getAddress().getHostAddress(), socketAddress.getPort());
|
||||
return new Host(NetUtils.getHost(socketAddress.getAddress()), socketAddress.getPort());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -19,6 +19,7 @@ package org.apache.dolphinscheduler.server.master.registry;
|
|||
|
||||
import static org.apache.dolphinscheduler.common.Constants.HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH;
|
||||
|
||||
import org.apache.dolphinscheduler.common.utils.NetUtils;
|
||||
import org.apache.dolphinscheduler.remote.utils.Constants;
|
||||
import org.apache.dolphinscheduler.server.master.config.MasterConfig;
|
||||
import org.apache.dolphinscheduler.server.registry.ZookeeperRegistryCenter;
|
||||
|
|
@ -59,7 +60,7 @@ public class MasterRegistryTest {
|
|||
masterRegistry.registry();
|
||||
String masterPath = zookeeperRegistryCenter.getMasterPath();
|
||||
TimeUnit.SECONDS.sleep(masterConfig.getMasterHeartbeatInterval() + 2); //wait heartbeat info write into zk node
|
||||
String masterNodePath = masterPath + "/" + (Constants.LOCAL_ADDRESS + ":" + masterConfig.getListenPort());
|
||||
String masterNodePath = masterPath + "/" + (NetUtils.getAddr(Constants.LOCAL_ADDRESS, masterConfig.getListenPort()));
|
||||
String heartbeat = zookeeperRegistryCenter.getZookeeperCachedOperator().get(masterNodePath);
|
||||
Assert.assertEquals(HEARTBEAT_FOR_ZOOKEEPER_INFO_LENGTH, heartbeat.split(",").length);
|
||||
masterRegistry.unRegistry();
|
||||
|
|
|
|||
|
|
@ -63,25 +63,25 @@
|
|||
<el-table-column :label="$t('Operation')" width="335" fixed="right">
|
||||
<template slot-scope="scope">
|
||||
<el-tooltip :content="$t('Edit')" placement="top" :enterable="false">
|
||||
<el-button type="primary" size="mini" icon="el-icon-edit-outline" :disabled="scope.row.releaseState === 'ONLINE'" @click="_edit(scope.row)" circle></el-button>
|
||||
<span><el-button type="primary" size="mini" icon="el-icon-edit-outline" :disabled="scope.row.releaseState === 'ONLINE'" @click="_edit(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Start')" placement="top" :enterable="false">
|
||||
<span><el-button type="success" size="mini" :disabled="scope.row.releaseState !== 'ONLINE'" icon="el-icon-video-play" @click="_start(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Timing')" placement="top" :enterable="false">
|
||||
<el-button type="primary" size="mini" icon="el-icon-time" :disabled="scope.row.releaseState !== 'ONLINE' || scope.row.scheduleReleaseState !== null" @click="_timing(scope.row)" circle></el-button>
|
||||
<span><el-button type="primary" size="mini" icon="el-icon-time" :disabled="scope.row.releaseState !== 'ONLINE' || scope.row.scheduleReleaseState !== null" @click="_timing(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('online')" placement="top" :enterable="false">
|
||||
<span><el-button type="warning" size="mini" v-if="scope.row.releaseState === 'OFFLINE'" icon="el-icon-upload2" @click="_poponline(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('offline')" placement="top" :enterable="false">
|
||||
<el-button type="danger" size="mini" icon="el-icon-download" v-if="scope.row.releaseState === 'ONLINE'" @click="_downline(scope.row)" circle></el-button>
|
||||
<span><el-button type="danger" size="mini" icon="el-icon-download" v-if="scope.row.releaseState === 'ONLINE'" @click="_downline(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Copy Workflow')" placement="top" :enterable="false">
|
||||
<span><el-button type="primary" size="mini" :disabled="scope.row.releaseState === 'ONLINE'" icon="el-icon-document-copy" @click="_copyProcess(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Cron Manage')" placement="top" :enterable="false">
|
||||
<el-button type="primary" size="mini" icon="el-icon-date" :disabled="scope.row.releaseState !== 'ONLINE'" @click="_timingManage(scope.row)" circle></el-button>
|
||||
<span><el-button type="primary" size="mini" icon="el-icon-date" :disabled="scope.row.releaseState !== 'ONLINE'" @click="_timingManage(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('delete')" placement="top" :enterable="false">
|
||||
<el-popconfirm
|
||||
|
|
@ -96,13 +96,13 @@
|
|||
</el-popconfirm>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('TreeView')" placement="top" :enterable="false">
|
||||
<el-button type="primary" size="mini" icon="el-icon-s-data" @click="_treeView(scope.row)" circle></el-button>
|
||||
<span><el-button type="primary" size="mini" icon="el-icon-s-data" @click="_treeView(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Export')" placement="top" :enterable="false">
|
||||
<span><el-button type="primary" size="mini" icon="el-icon-s-unfold" @click="_export(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
<el-tooltip :content="$t('Version Info')" placement="top" :enterable="false">
|
||||
<el-button type="primary" size="mini" icon="el-icon-info" :disabled="scope.row.releaseState === 'ONLINE'" @click="_version(scope.row)" circle></el-button>
|
||||
<span><el-button type="primary" size="mini" icon="el-icon-info" :disabled="scope.row.releaseState === 'ONLINE'" @click="_version(scope.row)" circle></el-button></span>
|
||||
</el-tooltip>
|
||||
</template>
|
||||
</el-table-column>
|
||||
|
|
|
|||
|
|
@ -129,28 +129,36 @@
|
|||
})
|
||||
},
|
||||
_submit () {
|
||||
this.$f.rule.forEach(item => {
|
||||
item.title = item.name
|
||||
})
|
||||
let param = {
|
||||
instanceName: this.instanceName,
|
||||
pluginDefineId: this.pluginDefineId,
|
||||
pluginInstanceParams: JSON.stringify(this.$f.rule)
|
||||
}
|
||||
if (this.item) {
|
||||
param.alertPluginInstanceId = this.item.id
|
||||
param.pluginDefineId = null
|
||||
}
|
||||
this.$refs.popover.spinnerLoading = true
|
||||
this.store.dispatch(`security/${this.item ? 'updateAlertPluginInstance' : 'createAlertPluginInstance'}`, param).then(res => {
|
||||
this.$refs.popover.spinnerLoading = false
|
||||
this.$emit('onUpdate')
|
||||
this.$message.success(res.msg)
|
||||
}).catch(e => {
|
||||
this.$message.error(e.msg || '')
|
||||
this.$refs.popover.spinnerLoading = false
|
||||
this.$f.validate((valid) => {
|
||||
if (valid) {
|
||||
this.$f.rule.forEach(item => {
|
||||
item.title = item.name
|
||||
})
|
||||
let param = {
|
||||
instanceName: this.instanceName,
|
||||
pluginDefineId: this.pluginDefineId,
|
||||
pluginInstanceParams: JSON.stringify(this.$f.rule)
|
||||
}
|
||||
if (this.item) {
|
||||
param.alertPluginInstanceId = this.item.id
|
||||
param.pluginDefineId = null
|
||||
}
|
||||
this.$refs.popover.spinnerLoading = true
|
||||
this.store.dispatch(`security/${this.item ? 'updateAlertPluginInstance' : 'createAlertPluginInstance'}`, param).then(res => {
|
||||
this.$refs.popover.spinnerLoading = false
|
||||
this.$emit('onUpdate')
|
||||
this.$message.success(res.msg)
|
||||
}).catch(e => {
|
||||
this.$message.error(e.msg || '')
|
||||
this.$refs.popover.spinnerLoading = false
|
||||
})
|
||||
} else {
|
||||
this.$message.warning(`${i18n.$t('Instance parameter exception')}`)
|
||||
this.$refs.popover.spinnerLoading = false
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
close () {
|
||||
this.$emit('close')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -143,10 +143,12 @@
|
|||
this.$message.success(res.msg)
|
||||
resolve()
|
||||
self.$emit('onUpdateDefinition')
|
||||
this.reset()
|
||||
}, e => {
|
||||
reject(e)
|
||||
self.$emit('closeDefinition')
|
||||
this.$message.error(e.msg || '')
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -171,6 +173,13 @@
|
|||
close () {
|
||||
this.$emit('closeDefinition')
|
||||
},
|
||||
reset () {
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.progress = 0
|
||||
this.file = ''
|
||||
this.dragOver = false
|
||||
},
|
||||
/**
|
||||
* Drag and drop upload
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -196,10 +196,12 @@
|
|||
this.$message.success(res.msg)
|
||||
resolve()
|
||||
self.$emit('onUpdate')
|
||||
this.reset()
|
||||
}, e => {
|
||||
reject(e)
|
||||
self.$emit('close')
|
||||
this.$message.error(e.msg || '')
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -221,6 +223,14 @@
|
|||
$('.update-file-modal').hide()
|
||||
this.$emit('onArchive')
|
||||
},
|
||||
reset () {
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.progress = 0
|
||||
this.file = null
|
||||
this.currentDir = localStore.getItem('currentDir')
|
||||
this.dragOver = false
|
||||
},
|
||||
/**
|
||||
* Drag and drop upload
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -181,10 +181,12 @@
|
|||
this.$message.success(res.msg)
|
||||
resolve()
|
||||
self.$emit('onUpdateFileChildUpdate')
|
||||
this.reset()
|
||||
}, e => {
|
||||
reject(e)
|
||||
self.$emit('close')
|
||||
this.$message.error(e.msg || '')
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -217,6 +219,15 @@
|
|||
},
|
||||
close () {
|
||||
this.$emit('closeFileChildUpdate')
|
||||
},
|
||||
reset () {
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.progress = 0
|
||||
this.file = ''
|
||||
this.currentDir = localStore.getItem('currentDir')
|
||||
this.pid = -1
|
||||
this.dragOver = false
|
||||
}
|
||||
},
|
||||
mounted () {
|
||||
|
|
|
|||
|
|
@ -195,10 +195,12 @@
|
|||
this.$message.success(res.msg)
|
||||
resolve()
|
||||
self.$emit('onUpdate')
|
||||
this.reset()
|
||||
}, e => {
|
||||
reject(e)
|
||||
self.$emit('close')
|
||||
this.$message.error(e.msg || '')
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -220,6 +222,14 @@
|
|||
$('.update-file-modal').hide()
|
||||
this.$emit('onArchive')
|
||||
},
|
||||
reset () {
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.progress = 0
|
||||
this.file = null
|
||||
this.currentDir = '/'
|
||||
this.dragOver = false
|
||||
},
|
||||
/**
|
||||
* Drag and drop upload
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -179,10 +179,12 @@
|
|||
this.$message.success(res.msg)
|
||||
resolve()
|
||||
self.$emit('onUpdateFileUpdate')
|
||||
this.reset()
|
||||
}, e => {
|
||||
reject(e)
|
||||
self.$emit('closeFileUpdate')
|
||||
this.$message.error(e.msg || '')
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -207,6 +209,15 @@
|
|||
close () {
|
||||
this.$emit('closeFileUpdate')
|
||||
},
|
||||
reset () {
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.progress = 0
|
||||
this.file = ''
|
||||
this.currentDir = '/'
|
||||
this.pid = -1
|
||||
this.dragOver = false
|
||||
},
|
||||
/**
|
||||
* Drag and drop upload
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -181,10 +181,12 @@
|
|||
this.$message.success(res.msg)
|
||||
resolve()
|
||||
self.$emit('onUpdateResourceChildUpdate')
|
||||
this.reset()
|
||||
}, e => {
|
||||
reject(e)
|
||||
self.$emit('close')
|
||||
this.$message.error(e.msg || '')
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -206,6 +208,15 @@
|
|||
$('.update-file-modal').hide()
|
||||
this.$emit('onArchiveResourceChildUpdate')
|
||||
},
|
||||
reset () {
|
||||
this.name = ''
|
||||
this.description = ''
|
||||
this.progress = 0
|
||||
this.file = ''
|
||||
this.currentDir = localStore.getItem('currentDir')
|
||||
this.pid = -1
|
||||
this.dragOver = false
|
||||
},
|
||||
/**
|
||||
* Drag and drop upload
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -124,11 +124,13 @@
|
|||
this.spinnerLoading = false
|
||||
this.progress = 0
|
||||
this.$emit('on-update', res.data)
|
||||
this.reset()
|
||||
}, e => {
|
||||
this.spinnerLoading = false
|
||||
this.progress = 0
|
||||
this.$message.error(e.msg || '')
|
||||
this.$emit('on-update', e)
|
||||
this.reset()
|
||||
}, {
|
||||
data: formData,
|
||||
emulateJSON: false,
|
||||
|
|
@ -148,6 +150,15 @@
|
|||
this._formDataUpdate()
|
||||
})
|
||||
}
|
||||
},
|
||||
reset () {
|
||||
this.udfName = ''
|
||||
this.udfDesc = ''
|
||||
this.file = ''
|
||||
this.progress = 0
|
||||
this.spinnerLoading = false
|
||||
this.pid = null
|
||||
this.currentDir = ''
|
||||
}
|
||||
},
|
||||
watch: {},
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ export default {
|
|||
'Alarm instance name': 'Alarm instance name',
|
||||
'Select plugin': 'Select plugin',
|
||||
'Please enter group name': 'Please enter group name',
|
||||
'Instance parameter exception': 'Instance parameter exception',
|
||||
'Group Type': 'Group Type',
|
||||
'Alarm plugin instance': 'Alarm plugin instance',
|
||||
Remarks: 'Remarks',
|
||||
|
|
|
|||
|
|
@ -222,6 +222,7 @@ export default {
|
|||
'Alarm instance name': '告警实例名称',
|
||||
'Select plugin': '选择插件',
|
||||
'Please enter group name': '请输入组名称',
|
||||
'Instance parameter exception': '实例参数异常',
|
||||
'Group Type': '组类型',
|
||||
'Alarm plugin instance': '告警插件实例',
|
||||
Remarks: '备注',
|
||||
|
|
|
|||
Loading…
Reference in New Issue