1<loader loading="dataService.loading || loading"></loader>
2<div id="power-operations" class="power-operations">
3  <div class="row column">
4    <h1>Server power operations</h1>
5    <div class="power__current-status page-header">
6      <h2 class="inline">Current status</h2>
7      <div class="power__status-log inline float-right">
8        Last power operation at
9        <span class="courier-bold">{{ powerTime | localeDate }}</span>
10      </div>
11    </div>
12  </div>
13  <!-- Power Indicator Bar -->
14  <div class="row column">
15    <div id="power-indicator-bar" class="power__indicator-bar"
16      ng-class="{'power__state-on': dataService.server_state == 'Running',
17                 'power__state-off': dataService.server_state == 'Off',
18                 'power__state-indet': dataService.server_state == 'Standby',
19                 'power__state-error': dataService.server_state == 'Quiesced'}">
20      <p class="inline">
21        {{ dataService.hostname }} - {{ dataService.server_id }}
22      </p>
23      <h3 class="power__state inline no-margin h3">
24        <status-icon status="{{ dataService.server_state == 'Running' ? 'on' :
25                                dataService.server_state == 'Off' ? 'off' :
26                                dataService.server_state == 'Unreachable' ? 'off' :
27                                dataService.server_state == 'Standby' ? 'warn' :
28                                dataService.server_state == 'Quiesced' ? 'error' : null }}">
29        </status-icon>
30        <span>{{ dataService.server_state | quiescedToError }}</span>
31      </h3>
32    </div>
33  </div>
34  <div class="row column">
35    <!-- Boot Settings Column -->
36    <div class="large-4 columns boot-options-wrapper">
37      <form id="host-boot-settings" name="hostBootSettings" class="host-boot-settings" novalidate>
38        <h2 class="subhead boot-options">Host OS boot settings</h2>
39        <div class="boot-settings-form">
40          <div class="boot-options">
41            <label for="boot-selected">
42              Boot setting override</label>
43            <select name="bootSelected"
44                    id="boot-selected"
45                    ng-disabled="dataService.server_unreachable || bootOverrideError"
46                    ng-model="boot.BootSourceOverrideTarget"
47                    ng-change="onChangeBootSetting()">
48              <option class="courier-bold" value="{{bootSource}}" ng-repeat="bootSource in bootSources">
49                {{ bootSource }}
50              </option>
51            </select>
52          <div class="boot-options one-time-boot-setting">
53            <div class="align-self-center">
54              <label class="control-check" id="one-time-label"> <span class="inline boot-checkbox">Enable one time boot</span>
55                <input type="checkbox"
56                       name="oneTime"
57                       ng-disabled="dataService.server_unreachable ||
58                                    bootOverrideError ||
59                                    boot.BootSourceOverrideTarget =='None'"
60                       ng-model="boot.oneTimeBootEnabled"/>
61                <span class="control__indicator"> </span>
62              </label>
63            </div>
64          </div>
65        </div>
66          <!-- TPM Required -->
67          <div class="boot-options one-time-boot-setting">
68            <div class="boot-options">
69              <h3 class="content-label">
70                TPM required policy</h3>
71              <p> Enable to ensure the system only boots when the TPM is functional. </p>
72              <!-- Toggle component -->
73              <div class="toggle-container">
74                  <div class="toggle">
75                    <input
76                      id="toggle__switch-round"
77                      class="toggle-switch toggle-switch__round-flat"
78                      name="toggle"
79                      type="checkbox"
80                      tabindex="0"
81                      ng-model="TPMToggle.TPMEnable"
82                      ng-disabled="dataService.server_unreachable"
83                    />
84                    <label for="toggle__switch-round" tabindex="0"
85                      >TPM required policy is {{ TPMToggle.TPMEnable ? "On" : "Off" }}</label
86                    >
87                  </div>
88                  <span>
89                    {{ TPMToggle.TPMEnable ? "On" : "Off" }}
90                  </span>
91                </div>
92            </div>
93          </div>
94          <!-- form actions -->
95          <div class="boot-form-actions">
96            <button type="submit" class="btn btn-primary" ng-click="saveBootSettings();saveTPMPolicy();hostBootSettings.$setPristine()" ng-disabled="dataService.server_unreachable || hostBootSettings.$pristine;">
97              Save
98            </button>
99            <button type="reset" class="btn btn-secondary" ng-disabled="dataService.server_unreachable || hostBootSettings.$pristine" ng-click="resetForm();hostBootSettings.$setPristine()">
100              Cancel
101            </button>
102          </div>
103        </div>
104      </form>
105    </div>
106  <!-- Power Operations Column -->
107  <div class="large-8 columns operations-wrapper">
108    <h2 class="subhead boot-operations">Operations</h2>
109    <!-- Pending one time boot alert -->
110    <div class="alert-warning"
111      ng-if="boot.oneTimeBootEnabled" ng-hide="dataService.server_state == 'Unreachable'">
112      <div class="pending-icon">
113        <icon file="icon-pending.svg"></icon>
114      </div>
115      <p class="alert-pending">
116        Pending one time boot. Next boot will be performed with the
117        specified one time boot settings. Subsequent boots will be performed
118        with the default settings.
119      </p>
120    </div>
121    <!-- Pending reboot warning -->
122    <p ng-show="operationPending">
123      There are no power operations to display while power operation is in
124      progress. When complete, any new power operations will be displayed
125      here.
126    </p>
127    <div ng-show="!operationPending">
128    <!-- Power on displays only when server is off -->
129    <div class="row column" ng-show="dataService.server_state == 'Off'"
130      ng-class="{disabled: dataService.server_unreachable}">
131      <button id="power__power-on" class="btn btn-primary inline" ng-click="powerOn()" role="button"
132        ng-disabled="dataService.server_unreachable">
133        Power on
134      </button>
135    </div>
136    <!-- Reboot/shutdown column -->
137    <div
138      ng-show="dataService.server_state !== 'Off'">
139      <div class="reboot__operations">
140        <form id="reboot-form" name="rebootForm" class="reboot-form">
141          <fieldset>
142            <legend class="boot-operations">Reboot server</legend>
143              <label class="control-radio">Orderly - OS shuts down, then server reboots
144                <input type="radio" name="radioReboot"
145                  ng-model="defaultRebootSetting" value="warm-reboot" />
146                <span class="control__indicator control__indicator-on"></span>
147              </label>
148              <label class="control-radio">Immediate - Server reboots without OS shutting down; may cause data corruption
149                <input type="radio" name="radioReboot"
150                   ng-model="defaultRebootSetting" value="cold-reboot" />
151                <span class="control__indicator control__indicator-on"></span>
152              </label>
153            </fieldset>
154              <div>
155                <button class="btn btn-primary" ng-click="rebootConfirmModal()" type="submit" ng-disabled="dataService.server_unreachable">
156                  Reboot
157                </button>
158              </div>
159        </form>
160      </div>
161      <!-- Shutdown Field Row -->
162      <div class="shutdown__operations">
163        <form id="shutdown-form" name="shutdownForm" class="shutdown-form">
164          <fieldset>
165            <legend class="boot-operations">Shutdown server</legend>
166            <label class="control-radio">Orderly - OS shuts down, then server shuts down
167              <input type="radio" name="radioShutdown" ng-model="defaultShutdownSetting"
168                value='warm-shutdown' />
169              <span class="control__indicator control__indicator-on"></span>
170            </label>
171            <label class="control-radio">Immediate - Server shuts down without OS shutting down; may cause data corruption
172              <input type="radio" name="radioShutdown" ng-model="defaultShutdownSetting"
173                value='cold-shutdown' />
174              <span class="control__indicator control__indicator-on"></span>
175            </label>
176           </fieldset>
177            <div>
178              <button class="btn btn-primary" ng-click="shutdownConfirmModal()" type="submit" ng-disabled="dataService.server_unreachable">
179                Shut down
180              </button>
181            </div>
182        </form>
183      </div>
184    </div>
185  </div>
186  </div>
187  </div>
188</div>