measure_filter.private=Private
measure_filter.manage.shared_filters=Shared Filters
measure_filter.manage.my_filters=My Filters
-measure_filter.criteria.what=What?
+measure_filter.criteria.what=What? Projects, files...
measure_filter.criteria.age=Age
measure_filter.criteria.date=Date
measure_filter.criteria.only_favourites=Favourites only
import org.apache.commons.lang.StringUtils;
-import java.sql.Date;
+import java.sql.Timestamp;
public class MeasureFilterRow {
private final long snapshotId;
private final long resourceId;
private final long resourceRootId;
private String sortText = null;
- private Date sortDate = null;
+ private Timestamp sortDate = null;
private Double sortDouble = null;
MeasureFilterRow(long snapshotId, long resourceId, long resourceRootId) {
this.sortText = StringUtils.defaultString(s);
}
- Date getSortDate() {
+ Timestamp getSortDate() {
return sortDate;
}
- void setSortDate(Date sortDate) {
+ void setSortDate(Timestamp sortDate) {
this.sortDate = sortDate;
}
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
-import com.google.common.primitives.Doubles;
import org.apache.commons.lang.StringEscapeUtils;
import org.apache.commons.lang.StringUtils;
import org.sonar.core.persistence.Database;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
+import java.sql.Timestamp;
import java.util.Comparator;
import java.util.List;
}
Ordering sortFieldOrdering(boolean ascending) {
- if (ascending) {
- return Ordering.from(new Comparator<Double>() {
- public int compare(@Nullable Double left, @Nullable Double right) {
- if (left == null) {
- return 1;
- }
- if (right == null) {
- return -1;
- }
-
- return Doubles.compare(left, right);
- }
- });
- }
- return Ordering.from(new Comparator<Double>() {
- public int compare(@Nullable Double left, @Nullable Double right) {
- if (left == null) {
- return 1;
- }
- if (right == null) {
- return -1;
- }
-
- return -Doubles.compare(left, right);
- }
- });
+ return newObjectOrdering(ascending);
}
}
static class DateSortRowProcessor extends RowProcessor {
MeasureFilterRow fetch(ResultSet rs) throws SQLException {
MeasureFilterRow row = new MeasureFilterRow(rs.getLong(1), rs.getLong(2), rs.getLong(3));
- row.setSortDate(rs.getDate(4));
+ row.setSortDate(rs.getTimestamp(4));
return row;
}
Function sortFieldFunction() {
- return new Function<MeasureFilterRow, Date>() {
- public Date apply(MeasureFilterRow row) {
+ return new Function<MeasureFilterRow, Timestamp>() {
+ public Timestamp apply(MeasureFilterRow row) {
return row.getSortDate();
}
};
}
Ordering sortFieldOrdering(boolean ascending) {
- if (ascending) {
- return Ordering.from(new Comparator<Date>() {
- public int compare(@Nullable Date left, @Nullable Date right) {
- if (left == null) {
- return 1;
- }
- if (right == null) {
- return -1;
- }
-
- return left.compareTo(right);
- }
- });
- }
- return Ordering.from(new Comparator<Date>() {
- public int compare(@Nullable Date left, @Nullable Date right) {
+ return newObjectOrdering(ascending);
+ }
+ }
+
+ private static Ordering newObjectOrdering(boolean ascending) {
+ if (ascending) {
+ return Ordering.from(new Comparator<Comparable>() {
+ public int compare(@Nullable Comparable left, @Nullable Comparable right) {
if (left == null) {
return 1;
}
return -1;
}
- return -left.compareTo(right);
+ return left.compareTo(right);
}
});
}
+ return Ordering.from(new Comparator<Comparable>() {
+ public int compare(@Nullable Comparable left, @Nullable Comparable right) {
+ if (left == null) {
+ return 1;
+ }
+ if (right == null) {
+ return -1;
+ }
+
+ return -left.compareTo(right);
+ }
+ });
}
}
require 'set'
class MeasureFilterDisplayList < MeasureFilterDisplay
KEY = :list
- MAX_PAGE_SIZE = 200
+ MAX_PAGE_SIZE = 250
class Column
attr_reader :key, :metric, :period
filter.set_criteria_default_value(:cols, ['metric:alert_status', 'name', 'date', 'metric:ncloc', 'metric:violations', 'links'])
filter.set_criteria_default_value(:sort, 'name')
filter.set_criteria_default_value(:asc, true)
- filter.set_criteria_default_value(:pageSize, 30)
+ filter.set_criteria_default_value(:pageSize, 100)
filter.set_criteria_value(:pageSize, MAX_PAGE_SIZE) if filter.criteria(:pageSize).to_i>MAX_PAGE_SIZE
@columns = []
<% @filter.errors.each do |attr, msg| %>
<p class="error"><%= h msg -%></p>
<% end %>
- <div class="form-field">
- <label>Copy</label>
- <input type="text" size="50" maxlength="100" value="<%= h @filter.name -%>" disabled="disabled"/>
- </div>
<div class="form-field">
<label for="name"><%= h message('name') -%> <em class="mandatory">*</em></label>
<input id="name" name="name" type="text" size="50" maxlength="100" value=""/>
<div id="measure_filter_list<%= widget_id -%>">
<% content_for :script do %>
<script>
+ var filterCriteria<%= widget_id -%> = <%= filter.criteria.to_json -%>;
+
function refreshList<%= widget_id -%>(sort, asc, page) {
$j('#measure_filter_foot<%= widget_id -%>_pages').hide();
$j('#measure_filter_foot<%= widget_id -%>_loading').show();
- filterCriteria['sort']=sort;
- filterCriteria['asc']=asc;
- filterCriteria['page']=page;
- var url=baseUrl + '/measures/search/?' + $j.param(filterCriteria);
+ filterCriteria<%= widget_id -%>['sort']=sort;
+ filterCriteria<%= widget_id -%>['asc']=asc;
+ filterCriteria<%= widget_id -%>['page']=page;
+ var url=baseUrl + '/measures/search/<%= filter.id -%>?widget_id=<%= widget_id -%>&' + $j.param(filterCriteria<%= widget_id -%>);
<% if widget_id %>
$j('#measure_filter_list<%= widget_id -%>').load(url);
}
}
function rightCol(id) {
- var cols = filterCriteria['cols']||[];
+ var cols = filterCriteria<%= widget_id -%>['cols']||[];
var cell = $j('#measures-table tr td[index=' + id + ']');
var columnIndex = cell.parent().children().index(cell);
}
}
function moveCol(from, to) {
- var cols = filterCriteria['cols']||[];
+ var cols = filterCriteria<%= widget_id -%>['cols']||[];
var temp = cols[from-colOffset];
cols[from-colOffset] = cols[to-colOffset];
cols[to-colOffset] = temp;
});
}
function deleteCol(id) {
- var cols = filterCriteria['cols']||[];
+ var cols = filterCriteria<%= widget_id -%>['cols']||[];
var cell = $j('#measures-table tr td[index=' + id + ']');
var columnIndex = cell.parent().children().index(cell);
cols.splice(columnIndex-colOffset, 1);
});
$j("#add-metric").on("click", function (e) {
- var cols = filterCriteria['cols']||[];
+ var cols = filterCriteria<%= widget_id -%>['cols']||[];
var columnKey = $j("#select-metric option:selected").val();
var period = $j("#select-period option:selected").val();
if (period.length > 0) {
}
cols.push(columnKey);
filterCriteria['edit']='true';
- window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria);
+ window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
$j("#exit-edit").on("click", function (e) {
delete filterCriteria['edit'];
- window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria);
+ window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
});
</script>
+<script>
+ var filterCriteria<%= widget_id -%> = <%= filter.criteria.to_json -%>;
+</script>
<%
treemap_id = (defined? widget) ? widget.id : 1
unless edit_mode
<script>
$j(document).ready(function () {
$j("#update-treemap").on("click", function (e) {
- filterCriteria['tmSize']=$j('#select-tm-size').val();
+ filterCriteria<%= widget_id -%>['tmSize']=$j('#select-tm-size').val();
var color = $j('#select-tm-color').val();
if (color != null && color != '') {
- filterCriteria['tmColor']=color;
+ filterCriteria<%= widget_id -%>['tmColor']=color;
}
- filterCriteria['edit']=true;
- window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria);
+ filterCriteria<%= widget_id -%>['edit']=true;
+ window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
$j("#exit-edit").on("click", function (e) {
- delete filterCriteria['edit'];
- window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria);
+ delete filterCriteria<%= widget_id -%>['edit'];
+ window.location = baseUrl + '/measures/search/<%= filter.id -%>?' + $j.param(filterCriteria<%= widget_id -%>);
});
});
</script>
-<div>
+<div xmlns="http://www.w3.org/1999/html">
<div class="page-split-left">
<%= render :partial => 'measures/sidebar' -%>
</div>
<% if @filter && @filter.display %>
- <script>var filterCriteria = <%= @filter.criteria.to_json -%>;</script>
-
<div class="page-split-right">
<div id="content">
<div class="line-block marginbottom10">
</ul>
<div class="page_title" id="filter-title">
<% if @filter.id && @filter.name.present? %>
+ <p>
<span class="h3"><%= h @filter.name -%></span>
<span class="note">
<% if !@filter.shared %>
[<%= message 'shared_by' -%> Sonar]
<% end %>
</span>
- <% if @filter.description.present? %>
- - <span class="note"><%= h @filter.description -%></span>
- <% end %>
<% if @filter.owner?(current_user) %>
- <a href="<%= url_for :action => 'edit_form', :id => @filter.id -%>" class="open-modal" id="edit-filter"><%= image_tag 'pencil-small.png', :alt => message('edit') -%></a>
+ <a href="<%= url_for :action => 'edit_form', :id => @filter.id -%>" class="open-modal" id="edit-filter"><%= image_tag 'pencil-small.png', :alt => message('edit') -%></a>
+ <% end %>
+ </p>
+ <% if @filter.description.present? %>
+ <p class="note"><%= h @filter.description -%></p>
<% end %>
+
<% end %>
</div>
</div>
}
#body {
-/* position: relative;*/
+ /* position: relative;*/
}
#footer {
#sidebar {
width: 150px;
- float:left;
+ float: left;
margin: 0 0 0 10px;
top: 0;
left: 0;
margin: 0;
padding: 0;
}
+
ul.sidebar select, ul.sidebar input {
font-size: 93%;
}
-
#logo {
text-align: center;
padding: 10px 0 0 0;
max-width: 200px;
width: 200px;
margin: 0;
- display: block;
+ display: table-cell;
vertical-align: top;
border-top: none;
border-left: none;
- float: left;
}
.page-split-right {
- display: block;
+ position: relative;
+ display: table-cell;
margin: 0;
vertical-align: top;
- padding: 0 0 0 200px;
+ padding: 0;
+ width: 100%;
}
.gray-sidebar {