Skip to content

Commit

Permalink
Merge pull request #149 from q-rapids/develop
Browse files Browse the repository at this point in the history
Release v1.4
  • Loading branch information
alejandravv committed Jun 16, 2020
2 parents 765e2d6 + d1fc8be commit 06dacaf
Show file tree
Hide file tree
Showing 24 changed files with 12,548 additions and 264 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ apply plugin: 'jacoco'
apply plugin: 'org.asciidoctor.convert'

group = 'com.upc.gessi.qrapids'
version = '1.3'
version = '1.4'
sourceCompatibility = 1.8

war {
Expand Down
21 changes: 18 additions & 3 deletions docs/asciidoc/index.adoc
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
= Q-Rapids Dashboard API REST Documentation
v1.3, {docdate}
v1.4, {docdate}
:toc: left

:sectnums:
Expand Down Expand Up @@ -57,6 +57,21 @@ include::{snippets}/si/historical-conflict/http-response.adoc[]
include::{snippets}/si/historical-read-error/http-response.adoc[]
:numbered:

=== Get current and historical evaluation

operation::si/current_and_historical[snippets='request-parameters,curl-request,response-fields,http-response']

:numbered!:
==== HTTP response wrong project
include::{snippets}/alerts/get-all-wrong-project/http-response.adoc[]

==== HTTP response categories error
include::{snippets}/si/historical-conflict/http-response.adoc[]

==== HTTP response error on ElasticSearch connection
include::{snippets}/si/historical-read-error/http-response.adoc[]
:numbered:


=== Get prediction evaluation

Expand Down Expand Up @@ -279,7 +294,7 @@ include::{snippets}/alerts/add-qr-from-alert-backlog-error/http-response.adoc[]

=== Get historical evaluation

operation::qf/current[snippets='request-parameters,curl-request,response-fields,http-response']
operation::qf/historical[snippets='request-parameters,curl-request,response-fields,http-response']

:numbered!:

Expand All @@ -294,7 +309,7 @@ include::{snippets}/alerts/add-qr-from-alert-backlog-error/http-response.adoc[]

=== Get historical evaluation for strategic indicator

operation::qf/current-si[snippets='path-parameters,request-parameters,curl-request,response-fields,http-response']
operation::qf/historical-si[snippets='path-parameters,request-parameters,curl-request,response-fields,http-response']

:numbered!:

Expand Down
559 changes: 411 additions & 148 deletions docs/asciidoc/index.html

Large diffs are not rendered by default.

11,416 changes: 11,345 additions & 71 deletions docs/index.html

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion sonar-project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ sonar.projectKey=q-rapids_qrapids-dashboard

sonar.projectName=qrapids-dashboard

sonar.projectVersion=1.3
sonar.projectVersion=1.4

sonar.sources=src/main/java
sonar.tests=src/test/java
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,170 @@
package com.upc.gessi.qrapids.app.presentation.rest.dto;

import com.upc.gessi.qrapids.app.domain.controllers.StrategicIndicatorsController;
import org.springframework.data.util.Pair;

import java.time.LocalDate;
import java.util.List;

public class DTOSICurrentHistoricEvaluation {
//class attributes
private String id;
private Long dbId;
private String prjName;
private String name;
private String description;
private Pair<Float, String> currentValue;
private String currentValueDescription;
private String currentRationale;
private LocalDate currentDate;
private List<DTOSIAssessment> probabilities;
private List<DTOHistoricalData> historicalDataList;

public static class DTOHistoricalData {
private Pair<Float, String> value;
private String valueDescription;
private String rationale;
private LocalDate date;

public DTOHistoricalData(Pair<Float, String> value, String rationale, LocalDate date) {
setValue(value);
this.valueDescription = StrategicIndicatorsController.buildDescriptiveLabelAndValue(value);
setRationale(rationale);
setDate(date);
}

public void setValue(Pair<Float, String> value) {
this.value = value;
}

public Pair<Float, String> getValue() {
return value;
}

public String getValueDescription() {
return valueDescription;
}

public void setValueDescription(String valueDescription) {
this.valueDescription = valueDescription;
}

public void setRationale(String rationale) {
this.rationale = rationale;
}

public String getRationale() {
return rationale;
}

public void setDate(LocalDate date) {
this.date = date;
}

public LocalDate getDate() {
return date;
}
}

public DTOSICurrentHistoricEvaluation(String id, String prjName, String name, String description, Pair<Float, String> value, Long dbId,
String rationale, List<DTOSIAssessment> probabilities, LocalDate date) {
setId(id);
setPrjName(prjName);
setName(name);
setDescription(description);
setCurrentValue(value);
setCurrentRationale(rationale);
setProbabilities(probabilities);
setCurrentDate(date);
setDbId(dbId);
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public Long getDbId() {
return dbId;
}

public void setDbId(Long dbId) {
this.dbId = dbId;
}

public String getPrjName() {
return prjName;
}

public void setPrjName(String prjName) {
this.prjName = prjName;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
if (description != null)
this.description = description;
}

public Pair<Float, String> getCurrentValue() {
return currentValue;
}

public String getCurrentValueDescription() { return currentValueDescription;}

private void setCurrentValueDescription(Pair<Float, String> value) {
this.currentValueDescription = StrategicIndicatorsController.buildDescriptiveLabelAndValue(value);
}

public void setCurrentValue(Pair<Float, String> value) {
this.currentValue = value;
setCurrentValueDescription(value);
}

public void setCurrentRationale(String rationale) {
this.currentRationale = rationale;
}

public String getCurrentRationale() {
return currentRationale;
}

public List<DTOSIAssessment> getProbabilities() {
return probabilities;
}

public void setProbabilities(List<DTOSIAssessment> probabilities) {
this.probabilities = probabilities;
}

public LocalDate getCurrentDate() {
return currentDate;
}

public void setCurrentDate(LocalDate date) {
this.currentDate = date;
}

public List<DTOHistoricalData> getHistoricalDataList() {
return historicalDataList;
}

public void setHistoricalDataList(List<DTOHistoricalData> historicalData) {
this.historicalDataList = historicalData;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -507,4 +507,40 @@ public LocalDate getcurrentDate(@RequestParam(value = "prj") String prj) {
// if the response is null
return null;
}

@GetMapping("/api/strategicIndicators/current_and_historical")
@ResponseStatus(HttpStatus.OK)
public List<DTOSICurrentHistoricEvaluation> getStrategicIndicatorsCurrentHistoricEvaluation(@RequestParam(value = "prj", required=false) String prj, @RequestParam("from") String from, @RequestParam("to") String to) {
try {
Project project = projectsController.findProjectByExternalId(prj);
List<DTOStrategicIndicatorEvaluation> currentData = strategicIndicatorsController.getAllStrategicIndicatorsCurrentEvaluation(prj);
List<DTOStrategicIndicatorEvaluation> historicData = strategicIndicatorsController.getAllStrategicIndicatorsHistoricalEvaluation(prj, LocalDate.parse(from), LocalDate.parse(to));
List<DTOSICurrentHistoricEvaluation> result = new ArrayList<>();
int j = 0;
for (int i = 0; i < currentData.size(); i++) {
DTOStrategicIndicatorEvaluation aux = currentData.get(i);
DTOSICurrentHistoricEvaluation siInfo = new DTOSICurrentHistoricEvaluation(aux.getId(),project.getName(),aux.getName(),aux.getDescription(),
aux.getValue(), aux.getDbId(),aux.getRationale(),aux.getProbabilities(),aux.getDate());
List<DTOSICurrentHistoricEvaluation.DTOHistoricalData> siHistInfo = new ArrayList<>();
while (j < historicData.size() && aux.getId().equals(historicData.get(j).getId())) {
DTOStrategicIndicatorEvaluation histAux = historicData.get(j);
DTOSICurrentHistoricEvaluation.DTOHistoricalData histInfo = new DTOSICurrentHistoricEvaluation.DTOHistoricalData(histAux.getValue(),histAux.getRationale(),histAux.getDate());
siHistInfo.add(histInfo);
j++;
}
siInfo.setHistoricalDataList(siHistInfo);
result.add(siInfo);
}
return result;
} catch (ElasticsearchStatusException e) {
logger.error(e.getMessage(), e);
throw new ResponseStatusException(HttpStatus.BAD_REQUEST, Messages.PROJECT_NOT_FOUND);
} catch (CategoriesException | ProjectNotFoundException e) {
logger.error(e.getMessage(), e);
throw new ResponseStatusException(HttpStatus.CONFLICT, Messages.CATEGORIES_DO_NOT_MATCH);
} catch (IOException e) {
logger.error(e.getMessage(), e);
throw new ResponseStatusException(HttpStatus.INTERNAL_SERVER_ERROR, Messages.INTERNAL_SERVER_ERROR + e.getMessage());
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import javax.servlet.http.HttpServletResponse;
import java.time.LocalDate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

@RestController
Expand All @@ -25,6 +26,20 @@ public class Util {
@Value("${server.url}")
private String serverUrl;

// add jasterserver data
@Value("${jasperServer.url}")
private String jasperserverURL;
@Value("${jasperserver.user}")
private String jasperserverUser;
@Value("${jasperserver.password}")
private String jasperserverPassword;

@GetMapping("/api/jasperserverInfo")
@ResponseStatus(HttpStatus.OK)
public List<String> jasperserverInfo() {
return Arrays.asList(jasperserverURL, jasperserverUser, jasperserverPassword);
}

@GetMapping("/api/rawdataDashboard")
@ResponseStatus(HttpStatus.OK)
public String RawDataDashboard() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package com.upc.gessi.qrapids.app.presentation.web.mapping;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;

@Controller("/Reporting")
public class ReportingController {
@RequestMapping("/Reporting")
public String reporting(){ return "Reporting/Reporting"; }
}
10 changes: 4 additions & 6 deletions src/main/resources/static/css/products.css
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
@CHARSET "UTF-8";


#productView, #SIConfigView, #CategoriesConfigView {
#productView, #SIConfigView, #CategoriesConfigView, #ReportingView {
display: flex;
flex-direction: row;
}

#productTree, #SITree, #CategoriesElementSelector {
#productTree, #SITree, #CategoriesElementSelector, #ProjectSelector {
margin: 1%;
width: 21%;
}

#productInfo, #SIInfo, #Categories {
#productInfo, #SIInfo, #Categories, #ReportingInfo {
margin: 1%;
width: 75%;
display: flex;
flex-direction: column;
}

#productForm, #SIForm, #SICategories, #FactorsCategories, #MetricsCategories {
#productForm, #SIForm, #SICategories, #FactorsCategories, #MetricsCategories, #RedirectToReport, #tableREPdiv {
margin: 1%;
display: flex;
flex-direction: column;
Expand Down
7 changes: 7 additions & 0 deletions src/main/resources/static/css/stylesDashboard.css
Original file line number Diff line number Diff line change
Expand Up @@ -236,4 +236,11 @@ canvas {
border: 1px solid gray;
border-collapse: collapse;
padding: 5px;
}

col-reporting {
width: 50%;
float: left;
position: relative;
min-height: 1px;
}
5 changes: 5 additions & 0 deletions src/main/resources/static/js/navScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,9 @@ if ((currentURL.search("/StrategicIndicators/") !== -1 || currentURL.search("/Ed
} else if (currentURL.search("/Decisions") !== -1) {
id = "Decisions";
highlight(id);
} else if (currentURL.search("/Reporting") !== -1) {
id = "Reporting";
highlight(id);
} else if (currentURL.search("/QualityModel") !== -1) {
id = "QualityModel";
highlightAndSaveCurrentAssessment(id);
Expand Down Expand Up @@ -374,6 +377,8 @@ $("#usersConfig").attr("href", serverUrl + "/users");

$("#usergroupsConfig").attr("href", serverUrl + "/usergroups");

$("#Reporting").attr("href", serverUrl + "/Reporting");

$("#LogoutProfileConfig").attr("href", serverUrl + "/logout_user");
$("#LogoutProfileConfig").click(function () {
sessionStorage.removeItem("userName");
Expand Down
Loading

0 comments on commit 06dacaf

Please sign in to comment.