<div id="dialog_login" style="display:none;">
  <form id="login_form">
    <div>Your session has expired. Log in again, please.</div>
    <div id="login_form_denied" style="color:red; display:none;">
      Bad username or password
    </div>
    <table>
      <tr>
        <td><label for="login_form_username">Username:</label></td>
        <td><input type="text" id="login_form_username" name="username"></td>
      </tr>
      <tr>
        <td><label for="login_form_password">Password:</label></td>
        <td><input type="password" id="login_form_password" name="password"></td>
      </tr>
    </table>
  </form>
</div>

<div id="auth_nodes" style="display:none;">
  <form id="auth_nodes_form">
    Enter password for user 'hacluster' to authenticate nodes.<br>
    <table class="err_msg_table" style="width: 100%">
      <tr><td align="center" style="color: red"><span id="auth_failed_error_msg" style="display:none;">Authentication on some nodes failed.</span></td></tr>
    </table>
    <p class="addr_port" style="max-width: 40em">
      For each node you can specify an address and a port via which pcsd will
      communicate with the node. If an address is not specified the node&apos;s
      name will be used. If a port is not specified 2224 will be used.
    </p>
    <table id="auth_nodes_list">
    </table>
    <div id="same_pass"><label><input type="checkbox" name="all" onchange="if ($(this).is(':checked')) {$('#auth_nodes_form').find('.password').each(function(){$(this).hide()}); $('#pass_for_all').show();} else {$('#auth_nodes_form').find('.password').each(function(){$(this).show()}); $('#pass_for_all').hide();}"> Use same password for all nodes:</label>
      <input type="password" name="pass-all" id="pass_for_all" style="display: none;"></div>
    <div>
      <label>
        <input type="checkbox" name="custom_addr_port"
          onchange="if ($(this).is(':checked')) { $('#auth_nodes_form').find('.addr_port').show(); } else { $('#auth_nodes_form').find('.addr_port').hide(); };"
        >
        Use custom address(es) and port(s)
      </label>
    </div>
  </form>
</div>

<div id="dialog_verify_remove_clusters" style="display: none;">
  <p style="font-size:12px;">Are you sure you want to remove the following cluster(s) from the GUI? (This only removes the cluster from the GUI, it does not stop the cluster from running.)</p>
  <span class="name_list"></span>
</div>

<div id="dialog_verify_destroy_cluster" style="display: none;">
  <p style="font-size:12px;">Are you sure you want to destroy the following cluster?</p>
  <span class="name_list"></span>
  <p style="font-size:14px; color: red;">The cluster will be stopped and all its configuration files will be deleted. This action cannot be undone.</p>
</div>

<div id="dialog_verify_remove_nodes" style="display:none;">
  <p style="font-size:12px;">Are you sure you want to remove the following node(s)?</p>
  <span class="name_list"></span>
  <table class="msg-box" style="width:100%"><tr><td/></tr></table>
</div>

<div id="dialog_verify_remove_resources" style="display: none;">
  <p style="font-size:12px;">Are you sure you want to remove the following resource(s)?</p>
  <span class="name_list"></span>
  <input type="checkbox" name="force">
  Enforce removal (Remove the resources without stopping them first.)
</div>

<div id="dialog_verify_remove_acl_roles" style="display:none;">
  <p style="font-size:12px;">Are you sure you want to remove the following ACL role(s)?</p>
  <span class="name_list"></span>
</div>

<div id="enable_sbd_dialog" style="display:none;">
  <form id="enable_sbd_form">
    <table>
      <tr>
        <td class="darkdatatable_header">
          Specify watchdog devices for nodes:
        </td>
      </tr>
      <tr>
        <td>
          <table id="watchdog_table">
          </table>
        </td>
      </tr>
    </table>
    <table style="margin-top: 20px;">
      <tr>
        <td class="darkdatatable_header">
          SBD options:
        </td>
      </tr>
      <tr>
        <td>
          <table id="sbd_options">
            <tr>
              <td>SBD_DELAY_START</td>
              <td>
                <select name="config[SBD_DELAY_START]">
                  <option value="" selected>(default)</option>
                  <option value="yes">yes</option>
                  <option value="no">no</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>SBD_STARTMODE</td>
              <td>
                <select name="config[SBD_STARTMODE]">
                  <option value="" selected>(default)</option>
                  <option value="clean">clean</option>
                  <option value="always">always</option>
                </select>
              </td>
            </tr>
            <tr>
              <td>SBD_WATCHDOG_TIMEOUT</td>
              <td>
                <input
                    type="text"
                    name="config[SBD_WATCHDOG_TIMEOUT]"
                    placeholder="5"
                />
              </td>
            </tr>
          </table>
        </td>
      </tr>
    </table>
    <table>
      <tr>
        <td>
          <label for="ignore_offline_nodes_enable_sbd">
            ignore offline nodes
          </label>
        </td>
        <td>
          <input
              id="ignore_offline_nodes_enable_sbd"
              type="checkbox"
              name="ignore_offline_nodes"
          />
        </td>
      </tr>
    </table>
  </form>
</div>

<div id="disable_sbd_dialog" style="display:none;">
  <form id="disable_sbd_form">
    Are you sure you want to disable SBD?
    <table>
      <tr>
        <td>
          <label for="ignore_offline_nodes_disable_sbd">
            ignore offline nodes
          </label>
        </td>
        <td>
          <input
              id="ignore_offline_nodes_disable_sbd"
              type="checkbox"
              name="ignore_offline_nodes"
          />
        </td>
      </tr>
    </table>
  </form>
</div>

<div id="sbd_status_dialog" style="display:none;">
  <table>
    <tr>
      <td class="darkdatatable_header">SBD service status</td>
    </tr>
    <tr>
      <td>
        <table class="darkdatatable">
          <tr>
            <th>NODE</th>
            <th>INSTALLED</th>
            <th>ENABLED</th>
            <th>RUNNING</th>
          </tr>
          {{#each node in Pcs.nodesController}}
          <tr>
            <td>{{node.name}}</td>
            <td>{{bool-to-icon node.is_sbd_installed}}</td>
            <td>{{bool-to-icon node.is_sbd_enabled}}</td>
            <td>{{bool-to-icon node.is_sbd_running}}</td>
          </tr>
          {{/each}}
        </table>
      </td>
    </tr>
  </table>
  {{#if Pcs.is_sbd_enabled_or_running}}
  <table style="margin-top: 20px;">
    <tr>
      <td class="darkdatatable_header">SBD configuration</td>
    </tr>
    <tr>
      <td>
        {{{Pcs.sbd_config_table}}}
      </td>
    </tr>
  </table>
  <table style="margin-top: 20px;">
    <tr>
      <td class="darkdatatable_header">SBD watchdogs</td>
    </tr>
    <tr>
      <td>
        <table class="darkdatatable">
          <tr>
            <th>NODE</th>
            <th>WATCHDOG</th>
          </tr>
          {{#each node in Pcs.nodesController}}
          <tr>
            <td>{{node.name}}</td>
            <td>{{node.sbd_watchdog}}</td>
          </tr>
          {{/each}}
        </table>
      </td>
    </tr>
  </table>
  {{/if}}
</div>

<div id="add_group" style="display: none;">
  <form method=POST onkeypress="if (event.keyCode == 13) {$(this).parent().parent().find('.ui-dialog-buttonpane button:eq(1)').trigger('click');return false;} " action="/resource_group_add">
    <table>
      <tr>
        <td>Group Name:</td>
        <td>
          <input name="resource_group" type="text" />
        </td>
      </tr>
      <tr>
        <td style="vertical-align: top;">Change order of resources:</td>
        <td>
          <table id="new_group_resource_list" class="sortable-table">
            <tbody></tbody>
          </table>
        </td>
      </tr>
    </table>
  </form>
</div>
