Commits

maximp  committed 2c3b2c7

Fix exception, support new project Ids (introduced in 8.0), some UI improvements

  • Participants
  • Parent commits b7efaa2

Comments (0)

Files changed (7)

File server/resources/analysis.css

   opacity: 1.0;
 }
 
+.test-details .block .procent,
+.test-details .block .rate {
+  width: 3em;
+  text-align: center;
+  padding-left: 1em;
+}
+
 .test-details .block .procent {
-  width: 3em;
   text-align: right;
-  padding-left: 1em;
+}
+
+.test-details .block .rate .fail {
+  color: red;
 }
 
 /* Settings dialog */

File server/resources/analysis.js

 
   formElement: function() {
     return $('settingsForm');
-  },
+  }
 });
 
 BS.TestDetails._toggleDetails = BS.TestDetails.toggleDetails;
 BS.TestDetails.toggleDetails = function(link, url) {
   var idx = url.indexOf("?");
   url = "/flakyTestDetails.html" + url.substr(idx);
+
+  // Should be compatible with 7.1.x and 8.0.
+  idx = url.indexOf("projectId=");
+  url = url.substr(0, idx) + "projectId=" + BS.projectId;
+
   return this._toggleDetails(link, url);
 };

File server/resources/buildTd.jsp

+<%@ include file="/include.jsp"
+%><jsp:useBean id="build" type="jetbrains.buildServer.serverSide.SBuild" scope="request"
+/><c:if test="${not empty build}">
+  <td class="bt"><bs:buildTypeLink buildType="${build.buildType}"/></td>
+  <td class="build"><%@ include file="/changeBuild.jspf" %></td>
+</c:if
+><c:if test="${empty build}">
+  <td colspan="2"><i>build no longer exists (please restart the analyzer)</i></td>
+</c:if>

File server/resources/failureRate.jsp

 <%@ include file="/include.jsp" %>
 <jsp:useBean id="failureRate" type="jetbrains.buildServer.serverSide.flaky.data.FailureRate" scope="request"/>
-<td class="procent" <bs:tooltipAttrs text="${failureRate.failures} / ${failureRate.totalRuns}"/> >
+<td class="rate" <bs:tooltipAttrs text="${failureRate.failures} failure${failureRate.failures != 1 ? 's' : ''} out of ${failureRate.totalRuns}"/>>
+  <span class="fail">${failureRate.failures}</span>  / ${failureRate.totalRuns}
+</td>
+<td class="procent" <bs:tooltipAttrs text="Failure rate in this environment"/> >
   <fmt:formatNumber value="${(failureRate.failures / failureRate.totalRuns) * 100}"
                     minFractionDigits="1"
                     maxFractionDigits="1" />%

File server/resources/printResultShort.jsp

 </div>
 
 <jsp:include page="startButton.jsp"/>
+
+<script type="text/javascript">
+  BS.projectId = "${bean.project.projectId}";
+</script>

File server/resources/testDetails.jsp

           <div>Diagnosis: test run differently in builds with same sources:</div>
 
           <table class="modificationBuilds">
-            <c:set var="build" value="${testDetails.failedInBuild}"/>
             <tr class="buildTypeProblem">
               <td class="fail">Failed in:</td>
-              <td class="bt"><bs:buildTypeLink buildType="${build.buildType}"/></td>
-              <td class="build"><%@ include file="/changeBuild.jspf" %></td>
+              <bs:changeRequest key="build" value="${testDetails.failedInBuild}">
+                <jsp:include page="buildTd.jsp"/>
+              </bs:changeRequest>
             </tr>
 
             <tr class="buildTypeProblem">
-              <c:set var="build" value="${testDetails.successfulInBuild}"/>
               <td class="success">Successful in:</td>
-              <td class="bt"><bs:buildTypeLink buildType="${build.buildType}"/></td>
-              <td class="build"><%@ include file="/changeBuild.jspf" %></td>
+              <bs:changeRequest key="build" value="${testDetails.successfulInBuild}">
+                <jsp:include page="buildTd.jsp"/>
+              </bs:changeRequest>
             </tr>
           </table>
         </c:when>
     failure rate: <b><fmt:formatNumber value="${stats.first > 0 ? (stats.second / stats.first) * 100 : 0}"
                                        minFractionDigits="1"
                                        maxFractionDigits="1" />%</b>
-    <br>
-    Failure rates in different build configurations and agents:
+    <%--<br>
+    Failure rates in different build configurations and agents:--%>
   </div>
 
   <table>
     <tr>
       <td class="block">
         <div class="block">
-          <div class="title">Build Types</div>
+          <div class="title">Failure statistics by all build configurations</div>
           <div class="content">
             <table>
               <c:forEach items="${testDetails.allBuildTypes}" var="bt">
       </td>
       <td class="block">
         <div class="block">
-          <div class="title">Agents</div>
+          <div class="title">Failure statistics by all agents</div>
           <div class="content">
             <table>
               <c:forEach items="${testDetails.allAgents}" var="agent">

File server/src/jetbrains/buildServer/serverSide/flaky/web/TestWebDetails.java

 import jetbrains.buildServer.serverSide.flaky.data.Reason;
 import jetbrains.buildServer.serverSide.flaky.data.TestData;
 import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
 
 /**
  * @author Maxim Podkolzine (maxim.podkolzine@jetbrains.com)
     return myTestData.getReason() instanceof BuildsOnSameModificationReason;
   }
 
-  @NotNull
+  @Nullable
   public SBuild getFailedInBuild() {
     Reason reason = myTestData.getReason();
-    assert reason instanceof BuildsOnSameModificationReason;
+    if (!(reason instanceof BuildsOnSameModificationReason)) return null;
     long buildId = ((BuildsOnSameModificationReason)reason).getFailedInBuildId();
-    SBuild build = myBuildServer.findBuildInstanceById(buildId);
-    assert build != null;
-    return build;
+    return myBuildServer.findBuildInstanceById(buildId);
   }
 
-  @NotNull
+  @Nullable
   public SBuild getSuccessfulInBuild() {
     Reason reason = myTestData.getReason();
-    assert reason instanceof BuildsOnSameModificationReason;
+    if (!(reason instanceof BuildsOnSameModificationReason)) return null;
     long buildId = ((BuildsOnSameModificationReason)reason).getSuccessfulInBuild();
-    SBuild build = myBuildServer.findBuildInstanceById(buildId);
-    assert build != null;
-    return build;
+    return myBuildServer.findBuildInstanceById(buildId);
   }
 
   public boolean isSuspiciousStatisticsReason() {