return null;
}
- List<ClusterNodeBean> clusters = new ArrayList<ClusterNodeBean>();
+ List<ClusterNodeBean> clusterNodes = new ArrayList<ClusterNodeBean>();
List<InetAddress> controllers = clusterServices.getClusteredControllers();
for (InetAddress controller : controllers) {
if (controller.equals(clusterServices.getMyAddress())) {
clusterBeanBuilder.highlightMe();
}
- if (clusterServices.amICoordinator()) {
+ if (clusterServices.getCoordinatorAddress().equals(controller)) {
clusterBeanBuilder.iAmCoordinator();
}
-
- clusters.add(clusterBeanBuilder.build());
+ clusterNodes.add(clusterBeanBuilder.build());
}
- return gson.toJson(clusters);
+ return gson.toJson(clusterNodes);
}
/**
* Return nodes connected to controller {controller}
- * @param cluster
+ * @param controller
* - byte[] of the address of the controller
* @return List<NodeBean>
*/
@RequestMapping("/cluster/controller/{controller}")
@ResponseBody
- public String getNodesConnectedToController(@PathVariable("controller") String cluster) {
+ public String getNodesConnectedToController(@PathVariable("controller") String controller) {
IClusterGlobalServices clusterServices = (IClusterGlobalServices) ServiceHelper.getGlobalInstance(
IClusterGlobalServices.class, this);
if (clusterServices == null) {
return null;
}
- byte[] address = gson.fromJson(cluster, byte[].class);
- InetAddress clusterAddress = null;
+ byte[] address = gson.fromJson(controller, byte[].class);
+ InetAddress controllerAddress = null;
try {
- clusterAddress = InetAddress.getByAddress(address);
+ controllerAddress = InetAddress.getByAddress(address);
} catch (UnknownHostException e) {
return null;
}
- InetAddress thisCluster = clusterServices.getMyAddress();
List<NodeBean> result = new ArrayList<NodeBean>();
- Set<Node> nodes = connectionManager.getNodes(thisCluster);
+ Set<Node> nodes = connectionManager.getNodes(controllerAddress);
+ if (nodes == null) {
+ return gson.toJson(result);
+ }
for (Node node : nodes) {
Description description = (Description) switchManager.getNodeProp(node, Description.propertyName);
NodeBean nodeBean;
close : 'one-main-cluster-id-close',
datagrid : 'one-main-cluster-id-datagrid'
},
- registry : { // one.main.cluster.registry
- cluster : undefined
- },
initialize : function() {
var h3 = 'Cluster Management';
var footer = one.main.cluster.footer();
if ($tr.find('td:nth-child(1)').attr('colspan') === '1') {
return false;
}
- var address = one.main.cluster.registry.cluster[$tr.index()];
+ var address = $tr.find('.ux-id').text();
one.main.cluster.nodes.initialize(address);
});
});
var registry = [];
$(data).each(function(idx, val) {
var name = val.name;
+ var address = val.address;
+ var $registry = $(document.createElement('span'));
+ $registry
+ .append(JSON.stringify(address))
+ .css('display', 'none')
+ .addClass('ux-id');
name = one.lib.dashlet.label(name, null)[0].outerHTML;
+ name += $registry[0].outerHTML;
if (val.me === true) {
var me = one.lib.dashlet.label('*', 'label-inverse')[0].outerHTML;
name += ' '+me;
tdata.push({
'controller' : name
});
- registry.push(val.address);
});
- one.main.cluster.registry.cluster = registry;
var source = new StaticDataSource({
columns : [
{
});
// body
- $.getJSON('/admin/cluster/controller/'+JSON.stringify(address), function(data) {
+ $.getJSON('/admin/cluster/controller/'+address, function(data) {
var $gridHTML = one.lib.dashlet.datagrid.init(one.main.cluster.nodes.id.datagrid, {
searchable: true,
filterable: false,