Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 99139959

Přidáno uživatelem stepanekp před téměř 3 roky(ů)

#27 Configuration menu item not shown if AP list is empty

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/controller/AppController.java
78 78
     */
79 79
    @GetMapping("/projects/{id}")
80 80
    public String getProjectById(@PathVariable Long id, Model model) {
81
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
81 82
        model.addAttribute("project", projectService.getProjectById(id));
82 83
        return "project";
83 84
    }
......
87 88
     * @return list of AP
88 89
     */
89 90
    @GetMapping("/anti-patterns")
90
    public @ResponseBody List<AntiPattern> getAllAntiPatterns() {
91
    public @ResponseBody List<AntiPattern> getAllAntiPatterns(Model model) {
92
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
91 93
        return antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns());
92 94
    }
93 95

  
......
101 103
    @GetMapping("/anti-patterns/{id}")
102 104
    public String getAntiPatternById(@PathVariable Long id, Model model, HttpSession session) {
103 105
        String currentConfigurationName = configurationGetFromSession(session);
106
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
104 107
        model.addAttribute("antiPattern", antiPatternService.getAntiPatternById(id).getAntiPatternModel());
105 108
        model.addAttribute("description", antiPatternService.getDescriptionFromCatalogue(id));
106 109
        model.addAttribute("operationalizationText", antiPatternService.getOperationalizationText(antiPatternService.getAntiPatternById(id).getAntiPatternModel().getName()));
......
164 167
        }
165 168
        antiPatternService.setConfigurationChanged(false);
166 169

  
170
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
167 171
        model.addAttribute("queryResults", antiPatternService.getResults());
168 172
        model.addAttribute("recalculationTime", DateTimeFormatter.ofPattern("HH:mm:ss").format(LocalTime.now()));
169 173

  
......
176 180
     * @return html file name for thymeleaf template
177 181
     */
178 182
    @GetMapping("/about")
179
    public String about() {return "about";}
183
    public String about(Model model) {
184
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
185
        return "about";
186
    }
180 187

  
181 188
    /**
182 189
     * Method for getting all configuration from app and set it to the model class.
......
186 193
     */
187 194
    @GetMapping("/configuration")
188 195
    public String configuration(Model model, HttpSession session) {
196
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
189 197
        model.addAttribute("antiPatterns", antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns()));
190 198

  
191 199
        String currentConfigurationName = configurationGetFromSession(session);
......
381 389
     * @return html file name for thymeleaf template
382 390
     */
383 391
    @GetMapping("/login")
384
    public String login(){
392
    public String login(Model model){
393
        model.addAttribute("query", new Query(projectService.getAllProjects(), antiPatternService.antiPatternsToModel(antiPatternService.getAllAntiPatterns())));
385 394
        return "login";
386 395
    }
387 396

  
src/main/webapp/WEB-INF/templates/fragments/navbar.html
9 9
                <li class="nav-item active">
10 10
                    <a class="nav-link" th:href="@{/}">Detect</a>
11 11
                </li>
12
                <li class="nav-item active">
12
                <li th:if="${not #lists.isEmpty(query.antiPatterns)}" class="nav-item active">
13 13
                    <a class="nav-link" th:href="@{/configuration}">Configuration</a>
14 14
                </li>
15 15
                <li class="nav-item active">

Také k dispozici: Unified diff