ArafatKhan2198 commented on code in PR #4344:
URL: https://github.com/apache/ozone/pull/4344#discussion_r1137296300
##########
hadoop-hdds/server-scm/src/main/resources/webapps/scm/scm.js:
##########
@@ -32,40 +32,56 @@
$scope.RecordsToDisplay = "10";
$scope.currentPage = 1;
$scope.lastIndex = 0;
+ var protocol = "";
+ var portNo = "";
$http.get("jmx?qry=Hadoop:service=SCMNodeManager,name=SCMNodeManagerInfo")
.then(function (result) {
- ctrl.nodemanagermetrics = result.data.beans[0];
- $scope.nodeStatus = ctrl.nodemanagermetrics &&
ctrl.nodemanagermetrics.NodeStatusInfo &&
+ const URLScheme = location.protocol.replace(":" , "");
+ ctrl.nodemanagermetrics = result.data.beans[0];
+
+ $scope.nodeStatus = ctrl.nodemanagermetrics &&
ctrl.nodemanagermetrics.NodeStatusInfo &&
ctrl.nodemanagermetrics.NodeStatusInfo.map(({ key, value
}) => {
- return {
- hostname: key,
- opstate: value[0],
- comstate: value[1]
- }});
- nodeStatusCopy = [...$scope.nodeStatus];
- $scope.lastIndex = Math.ceil(nodeStatusCopy.length /
$scope.RecordsToDisplay);
- $scope.nodeStatus = nodeStatusCopy.slice(0,
$scope.RecordsToDisplay);
+ value.map(({key, value}) => {
+ if(key == "HTTP") {
+ protocol = key;
+ portNo = value;
+ }
+ if(key == "HTTPS"){
+ protocol = key.toLowerCase() === URLScheme ?
key : "HTTP";
+ portNo = value;
+ }
+ });
+ return {
+ hostname: key,
+ opstate: value && value.find((element) => element.key
== "OPSTATE").value,
+ comstate: value && value.find((element) => element.key
== "COMSTATE").value,
+ portno: portNo,
+ portval: protocol
+ }});
+ nodeStatusCopy = [...$scope.nodeStatus];
+ $scope.lastIndex = Math.ceil(nodeStatusCopy.length /
$scope.RecordsToDisplay);
+ $scope.nodeStatus = nodeStatusCopy.slice(0,
$scope.RecordsToDisplay);
});
/*if option is 'All' display all records else display specified
record on page*/
- $scope.UpdateRecordsToShow = () => {
- if($scope.RecordsToDisplay == 'All') {
- $scope.lastIndex = 1;
- $scope.nodeStatus = nodeStatusCopy;
- } else {
- $scope.lastIndex = Math.ceil(nodeStatusCopy.length /
$scope.RecordsToDisplay);
- $scope.nodeStatus = nodeStatusCopy.slice(0,
$scope.RecordsToDisplay);
- }
- $scope.currentPage = 1;
+ $scope.UpdateRecordsToShow = () => {
+ if($scope.RecordsToDisplay == 'All') {
+ $scope.lastIndex = 1;
+ $scope.nodeStatus = nodeStatusCopy;
+ } else {
+ $scope.lastIndex = Math.ceil(nodeStatusCopy.length /
$scope.RecordsToDisplay);
+ $scope.nodeStatus = nodeStatusCopy.slice(0,
$scope.RecordsToDisplay);
+ }
+ $scope.currentPage = 1;
}
/* Page Slicing logic */
- $scope.handlePagination = (pageIndex, isDisabled) => {
- if(!isDisabled) {
- let startIndex = 0, endIndex = 0;
- $scope.currentPage = pageIndex;
- startIndex = (pageIndex * $scope.RecordsToDisplay) -
$scope.RecordsToDisplay;
- endIndex = startIndex + parseInt($scope.RecordsToDisplay);
- $scope.nodeStatus = nodeStatusCopy.slice(startIndex,
endIndex);
+ $scope.handlePagination = (pageIndex, isDisabled) => {
Review Comment:
There is a significant amount of unnecessary indentation added in scm.js.
Could you please remove it?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]