@Html.Partial("admin/_header.cshtml")

<!-- ============================================================== -->
<!-- pageheader  -->
<!-- ============================================================== -->
<div class="row">
  <div class="col-xl-12 col-lg-12 col-md-12 col-sm-12 col-12">
    <div class="page-header">
      <h2 class="pageheader-title">Relevance feedback dashboard</h2>
    </div>
  </div>
</div>

<h5 class="card-header">Resource state</h5>
<table class="table">
  <thead>
    <tr>
      <th scope="col">Name</th>
      <th scope="col">State</th>
      <th scope="col"></th>
    </tr>
  </thead>
  <tbody>
    @foreach (var rState in ViewBag.Sources.Value.Resources) {
    <tr>
      <td>@rState.Name</td>
      <td>
        @if(((int)rState.State)  == 2) {
        @:<span class="badge-dot badge-primary"></span>
        } else if(((int)rState.State)  == 1) {
        @:<span class="badge-dot badge-brand"></span>
        } else {
        @:<span class="badge-dot badge-danger"></span>
        }
        @rState.State
      </td>
      <td>
        @if(((int)rState.State) == 0) {
        <a href="/@rState.LoadRequest" class="btn btn-primary">Load</a>
        }
      </td>
    </tr>
    }
  </tbody>
</table>

<h5 class="card-header">Engine state</h5>
<table class="table">
  <thead>
    <tr>
      <th scope="col">Name</th>
      <th scope="col">Running</th>
      <th scope="col">Occupancy</th>
      <th scope="col"></th>
    </tr>
  </thead>
  <tbody>
    @foreach (var rState in ViewBag.Sources.Value.Engines) {
    <tr>
      <td>@rState.Name</td>
      <td>
        @if(rState.Running) {
        @:<span class="badge-dot badge-primary"></span>
        } else {
        @:<span class="badge-dot badge-danger"></span>
        }
        @rState.Running
      </td>
      <td>
        @rState.Occupancy
      </td>
      <td>
        <a href="/@rState.StartStopRequest" class="btn btn-primary">
          @if(rState.Running)
          @:Stop
          else
          @:Start
        </a>
      </td>
    </tr>
    }
  </tbody>
</table>

<h5 class="card-header">
  Others
</h5>

<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal">
  Save Processes
</a>
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal2">
  Brute Force Process
</a>
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#exampleModal3">
  Custom process
</a>

<!-- Modal -->
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">Are you sure?</h5>
        <a href="#" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </a>
      </div>
      <div class="modal-body">
        <p>Saving processes while evaluating tasks can lead to data loss. Always save processes when evaluating is done.</p>
      </div>
      <div class="modal-footer">
        <a href="#" class="btn btn-secondary" data-dismiss="modal">Close</a>
        <a href="/SaveProcessCache" class="btn btn-primary">Save changes</a>
      </div>
    </div>
  </div>
</div>

<!-- Modal 2 -->
<div class="modal fade" id="exampleModal2" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel2" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel2">Are you sure?</h5>
        <a href="#" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </a>
      </div>
      <div class="modal-body">
        <p>Do you really want to start brute force process?</p>
        <p>Number of targets:</p>
      </div>

      <form method="post" action="/StartBruteForce">
        <input name="numOfTests" id="numOfTests" type="number" class="form-control" />
        <div class="modal-footer">
          <a href="#" class="btn btn-secondary" data-dismiss="modal">No</a>
          <button type="submit" class="btn btn-primary">
            Yes
          </button>
        </div>
      </form>
    </div>
  </div>
</div>

<!-- Modal 3 -->
<div class="modal fade" id="exampleModal3" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel3" aria-hidden="true">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel3">Are you sure?</h5>
        <a href="#" class="close" data-dismiss="modal" aria-label="Close">
          <span aria-hidden="true">&times;</span>
        </a>
      </div>
      <div class="modal-body">
        <p>Do you really want to start custom process?</p>
        <p>Path to json blueprint:</p>
      </div>

      <form method="post" action="/StartCustom">
        <input name="processJson" id="processJson" type="text" class="form-control" />
        <div class="modal-footer">
          <a href="#" class="btn btn-secondary" data-dismiss="modal">Close</a>
          <button type="submit" class="btn btn-primary">
            Start
          </button>
        </div>
      </form>
    </div>
  </div>
</div>

  @Html.Partial("admin/_footer.cshtml")
