Added host power on/off functionality to button.
Change-Id: I8942444c7686851c1cf2db9a6125654a5fa399d9
Signed-off-by: Iftekharul Islam <iislam@us.ibm.com>
diff --git a/src/power-operations.html b/src/power-operations.html
index a692ca5..adcdd0e 100644
--- a/src/power-operations.html
+++ b/src/power-operations.html
@@ -12,7 +12,7 @@
</div>
</div>
<div class="row column">
- <div id="power-indicator-bar" class="power__indicator-bar " ng-class="{'power__state-on': dataService.server_state == 'On', 'power__state-off': dataService.server_state == 'Off', 'power__state-indet' : dataService.server_state == 'Booting' }">
+ <div id="power-indicator-bar" class="power__indicator-bar" ng-class="{'power__state-on': dataService.server_state == 'Running', 'power__state-off': dataService.server_state == 'Off', 'power__state-indet': dataService.server_state == 'Quiesced'}">
<p class="inline">{{dataService.server_id}}</p>
<h3 class="power__state inline float-right h3"><span>{{dataService.server_state}}</span></h3>
</div>
@@ -23,33 +23,33 @@
</div>
<!-- Power on displays only when server is shutdown -->
- <div class="row column power-option" ng-hide="dataService.server_state == 'On'" ng-class="{disabled: confirm && !power_confirm, transitionAll: confirm && power_confirm}">
- <button id="power__power-on" class="btn-secondary" ng-click="powerOnConfirm()" role="button"><img src="img/icon-power.svg" />Power On</button>
+ <div class="row column power-option" ng-hide="dataService.server_state == 'Running'" ng-class="{disabled: (confirm && !power_confirm) || dataService.loading, transitionAll: confirm && power_confirm}">
+ <button id="power__power-on" class="btn-secondary" ng-click="togglePower()" role="button">Power On</button>
<p>Attempts to power on the server</p>
- <confirm title="power on" message="Power on the server" confirm="power_confirm" callback="togglePower"></confirm>
+ <!---<confirm title="power off" message="Power off the server" confirm="power_confirm" ng-show="power_confirm" callback="togglePower"></confirm>-->
</div>
<!-- Power reboot/shutdown options : when server is off all of these are hidden. When one option is selected, the others are disabled. -->
- <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: confirm && !warmboot_confirm, transitionAll: confirm && warmboot_confirm}">
+ <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !warmboot_confirm) || dataService.loading, transitionAll: confirm && warmboot_confirm}">
<button id="power__warm-boot" class="btn-secondary" ng-click="warmRebootConfirm()" role="button"><i>↻</i> Warm reboot</button>
<p>Attempts to perform an orderly shutdown before restarting the server</p>
- <confirm title="Warm Reboot" message="perform an orderly shutdown" confirm="warmboot_confirm" callback="warmReboot"></confirm>
+ <confirm title="Warm Reboot" message="perform an orderly shutdown" confirm="warmboot_confirm" ng-show="warmboot_confirm" callback="warmReboot"></confirm>
</div>
- <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: confirm && !coldboot_confirm, transitionAll: confirm && coldboot_confirm}">
+ <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !coldboot_confirm) || dataService.loading, transitionAll: confirm && coldboot_confirm}">
<button id="power__cold-boot" class="btn-secondary" ng-click="coldRebootConfirm()" role="button"><i>↻</i> Cold reboot</button>
<p>Shuts down the server immediately, then restarts it</p>
- <confirm title="Cold Reboot" message="Shutdown server immediately." confirm="coldboot_confirm" cancel="coldbootCancel" callback="toggleState"></confirm>
+ <confirm title="Cold Reboot" message="Shutdown server immediately." confirm="coldboot_confirm" ng-show="coldboot_confirm" cancel="coldbootCancel" callback="coldReboot"></confirm>
</div>
- <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: confirm && !orderly_confirm, transitionAll: confirm && orderly_confirm}">
+ <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !orderly_confirm) || dataService.loading, transitionAll: confirm && orderly_confirm}">
<button id="power__soft-shutdown" class="btn-secondary" ng-click="orderlyShutdownConfirm()" role="button"><img src="img/icon-power.svg" />Orderly shutdown</button>
<p>Attempts to stop all software on the server before removing power</p>
- <confirm title="Orderly shutdown" message="Attempts to stop all software orderly." confirm="orderly_confirm" cancel="orderlyShutdownCancel" callback="toggleState"></confirm>
+ <confirm title="Orderly shutdown" message="Attempts to stop all software orderly." confirm="orderly_confirm" ng-show="orderly_confirm" cancel="orderlyShutdownCancel" callback="orderlyShutdown"></confirm>
</div>
- <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: confirm && !immediately_confirm, transitionAll: confirm && immediately_confirm}">
+ <div class="row column power-option" ng-hide="dataService.server_state == 'Off'" ng-class="{disabled: (confirm && !immediately_confirm) || dataService.loading, transitionAll: confirm && immediately_confirm}">
<button id="power__hard-shutdown" class="btn-secondary" ng-click="immediateShutdownConfirm()" role="button"><img src="img/icon-power.svg" />Immediate shutdown</button>
<p>Removes power from the server without waiting for software to stop</p>
- <confirm title="Immediate shutdown" message="Removes power from the server immediately." confirm="immediately_confirm" cancel="immediatelyShutdownCancel" callback="toggleState"></confirm>
+ <confirm title="Immediate shutdown" message="Removes power from the server immediately." confirm="immediately_confirm" ng-show="immediately_confirm" cancel="immediatelyShutdownCancel" callback="immediateShutdown"></confirm>
</div>
</div>
</div>
\ No newline at end of file