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