Add categories
This commit is contained in:
parent
cf46ec26c4
commit
7f2256bcbb
10
config.toml
10
config.toml
@ -22,11 +22,13 @@ display = "Kotlin Version"
|
||||
groupId = "org.http4k"
|
||||
artifactId = "http4k-core"
|
||||
version = "3.260.0"
|
||||
category = "server"
|
||||
|
||||
[dependencies.javalin]
|
||||
groupId = "io.javalin"
|
||||
artifactId = "javalin"
|
||||
version = "3.10.1"
|
||||
category = "server"
|
||||
|
||||
[dependencies.pebble]
|
||||
groupId = "io.pebbletemplates"
|
||||
@ -43,28 +45,34 @@ default = true
|
||||
groupId = "org.mariadb.jdbc"
|
||||
artifactId = "mariadb-java-client"
|
||||
version = "2.6.2"
|
||||
category = "database"
|
||||
|
||||
[dependencies.h2]
|
||||
groupId = "com.h2database"
|
||||
artifactId = "h2"
|
||||
version = "1.4.200"
|
||||
category = "database"
|
||||
|
||||
[dependencies.flyway]
|
||||
groupId = "org.flywaydb"
|
||||
artifactId = "flyway-core"
|
||||
version = "6.5.4"
|
||||
category = "database"
|
||||
|
||||
[dependencies.HikariCP]
|
||||
groupId = "com.zaxxer"
|
||||
artifactId = "HikariCP"
|
||||
version = "3.4.5"
|
||||
category = "database"
|
||||
|
||||
[dependencies.Ktorm]
|
||||
groupId = "me.liuwj.ktorm"
|
||||
artifactId = "ktorm-core"
|
||||
version = "3.0.0"
|
||||
category = "database"
|
||||
|
||||
[dependencies.Ktorm-Mysql]
|
||||
groupId = "me.liuwj.ktorm"
|
||||
artifactId = "ktorm-support-mysql"
|
||||
version = "3.0.0"
|
||||
version = "3.0.0"
|
||||
category = "database"
|
||||
3
src/css/src/category.pcss
Normal file
3
src/css/src/category.pcss
Normal file
@ -0,0 +1,3 @@
|
||||
.category{
|
||||
@apply text-lg inline-block text-center font-semibold text-gray-800 bg-green-300 rounded-full px-3 py-1 my-2;
|
||||
}
|
||||
@ -5,6 +5,7 @@
|
||||
@import "tailwindcss/components";
|
||||
|
||||
@import "button.pcss";
|
||||
@import "category.pcss";
|
||||
@import "inputs.pcss";
|
||||
|
||||
/*noinspection CssUnknownTarget*/
|
||||
|
||||
@ -12,7 +12,14 @@ class Config {
|
||||
val dependenciesNode: NightConfig = cfg["dependencies"]
|
||||
@Suppress("UNCHECKED_CAST") val dependenciesMap = dependenciesNode.valueMap() as Map<String, NightConfig>
|
||||
val dependencies = dependenciesMap.map { (name, values) ->
|
||||
Dependency(name, values["groupId"], values["artifactId"], values["version"], values.getOrElse("default", false))
|
||||
Dependency(
|
||||
name,
|
||||
values["groupId"],
|
||||
values["artifactId"],
|
||||
values["version"],
|
||||
values.getOrElse("default", false),
|
||||
values.getEnumOrElse("category", Category.Other)
|
||||
)
|
||||
}
|
||||
|
||||
val inputsNode: NightConfig = cfg["inputs"]
|
||||
|
||||
@ -1,4 +1,15 @@
|
||||
package starter
|
||||
|
||||
data class Dependency(val name: String, val groupId: String, val artifactId: String, val version: String, val default: Boolean)
|
||||
enum class Category {
|
||||
Server, Database, Other
|
||||
}
|
||||
|
||||
data class Dependency(
|
||||
val name: String,
|
||||
val groupId: String,
|
||||
val artifactId: String,
|
||||
val version: String,
|
||||
val default: Boolean,
|
||||
val category: Category,
|
||||
)
|
||||
data class Input(val name: String, val display: String, val value: String? = null)
|
||||
@ -14,11 +14,15 @@ private fun PebbleEngine.render(name: String, args: Map<String, Any?> = mapOf())
|
||||
class Views(private val engine: PebbleEngine) {
|
||||
private val logger = LoggerFactory.getLogger(javaClass)
|
||||
|
||||
fun index(dependencies: List<Dependency>, inputs: List<Input>) = engine.render("views/index",
|
||||
mapOf("dependencies" to dependencies, "inputs" to inputs)
|
||||
)
|
||||
fun index(dependencies: List<Dependency>, inputs: List<Input>): String {
|
||||
val dependenciesByCategory = dependencies.groupBy { it.category }.toSortedMap()
|
||||
return engine.render("views/index",
|
||||
mapOf("dependencies" to dependenciesByCategory, "inputs" to inputs)
|
||||
)
|
||||
}
|
||||
|
||||
fun pom(dependencies: List<Dependency>, inputs: List<Input>): String {
|
||||
|
||||
val args: MutableMap<String, Any?> = mutableMapOf(
|
||||
"dependencies" to dependencies,
|
||||
)
|
||||
@ -27,8 +31,6 @@ class Views(private val engine: PebbleEngine) {
|
||||
args[it.name] = it.value
|
||||
}
|
||||
|
||||
logger.debug(args.toString())
|
||||
|
||||
return engine.render("starter/pom",
|
||||
args
|
||||
)
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,10 +8,17 @@
|
||||
{% for input in inputs %}
|
||||
{{ input(input) }}
|
||||
{% endfor %}
|
||||
<hr>
|
||||
<div class="flex flex-wrap">
|
||||
{% for dependency in dependencies %}
|
||||
{{ dependency(dependency) }}
|
||||
|
||||
<div class="mt-4">
|
||||
{% for category in dependencies %}
|
||||
<section>
|
||||
<h2 class="category">{{ category.key }}</h2>
|
||||
<ul>
|
||||
{% for dependency in category.value %}
|
||||
<li>{{ dependency(dependency) }}</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</section>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<button type="submit" class="w-full btn btn-purple">Submit</button>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user