Skip to content

Commit

Permalink
Merge pull request #450 from OWASP/datatable
Browse files Browse the repository at this point in the history
Datatable implementation (#415)
  • Loading branch information
commjoen committed Nov 24, 2022
2 parents 0554583 + 14b7681 commit b6c28ce
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 11 deletions.
24 changes: 18 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@
<name>The Open Web Application Security Project (OWASP)</name>
<url>https://owasp.org/</url>
</organization>
<!-- <distributionManagement>-->
<!-- <snapshotRepository>-->
<!-- <id>ossrh</id>-->
<!-- <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>-->
<!-- </snapshotRepository>-->
<!-- </distributionManagement>-->
<!-- <distributionManagement>-->
<!-- <snapshotRepository>-->
<!-- <id>ossrh</id>-->
<!-- <url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>-->
<!-- </snapshotRepository>-->
<!-- </distributionManagement>-->

<properties>
<java.version>19</java.version>
Expand All @@ -49,6 +49,8 @@
<bootstrap.version>5.2.2</bootstrap.version>
<github.button.version>2.14.1</github.button.version>
<gcp.sdk.version>3.4.0</gcp.sdk.version>
<datatables.version>1.12.1</datatables.version>
<jquery.version>3.6.1</jquery.version>
<thymeleaf-spring5.version>3.0.15.RELEASE</thymeleaf-spring5.version>
<thymeleaf.version>3.0.15.RELEASE</thymeleaf.version>
<thymeleaf.layout>3.1.0</thymeleaf.layout>
Expand Down Expand Up @@ -156,6 +158,16 @@
<artifactId>github-buttons</artifactId>
<version>${github.button.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>datatables</artifactId>
<version>${datatables.version}</version>
</dependency>
<dependency>
<groupId>org.webjars</groupId>
<artifactId>jquery</artifactId>
<version>${jquery.version}</version>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-devtools</artifactId>-->
Expand Down
10 changes: 10 additions & 0 deletions src/main/resources/static/css/dark.css
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,13 @@
background-color: var(--bs-indigo);
border-color: var(--bs-indigo);
}

.dark-mode input {
background-color: var(--bs-gray-600);
color: var(--bs-body-color);
}

.dark-mode select {
background-color: var(--bs-gray-600);
color: var(--bs-body-color);
}
19 changes: 19 additions & 0 deletions src/main/resources/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@
<title>OWASP WrongSecrets</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link th:rel="stylesheet" th:href="@{/webjars/bootstrap/5.2.2/css/bootstrap.min.css} " />
<link th:rel="stylesheet" th:href="@{/webjars/datatables/1.12.1/css/dataTables.bootstrap5.min.css} " />
<link rel="stylesheet" type="text/css" th:href="@{/css/style.css}" />
<link rel="stylesheet" type="text/css" th:href="@{/css/dark.css}" />

</head>

<body>
Expand All @@ -18,6 +20,9 @@

<script th:src="@{/webjars/bootstrap/5.2.2/js/bootstrap.bundle.min.js}"></script>
<script th:src="@{/webjars/github-buttons/2.14.1/dist/buttons.js}"></script>
<script th:src="@{/webjars/jquery/3.6.1/jquery.js}"></script>
<script th:src="@{/webjars/datatables/1.12.1/js/jquery.dataTables.min.js}"></script>
<script th:src="@{/webjars/datatables/1.12.1/js/dataTables.bootstrap5.min.js}"></script>
<script th:if="${allCompleted} eq 'party'">
window.addEventListener("load", function () {
new bootstrap.Modal(document.getElementById('finishedModal'), {}).toggle()
Expand All @@ -37,4 +42,18 @@
</script>
</body>

<script>

$.extend(true, $.fn.dataTable.defaults, {
searching: true,
ordering: true,
});
$(document).ready(function () {
$('#challenge_overview').DataTable({
lengthMenu: [ [20, 30, 50, -1], [20, 30, 50, "All"] ]
});
});
</script>


</html>
11 changes: 6 additions & 5 deletions src/main/resources/templates/welcome.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<div class="container-fluid text-sm p-2 p-lg-3">
<div class="row">
<div class="col-12 col-lg-7">
<table class="table table-responsive">
<table class="table table-responsive" id="challenge_overview">
<thead>
<tr>
<th scope="col" class="d-none d-xl-table-cell">#</th>
Expand All @@ -38,24 +38,25 @@
th:text="${challenge.name}"
th:remove="tag"></span></a></td>
<td th:text="${challenge.tech}"></td>
<td td:if="${{challenge.requiredEnv == 'USEDFORDEDUPLICATIONDONOTREMOVE'}}" class="d-sm-none"></td>
<td class="d-none d-md-table-cell">
<th:span th:each="i: ${#numbers.sequence(1, challenge.difficulty)}"><span></span></th:span>
<th:span th:if="${challenge.difficulty<5}"
th:each="i: ${#numbers.sequence(challenge.difficulty+1, 5)}"><span></span>
</th:span>
</td>
<th:block th:if="${challenge.requiredEnv} == 'DOCKER'">
<td>Docker</td>
<td class="d-none d-sm-table-cell" >Docker</td>
</th:block>
<th:block th:if="${challenge.requiredEnv} == 'K8S'">
<td>K8s or Minikube</td>
<td class="d-none d-sm-table-cell" >K8s or Minikube</td>
</th:block>
<th:block th:if="${challenge.requiredEnv} == 'VAULT'">
<td>K8s or Minikube with Vault</td>
<td class="d-none d-sm-table-cell" >K8s or Minikube with Vault</td>
</th:block>
<th:block
th:if="${challenge.requiredEnv} == 'AWS' or ${challenge.requiredEnv} == 'GCP' or ${challenge.requiredEnv} == 'AZURE'">
<td>AWS, GCP, Azure</td>
<td class="d-none d-sm-table-cell" >AWS, GCP, Azure</td>
</th:block>

</tr>
Expand Down

0 comments on commit b6c28ce

Please sign in to comment.