Skip to content

Commit

Permalink
Merge pull request #851 from gnehapk/volume-profiling
Browse files Browse the repository at this point in the history
Enable/disable profiling for mixed status
  • Loading branch information
gnehapk committed Mar 2, 2018
2 parents 90d93f8 + 78a87af commit 8a36309
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
7 changes: 5 additions & 2 deletions src/modules/clusters/cluster-list/cluster-list.html
Expand Up @@ -58,8 +58,11 @@ <h1>No Clusters Detected</h1>
</button>
<ul class="dropdown-menu dropdown-menu-right" aria-labelledby="dropdownKebabRight{{$index}}">
<li ng-show = "cluster.managed === 'Yes'">
<a ng-class="{'disable-pointer': $root.userRole === 'limited' || clusterCntrl.profilingButtonClick}" ng-click="clusterCntrl.doProfilingAction($event, cluster, cluster.isProfilingEnabled === 'Enabled' ? 'Disable' : 'Enable', cluster.clusterId)" tooltip-enable="clusterCntrl.flag" ng-mouseover="clusterCntrl.addTooltip($event)" uib-tooltip="cluster.isProfilingEnabled === 'Enabled' ? 'Disable Profiling' : 'Enable Profiling'">{{cluster.isProfilingEnabled === "Enabled" ? "Disable Profiling" : "Enable Profiling"}}
<i class="glyphicon glyphicon-refresh glyphicon-refresh-animate" data-ng-class="{'hidden': clusterCntrl.profilingButtonClick !== true }"></i>
<a ng-class="{'disable-pointer': $root.userRole === 'limited' || clusterCntrl.disProfilingBtnClicked}" ng-click="clusterCntrl.doProfilingAction($event, cluster, 'Disable', cluster.clusterId)" tooltip-enable="clusterCntrl.flag" ng-mouseover="clusterCntrl.addTooltip($event)" uib-tooltip="Disable Profiling" ng-show="cluster.isProfilingEnabled === 'Enabled' || cluster.isProfilingEnabled === 'Mixed'">Disable Profiling
<i class="glyphicon glyphicon-refresh glyphicon-refresh-animate" data-ng-class="{'hidden': clusterCntrl.disProfilingBtnClicked !== true }"></i>
</a>
<a ng-class="{'disable-pointer': $root.userRole === 'limited' || clusterCntrl.enProfilingBtnClicked}" ng-click="clusterCntrl.doProfilingAction($event, cluster, 'Enable', cluster.clusterId)" tooltip-enable="clusterCntrl.flag" ng-mouseover="clusterCntrl.addTooltip($event)" uib-tooltip="Enable Profiling" ng-show="cluster.isProfilingEnabled === 'Disabled' || cluster.isProfilingEnabled === 'Mixed'">Enable Profiling
<i class="glyphicon glyphicon-refresh glyphicon-refresh-animate" data-ng-class="{'hidden': clusterCntrl.enProfilingBtnClicked !== true }"></i>
</a>
</li>
<li>
Expand Down
28 changes: 22 additions & 6 deletions src/modules/clusters/cluster-list/cluster-list.js
Expand Up @@ -29,7 +29,8 @@
vm.isDataLoading = true;
vm.clusterNotPresent = false;
vm.flag = false;
vm.profilingButtonClick = false;
vm.enProfilingBtnClicked = false;
vm.disProfilingBtnClicked = false;
$rootScope.selectedClusterOption = "allClusters";
vm.filtersText = "";
vm.filters = [];
Expand Down Expand Up @@ -168,16 +169,32 @@
* @memberOf clusterController
*/
function doProfilingAction($event, cluster, action, clusterId) {
vm.profilingButtonClick = true;
var profileStatus = {
"enabled": "Enabled",
"disabled": "Disabled",
"mixed": "Mixed"
};

if (action === "Enable") {
vm.enProfilingBtnClicked = true;
} else {
vm.disProfilingBtnClicked = true;
}

clusterStore.doProfilingAction(cluster.clusterId, action)
.then(function(data) {
Notifications.message("success", "", "Volume profiling " + (action === "Enable" ? "enabled" : "disabled") + " successfully.");
Notifications.message("success", "", (action === "Enable" ? "Enable" : "Disable") + " volume profiling job initiated successfully.");
cluster = _isClusterPresent(data, clusterId);
vm.clusterList[cluster.index].isProfilingEnabled = data.enable_volume_profiling === "yes" ? "Enabled" : "Disabled";
vm.clusterList[cluster.index].isProfilingEnabled = profileStatus[data.volume_profiling_state];
}).catch(function(error) {
Notifications.message("danger", "", "Failed to " + (action === "Enable" ? "enable" : "disable") + " volume profile.");
}).finally(function() {
vm.profilingButtonClick = false;

if (action === "Enable") {
vm.enProfilingBtnClicked = false;
} else {
vm.disProfilingBtnClicked = false;
}
});
$event.stopPropagation();
}
Expand Down Expand Up @@ -240,7 +257,6 @@
vm.flag = utils.tooltip($event);
}


function goToTaskDetail(cluster) {
$state.go("global-task-detail", { clusterId: cluster.integrationId, taskId: cluster.currentTaskId });
}
Expand Down
2 changes: 1 addition & 1 deletion src/modules/tasks/task-detail/task-detail.html
Expand Up @@ -18,7 +18,7 @@
<a href="" class="no-content">Tasks</a>
</li>
<li>
<i class="breadcrumb-icon" ng-class="{'pficon pficon-ok status-icon': (taskDetailCntrl.taskDetail.status === 'finished')}"></i>
<i class="breadcrumb-icon" ng-class="{'pficon pficon-ok status-icon': (taskDetailCntrl.taskDetail.status === 'finished'), 'pficon pficon-error-circle-o':(taskDetailCntrl.taskDetail.status === 'failed')}"></i>
<span class="cluster-name" ng-class="{'remove-width': !$root.selectedClusterOption}">
{{taskDetailCntrl.taskDetail.flow}}: {{taskDetailCntrl.taskDetail.job_id}}
</span>
Expand Down

0 comments on commit 8a36309

Please sign in to comment.