Projekt

Obecné

Profil

« Předchozí | Další » 

Revize 29dfa1d9

Přidáno uživatelem Ondřej Váně před asi 4 roky(ů)

Show detection details on result page

Zobrazit rozdíly:

src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/LongOrNonExistentFeedbackLoopsDetectorImpl.java
4 4
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern;
5 5
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project;
6 6
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem;
7
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail;
8
import cz.zcu.fav.kiv.antipatterndetectionapp.utils.Utils;
7 9
import org.slf4j.Logger;
8 10
import org.slf4j.LoggerFactory;
9 11

  
......
85 87
        }
86 88
        int minFeedbackLimit =  totalNumberIterations.intValue() - Math.round(totalNumberIterations * DIVISION_LONG_OR_NON_FEEDBACK_ITERATIONS);
87 89

  
90
        List<ResultDetail> resultDetails = Utils.createResultDetailsList(
91
                new ResultDetail("Project id", project.getId().toString()));
92

  
88 93
        if ((totalNumberIterations.intValue() != iterationsResults.size())) {
89 94
            if (totalNumberIterations - iterationsResults.size() > minFeedbackLimit) {
90
                return new QueryResultItem(this.antiPattern, true , null);
95
                return new QueryResultItem(this.antiPattern, true , resultDetails);
91 96
            } else {
92
                return new QueryResultItem(this.antiPattern, false , null);
97
                return new QueryResultItem(this.antiPattern, false , resultDetails);
93 98

  
94 99
            }
95 100
        } else {
96
            return new QueryResultItem(this.antiPattern, false , null);
101
            return new QueryResultItem(this.antiPattern, false , resultDetails);
97 102
        }
98 103
    }
99 104
}
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/RoadToNowhereDetectorImpl.java
4 4
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern;
5 5
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project;
6 6
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem;
7
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail;
8
import cz.zcu.fav.kiv.antipatterndetectionapp.utils.Utils;
7 9
import org.slf4j.Logger;
8 10
import org.slf4j.LoggerFactory;
9 11

  
......
66 68
        } catch (SQLException e) {
67 69
            e.printStackTrace();
68 70
        }
71
        List<ResultDetail> resultDetails = Utils.createResultDetailsList(
72
                new ResultDetail("Project id", project.getId().toString()));
69 73

  
70 74
        if( numberOfIssuesForProjectPlan >= this.MINIMUM_NUMBER_OF_ACTIVITIES || numberOfWikiPagesForProjectPlan >= this.MINIMUM_NUMBER_OF_WIKI_PAGES) {
71 75

  
72
            return new QueryResultItem(this.antiPattern, false, null);
76
            return new QueryResultItem(this.antiPattern, false, resultDetails);
73 77
        } else {
74
            return new QueryResultItem(this.antiPattern, true, null);
78
            return new QueryResultItem(this.antiPattern, true, resultDetails);
75 79
        }
76 80
    }
77 81
}
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/detecting/detectors/SpecifyNothingDetectorImpl.java
4 4
import cz.zcu.fav.kiv.antipatterndetectionapp.model.AntiPattern;
5 5
import cz.zcu.fav.kiv.antipatterndetectionapp.model.Project;
6 6
import cz.zcu.fav.kiv.antipatterndetectionapp.model.QueryResultItem;
7
import cz.zcu.fav.kiv.antipatterndetectionapp.model.ResultDetail;
8
import cz.zcu.fav.kiv.antipatterndetectionapp.utils.Utils;
7 9
import org.slf4j.Logger;
8 10
import org.slf4j.LoggerFactory;
9 11

  
......
78 80
        LOGGER.info("wiki:" + numberOfWikiPages);
79 81
        LOGGER.info("average:" + averageLengthOfIssueDescription);
80 82

  
83
        List<ResultDetail> resultDetails = Utils.createResultDetailsList(
84
                new ResultDetail("Project id", project.getId().toString()));
85

  
81 86
        if (numberOfActivitiesForSpecification >= MINIMUM_NUMBER_OF_ACTIVITIES ||
82 87
                numberOfWikiPages >= MINIMUM_NUMBER_OF_WIKI_PAGES) {
83
            return new QueryResultItem(this.antiPattern, false, null);
88
            return new QueryResultItem(this.antiPattern, false, resultDetails);
84 89
        } else {
85 90
            if (averageLengthOfIssueDescription > MINIMUM_AVERAGE_LENGTH_OF_ACTIVITY_DESCRIPTION) {
86
                return new QueryResultItem(this.antiPattern, false, null);
91
                return new QueryResultItem(this.antiPattern, false, resultDetails);
87 92
            } else {
88
                return new QueryResultItem(this.antiPattern, true, null);
93
                return new QueryResultItem(this.antiPattern, true, resultDetails);
89 94
            }
90 95
        }
91 96
    }
src/main/java/cz/zcu/fav/kiv/antipatterndetectionapp/model/QueryResultItem.java
46 46
    public void setResultDetails(List<ResultDetail> resultDetails) {
47 47
        this.resultDetails = resultDetails;
48 48
    }
49

  
50
    public String resultDetailsToString() {
51
        StringBuilder result = new StringBuilder();
52
        for (ResultDetail resultDetails :
53
                resultDetails) {
54
            result.append(resultDetails.getResultDetailName()).append(" = ").append(resultDetails.getResultDetailValue()).append("<br>");
55
        }
56
        return result.toString();
57
    }
49 58
}
src/main/resources/templates/result.html
4 4
    <title>Anti Pattern Detector - Results</title>
5 5
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
6 6
    <meta name="viewport" content="width=device-width, initial-scale=1">
7
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css">
8
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
9
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
7
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
10 8
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
9
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
10
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.5.2/js/bootstrap.min.js"></script>
11 11

  
12 12
    <style>
13 13
        .not-found-bg {
......
46 46
            <td class="align-middle" th:each="resultItems: ${queryResult.getQueryResultItems()}">
47 47

  
48 48
                <div th:if="${resultItems.isDetected()}">
49
                    <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25"
50
                         fill="currentColor" class="bi bi-check my-center found-bg icon-style" viewBox="0 0 16 16">
51
                        <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"/>
52
                    </svg>
49
                    <div class="container">
50
                        <a data-toggle="popover" title="Detection details" data-html="true" data-content="" th:attr="data-content=${resultItems.resultDetailsToString()}">
51
                            <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25"
52
                                fill="currentColor" class="bi bi-check my-center found-bg icon-style" viewBox="0 0 16 16">
53
                                <path d="M10.97 4.97a.75.75 0 0 1 1.07 1.05l-3.99 4.99a.75.75 0 0 1-1.08.02L4.324 8.384a.75.75 0 1 1 1.06-1.06l2.094 2.093 3.473-4.425a.267.267 0 0 1 .02-.022z"/>
54
                            </svg>
55
                        </a>
56
                    </div>
53 57
                </div>
54 58
                <div th:unless="${resultItems.isDetected()}">
55
                    <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-x not-found-bg icon-style" viewBox="0 0 16 16">
56
                        <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
57
                    </svg>
59
                    <div class="container">
60
                        <a data-toggle="popover" title="Detection details" data-html="true" data-content="" th:attr="data-content=${resultItems.resultDetailsToString()}">
61
                            <svg xmlns="http://www.w3.org/2000/svg" width="25" height="25" fill="currentColor" class="bi bi-x not-found-bg icon-style" viewBox="0 0 16 16">
62
                            <path d="M4.646 4.646a.5.5 0 0 1 .708 0L8 7.293l2.646-2.647a.5.5 0 0 1 .708.708L8.707 8l2.647 2.646a.5.5 0 0 1-.708.708L8 8.707l-2.646 2.647a.5.5 0 0 1-.708-.708L7.293 8 4.646 5.354a.5.5 0 0 1 0-.708z"/>
63
                        </svg>
64
                        </a>
65
                    </div>
58 66
                </div>
59 67
            </td>
60 68
        </tr>
......
78 86
    </div>
79 87
</div>
80 88

  
89

  
90
<script>
91
    $(document).ready(function(){
92
        $('[data-toggle="popover"]').popover();
93
    });
94
</script>
81 95
</body>
82 96
</html>

Také k dispozici: Unified diff