From a24bb8b56c972b047b20dce55b483063594a50d0 Mon Sep 17 00:00:00 2001 From: Shiwen Cheng Date: Fri, 12 Mar 2021 16:46:14 +0800 Subject: [PATCH] [1.3.6-prepare][Improvement][Server&UI] Update worker group ip ad unify form model #4982 (#5016) --- .../api/service/WorkerGroupService.java | 21 ++++++++++++------- .../_source/formModel/tasks/conditions.vue | 10 ++++----- .../dag/_source/formModel/tasks/dependent.vue | 10 ++++----- .../pages/dag/_source/formModel/tasks/mr.vue | 4 ++-- .../dag/_source/formModel/tasks/procedure.vue | 3 --- .../dag/_source/formModel/tasks/python.vue | 2 +- .../dag/_source/formModel/tasks/sqoop.vue | 5 ++--- 7 files changed, 28 insertions(+), 27 deletions(-) diff --git a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java index 374fd6e718..26542b2ba7 100644 --- a/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java +++ b/dolphinscheduler-api/src/main/java/org/apache/dolphinscheduler/api/service/WorkerGroupService.java @@ -25,13 +25,19 @@ import org.apache.dolphinscheduler.common.utils.StringUtils; import org.apache.dolphinscheduler.dao.entity.User; import org.apache.dolphinscheduler.dao.entity.WorkerGroup; import org.apache.dolphinscheduler.dao.mapper.ProcessInstanceMapper; +import org.apache.dolphinscheduler.remote.utils.Host; import org.apache.dolphinscheduler.service.zk.ZookeeperCachedOperator; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import java.util.stream.Collectors; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + /** * work group service */ @@ -133,7 +139,6 @@ public class WorkerGroupService extends BaseService { // available workerGroup list List availableWorkerGroupList = new ArrayList<>(); - List workerGroups = new ArrayList<>(); for (String workerGroup : workerGroupList){ @@ -144,10 +149,10 @@ public class WorkerGroupService extends BaseService { WorkerGroup wg = new WorkerGroup(); wg.setName(workerGroup); if (isPaging){ - wg.setIpList(childrenNodes); - String registeredIpValue = zookeeperCachedOperator.get(workerGroupPath + "/" + childrenNodes.get(0)); - wg.setCreateTime(DateUtils.stringToDate(registeredIpValue.split(",")[6])); - wg.setUpdateTime(DateUtils.stringToDate(registeredIpValue.split(",")[7])); + wg.setIpList(childrenNodes.stream().map(node -> Host.of(node).getIp()).collect(Collectors.toList())); + String registeredValue = zookeeperCachedOperator.get(workerGroupPath + "/" + childrenNodes.get(0)); + wg.setCreateTime(DateUtils.stringToDate(registeredValue.split(",")[6])); + wg.setUpdateTime(DateUtils.stringToDate(registeredValue.split(",")[7])); } workerGroups.add(wg); } diff --git a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue index 621de81037..8cf71443fe 100644 --- a/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue +++ b/dolphinscheduler-ui/src/js/conf/home/pages/dag/_source/formModel/tasks/conditions.vue @@ -15,7 +15,7 @@ * limitations under the License. */