diff options
| author | Yoshie Muranaka <yoshiemuranaka@gmail.com> | 2019-07-18 15:36:39 -0500 |
|---|---|---|
| committer | Gunnar Mills <gmills@us.ibm.com> | 2019-07-29 16:28:38 +0000 |
| commit | 5ff98780e0a9c3987447a83782f1409dd3d11f02 (patch) | |
| tree | d916710f88a45e054a1374f0f14336a83feb23d6 /app/server-control/controllers/power-operations-controller.html | |
| parent | ae0353989abe7d9194dba47ca26d803fe11f46b6 (diff) | |
| download | phosphor-webui-5ff98780e0a9c3987447a83782f1409dd3d11f02.tar.gz phosphor-webui-5ff98780e0a9c3987447a83782f1409dd3d11f02.zip | |
Refactor power operations
Refactored power operations to use checkHostStatus function
that checks host_status property provided by dataService,
instead of polling for host/chassis status.
Added property to check when a power operation is in progress.
This property will show/hide the in progress message and make
other operations unavailable until the operation completes.
We were previously checking whether the server_state property
was set to 'Unreachable', which enables the Power on button in
the middle of a reboot, since the server_state changes to 'Off'
during reboot.
- Removed unused $timeout service
Signed-off-by: Yoshie Muranaka <yoshiemuranaka@gmail.com>
Change-Id: I234749a9a875c7370b52bd23ed74d6e9617cf5e2
Diffstat (limited to 'app/server-control/controllers/power-operations-controller.html')
| -rw-r--r-- | app/server-control/controllers/power-operations-controller.html | 68 |
1 files changed, 36 insertions, 32 deletions
diff --git a/app/server-control/controllers/power-operations-controller.html b/app/server-control/controllers/power-operations-controller.html index 2fcb95b..ddf8bda 100644 --- a/app/server-control/controllers/power-operations-controller.html +++ b/app/server-control/controllers/power-operations-controller.html @@ -17,38 +17,42 @@ <div class="row column"> <h3 class="subhead">Select a power operation</h3> </div> - <span class="inactive-message" ng-show="dataService.server_state == 'Unreachable'">There are no power operations to display while a power operation is in progress. When complete, any new power operations will be displayed here.</span> - <!-- Power on displays only when server is shutdown --> - <div class="row column power-option" ng-hide="dataService.server_state == 'Running' || dataService.server_state == 'Quiesced' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || confirm || dataService.loading, transitionAll: confirm}"> - <button id="power__power-on" class="btn btn-secondary" ng-click="powerOn()" role="button" ng-disabled="dataService.server_unreachable"> - <icon file="icon-power.svg"></icon>Power on - </button> - <p class="inline">Attempts to power on the server</p> - </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="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmWarmReboot) || dataService.loading, transitionAll: confirm && confirmWarmReboot}"> - <button id="power__warm-boot" class="btn btn-secondary" ng-click="warmRebootConfirm()" role="button" ng-disabled="dataService.server_unreachable"> - <icon file="icon-restart.svg"></icon>Warm reboot</button> - <p class="inline">Attempts to perform an orderly shutdown before restarting the server</p> - <confirm title="warm reboot" confirm="confirmWarmReboot" ng-show="confirmWarmReboot" callback="warmReboot"></confirm> - </div> - <div class="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmColdReboot) || dataService.loading, transitionAll: confirm && confirmColdReboot}"> - <button id="power__cold-boot" class="btn btn-secondary" ng-click="coldRebootConfirm()" role="button" ng-disabled="dataService.server_unreachable"> - <icon file="icon-restart.svg"></icon>Cold reboot</button> - <p class="inline">Shuts down the server immediately, then restarts it</p> - <confirm title="cold reboot" confirm="confirmColdReboot" ng-show="confirmColdReboot" cancel="coldbootCancel" callback="coldReboot"></confirm> - </div> - <div class="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmOrderlyShutdown) || dataService.loading, transitionAll: confirm && confirmOrderlyShutdown}"> - <button id="power__soft-shutdown" class="btn btn-secondary" ng-click="orderlyShutdownConfirm()" role="button" ng-disabled="dataService.server_unreachable"> - <icon file="icon-power.svg"></icon>Orderly shutdown</button> - <p class="inline">Attempts to stop all software on the server before removing power</p> - <confirm title="orderly shutdown" confirm="confirmOrderlyShutdown" ng-show="confirmOrderlyShutdown" cancel="orderlyShutdownCancel" callback="orderlyShutdown"></confirm> - </div> - <div class="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmImmediateShutdown) || dataService.loading, transitionAll: confirm && confirmImmediateShutdown}"> - <button id="power__hard-shutdown" class="btn btn-secondary" ng-click="immediateShutdownConfirm()" role="button" ng-disabled="dataService.server_unreachable"> - <icon file="icon-power.svg"></icon>Immediate shutdown</button> - <p class="inline">Removes power from the server without waiting for software to stop</p> - <confirm title="immediate shutdown" confirm="confirmImmediateShutdown" ng-show="confirmImmediateShutdown" cancel="immediatelyShutdownCancel" callback="immediateShutdown"></confirm> + <div ng-if="operationPending"> + <span class="inactive-message">There are no power operations to display while a power operation is in progress. When complete, any new power operations will be displayed here.</span> + </div> + <div ng-if="!operationPending"> + <!-- Power on displays only when server is shutdown --> + <div class="row column power-option" ng-hide="dataService.server_state == 'Running' || dataService.server_state == 'Quiesced' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || confirm || dataService.loading, transitionAll: confirm}"> + <button id="power__power-on" class="btn btn-secondary" ng-click="powerOn()" role="button" ng-disabled="dataService.server_unreachable"> + <icon file="icon-power.svg"></icon>Power on + </button> + <p class="inline">Attempts to power on the server</p> + </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="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmWarmReboot) || dataService.loading, transitionAll: confirm && confirmWarmReboot}"> + <button id="power__warm-boot" class="btn btn-secondary" ng-click="warmRebootConfirm()" role="button" ng-disabled="dataService.server_unreachable"> + <icon file="icon-restart.svg"></icon>Warm reboot</button> + <p class="inline">Attempts to perform an orderly shutdown before restarting the server</p> + <confirm title="warm reboot" confirm="confirmWarmReboot" ng-show="confirmWarmReboot" callback="warmReboot"></confirm> + </div> + <div class="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmColdReboot) || dataService.loading, transitionAll: confirm && confirmColdReboot}"> + <button id="power__cold-boot" class="btn btn-secondary" ng-click="coldRebootConfirm()" role="button" ng-disabled="dataService.server_unreachable"> + <icon file="icon-restart.svg"></icon>Cold reboot</button> + <p class="inline">Shuts down the server immediately, then restarts it</p> + <confirm title="cold reboot" confirm="confirmColdReboot" ng-show="confirmColdReboot" cancel="coldbootCancel" callback="coldReboot"></confirm> + </div> + <div class="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmOrderlyShutdown) || dataService.loading, transitionAll: confirm && confirmOrderlyShutdown}"> + <button id="power__soft-shutdown" class="btn btn-secondary" ng-click="orderlyShutdownConfirm()" role="button" ng-disabled="dataService.server_unreachable"> + <icon file="icon-power.svg"></icon>Orderly shutdown</button> + <p class="inline">Attempts to stop all software on the server before removing power</p> + <confirm title="orderly shutdown" confirm="confirmOrderlyShutdown" ng-show="confirmOrderlyShutdown" cancel="orderlyShutdownCancel" callback="orderlyShutdown"></confirm> + </div> + <div class="column power-option" ng-hide="dataService.server_state == 'Off' || dataService.server_state == 'Unreachable'" ng-class="{disabled: dataService.server_unreachable || (confirm && !confirmImmediateShutdown) || dataService.loading, transitionAll: confirm && confirmImmediateShutdown}"> + <button id="power__hard-shutdown" class="btn btn-secondary" ng-click="immediateShutdownConfirm()" role="button" ng-disabled="dataService.server_unreachable"> + <icon file="icon-power.svg"></icon>Immediate shutdown</button> + <p class="inline">Removes power from the server without waiting for software to stop</p> + <confirm title="immediate shutdown" confirm="confirmImmediateShutdown" ng-show="confirmImmediateShutdown" cancel="immediatelyShutdownCancel" callback="immediateShutdown"></confirm> + </div> </div> </div> </div> |

