menu.jsp 5.35 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<html lang="en">
<head>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css" integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh" crossorigin="anonymous">

  <link href="webjars/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet">
  <title>Administrator menu</title>

  <link href="<c:url value="/css/toggleSwitch.css" />" rel="stylesheet">
</head>
<body>

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="https://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>

<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />

<div class="jumbotron">
  <h1>Administrator Menu</h1>
  <a href="/curex/add" style="float:left; padding-top:2%">Create New Credentials</a>
  <a href="/curex/logout" style="float: left; padding-top:2%; padding-left:7%">Logout</a>
  <a href="/curex/vdm" style="float: left; padding-top:2%; padding-right:12%">VDM Endpoint</a>
  <a href="/curex/report" style="float:right; padding-top:2%">PDF Reports</a>
  <a href="/curex/events" style="float: right; padding-top:2%; padding-right:7%">Event Service</a>
  <a href="/curex/visualization" style="float: right; padding-top:2%; padding-right:7%">Visualizations</a>
</div>
<div class="container">
  <div class="row">

 <c:set var="count" value="0" scope="page" />

<c:forEach items="${allCredentials}" var="item">
    <c:set var="count" value="0" scope="page" />

    <c:forEach items="${allScanConfigs}" var="scan">
    <c:if test="${scan.nodeId == item.name && count == 0}">

    <c:set var="count" value="${count + 1}" scope="page"/>

    <div id="dialog_${item.token}" title="Scan Configuration for Node ${item.name}" >
    <table border="1" style="display:''" id="${item.token}_scantable_${scan.vlanName}">
      <thead>

          <%-- <th>Node ID</th> --%>
          <th style="text-align: center;">Vlan Name</th>
          <th style="text-align: center;">IP to scan</th>
          <th style="text-align: center;">Mask</th>
          <th style="text-align: center;">Delay</th>

      </thead>
      <tbody>

        <c:forEach items="${allScanConfigs}" var="scan">
            <c:if test="${scan.nodeId == item.name}">

                <tr>
                   <%-- <td>${scan.nodeId}</td> --%>
                   <td>${scan.vlanName}</td>
                   <td>${scan.ipToScan}</td>
                   <td>${scan.mask}</td>
                   <td>${scan.delay}</td>
                </tr>

            </c:if>
        </c:forEach>

      </tbody>
    </table>
    </div>

    </c:if>

    </c:forEach>

</c:forEach>


        <table border="1">
           <thead>

               <th style="text-align: center;">Node ID</th>
               <th style="text-align: center;">Type</th>
               <th style="text-align: center;">Description</th>
               <th style="text-align: center;">Token</th>
               <th style="text-align: center;">Email</th>
               <th style="text-align: center;">Available Endpoints</th>
               <th style="text-align: center;">Options</th>

           </thead>

           <tbody>

       <c:forEach items="${allCredentials}" var="item">
            <c:if test="${item.type != 'SYS_ADMIN'}">

                 <tr>
                   <td>${item.name}</td>
                   <td>${item.type}</td>
                   <td>${item.description}</td>
                   <td>${item.token}</td>
                   <td>${item.email}</td>
                   <td>${item.availableEndpoint}</td>

                   <td>
                    <button type="submit" id="button_${item.token}" name="button" value="${item.token}_show">Show Scan Configuration</button>

                    <p style="vertical-align:bottom; margin-top:0" align="center">
                        <%-- <button type="submit" name="button" value="${item.token}_edit">Edit Credentials</button> --%>
                        <a href="<c:url value='/curex/add/${item.token}' />" >Edit Credentials</a>
                    </p>

                    <p style="vertical-align:bottom; margin-top:0" align="center">
                        <a href="<c:url value='/curex/admin/${item.token}' />" >Remove row</a>
                    </p>

                   </td>

                 </tr>

            </c:if>
       </c:forEach>

    </tbody>
  </table>

  <div class="container" style="margin-top:5%">

      <p style="float:left">TPM Status</p>

      <label class="switch" style="margin-left:10px">
        <input type="checkbox">
          <div class="slider"></div>
      <label>

  </div>


<%-- Script for toggling the correspondent dialog boxes for each node´s scan configuration. --%>
<script>
$(function() {

    var elems = document.querySelectorAll("[id^='button_']")

    elems.forEach(function(element) {

        var str = element.id;
        var res = str.split("_");
        var result = res[1];

        $('#dialog_'+result).dialog({
             autoOpen: false,
             modal: true
           });

        $('#'+element.id).on("click", function(e) {
            e.preventDefault();
            $('#dialog_'+result).dialog("open");
        });
    });

});
</script>

<script src="webjars/bootstrap/4.1.3/js/bootstrap.min.js"></script>

</body>
</html>