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