Add initial Bootstrap style

Signed-off-by: Graham <gpe@openrs2.org>
pull/132/head
Graham 3 years ago
parent 81e2dedee5
commit 554520b285
  1. 2
      archive/build.gradle.kts
  2. 3
      archive/src/main/kotlin/org/openrs2/archive/web/WebServer.kt
  3. 66
      archive/src/main/resources/org/openrs2/archive/templates/caches/index.html
  4. 1
      buildSrc/src/main/kotlin/Versions.kt

@ -24,11 +24,13 @@ dependencies {
implementation("io.ktor:ktor-jackson:${Versions.ktor}") implementation("io.ktor:ktor-jackson:${Versions.ktor}")
implementation("io.ktor:ktor-server-netty:${Versions.ktor}") implementation("io.ktor:ktor-server-netty:${Versions.ktor}")
implementation("io.ktor:ktor-thymeleaf:${Versions.ktor}") implementation("io.ktor:ktor-thymeleaf:${Versions.ktor}")
implementation("io.ktor:ktor-webjars:${Versions.ktor}")
implementation("org.flywaydb:flyway-core:${Versions.flyway}") implementation("org.flywaydb:flyway-core:${Versions.flyway}")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}") implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:${Versions.kotlinCoroutines}")
implementation("org.postgresql:postgresql:${Versions.postgres}") implementation("org.postgresql:postgresql:${Versions.postgres}")
implementation("org.thymeleaf:thymeleaf:${Versions.thymeleaf}") implementation("org.thymeleaf:thymeleaf:${Versions.thymeleaf}")
implementation("org.thymeleaf.extras:thymeleaf-extras-java8time:${Versions.thymeleafJava8Time}") implementation("org.thymeleaf.extras:thymeleaf-extras-java8time:${Versions.thymeleafJava8Time}")
implementation("org.webjars:bootstrap:${Versions.bootstrap}")
} }
publishing { publishing {

@ -11,6 +11,7 @@ import io.ktor.routing.routing
import io.ktor.server.engine.embeddedServer import io.ktor.server.engine.embeddedServer
import io.ktor.server.netty.Netty import io.ktor.server.netty.Netty
import io.ktor.thymeleaf.Thymeleaf import io.ktor.thymeleaf.Thymeleaf
import io.ktor.webjars.Webjars
import org.openrs2.json.Json import org.openrs2.json.Json
import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect import org.thymeleaf.extras.java8time.dialect.Java8TimeDialect
import org.thymeleaf.templatemode.TemplateMode import org.thymeleaf.templatemode.TemplateMode
@ -38,6 +39,8 @@ public class WebServer @Inject constructor(
}) })
} }
install(Webjars)
routing { routing {
get("/caches") { cachesController.index(call) } get("/caches") { cachesController.index(call) }
get("/caches/{id}.zip") { cachesController.export(call) } get("/caches/{id}.zip") { cachesController.export(call) }

@ -1,35 +1,41 @@
<!DOCTYPE html> <!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org" lang="en"> <html xmlns:th="http://www.thymeleaf.org" lang="en">
<head>
<title>OpenRS2 Archive</title>
<link rel="stylesheet" href="/webjars/bootstrap/css/bootstrap.min.css" />
</head>
<body> <body>
<table> <main class="container">
<thead> <table class="table table-striped table-bordered table-hover">
<tr> <thead class="thead-dark">
<th>Game</th> <tr>
<th>Build</th> <th>Game</th>
<th>Timestamp</th> <th>Build</th>
<th>Name</th> <th>Timestamp</th>
<th>Indexes</th> <th>Name</th>
<th>Groups</th> <th>Indexes</th>
<th>Keys</th> <th>Groups</th>
<th>Download</th> <th>Keys</th>
</tr> <th>Download</th>
</thead> </tr>
<tbody> </thead>
<!--/*@thymesVar id="caches" type="java.util.List<org.openrs2.archive.cache.CacheExporter.Cache>"*/--> <tbody>
<tr th:each="cache : ${caches}"> <!--/*@thymesVar id="caches" type="java.util.List<org.openrs2.archive.cache.CacheExporter.Cache>"*/-->
<td th:text="${cache.game}">runescape</td> <tr th:each="cache : ${caches}">
<td th:text="${cache.build}">550</td> <td th:text="${cache.game}">runescape</td>
<td th:text="${#temporals.formatISO(cache.timestamp)}"></td> <td th:text="${cache.build}">550</td>
<td th:text="${cache.name}"></td> <td th:text="${#temporals.formatISO(cache.timestamp)}"></td>
<td th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'">Calculating...</td> <td th:text="${cache.name}"></td>
<td th:text="${cache.groupStats}? ${cache.groupStats.validGroups} + ' / ' + ${cache.groupStats.groups} : 'Calculating...'">Calculating...</td> <td th:text="${cache.archiveStats}? ${cache.archiveStats.validIndexes} + ' / ' + ${cache.archiveStats.indexes} : 'Calculating...'">Calculating...</td>
<td th:text="${cache.groupStats}? ${cache.groupStats.validKeys} + ' / ' + ${cache.groupStats.keys} : 'Calculating...'">Calculating...</td> <td th:text="${cache.groupStats}? ${cache.groupStats.validGroups} + ' / ' + ${cache.groupStats.groups} : 'Calculating...'">Calculating...</td>
<td> <td th:text="${cache.groupStats}? ${cache.groupStats.validKeys} + ' / ' + ${cache.groupStats.keys} : 'Calculating...'">Calculating...</td>
<a th:href="${'/caches/' + cache.id + '.zip'}">Cache</a> <td>
<a th:href="${'/caches/' + cache.id + '.json'}">Keys</a> <a th:href="${'/caches/' + cache.id + '.zip'}" class="btn btn-primary btn-sm">Cache</a>
</td> <a th:href="${'/caches/' + cache.id + '.json'}" class="btn btn-primary btn-sm">Keys</a>
</tr> </td>
</tbody> </tr>
</table> </tbody>
</table>
</main>
</body> </body>
</html> </html>

@ -1,5 +1,6 @@
object Versions { object Versions {
const val asm = "9.1" const val asm = "9.1"
const val bootstrap = "4.6.0"
const val bouncyCastlePkix = "1.68" const val bouncyCastlePkix = "1.68"
const val bouncyCastleProvider = "1.68" const val bouncyCastleProvider = "1.68"
const val clikt = "3.1.0" const val clikt = "3.1.0"

Loading…
Cancel
Save