Skip to content

Commit f81abfd

Browse files
We remove the section when running recipe succeeds. (#552)
1 parent 35ed9ef commit f81abfd

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

applications/rest-service/src/main/java/org/springframework/sbm/ReportController.java

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
*/
1616
package org.springframework.sbm;
1717

18+
import lombok.Getter;
19+
import lombok.Setter;
20+
import lombok.Value;
1821
import org.springframework.beans.factory.annotation.Autowired;
1922
import org.springframework.http.MediaType;
2023
import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportRenderer;
@@ -58,10 +61,17 @@ public String applyRecipes(@RequestParam("recipeNames[]") String[] recipeNames)
5861

5962
@PostMapping(path = "/spring-boot-upgrade")
6063
@ResponseBody
61-
public void applyRecipes2(@RequestBody String recipeNames) {
64+
public void applyRecipes2(@RequestBody Recipe recipeNames) {
6265
ProjectContext context = contextHolder.getProjectContext();
63-
List.of(recipeNames).forEach(recipeName -> applyCommand.execute(context, recipeName));
66+
recipeNames.getRecipes().forEach(
67+
recipeName -> applyCommand.execute(context, recipeName)
68+
);
6469
applyCommand.execute(context, REPORT_RECIPE);
6570
}
6671

67-
}
72+
@Getter
73+
@Setter
74+
static class Recipe {
75+
private List<String> recipes;
76+
}
77+
}

applications/rest-service/src/main/resources/static/js/recipe.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ function applyRecipes(btn) {
7272
url: "http://localhost:8080/spring-boot-upgrade",
7373
contentType: 'application/json',
7474
data: JSON.stringify({
75-
recipes: $(btn).attr('recipe')
75+
recipes: [$(btn).attr('recipe')]
7676
}),
7777
beforeSend: function() {
7878
state.startedRunningRecipe();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2021 - 2022 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package org.springframework.sbm.boot.upgrade_27_30.report.helper;
18+
19+
import org.springframework.sbm.boot.upgrade_27_30.report.SpringBootUpgradeReportSection;
20+
import org.springframework.sbm.engine.context.ProjectContext;
21+
import org.springframework.sbm.properties.api.PropertiesSource;
22+
23+
import java.util.List;
24+
import java.util.Map;
25+
26+
public class MissingHelper implements SpringBootUpgradeReportSection.Helper<String>{
27+
@Override
28+
public String getDescription() {
29+
return null;
30+
}
31+
32+
@Override
33+
public boolean evaluate(ProjectContext context) {
34+
return false;
35+
}
36+
37+
@Override
38+
public Map<String, String> getData() {
39+
return null;
40+
}
41+
}

0 commit comments

Comments
 (0)