Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
adrw committed Jan 22, 2025
1 parent dfdc2ec commit c11cffd
Show file tree
Hide file tree
Showing 8 changed files with 5 additions and 53 deletions.

This file was deleted.

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

import app.cash.backfila.dashboard.CreateBackfillAction
import app.cash.backfila.dashboard.StartBackfillAction
import app.cash.backfila.dashboard.StopBackfillAction
import app.cash.backfila.dashboard.UpdateBackfillAction
import app.cash.backfila.protos.service.CreateBackfillRequest
import app.cash.backfila.ui.pages.BackfillCreateAction.BackfillCreateField
import javax.inject.Inject
import javax.inject.Singleton
import misk.scope.ActionScoped
import misk.security.authz.Authenticated
import misk.web.Get
Expand All @@ -20,32 +15,18 @@ import misk.web.mediatype.MediaTypes
import misk.web.toResponseBody
import okhttp3.Headers
import okio.ByteString.Companion.encodeUtf8
import javax.inject.Inject
import javax.inject.Singleton

@Singleton
class BackfillCreateHandlerAction @Inject constructor(
private val createBackfillAction: CreateBackfillAction,
private val startBackfillAction: StartBackfillAction,
private val stopBackfillAction: StopBackfillAction,
private val updateBackfillAction: UpdateBackfillAction,
private val httpCall: ActionScoped<HttpCall>,
) : WebAction {
@Get(PATH)
@ResponseContentType(MediaTypes.TEXT_HTML)
@Authenticated(capabilities = ["users"])
fun get(
// @QueryParam service: String,
// @QueryParam variant: String,
// @QueryParam backfillName: String,
// @QueryParam dryRun: Boolean?,
// @QueryParam rangeStart: String?,
// @QueryParam rangeEnd: String?,
// @QueryParam batchSize: String?,
// @QueryParam scanSize: String?,
// @QueryParam extraSleepMs: String?,
// @QueryParam backoffSchedule: String?,
// // TODO need to make this generic to work with any named custom params
// @QueryParam customParameter_mealDelayMs: String?,
): Response<ResponseBody> {
fun get(): Response<ResponseBody> {
// Parse form
val formFieldNames = this.httpCall.get().asOkHttpRequest().url.queryParameterNames
val formFields = formFieldNames.associateWith { this.httpCall.get().asOkHttpRequest().url.queryParameter(it) }
Expand Down Expand Up @@ -79,7 +60,6 @@ class BackfillCreateHandlerAction @Inject constructor(
request = createRequestBuilder.build(),
)

// TODO get created backfill id and redirect to that page on create/clone
val id = response.backfill_run_id

return Response(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,6 @@ class BackfillShowButtonHandlerAction @Inject constructor(
"backoff_schedule" -> {
updateBackfillAction.update(id.toLong(), UpdateBackfillRequest(backoff_schedule = field_value))
}

// TODO add support for updating other fields, not just state
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ fun TagConsumer<*>.BackfillsTable(running: Boolean, backfills: List<UiBackfillRu
div("sm:flex sm:items-center") {
div("sm:flex-auto") {
h1("text-base font-semibold leading-6 text-gray-900") { +"""Backfills ($title)""" }
// TODO delete
// p("mt-2 text-sm text-gray-700") { +"""A list of all the users in your account including their name, title, email and role.""" }
}
}
div("mt-8 flow-root") {
Expand Down Expand Up @@ -67,17 +65,6 @@ 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",
) { +"""$it""" }
}

// TODO delete
// td(
// "relative whitespace-nowrap py-4 pl-3 pr-4 text-right text-sm font-medium sm:pr-0"
// ) {
// a(classes = "text-indigo-600 hover:text-indigo-900") {
// href = "#"
// +"""Edit"""
// span("sr-only") { +""", Lindsay Walton""" }
// }
// }
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,7 @@ class DashboardPageLayout @Inject constructor(
}
}

// TODO upstream this to Misk
private fun TagConsumer<*>.Breadcrumbs(links: List<Link>) {
nav("flex") {
attributes["aria-label"] = "Breadcrumb"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,10 +133,6 @@ class BackfillCreateAction @Inject constructor(
.replace("{variantOrBlank}", variantOrBlank ?: ""),
)
} else {
// TODO add Header buttons / metrics

// TODO add backfill name and back button to select a different backfill, or select/options

div("mx-auto max-w-7xl px-4 py-16 sm:px-6 lg:px-8") {
form {
action = BackfillCreateHandlerAction.PATH
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ class BackfillShowAction @Inject constructor(
}
}

// TODO add Header buttons / metrics

div("mx-auto max-w-7xl px-4 py-16 sm:px-6 lg:px-8") {
div("mx-auto grid max-w-2xl grid-cols-1 grid-rows-1 items-start gap-x-8 gap-y-8 lg:mx-0 lg:max-w-none lg:grid-cols-3") {
// +"""<!-- Right Small Column -->"""
Expand Down Expand Up @@ -260,6 +258,7 @@ class BackfillShowAction @Inject constructor(
)
}
td("hidden py-5 pl-8 pr-0 text-right align-top tabular-nums text-gray-700 sm:table-cell") { +"""${partition.matching_records_per_minute} #/m""" }
// TODO properly calculate the ETA until finished
td("py-5 pl-8 pr-0 text-right align-top tabular-nums text-gray-700") { +"""ETA TODO""" }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,6 @@ class ServiceShowAction @Inject constructor(
}
}

// TODO Add completed table
// TODO Add deleted support?
BackfillsTable(true, backfillRuns.running_backfills)
BackfillsTable(false, backfillRuns.paused_backfills)
}
Expand Down

0 comments on commit c11cffd

Please sign in to comment.