Skip to content

Commit

Permalink
working breadcrumbs, create, clone
Browse files Browse the repository at this point in the history
  • Loading branch information
adrw committed Jan 22, 2025
1 parent 6e4769c commit c3faec7
Show file tree
Hide file tree
Showing 19 changed files with 531 additions and 643 deletions.
8 changes: 8 additions & 0 deletions service/src/main/kotlin/app/cash/backfila/ui/DashboardUrls.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package app.cash.backfila.ui

object DashboardUrls {
fun app(appName: String) = "/app/$appName"
fun createDeploy(appName: String) = "/app/$appName/deploy"
fun deploy(appName: String, deployName: String) = "/app/$appName/deploy/$deployName"
fun setMinimalCommitTimestamp(appName: String) = "/app/$appName/set-minimal-commit-timestamp"
}
69 changes: 0 additions & 69 deletions service/src/main/kotlin/app/cash/backfila/ui/PathBuilder.kt

This file was deleted.

4 changes: 2 additions & 2 deletions service/src/main/kotlin/app/cash/backfila/ui/UiModule.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package app.cash.backfila.ui

import app.cash.backfila.ui.actions.BackfillCreateHandlerAction
import app.cash.backfila.ui.actions.BackfillShowButtonHandlerAction
import app.cash.backfila.ui.actions.ServiceAutocompleteAction
import app.cash.backfila.ui.pages.BackfillCreateAction
import app.cash.backfila.ui.pages.BackfillCreateIndexAction
import app.cash.backfila.ui.pages.BackfillCreateServiceIndexAction
import app.cash.backfila.ui.pages.BackfillIndexAction
import app.cash.backfila.ui.pages.BackfillShowAction
import app.cash.backfila.ui.pages.IndexAction
Expand All @@ -20,13 +20,13 @@ class UiModule : KAbstractModule() {
install(WebActionModule.create<ServiceIndexAction>())
install(WebActionModule.create<ServiceShowAction>())
install(WebActionModule.create<BackfillCreateIndexAction>())
install(WebActionModule.create<BackfillCreateServiceIndexAction>())
install(WebActionModule.create<BackfillCreateAction>())
install(WebActionModule.create<BackfillIndexAction>())
install(WebActionModule.create<BackfillShowAction>())

// Other
install(WebActionModule.create<BackfillCreateHandlerAction>())
install(WebActionModule.create<BackfillShowButtonHandlerAction>())
install(WebActionModule.create<ServiceAutocompleteAction>())
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
package app.cash.backfila.ui.actions

import app.cash.backfila.dashboard.GetServicesAction
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class ServiceDataHelper @Inject constructor(
private val getServicesAction: GetServicesAction,
) {
fun getFlattenedServices(): Map<String, GetServicesAction.UiService> {
val services = getServicesAction.services().services
return services.flatMap { service ->
service.variants.map { variant -> "${service.name}/$variant" to service }
}.toMap()
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package app.cash.backfila.ui.components

import app.cash.backfila.dashboard.UiBackfillRun
import app.cash.backfila.ui.PathBuilder
import app.cash.backfila.ui.pages.BackfillShowAction
import kotlinx.html.TagConsumer
import kotlinx.html.a
Expand Down Expand Up @@ -48,7 +47,7 @@ fun TagConsumer<*>.BackfillsTable(running: Boolean, backfills: List<UiBackfillRu
"whitespace-nowrap py-4 pl-4 pr-3 text-sm font-medium text-gray-900 sm:pl-0",
) {
a(classes = "text-green-500 hover:underline") {
href = PathBuilder(path = BackfillShowAction.PATH.replace("{id}", it.id)).build()
href = BackfillShowAction.PATH.replace("{id}", it.id)
+it.name
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class DashboardPageLayout @Inject constructor(

fun headBlock(block: TagConsumer<*>.() -> Unit) = apply { this.headBlock = block }

fun breadcrumbLinks(links: List<Link>) = apply { this.breadcrumbLinks = links }
fun breadcrumbLinks(vararg links: Link?) = apply { this.breadcrumbLinks = links.toList().filterNotNull() }

@JvmOverloads
fun build(block: TagConsumer<*>.() -> Unit = { }): String {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import kotlinx.html.div
import kotlinx.html.header
import kotlinx.html.span

fun TagConsumer<*>.PageTitle(title: String, subtitle: String? = null, floatRightBlock: TagConsumer<*>.() -> Unit = {}) {
fun TagConsumer<*>.PageTitle(title: String, subtitle: String? = null, smallerSubtitle: String? = null, floatRightBlock: TagConsumer<*>.() -> Unit = {}) {
header {
div("mx-auto max-w-7xl px-200 sm:px-6 lg:px-8s py-10") {
val maybeSubtitleSuffix = subtitle?.let { ": " } ?: ""
Expand All @@ -14,6 +14,11 @@ fun TagConsumer<*>.PageTitle(title: String, subtitle: String? = null, floatRight
div("float-right") {
floatRightBlock()
}
div {
smallerSubtitle?.let {
span("text-sm font-medium text-gray-500") { +it }
}
}
}
}
}

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Loading

0 comments on commit c3faec7

Please sign in to comment.