<div class="well section">
  <div class="row">
    <div class="col-sm-6">
      <h4>Listeners ({{unremovedListeners.length}})</h4>
    </div>
  </div>

  <table class="grid fixed" style="margin-bottom: 0;">
    <thead>
      <tr>
        <th width="120">State</th>
        <th>Source</th>
        <th width="30"></th>
        <th>Target</th>
        <th class="text-right">Algorithm</th>
      </tr>
    </thead>
    <tbody>
      {{#each unremovedListeners as |listener|}}
        <tr>
          <td>
            <span class="badge state {{listener.stateBackground}}">
              {{listener.displayState}}
            </span>
          </td>
          <td>
            {{listener.sourcePort}}/{{listener.sourceProtocol}}
          </td>
          <td>
            <i class="icon icon-arrow-right"></i>
          </td>
          <td>
            {{listener.targetPort}}{{#if listener.targetProtocol}}/{{listener.targetProtocol}}{{/if}}
          </td>
          <td class="text-right">
            Round Robin
          </td>
        </tr>
      {{else}}
        <tr><td colspan="5" class="text-center text-muted">This balancer config has no listeners.</td></tr>
      {{/each}}
    </tbody>
  </table>
</div>

<div class="well section">
  <h4 style="margin-bottom: 20px;">Health Check</h4>

  <div class="row form-group">
    <div class="col-sm-12 col-md-3">
      <label>URL</label>
    </div>
    <div class="col-sm-12 col-md-9">
      <span class="form-control-static">
        {{#if config.healthCheck.requestLine}}
          {{config.healthCheck.requestLine}}
        {{else}}
          <i>None</i>
        {{/if}}
      </span>
    </div>
  </div>

  <div class="row form-group">
    <div class="col-sm-12 col-md-3">
      <label>Check Interval</label>
    </div>
    <div class="col-sm-12 col-md-3">
      <span class="form-control-static">{{config.healthCheck.interval}}ms</span>
    </div>

    <div class="col-sm-12 col-md-3">
      <label>Timeout</label>
    </div>
    <div class="col-sm-12 col-md-3">
      <span class="form-control-static">{{config.healthCheck.responseTimeout}}ms</span>
    </div>
  </div>

  <div class="row form-group">
    <div class="col-sm-12 col-md-3">
      <label>Healthy Threshold</label>
    </div>
    <div class="col-sm-12 col-md-3">
      <span class="form-control-static">{{config.healthCheck.healthyThreshold}}</span>
    </div>
    <div class="col-sm-12 col-md-3">
      <label>Unhealthy Threshold</label>
    </div>
    <div class="col-sm-12 col-md-3">
      <span class="form-control-static">{{config.healthCheck.unhealthyThreshold}}</span>
    </div>
  </div>
</div>

<div class="well section">
  <h4 style="margin-bottom: 20px;">Stickiness</h4>

  {{#if config.appCookieStickinessPolicy}}
    <div class="row form-group">
      <div class="col-sm-12 col-md-3">
        <label>Cookie Name</label>
      </div>
      <div class="col-sm-12 col-md-9">
        <span class="form-control-static">{{config.appCookieStickinessPolicy.cookie}}</span>
      </div>
    </div>
    <div class="row form-group">
      <div class="col-sm-12 col-md-3">
        <label>Prefix</label>
      </div>
      <div class="col-sm-12 col-md-9">
        <span class="form-control-static">{{config.appCookieStickinessPolicy.prefix}}</span>
      </div>
    </div>
    <div class="row form-group">
      <div class="col-sm-12 col-md-3">
        <label>Maximum Length</label>
      </div>
      <div class="col-sm-12 col-md-9">
        <span class="form-control-static">{{config.appCookieStickinessPolicy.maxLength}}</span>
      </div>
    </div>
    <div class="row form-group">
      <div class="col-sm-12 col-md-3">
        <label>Timeout</label>
      </div>
      <div class="col-sm-12 col-md-9">
        <span class="form-control-static">{{config.appCookieStickinessPolicy.timeout}}ms</span>
      </div>
    </div>
    <div class="row form-group">
      <div class="col-sm-12 col-md-3">
        <label>Mode/Options</label>
      </div>
      <div class="col-sm-12 col-md-9">
        <span class="form-control-static">
          {{config.appCookieStickinessPolicy.mode}}
          {{#if config.appCookieStickinessPolicy.requestLearn}}, learn from request{{/if}}
        </span>
      </div>
    </div>
  {{else}}
    {{#if config.lbCookieStickinessPolicy}}
      <div class="row form-group">
        <div class="col-sm-12 col-md-3">
          <label>Cookie Name</label>
        </div>
        <div class="col-sm-12 col-md-9">
          <span class="form-control-static">{{config.lbCookieStickinessPolicy.cookie}}</span>
        </div>
      </div>
      <div class="row form-group">
        <div class="col-sm-12 col-md-3">
          <label>Cookie Domain</label>
        </div>
        <div class="col-sm-12 col-md-9">
          <span class="form-control-static">{{config.lbCookieStickinessPolicy.domain}}</span>
        </div>
      </div>
      <div class="row form-group">
        <div class="col-sm-12 col-md-3">
          <label>Mode/Options</label>
        </div>
        <div class="col-sm-12 col-md-9">
          <span class="form-control-static">
            {{config.lbCookieStickinessPolicy.mode}}
            {{#if config.lbCookieStickinessPolicy.indirect}}, indirect{{/if}}
            {{#if config.lbCookieStickinessPolicy.nocache}}, no-cache{{/if}}
            {{#if config.lbCookieStickinessPolicy.postonly}}, POST only{{/if}}
          </span>
        </div>
      </div>
    {{else}}
      <span class="text-muted">Stickiness is not configured.</span>
    {{/if}}
  {{/if}}
</div>
