handle parallel webui

This commit is contained in:
Gauthier Roebroeck 2025-10-17 09:51:43 +08:00
parent 573eb58d72
commit 38d21643c4
4 changed files with 20 additions and 1 deletions

View file

@ -219,9 +219,18 @@ tasks {
}
}
register<Copy>("copyWebDistNext") {
group = "web"
from("$nextui/dist/")
into("$projectDir/src/main/resources/public/")
excludes.add("index.html") //will be copied by 'prepareThymeLeafNext'
mustRunAfter(getByName("copyWebDist"))
}
// modifies index.html to inject ThymeLeaf th: tags
register<Copy>("prepareThymeLeafNext") {
group = "web"
dependsOn("copyWebDistNext")
from("$nextui/dist/index.html")
into("$projectDir/src/main/resources/public/")
filter { line ->
@ -229,13 +238,14 @@ tasks {
it.groups[0]?.value + " th:" + it.groups[1]?.value + "@{" + it.groups[2]?.value?.prefixIfNot("/") + "}" + it.groups[3]?.value
}
}
rename("index.html", "index-next.html")
}
withType<ProcessResources> {
filesMatching("application*.yml") {
expand(project.properties)
}
mustRunAfter(getByName("prepareThymeLeaf"))
mustRunAfter(getByName("prepareThymeLeaf"), getByName("prepareThymeLeafNext"))
}
register<Test>("benchmark") {

View file

@ -27,6 +27,7 @@ class WebMvcConfiguration : WebMvcConfigurer {
registry
.addResourceHandler(
"/index.html",
"/index-next.html",
"/favicon.ico",
"/favicon-16x16.png",
"/favicon-32x32.png",

View file

@ -16,4 +16,10 @@ class IndexController(
model.addAttribute("baseUrl", baseUrl)
return "index"
}
@GetMapping("/next")
fun indexNext(model: Model): String {
model.addAttribute("baseUrl", baseUrl)
return "index-next"
}
}

View file

@ -12,6 +12,8 @@
import { useCurrentUser } from '@/colada/users'
import { useClaimStatus } from '@/colada/claim'
definePage({ alias: '/next' })
async function checkAuthenticated() {
const router = useRouter()
const route = useRoute()