Skip to content

Commit

Permalink
Merge pull request #112 from sonatype-nexus-community/allow_view_metr…
Browse files Browse the repository at this point in the history
…ics_without_success_metrics

Remove requirement for success metrics in web view
  • Loading branch information
rpanman-sonatype authored Feb 11, 2023
2 parents ebdc96f + 1bbf1e3 commit 4f787ab
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 67 deletions.
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,9 @@ There are two modes to the application.

The view-metrics script processes metrics stored in the `./nexusiq` directory and presents them as detailed aggregated charts in a web view or in data files in the `./datafiles` directory.

⚠ There must be a `successmetrics.csv` in the `./iqmetrics` directory.
⚠ In order to aggregate and process success metrics a minimum of three data points (weeks or months) are needed.

⚠ In order to aggregate and process metrics a minimum of three data points (weeks or months) are needed.

⚠ Only fully completed months (or weeks) are included in the data extract.
⚠ Only fully completed months (or weeks) are included in the success metrics data extract.

### View-metrics configuration

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Objects;

@SpringBootApplication
@EnableJpaRepositories
Expand Down Expand Up @@ -78,24 +79,19 @@ public void run(String... args) throws Exception {

successMetricsFileLoaded = loaderService.loadAllMetrics(activeProfile);

if (isSuccessMetricsFileLoaded()) {
if (runMode.contains("SERVLET")) {
// web app
this.startUp();
if (runMode.contains("SERVLET")) {
// web app
this.startUp();
} else {
// non-interactive mode
this.timestamp =
DateTimeFormatter.ofPattern("ddMMyy_HHmm")
.format(LocalDateTime.now(ZoneId.systemDefault()));
if (Objects.equals(activeProfile, "data")) {
createDataFiles();
} else {
// non-interactive mode
this.timestamp =
DateTimeFormatter.ofPattern("ddMMyy_HHmm")
.format(LocalDateTime.now(ZoneId.systemDefault()));
if ("data".equals(activeProfile)) {
createDataFiles();
} else {
log.error("unknown profile");
}
log.error("unknown profile");
}
} else {
log.error("No data files found");
System.exit(-1);
}
}

Expand Down
43 changes: 19 additions & 24 deletions view-metrics/src/main/resources/templates/home.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,45 +12,40 @@
<div class="text-center">

<div th:if="${successmetricsreport}">
<a th:href="@{summary.html}">Summary Report <em>(anonymised)</em></a>
<br><br>
<a th:href="@{applications.html}">Applications Report</a>
<br><br>
<a th:href="@{securityviolations.html}">Security Violations Report</a>
<br><br>
<a th:href="@{licenseviolations.html}">License Violations Report</a>
<br><br>
<!--
<a th:href="@{analysis}">Insights Analysis Data</a>
<br><br>
</div>
-->
<a th:href="@{summary.html}">Summary Report <em>(anonymised)</em></a>
<br><br>
<a th:href="@{applications.html}">Applications Report</a>
<br><br>
<a th:href="@{securityviolations.html}">Security Violations Report</a>
<br><br>
<a th:href="@{licenseviolations.html}">License Violations Report</a>
<br><br>
</div>

<div th:if="${firewallreport}">
<a th:href="@{firewall.html}">Firewall Report</a>
<br><br>
</div>

<div th:if="${policyViolationsreport}">
<a th:href="@{violationsage.html}">Policy Violations Report</a>
<br><br>
</div>
<div th:if="${policyViolationsreport}">
<a th:href="@{violationsage.html}">Policy Violations Report</a>
<br><br>
</div>

<div th:if="${applicationEvaluationsreport}">
<a th:href="@{evaluations.html}">Application Evaluations Report</a>
<br><br>
<div th:if="${applicationEvaluationsreport}">
<a th:href="@{evaluations.html}">Application Evaluations Report</a>
<br><br>
</div>

<div th:if="${componentWaiversReport}">
<a th:href="@{waivers.html}">Component Waivers Report</a>
<br><br>
</div>

<div th:if="${smdatabase}">
<a th:href="@{/h2}">Database</a>
</div>
<div th:if="${smdatabase}">
<a th:href="@{/h2}">Database</a>
</div>

</div>
</div>

</body>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,44 +154,39 @@
<div class="text-center">

<div>
<a href="summary.html">Summary Report <em>(anonymised)</em></a>
<br><br>
<a href="applications.html">Applications Report</a>
<br><br>
<a href="securityviolations.html">Security Violations Report</a>
<br><br>
<a href="licenseviolations.html">License Violations Report</a>
<br><br>
<!--
<a th:href="@{analysis}">Insights Analysis Data</a>
<br><br>
</div>
-->
<a href="summary.html">Summary Report <em>(anonymised)</em></a>
<br><br>
<a href="applications.html">Applications Report</a>
<br><br>
<a href="securityviolations.html">Security Violations Report</a>
<br><br>
<a href="licenseviolations.html">License Violations Report</a>
<br><br>
</div>

<div>
<a href="firewall.html">Firewall Report</a>
<br><br>
</div>

<div>
<a href="violationsage.html">Policy Violations Report</a>
<br><br>
</div>
<div>
<a href="violationsage.html">Policy Violations Report</a>
<br><br>
</div>

<div>
<a href="evaluations.html">Application Evaluations Report</a>
<br><br>
<div>
<a href="evaluations.html">Application Evaluations Report</a>
<br><br>
</div>

<div>
<a href="waivers.html">Component Waivers Report</a>
<br><br>
</div>


</div>
</div>

</body>
</html>
</html>

0 comments on commit 4f787ab

Please sign in to comment.