Skip to content

Commit 1915641

Browse files
adrwsvc-squareup-copybara
authored andcommitted
Remove old Web Actions tabs
GitOrigin-RevId: 63cb87180eae632e3dc0e420ccd1de3707f4cfd0
1 parent 055f84d commit 1915641

File tree

76 files changed

+27
-46097
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

76 files changed

+27
-46097
lines changed

misk-admin/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ abstract class MiskWebBuildTask @Inject constructor(
146146

147147
val tabDirs = listOf(
148148
"web/tabs/database",
149-
"web/tabs/web-actions",
150149
)
151150

152151
val buildMiskWeb = tasks.register("buildMiskWeb", MiskWebBuildTask::class.java) {
@@ -187,7 +186,7 @@ tasks.register<Copy>("buildAndCopyWebActions") {
187186
from({
188187
project(":misk-admin-web-actions").tasks.named("buildWebActionsTab").get().outputs.files
189188
})
190-
into(project.layout.buildDirectory.dir("resources/main/web/_tab/web-actions-v4"))
189+
into(project.layout.buildDirectory.dir("resources/main/web/_tab/web-actions"))
191190
dependsOn(":misk-admin-web-actions:buildWebActionsTab")
192191
}
193192

misk-admin/src/main/kotlin/misk/web/dashboard/MiskWebTabIndexAction.kt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ class MiskWebTabIndexAction @Inject constructor(
3333
fun get(@PathParam slug: String?): String {
3434
val dashboardTab = dashboardTabs.firstOrNull { slug == it.slug }
3535
?: throw NotFoundException("No Misk-Web tab found for slug: $slug")
36-
// TODO remove this hack when new Web Actions tab lands and old ones removed, v1 and v2 are in the same web-actions tab
37-
val normalizedSlug = if (dashboardTab.slug == "web-actions-v1") "web-actions" else dashboardTab.slug
38-
val tabEntrypointJs = "/_tab/${normalizedSlug}/tab_${normalizedSlug}.js"
36+
val tabEntrypointJs = "/_tab/${dashboardTab.slug}/tab_${dashboardTab.slug}.js"
3937

4038
return buildHtml {
4139
html {
@@ -52,7 +50,7 @@ class MiskWebTabIndexAction @Inject constructor(
5250

5351
// App anchor
5452
div {
55-
id = normalizedSlug
53+
id = dashboardTab.slug
5654
}
5755
}
5856

Lines changed: 5 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,61 +1,29 @@
11
package misk.web.metadata.webaction
22

33
import misk.inject.KAbstractModule
4-
import misk.web.WebActionModule
54
import misk.web.dashboard.AdminDashboard
65
import misk.web.dashboard.AdminDashboardAccess
76
import misk.web.dashboard.DashboardModule
87

98
/**
109
* Installs WebActions dashboard tab which allows introspection
11-
* and exercising actions from a UI form.
12-
*
13-
* This installs both versions of the WebActions tab, v1 and v2.
10+
* and exercising actions from an auto-fill JSON editor.
1411
*/
15-
class WebActionsDashboardTabModule(private val isDevelopment: Boolean): KAbstractModule() {
12+
class WebActionsDashboardTabModule(private val isDevelopment: Boolean) : KAbstractModule() {
1613
override fun configure() {
17-
// Web Actions v2
1814
bind<WebActionsMetadata>().toProvider(WebActionsMetadataProvider())
19-
install(WebActionModule.create<WebActionMetadataAction>())
2015

21-
// Web Actions v4
2216
install(
2317
DashboardModule.createIFrameTab<AdminDashboard, AdminDashboardAccess>(
2418
// TODO get development proxy working for IFrame tabs
2519
// isDevelopment = isDevelopment,
26-
slug = "web-actions-v4",
27-
urlPathPrefix = "/_admin/web-actions-v4/",
28-
iframePath = "/_tab/web-actions-v4/index.html",
20+
slug = "web-actions",
21+
urlPathPrefix = "/_admin/web-actions/",
22+
iframePath = "/_tab/web-actions/index.html",
2923
// developmentWebProxyUrl = "http://localhost:3210/",
3024
menuLabel = "Web Actions",
3125
menuCategory = "Container Admin",
3226
)
3327
)
34-
35-
36-
// Web Actions v2
37-
install(
38-
DashboardModule.createMiskWebTab<AdminDashboard, AdminDashboardAccess>(
39-
isDevelopment = isDevelopment,
40-
slug = "web-actions",
41-
urlPathPrefix = "/_admin/web-actions/",
42-
developmentWebProxyUrl = "http://localhost:3201/",
43-
menuLabel = "Old Web Actions v2",
44-
menuCategory = "Container Admin"
45-
)
46-
)
47-
48-
// Web Actions v1
49-
install(
50-
DashboardModule.createMiskWebTab<AdminDashboard, AdminDashboardAccess>(
51-
isDevelopment = isDevelopment,
52-
slug = "web-actions-v1",
53-
urlPathPrefix = "/_admin/web-actions-v1/",
54-
developmentWebProxyUrl = "http://localhost:3201/",
55-
classpathResourcePathPrefix = "classpath:/web/_tab/web-actions/",
56-
menuLabel = "Old Web Actions v1",
57-
menuCategory = "Container Admin"
58-
)
59-
)
6028
}
6129
}

misk-admin/src/main/kotlin/misk/web/v2/DashboardIFrameTabAction.kt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,9 +69,7 @@ internal class DashboardIFrameTabAction @Inject constructor(
6969
AlertError("No Misk-Web tab found for slug: $slug. Check your install bindings or Misk-Web build.")
7070
}
7171
} else {
72-
// TODO remove this hack when new Web Actions tab lands and old ones removed, v1 and v2 are in the same web-actions tab
73-
val normalizedSlug =
74-
if (dashboardTab.slug == "web-actions-v1") "web-actions" else dashboardTab.slug
72+
val normalizedSlug = dashboardTab.slug
7573
val tabEntrypointJs = "/_tab/${normalizedSlug}/tab_${normalizedSlug}.js"
7674

7775
// If tab is Misk-Web do additional checks and show separate development and real errors
@@ -113,12 +111,14 @@ internal class DashboardIFrameTabAction @Inject constructor(
113111
// If tab is Misk-Web do additional checks and show separate development and real errors
114112
if (deployment.isLocalDevelopment) {
115113
// If local development, check web proxy action and show fuller development 404 message
116-
val tabEntrypointJsResponse = webProxyAction
114+
val proxyResponse = webProxyAction
117115
.getResponse((hostname / iframeTab.iframePath).toHttpUrl())
118-
if (tabEntrypointJsResponse.statusCode != 200) {
116+
val staticResponse = staticResourceAction
117+
.getResponse((hostname / iframeTab.iframePath).toHttpUrl())
118+
if (proxyResponse.statusCode != 200 && staticResponse.statusCode != 200) {
119119
div("container mx-auto p-8") {
120120
AlertError("Failed to load tab: ${dashboardTab.menuCategory} / ${dashboardTab.menuLabel}")
121-
if (iframeTab.iframePath == "/_tab/web-actions-v4/index.html") {
121+
if (iframeTab.iframePath == "/_tab/web-actions/index.html") {
122122
AlertInfo("In local development, this can be from not having your local dev server (ie. Webpack) running or not doing an initial local frontend build to generate the necessary web assets. Try running in your Terminal: \$ gradle :misk:misk-admin:buildAndCopyWebActions.")
123123
} else {
124124
AlertInfo("In local development, this can be from not having your local dev server (ie. Webpack) running or not doing an initial local frontend build to generate the necessary web assets. Try running in your Terminal: \$ gradle buildMiskWeb OR \$ misk-web ci-build -e.")

misk-admin/web/tabs/web-actions-v3/tslint.json

Lines changed: 0 additions & 4 deletions
This file was deleted.

misk-admin/web/tabs/web-actions/.gitignore

Lines changed: 0 additions & 22 deletions
This file was deleted.

misk-admin/web/tabs/web-actions/miskTab.json

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)