Skip to content

Commit

Permalink
#418 fix bug
Browse files Browse the repository at this point in the history
  • Loading branch information
kfchu committed Apr 29, 2018
1 parent 24029d4 commit dc07f2d
Showing 1 changed file with 26 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import com.vip.saturn.job.console.controller.SuccessResponseEntity;
import com.vip.saturn.job.console.domain.*;
import com.vip.saturn.job.console.exception.SaturnJobConsoleException;
import com.vip.saturn.job.console.mybatis.service.NamespaceZkClusterMapping4SqlService;
import com.vip.saturn.job.console.service.NamespaceZkClusterMappingService;
import com.vip.saturn.job.console.utils.Permissions;
import com.vip.saturn.job.console.utils.SaturnConsoleUtils;
Expand All @@ -28,6 +29,9 @@ public class RegistryCenterController extends AbstractGUIController {
@Resource
private NamespaceZkClusterMappingService namespaceZkClusterMappingService;

@Resource
private NamespaceZkClusterMapping4SqlService namespaceZkClusterMapping4SqlService;

/**
* 创建域
*/
Expand Down Expand Up @@ -59,11 +63,32 @@ public SuccessResponseEntity queryAllNamespaceInfo() {
List<RegistryCenterConfiguration> namespaceInfoList = Lists.newLinkedList();
Collection<ZkCluster> zkClusterList = registryCenterService.getZkClusterList();
for (ZkCluster zkCluster : zkClusterList) {
namespaceInfoList.addAll(zkCluster.getRegCenterConfList());
if (!zkCluster.isOffline()) {
namespaceInfoList.addAll(zkCluster.getRegCenterConfList());
} else {
List<String> namespaces = namespaceZkClusterMapping4SqlService
.getAllNamespacesOfCluster(zkCluster.getZkClusterKey());
if (namespaces != null && !namespaces.isEmpty()) {
namespaceInfoList.addAll(constructRegistryCenterConfigurations(namespaces, zkCluster));
}
}
}

return new SuccessResponseEntity(namespaceInfoList);
}

protected List<RegistryCenterConfiguration> constructRegistryCenterConfigurations(List<String> namespaces,
ZkCluster zkCluster) {
List<RegistryCenterConfiguration> result = Lists.newArrayList();
for (String namespace : namespaces) {
RegistryCenterConfiguration config = new RegistryCenterConfiguration("", namespace, zkCluster.getZkAddr());
config.setZkClusterKey(zkCluster.getZkClusterKey());
result.add(config);
}

return result;
}

/**
* 导出指定的namespce
*/
Expand Down

0 comments on commit dc07f2d

Please sign in to comment.