Skip to content

Commit 9cb87b9

Browse files
authored
chore: Remove Hilla from new project wizard (#469)
* chore: Remove Hilla from new project wizard * spotless
1 parent 260b7f9 commit 9cb87b9

File tree

5 files changed

+11
-86
lines changed

5 files changed

+11
-86
lines changed

plugin/src/main/kotlin/com/vaadin/plugin/module/HelloWorldPanel.kt

Lines changed: 3 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,22 +41,19 @@ class HelloWorldPanel(private val model: HelloWorldModel) {
4141
}
4242

4343
private class ViewModel(val model: HelloWorldModel) {
44-
val framework =
45-
SegmentModel(StarterSupport.frameworks, model.frameworkProperty, StarterSupport::isSupportedFramework)
46-
val language =
47-
SegmentModel(StarterSupport.languages, model.languageProperty, StarterSupport::isSupportedLanguage)
44+
val language = SegmentModel(StarterSupport.languages, model.languageProperty, { _, _ -> true })
4845
val buildTool =
4946
SegmentModel(StarterSupport.buildTools, model.buildToolProperty, StarterSupport::isSupportedBuildTool)
5047
val architecture =
5148
SegmentModel(
5249
StarterSupport.architectures, model.architectureProperty, StarterSupport::isSupportedArchitecture)
5350

5451
fun all(): List<SegmentModel> {
55-
return listOf(framework, language, buildTool, architecture)
52+
return listOf(language, buildTool, architecture)
5653
}
5754

5855
fun isSupported(segmentModel: SegmentModel, value: String): Boolean {
59-
return segmentModel.supported(model, value)
56+
return segmentModel.supported.let { it(model, value) } ?: true
6057
}
6158
}
6259

@@ -68,7 +65,6 @@ class HelloWorldPanel(private val model: HelloWorldModel) {
6865
private val notAllArchitecturesSupportedMessage = graph.property("")
6966

7067
init {
71-
viewModel.framework.property.afterChange { refreshSegments("framework") }
7268
viewModel.language.property.afterChange { refreshSegments("language") }
7369
viewModel.buildTool.property.afterChange { refreshSegments("buildTool") }
7470
viewModel.architecture.property.afterChange { refreshSegments("architecture") }
@@ -85,7 +81,6 @@ class HelloWorldPanel(private val model: HelloWorldModel) {
8581
}
8682

8783
val root: DialogPanel = panel {
88-
buildSegment(row("Framework") {}, viewModel.framework)
8984
buildSegment(row("Language") {}, viewModel.language)
9085
row("") { text("<i>Kotlin support uses a community add-on.</i>") }.visibleIf(kotlinInfoVisibleProperty)
9186
buildSegment(row("Build tool") {}, viewModel.buildTool)
@@ -94,9 +89,6 @@ class HelloWorldPanel(private val model: HelloWorldModel) {
9489
}
9590

9691
private fun refreshSegments(source: String) {
97-
if (source != "framework") {
98-
viewModel.framework.update()
99-
}
10092
if (source != "language") {
10193
viewModel.language.update()
10294
}
@@ -106,7 +98,6 @@ class HelloWorldPanel(private val model: HelloWorldModel) {
10698
if (source != "architecture") {
10799
viewModel.architecture.update()
108100
}
109-
refreshArchitecturesSupportedMessage()
110101
refreshKotlinInfo()
111102
fallbackToFirstEnabled()
112103
}
@@ -115,15 +106,6 @@ class HelloWorldPanel(private val model: HelloWorldModel) {
115106
kotlinInfoVisibleProperty.set(viewModel.language.value() == "kotlin")
116107
}
117108

118-
private fun refreshArchitecturesSupportedMessage() {
119-
if (StarterSupport.supportsAllArchitectures(model)) {
120-
notAllArchitecturesSupportedMessage.set("")
121-
} else {
122-
val frameworkName = viewModel.framework.label()
123-
notAllArchitecturesSupportedMessage.set("<i>$frameworkName does not support all architectures.</i>")
124-
}
125-
}
126-
127109
private fun fallbackToFirstEnabled() {
128110
viewModel.all().filter { !viewModel.isSupported(it, it.value()) }.forEach { it.reset() }
129111
}

plugin/src/main/kotlin/com/vaadin/plugin/module/StarterProjectPanel.kt

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,8 @@ class StarterProjectPanel(private val model: StarterProjectModel) {
1313
segmentedButton(setOf(false, true)) { this.text = if (it) "Prerelease" else "Stable" }
1414
.bind(model.usePrereleaseProperty)
1515
}
16-
row { text("Include Walking Skeleton").bold() }
17-
row {
18-
text(
19-
"A walking skeleton is a minimal application that includes a fully-functional " +
20-
"end-to-end workflow. All major building blocks are included, but it does not " +
21-
"yet perform any meaningful tasks.",
22-
MAX_LINE_LENGTH)
23-
}
24-
row("Pure Java with Vaadin Flow") { checkBox("").bindSelected(model.includeFlowProperty) }
25-
row("Full-stack React with Vaadin Hilla") { checkBox("").bindSelected(model.includeHillaProperty) }
16+
row { text("Include sample view").bold() }
17+
row { text("A sample view built fully in Java, front to back.", MAX_LINE_LENGTH) }
18+
row("Include sample view") { checkBox("").bindSelected(model.includeFlowProperty) }
2619
}
2720
}

plugin/src/main/kotlin/com/vaadin/plugin/module/VaadinPanel.kt

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -101,20 +101,6 @@ class VaadinPanel(propertyGraph: PropertyGraph, private val wizardContext: Wizar
101101
"muscles to your skeleton—transforming it into a fully-featured application.",
102102
MAX_LINE_LENGTH)
103103
}
104-
row { text("Flow and Hilla").bold() }
105-
row {
106-
text(
107-
"<a href=\"https://vaadin.com/flow\">Flow framework</a> is the most productive" +
108-
" choice, allowing 100% of the user interface to be coded in server-side Java.",
109-
MAX_LINE_LENGTH)
110-
}
111-
row {
112-
text(
113-
"<a href=\"https://hilla.dev/\">Hilla framework</a>, on the other hand, enables" +
114-
" implementation of your user interface with React while automatically connecting it to your" +
115-
" Java backend.",
116-
MAX_LINE_LENGTH)
117-
}
118104
}
119105

120106
starterProjectGroup!!.expanded = true

plugin/src/main/kotlin/com/vaadin/plugin/starter/HelloWorldModel.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,10 @@ class HelloWorldModel(val groupIdProperty: com.intellij.openapi.observable.prope
1010
DownloadableModel {
1111

1212
private val graph = PropertyGraph()
13-
val frameworkProperty = graph.property(StarterSupport.frameworks.keys.first())
1413
val languageProperty = graph.property(StarterSupport.languages.keys.first())
1514
val buildToolProperty = graph.property(StarterSupport.buildTools.keys.first())
1615
val architectureProperty = graph.property(StarterSupport.architectures.keys.first())
1716

18-
val framework by frameworkProperty
1917
val language by languageProperty
2018
val buildTool by buildToolProperty
2119
val architecture by architectureProperty
@@ -24,7 +22,7 @@ class HelloWorldModel(val groupIdProperty: com.intellij.openapi.observable.prope
2422
override fun getDownloadLink(project: Project): String {
2523
val params =
2624
mapOf(
27-
"framework" to framework,
25+
"framework" to "flow",
2826
"language" to language,
2927
"buildtool" to buildTool,
3028
"stack" to architecture,

plugin/src/main/kotlin/com/vaadin/plugin/starter/StarterSupport.kt

Lines changed: 4 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@ class StarterSupport {
44

55
companion object {
66

7-
val frameworks = linkedMapOf("flow" to "Flow / Java", "hilla" to "Hilla / React")
8-
97
val languages = linkedMapOf("java" to "Java", "kotlin" to "Kotlin")
108

119
val architectures =
@@ -18,52 +16,20 @@ class StarterSupport {
1816

1917
val buildTools = linkedMapOf("maven" to "Maven", "gradle" to "Gradle")
2018

21-
private val supportMatrix =
22-
arrayOf(
23-
StarterSupportMatrixElement(
24-
"flow",
25-
languages.keys,
26-
setOf("springboot", "quarkus", "jakartaee", "servlet"),
27-
buildTools.keys,
28-
),
29-
StarterSupportMatrixElement("hilla", setOf("java"), setOf("springboot"), buildTools.keys),
30-
)
31-
32-
fun isSupportedFramework(model: HelloWorldModel, framework: String): Boolean {
33-
val foundSupport = getSupport(framework) ?: return false
34-
return foundSupport.architectures.contains(model.architecture)
35-
}
36-
37-
fun isSupportedLanguage(model: HelloWorldModel, language: String): Boolean {
38-
val foundSupport = getSupport(model.framework) ?: return false
39-
return foundSupport.languages.contains(language)
40-
}
41-
4219
fun isSupportedArchitecture(model: HelloWorldModel, architecture: String): Boolean {
43-
val foundSupport = getSupport(model.framework) ?: return false
4420
if (model.buildTool == "gradle") {
45-
return foundSupport.architectures.contains(architecture) &&
46-
setOf("springboot", "servlet").contains(architecture)
21+
return setOf("springboot", "servlet").contains(architecture)
4722
} else if (model.language == "kotlin") {
4823
return architecture == "springboot"
4924
}
50-
return foundSupport.architectures.contains(architecture)
25+
return true
5126
}
5227

5328
fun isSupportedBuildTool(model: HelloWorldModel, buildTool: String): Boolean {
54-
val foundSupport = getSupport(model.framework) ?: return false
5529
if (model.language == "kotlin") {
56-
return foundSupport.buildTools.contains(buildTool) && buildTool == "maven"
30+
return buildTool == "maven"
5731
}
58-
return foundSupport.buildTools.contains(buildTool)
59-
}
60-
61-
fun supportsAllArchitectures(model: HelloWorldModel): Boolean {
62-
return getSupport(model.framework)?.architectures?.containsAll(architectures.keys)!!
63-
}
64-
65-
private fun getSupport(framework: String): StarterSupportMatrixElement? {
66-
return supportMatrix.find { it.framework == framework }
32+
return true
6733
}
6834
}
6935
}

0 commit comments

Comments
 (0)