<!doctype html>
<html lang="en">
  <head>
    <title>Experiments records</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="css/bootstrap.min.css">
    <script src="js/d3.min.js"></script>
  </head>
  <body>
    <div class='container-fluid'>
        <div class="row">
            <main role='main' class="col-sm-9 col-md-10 pt-3">
                <h1>Experiments</h1>
                <div class="row justify-content-between">
                    <div class="col-1">
                        <button class="btn btn-secondary dropdown-toggle" type="button" id="statusMenuButton" data-bs-toggle="dropdown" aria-expanded="false">
                            <span id='status-show'>Status</span>
                        </button>
                        <ul class="dropdown-menu" id="dropdown-status" aria-labelledby="dropdownMenuButton">
                            <li><a class='dropdown-item'>All</a></li>
                            <li><a class="dropdown-item">Completed</a></li>
                            <li><a class="dropdown-item">Failed</a></li>
                            <li><a class="dropdown-item">Aborted</a></li>
                        </ul>
                    </div>
                        <div class="col-4">
                            <input type="text" id="comment-search" class="form-control" placeholder="Search Comments" aria-label="Search Comments">
                        </div>

                    <!--
                    <button class="btn btn-secondary dropdown-toggle" type="button" id="list-button" data-bs-toggle="dropdown" aria-expanded="false">
                        <span id='list-show'>List</span>
                    </button>
                    <ul class="dropdown-menu" id="dropdown-list" aria-labelledby="dropdownMenuButton">
                    </ul>

                        <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#list-modal">
                          Create new list
                        </button>
                        
                        <div class="modal fade" id="list-modal" tabindex="-1" aria-labelledby="exampleModalLabel" aria-hidden="true">
                          <div class="modal-dialog">
                            <div class="modal-content">
                              <div class="modal-header">
                                <h5 class="modal-title" id="exampleModalLabel">Create a new list</h5>
                                <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
                              </div>
                              <div class="modal-body">
                                  <input type="text" id="list-name" class="form-control" placeholder="list name" aria-label="list name" aria-describedby="basic-addon1">
                              </div>
                              <div class="modal-footer">
                                <button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
                                <button type="button" id='create-button' class="btn btn-primary">Create</button>
                              </div>
                            </div>
                          </div>
                        </div>
                        -->

                </div>
                <div class="table-responsive">
                    <table class="table table-striped table-hover" id='result-table'>
                      <thead class="thead-dark">
                        <tr>
                          <th>#</th>
                          <th>Start time</th>
                          <th>Stop time</th>
                          <th>Time lapse</th>
                          <th>CPU time</th>
                          <th>Status</th>
                          <th>Comments</th>
                          <th>Result</th>
                        </tr>
                      </thead>
                      <tbody>
                            % for row in records:
                                ${makerow(row)}
                            % endfor
                       </tbody>
                    </table>
                    <%def name='makerow(row)'>
                            % if row[5] == 'Failed':
                            <tr class='table-danger'>
                            % elif row[5] == 'Aborted':
                            <tr class='table-warning'>
                            % else:
                            <tr class='table-success'>
                            %endif
                            % for i,value in enumerate(row):
                                % if i == 0:
                                    <td><a href='${value}/index.html'>${value}</a></td>
                                % elif i == 5:
                                    <td class='status'>${value}</td>\
                                % elif i == 6:
                                    <td class='comments'>${value}</td>\
                                % else:
                                    <td>${value}</td>\
                                % endif
                            % endfor
                        </tr>
                    </%def>
                </div>
            </main>
        </div>
    </div>

    <!-- Optional JavaScript -->
    <!-- jQuery first, then Popper.js, then Bootstrap JS -->
    <script src="js/jquery-3.5.1.min.js" ></script>
    <!-- <script src="js/popper.min.js"></script> -->
    <script src="js/bootstrap.bundle.min.js"></script>
    <script src="js/index_script.js"></script>
  </body>
</html>
