aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorsimonbrandhof <simon.brandhof@gmail.com>2010-12-07 16:17:50 +0000
committersimonbrandhof <simon.brandhof@gmail.com>2010-12-07 16:17:50 +0000
commit0cd519b35d499f60fceec66f08dc7ca80301f127 (patch)
tree8c9a547da0ee1ce5c1bf20e9d139f1f705b42bec /plugins
parentc1cfffea2098a53ab078deb9bebe47b627c389cf (diff)
downloadsonarqube-0cd519b35d499f60fceec66f08dc7ca80301f127.tar.gz
sonarqube-0cd519b35d499f60fceec66f08dc7ca80301f127.zip
SONAR-1937 add the field 'age' to violations web service + display the select box to filter violations by period
Diffstat (limited to 'plugins')
-rw-r--r--plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java7
-rw-r--r--plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java2
2 files changed, 7 insertions, 2 deletions
diff --git a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java
index 772325dfa83..14cf189a9f0 100644
--- a/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java
+++ b/plugins/sonar-core-gwt/src/main/java/org/sonar/plugins/core/violationsviewer/client/ViolationsPanel.java
@@ -139,13 +139,16 @@ public class ViolationsPanel extends SourcePanel {
@Override
public String getColumn4() {
+ String age = "";
+ if (violation.getAge()!=null && violation.getAge()>0) {
+ age = " <span class='note'>(" + violation.getAge() + " days)</span>";
+ }
return "<div class=\"warn\">" + Icons.forPriority(violation.getPriority()).getHTML() + "</img> "
- + Utils.formatDate(violation.getCreatedAt())
+ " <a href=\"" + Links.urlForRule(violation.getRuleKey(), false)
+ "\" onclick=\"window.open(this.href,'rule','height=800,width=900,scrollbars=1,resizable=1');return false;\" title=\""
+ violation.getRuleKey() + "\"><b>"
+ Utils.escapeHtml(violation.getRuleName()) + "</b></a> : "
- + Utils.escapeHtml(violation.getMessage()) + "</div>";
+ + Utils.escapeHtml(violation.getMessage()) + age + "</div>";
}
}
diff --git a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java
index f119344ba32..d7f586d3993 100644
--- a/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java
+++ b/plugins/sonar-core-plugin/src/main/java/org/sonar/plugins/core/timemachine/TimeMachineConfigurationPersister.java
@@ -40,9 +40,11 @@ public final class TimeMachineConfigurationPersister implements BatchExtension {
public void start() {
List<PastSnapshot> variationSnapshots = configuration.getProjectPastSnapshots();
for (PastSnapshot variationSnapshot : variationSnapshots) {
+ projectSnapshot = session.reattach(Snapshot.class, projectSnapshot.getId());
projectSnapshot.setVariationMode(variationSnapshot.getIndex(), variationSnapshot.getMode());
projectSnapshot.setVariationModeParam(variationSnapshot.getIndex(), variationSnapshot.getModeParameter());
session.save(projectSnapshot);
}
+ session.commit();
}
}