File tree Expand file tree Collapse file tree 2 files changed +53
-0
lines changed
misk-admin/src/main/kotlin/misk/web/metadata/database Expand file tree Collapse file tree 2 files changed +53
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import misk.web.WebActionModule
66import misk.web.dashboard.AdminDashboard
77import misk.web.dashboard.AdminDashboardAccess
88import misk.web.dashboard.DashboardModule
9+ import misk.web.metadata.guice.GuiceTabIndexAction
910
1011/* *
1112 * Installs Database dashboard tab which allows querying the database from a UI form.
@@ -16,6 +17,16 @@ class DatabaseDashboardTabModule(private val isDevelopment: Boolean): KAbstractM
1617 newMultibinder<DatabaseQueryMetadata >()
1718 install(WebActionModule .create<DatabaseQueryMetadataAction >())
1819
20+ // New Database Tab
21+ install(WebActionModule .create<DatabaseTabIndexAction >())
22+ install(DashboardModule .createHotwireTab<AdminDashboard , AdminDashboardAccess >(
23+ slug = " database-beta" ,
24+ urlPathPrefix = DatabaseTabIndexAction .PATH ,
25+ menuCategory = " Container Admin" ,
26+ menuLabel = " Database Beta" ,
27+ ))
28+
29+ // Old Database Tab
1930 install(
2031 DashboardModule .createMiskWebTab<AdminDashboard , AdminDashboardAccess >(
2132 isDevelopment = isDevelopment,
Original file line number Diff line number Diff line change 1+ package misk.web.metadata.database
2+
3+ import jakarta.inject.Inject
4+ import jakarta.inject.Singleton
5+ import kotlinx.html.div
6+ import kotlinx.html.h1
7+ import misk.tailwind.components.AlertInfoHighlight
8+ import misk.web.Get
9+ import misk.web.ResponseContentType
10+ import misk.web.actions.WebAction
11+ import misk.web.dashboard.AdminDashboardAccess
12+ import misk.web.mediatype.MediaTypes
13+ import misk.web.v2.DashboardPageLayout
14+
15+ @Singleton
16+ internal class DatabaseTabIndexAction @Inject constructor(
17+ private val dashboardPageLayout : DashboardPageLayout ,
18+ ) : WebAction {
19+ @Get(PATH )
20+ @ResponseContentType(MediaTypes .TEXT_HTML )
21+ @AdminDashboardAccess
22+ fun get (): String = dashboardPageLayout
23+ .newBuilder()
24+ .build { _, _, _ ->
25+
26+ div(" container mx-auto p-8" ) {
27+ h1(" text-3xl font-bold mb-4" ) {
28+ + """ Database Beta"""
29+ }
30+ AlertInfoHighlight (
31+ " Execute SQL queries against your database." ,
32+ " Old Tab" ,
33+ " /_admin/database/" ,
34+ )
35+
36+ }
37+ }
38+
39+ companion object {
40+ const val PATH = " /_admin/database-beta/"
41+ }
42+ }
You can’t perform that action at this time.
0 commit comments