Skip to content

Commit

Permalink
HDDS-9303. Ozone Manager : Display leader information in table format…
Browse files Browse the repository at this point in the history
… and highlight current node. Review Comments
  • Loading branch information
smitajoshi12 committed Oct 23, 2023
1 parent 1343bc4 commit ef42695
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -825,22 +825,17 @@ public static List<Map<String, String>> format(List<ServiceInfo> nodes, int port
if (info.getNodeType() == HddsProtos.NodeType.OM) {
String role = info.getOmRoleInfo().getNodeId().equals(leaderId) ? "LEADER" : "FOLLOWER";
Map<String, String> omInfo = new HashMap<>();
omInfo.put("HostName", info.getHostname());
omInfo.put("Node-Id", info.getOmRoleInfo().getNodeId());
omInfo.put("Ratis-Port", String.valueOf(port));
omInfo.put("Role", role);
omInfo.put("hostName", info.getHostname());
omInfo.put("nodeId", info.getOmRoleInfo().getNodeId());
omInfo.put("ratisPort", String.valueOf(port));
omInfo.put("role", role);

omInfoList.add(omInfo);
count++;
}
}
// Print Stand-alone if only one OM exists
if (count == 1) {
// Return an empty list to indicate "STANDALONE"
return Collections.emptyList();
} else {
// Return omInfoList if count ==1 or count >=1
return omInfoList;
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3009,23 +3009,31 @@ public String getRpcPort() {
@Override
public List<Map<String, String>> getRatisRoles() {
List<ServiceInfo> serviceList;
List<Map<String, String>> resultList = new ArrayList<>();
Map<String, String> messageException = new HashMap<>();
int port = omNodeDetails.getRatisPort();
RaftPeer leaderId;
if (isRatisEnabled) {
try {
leaderId = omRatisServer.getLeader();
if (leaderId == null) {
LOG.error("No leader found");
return Collections.emptyList();
messageException.put("Message", "Exception: Not a leader");
resultList.add(messageException);
return resultList;
}
serviceList = getServiceList();
} catch (IOException e) {
LOG.error("IO-Exception Occurred", e);
return Collections.emptyList();
messageException.put("Message", "IO-Exception Occurred");
resultList.add(messageException);
return resultList;
}
return OmUtils.format(serviceList, port, leaderId.getId().toString());
} else {
return Collections.emptyList();
messageException.put("Message", "Exception: Ratis Disabled");
resultList.add(messageException);
return resultList;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,18 @@ <h2>OM Roles (HA)</h2>
<th>Role</th>
</tr>
</thead>
<tbody>
<tr class="om-roles-background" ng-repeat="roles in $ctrl.overview.jmx.RatisRoles"
ng-if="$ctrl.role.Id == roles[2].value">
<tbody ng-repeat="roles in $ctrl.overview.jmx.RatisRoles">
<tr class="om-roles-background" ng-if="$ctrl.role.Id == roles[3].value">
<td>{{roles[0].value}}</td>
<td>{{roles[3].value}}</td>
<td>{{roles[2].value}}</td>
<td>{{roles[1].value}}</td>
<td>{{roles[0].value}}</td>
</tr>
<tr ng-repeat="roles in $ctrl.overview.jmx.RatisRoles" ng-if="$ctrl.role.Id != roles[2].value">
<tr ng-if="$ctrl.role.Id != roles[3].value">
<td>{{roles[0].value}}</td>
<td>{{roles[3].value}}</td>
<td>{{roles[2].value}}</td>
<td>{{roles[1].value}}</td>
<td>{{roles[0].value}}</td>
</tr>
</tbody>
</table>
Expand Down

0 comments on commit ef42695

Please sign in to comment.