Fixed cluster details panel

- renaming; data watch.

Change-Id: I19c3f57d78d3e1950c80f28ca8b2291e92852493
This commit is contained in:
Simon Hunt 2016-10-26 10:59:14 -07:00
parent 171bce7252
commit a271e0a1e1
4 changed files with 23 additions and 15 deletions

View File

@ -40,8 +40,8 @@ public class ClusterViewMessageHandler extends UiMessageHandler {
private static final String CLUSTER_DATA_RESP = "clusterDataResponse"; private static final String CLUSTER_DATA_RESP = "clusterDataResponse";
private static final String CLUSTERS = "clusters"; private static final String CLUSTERS = "clusters";
private static final String CLUSTER_DETAILS_REQ = "clusterNodeDetailsRequest"; private static final String CLUSTER_DETAILS_REQ = "clusterDetailsRequest";
private static final String CLUSTER_DETAILS_RESP = "clusterNodeDetailsResponse"; private static final String CLUSTER_DETAILS_RESP = "clusterDetailsResponse";
private static final String DETAILS = "details"; private static final String DETAILS = "details";
private static final String ID = "id"; private static final String ID = "id";

View File

@ -29,29 +29,29 @@
/* More in generic panel.css */ /* More in generic panel.css */
#node-details-panel.floatpanel { #cluster-details-panel.floatpanel {
z-index: 0; z-index: 0;
} }
#node-details-panel .container { #cluster-details-panel .container {
padding: 8px 12px; padding: 8px 12px;
} }
#node-details-panel .close-btn { #cluster-details-panel .close-btn {
position: absolute; position: absolute;
right: 12px; right: 12px;
top: 12px; top: 12px;
cursor: pointer; cursor: pointer;
} }
#node-details-panel .dev-icon { #cluster-details-panel .dev-icon {
display: inline-block; display: inline-block;
padding: 0 6px 0 0; padding: 0 6px 0 0;
vertical-align: middle; vertical-align: middle;
} }
#flow-details-panel h2 { #cluster-details-panel h2 {
display: inline-block; display: inline-block;
margin: 8px 0; margin: 8px 0;
} }

View File

@ -53,5 +53,5 @@
</div> </div>
</div> </div>
<node-details-panel></node-details-panel> <cluster-details-panel></cluster-details-panel>
</div> </div>

View File

@ -44,9 +44,9 @@
htPdg = 479, htPdg = 479,
wtPdg = 532, wtPdg = 532,
pName = 'node-details-panel', pName = 'cluster-details-panel',
detailsReq = 'nodeDetailsRequest', detailsReq = 'clusterDetailsRequest',
detailsResp = 'nodeDetailsResponse'; detailsResp = 'clusterDetailsResponse';
function closePanel() { function closePanel() {
if (detailsPanel.isVisible()) { if (detailsPanel.isVisible()) {
@ -110,14 +110,14 @@
detailsPanel.width(wtPdg); detailsPanel.width(wtPdg);
//Todo : remove this when server implementation is done //Todo : remove this when server implementation is done
detailsPanel.show(); // detailsPanel.show();
} }
function respDetailsCb(data) { function respDetailsCb(data) {
$scope.panelData = data.details; $scope.panelData = data.details;
$scope.$apply(); $scope.$apply();
//TODO Use populateDetails() when merging server code //TODO Use populateDetails() when merging server code
$log.debug('Get the details:', $scope.panelData.id); $log.debug('Get the details:', $scope.panelData);
} }
@ -158,7 +158,7 @@
wss.sendEvent(detailsReq, {id: row.id}); wss.sendEvent(detailsReq, {id: row.id});
//ToDo : Remove this line when server implmentation is complete //ToDo : Remove this line when server implmentation is complete
populateDetails($scope.selId); // populateDetails($scope.selId);
} else { } else {
$scope.hidePanel(); $scope.hidePanel();
} }
@ -173,7 +173,7 @@
}]) }])
.directive('nodeDetailsPanel', .directive('clusterDetailsPanel',
['$rootScope', '$window', '$timeout', 'KeyService', ['$rootScope', '$window', '$timeout', 'KeyService',
function ($rootScope, $window, $timeout, ks) { function ($rootScope, $window, $timeout, ks) {
return function (scope) { return function (scope) {
@ -199,6 +199,14 @@
initPanel(); initPanel();
} }
// if the panelData changes
scope.$watch('panelData', function () {
if (!fs.isEmptyObject(scope.panelData)) {
populateDetails(scope.panelData);
detailsPanel.show();
}
});
// if the window size changes // if the window size changes
unbindWatch = $rootScope.$watchCollection( unbindWatch = $rootScope.$watchCollection(
function () { function () {