@@ -7,16 +7,12 @@ import app.cash.backfila.ui.components.DashboardPageLayout
7
7
import app.cash.backfila.ui.pages.BackfillShowAction
8
8
import javax.inject.Inject
9
9
import javax.inject.Singleton
10
- import kotlinx.html.div
11
- import kotlinx.html.h1
12
- import kotlinx.html.p
13
10
import misk.exceptions.BadRequestException
14
11
import misk.hibernate.Query
15
12
import misk.hibernate.Transacter
16
13
import misk.hibernate.newQuery
17
14
import misk.scope.ActionScoped
18
15
import misk.security.authz.Authenticated
19
- import misk.tailwind.Link
20
16
import misk.web.Get
21
17
import misk.web.HttpCall
22
18
import misk.web.PathParam
@@ -25,6 +21,8 @@ import misk.web.ResponseBody
25
21
import misk.web.ResponseContentType
26
22
import misk.web.actions.WebAction
27
23
import misk.web.mediatype.MediaTypes
24
+ import misk.web.toResponseBody
25
+ import okhttp3.Headers
28
26
import okio.ByteString.Companion.encodeUtf8
29
27
30
28
@Singleton
@@ -44,7 +42,7 @@ class EditPartitionCursorHandlerAction @Inject constructor(
44
42
@PathParam partitionName : String ,
45
43
): Response <ResponseBody > {
46
44
val request = httpCall.get().asOkHttpRequest()
47
- val cursorSnapshot = request.url.queryParameter(" cursor_snapshot" )
45
+ val cursorSnapshot = request.url.queryParameter(" cursor_snapshot" )?. takeIf { it.isNotBlank() }
48
46
val newCursor = request.url.queryParameter(" new_cursor" )
49
47
50
48
// Validate UTF-8
@@ -78,39 +76,11 @@ class EditPartitionCursorHandlerAction @Inject constructor(
78
76
} ? : throw BadRequestException (" Partition not found" )
79
77
}
80
78
81
- // Return success page with updated form
79
+ // Redirect to backfill page
82
80
return Response (
83
- dashboardPageLayout.newBuilder()
84
- .title(" Edit Cursor - Partition $partitionName " )
85
- .breadcrumbLinks(
86
- Link (" Backfill #$id " , BackfillShowAction .path(id)),
87
- Link (" Edit Cursor" , path(id, partitionName)),
88
- )
89
- .buildHtmlResponseBody {
90
- div(" space-y-6 max-w-2xl mx-auto py-8" ) {
91
- // Success message
92
- div(" rounded-md bg-green-50 p-4 mb-6" ) {
93
- div(" flex" ) {
94
- div(" flex-shrink-0" ) {
95
- // Success icon (checkmark)
96
- div(" h-5 w-5 text-green-400" ) {
97
- + " ✓"
98
- }
99
- }
100
- div(" ml-3" ) {
101
- h1(" text-sm font-medium text-green-800" ) {
102
- + " Success"
103
- }
104
- div(" mt-2 text-sm text-green-700" ) {
105
- p {
106
- + " Cursor has been updated successfully."
107
- }
108
- }
109
- }
110
- }
111
- }
112
- }
113
- },
81
+ body = " go to ${BackfillShowAction .path(id)} " .toResponseBody(),
82
+ statusCode = 303 ,
83
+ headers = Headers .headersOf(" Location" , BackfillShowAction .path(id)),
114
84
)
115
85
}
116
86
0 commit comments