Skip to content

Commit

Permalink
Show custom params in backfill configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
adrw committed Jan 24, 2025
1 parent 4a07a4a commit a2756ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class BackfillCreateHandlerAction @Inject constructor(
formFields[BackfillCreateField.EXTRA_SLEEP_MS.fieldId]?.ifNotBlank { createRequestBuilder.extra_sleep_ms(it.toLongOrNull()) }
formFields[BackfillCreateField.BACKOFF_SCHEDULE.fieldId]?.ifNotBlank { createRequestBuilder.backoff_schedule(it) }
val customParameters = formFields.filter { it.key.startsWith(BackfillCreateField.CUSTOM_PARAMETER_PREFIX.fieldId) }
.mapValues { it.value?.encodeUtf8() }
.map { it.key.removePrefix(BackfillCreateField.CUSTOM_PARAMETER_PREFIX.fieldId) to it.value?.encodeUtf8() }.toMap()
if (customParameters.isNotEmpty()) {
createRequestBuilder.parameter_map(customParameters)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import app.cash.backfila.ui.components.AutoReload
import app.cash.backfila.ui.components.DashboardPageLayout
import app.cash.backfila.ui.components.PageTitle
import app.cash.backfila.ui.components.ProgressBar
import app.cash.backfila.ui.pages.BackfillCreateAction.BackfillCreateField.CUSTOM_PARAMETER_PREFIX
import javax.inject.Inject
import javax.inject.Singleton
import kotlinx.html.ButtonType
Expand Down Expand Up @@ -319,8 +320,13 @@ class BackfillShowAction @Inject constructor(
label = "View",
href = "#",
),
),
) + (parameters ?: mapOf()).map { (key, value) ->
DescriptionListRow(
label = key.removePrefix(CUSTOM_PARAMETER_PREFIX.fieldId),
description = value,
)
)
}

private fun TagConsumer<*>.Card(block: TagConsumer<*>.() -> Unit) {
div("-mx-4 mb-8 px-4 py-8 overflow-x-auto shadow-sm ring-1 ring-gray-900/5 sm:mx-0 sm:rounded-lg sm:px-8 lg:col-span-2 lg:row-span-2 lg:row-end-2") {
Expand Down

0 comments on commit a2756ac

Please sign in to comment.