From eade9001d54cd9170fdfd0127f23414ae7a243b4 Mon Sep 17 00:00:00 2001 From: Simon Brandhof Date: Fri, 30 Nov 2012 09:20:25 +0100 Subject: [PATCH] SONAR-3825 remove MEASURE_FILTERS.SYSTEM and add breadcrumb --- .../resources/org/sonar/l10n/core.properties | 6 +- .../core/measure/MeasureFilterFactory.java | 2 +- .../org/sonar/core/persistence/schema-h2.ddl | 1 - .../sonar/core/resource/ResourceMapper.xml | 2 +- .../measure/MeasureFilterDecoderTest.java | 2 +- .../app/controllers/measures_controller.rb | 12 +- .../system_measure_filters_controller.rb | 61 ----- .../WEB-INF/app/helpers/application_helper.rb | 5 + .../app/views/layouts/_breadcrumb.html.erb | 2 +- .../app/views/layouts/_layout.html.erb | 4 +- .../app/views/measures/_filters.html.erb | 23 -- .../app/views/measures/manage.html.erb | 208 +++++++------- .../app/views/measures/search.html.erb | 256 +++++++++--------- .../system_measure_filters/index.html.erb | 71 ----- .../db/migrate/356_create_measure_filters.rb | 1 - .../357_move_existing_measure_filters.rb | 3 +- .../src/main/webapp/stylesheets/layout.css | 12 +- .../src/main/webapp/stylesheets/style.css | 37 +-- 18 files changed, 249 insertions(+), 459 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/controllers/system_measure_filters_controller.rb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/measures/_filters.html.erb delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/system_measure_filters/index.html.erb diff --git a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties index fad4634ba8f..ab22ca13791 100644 --- a/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties +++ b/plugins/sonar-core-plugin/src/main/resources/org/sonar/l10n/core.properties @@ -190,6 +190,7 @@ greater_than=Greater than help_tips=Help tips less_or_equals=Less or equals less_than=Less than +manage=Manage move_left=Move left move_right=Move right new_violations=New violations @@ -355,7 +356,6 @@ resource_deletion.page={0} Deletion update_key.page=Update Key project_quality_profiles.page=Quality Profiles bulk_deletion.page=Bulk Deletion -system_measure_filters.page=System Measure Filters comparison.page=Comparison @@ -399,13 +399,11 @@ measure_filter.name_too_long=Name is too long measure_filter.sharing=Sharing measure_filter.delete_confirm_title=Delete Filter measure_filter.are_you_sure_want_delete_filter_x=Are you sure that you want to delete the filter "{0}"? -measure_filter.remove_from_system=Remove from system -measure_filter.add_to_system=Add to system measure_filter.title_shared_filters=Shared Filters -measure_filter.title_system_filters=System Filters measure_filter.key_like=Key like measure_filter.name_contains=Name contains measure_filter.only_favourites=Favourites only +measure_filter.manage_filters=Manage Filters #------------------------------------------------------------------------------ # diff --git a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterFactory.java b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterFactory.java index e951420881c..f81086d5c86 100644 --- a/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterFactory.java +++ b/sonar-core/src/main/java/org/sonar/core/measure/MeasureFilterFactory.java @@ -54,7 +54,7 @@ public class MeasureFilterFactory implements ServerComponent { if (properties.containsKey("onBaseComponents")) { filter.setOnBaseResourceChildren(Boolean.valueOf((String) properties.get("onBaseComponents"))); } - filter.setResourceName((String) properties.get("nameRegexp")); + filter.setResourceName((String) properties.get("nameSearch")); filter.setResourceKeyRegexp((String) properties.get("keyRegexp")); if (properties.containsKey("fromDate")) { filter.setFromDate(toDate((String) properties.get("fromDate"))); diff --git a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl index 8ad5551c6d3..76f26b33d85 100644 --- a/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl +++ b/sonar-core/src/main/resources/org/sonar/core/persistence/schema-h2.ddl @@ -518,7 +518,6 @@ CREATE TABLE "SEMAPHORES" ( CREATE TABLE "MEASURE_FILTERS" ( "ID" INTEGER NOT NULL GENERATED BY DEFAULT AS IDENTITY (START WITH 1, INCREMENT BY 1), "NAME" VARCHAR(100) NOT NULL, - "SYSTEM" BOOLEAN, "SHARED" BOOLEAN NOT NULL DEFAULT FALSE, "USER_ID" INTEGER, "DESCRIPTION" VARCHAR(4000), diff --git a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml index 044da26c78f..3d14bcf1d62 100644 --- a/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml +++ b/sonar-core/src/main/resources/org/sonar/core/resource/ResourceMapper.xml @@ -79,7 +79,7 @@ select * from snapshots where id=#{id} - select s.* from snapshots s, projects p where p.kee=#{id} and p.enabled=${_true} and p.copy_resource_id is null and s.islast=${_true} and p.id=s.project_id diff --git a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterDecoderTest.java b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterDecoderTest.java index ce7ed550464..a4294dde995 100644 --- a/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterDecoderTest.java +++ b/sonar-core/src/test/java/org/sonar/core/measure/MeasureFilterDecoderTest.java @@ -74,7 +74,7 @@ public class MeasureFilterDecoderTest { assertThat(filter.sort().isAsc()).isTrue(); MeasureFilterCondition condition = filter.getMeasureConditions().get(0); assertThat(condition.metric().getKey()).isEqualTo("lines"); - assertThat(condition.operator()).isEqualTo(">"); + assertThat(condition.operator()).isEqualTo(MeasureFilterCondition.Operator.GREATER); assertThat(condition.value()).isEqualTo(123.0); } diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb index 7475ad4e401..ffe8afd23fd 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/controllers/measures_controller.rb @@ -19,18 +19,23 @@ # class MeasuresController < ApplicationController + ROOT_BREADCRUMB = {:name => Api::Utils.message('layout.measures'), :url => {:action => 'index'}} # GET /measures/index def index @filter = MeasureFilter.new + add_breadcrumbs(ROOT_BREADCRUMB) render :action => 'search' end def search + add_breadcrumbs(ROOT_BREADCRUMB) if params[:id] @filter = MeasureFilter.find(params[:id]) + add_breadcrumbs({:name => @filter.name, :url => {:action => 'filter', :id => @filter.id}}) else @filter = MeasureFilter.new + add_breadcrumbs(message('search_verb')) end @filter.criteria=(params) @filter.enable_default_display @@ -85,6 +90,7 @@ class MeasuresController < ApplicationController # GET /measures/manage def manage access_denied unless logged_in? + add_breadcrumbs(ROOT_BREADCRUMB, message('measure_filter.manage')) @shared_filters = MeasureFilter.find(:all, :include => :user, :conditions => ['shared=? and user_id<>?', true, current_user.id]) @@ -176,12 +182,6 @@ class MeasuresController < ApplicationController render :text => is_favourite.to_s, :status => 200 end - # GET /measures/filters - def filters - verify_ajax_request - render :partial => 'measures/filters' - end - private def find_filter(id) filter = MeasureFilter.find(id) diff --git a/sonar-server/src/main/webapp/WEB-INF/app/controllers/system_measure_filters_controller.rb b/sonar-server/src/main/webapp/WEB-INF/app/controllers/system_measure_filters_controller.rb deleted file mode 100644 index 43cebd75465..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/controllers/system_measure_filters_controller.rb +++ /dev/null @@ -1,61 +0,0 @@ -# -# Sonar, open source software quality management tool. -# Copyright (C) 2008-2012 SonarSource -# mailto:contact AT sonarsource DOT com -# -# Sonar is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# Sonar is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public -# License along with Sonar; if not, write to the Free Software -# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02 -# -class SystemMeasureFiltersController < ApplicationController - SECTION = Navigation::SECTION_CONFIGURATION - - # GET /system_measure_filters/index - def index - access_denied unless has_role?(:admin) - - @system_filters = MeasureFilter.find(:all, :include => :user, :conditions => ['system=?', true]) - Api::Utils.insensitive_sort!(@system_filters) { |f| f.name } - - @shared_filters = MeasureFilter.find(:all, :include => :user, :conditions => ['shared=? and system=?', true, false]) - end - - # POST /system_measure_filters/add/ - def add - verify_post_request - access_denied unless has_role?(:admin) - require_parameters :id - - filter = MeasureFilter.find(params[:id]) - filter.system=true - unless filter.save - flash[:error]=filter.errors.full_messages.join("
") - end - redirect_to :action => :index - end - - # POST /system_measure_filters/remove/ - def remove - verify_post_request - access_denied unless has_role?(:admin) - require_parameters :id - - filter = MeasureFilter.find(params[:id]) - filter.system=false - unless filter.save - flash[:error]=filter.errors.full_messages.join("
") - end - redirect_to :action => :index - end - -end diff --git a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb index e44991b4189..8a42d5e6545 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb +++ b/sonar-server/src/main/webapp/WEB-INF/app/helpers/application_helper.rb @@ -646,6 +646,8 @@ module ApplicationHelper # * :qualifiers - Array of resource qualifiers to filter. # * :resource_type_property -Filter on resource types on which the property is enabled, for example 'supportsGlobalDashboards'. # * :selected_resource - the resource that is selected by default. + # * :placeholder - the label to display when nothing is selected + # * :select2_options - hash of select2 options # def resource_select_tag(name, options={}) width=options[:width] @@ -673,6 +675,7 @@ module ApplicationHelper 'formatSearching' => "function(){return '#{escape_javascript message('select2.searching')}'}", 'formatInputTooShort' => "function(term, minLength){return '#{escape_javascript message('select2.tooShort', :params => [min_length])}'}" } + js_options['placeholder']= "'#{options[:placeholder]}'" if options.has_key?(:placeholder) js_options['width']= "'#{width}'" if width js_options['ajax']='{' + ajax_options.map { |k, v| "#{k}:#{v}" }.join(',') + '}' js_options.merge!(options[:select2_options]) if options[:select2_options] @@ -700,6 +703,7 @@ module ApplicationHelper # * :html_id - The id of the HTML element. Default is the name. # * :key_prefix - Prefix added to metric keys. Default is '' # * :extra_values - + # * :placeholder - the label to display when nothing is selected # def metric_select_tag(name, metrics, options={}) width=options[:width]||'250px' @@ -729,6 +733,7 @@ module ApplicationHelper h end end + js_options['placeholder']= "'#{options[:placeholder]}'" if options.has_key?(:placeholder) key_prefix = options[:key_prefix]||'' metrics.sort_by(&:short_name).inject(metrics_by_domain) do |h, metric| diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb index 6877f148f05..b7c9b716440 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_breadcrumb.html.erb @@ -22,7 +22,7 @@ icon = breadcrumb[:icon] %> <% if icon %><% end %> - <%= link_to_if url, name, url -%> + <%= link_to_if url, h(name), url -%> <% elsif breadcrumb.respond_to?(:html) %> <%= breadcrumb.html -%> <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb index e35d9b54758..1ae072d79b6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_layout.html.erb @@ -144,8 +144,6 @@ <%= message('manual_rules.page') -%>
  • <%= message('default_dashboards.page') -%>
  • -
  • - <%= message('system_measure_filters.page') -%>
  • <% controller.java_facade.getPages(Navigation::SECTION_CONFIGURATION, nil, nil, nil, nil).each do |page| page_url = (page.isController() ? page.getId() : "/plugins/configuration/#{page.getId()}") %> @@ -193,7 +191,7 @@ <% end %> <% end %> -
    +
    > <% if @project %>

    <%= @project.name(true) %>

    <% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_filters.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_filters.html.erb deleted file mode 100644 index 6a4e4523a7f..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/_filters.html.erb +++ /dev/null @@ -1,23 +0,0 @@ -
      - <% - system_filters = Api::Utils.insensitive_sort(MeasureFilter.find(:all, :include => :user, :conditions => ['system=?', true])) { |f| f.name } - system_filters.each do |filter| %> -
    • - <%= h filter.name -%> -
    • - <% end %> -
    - -<% if logged_in? %> -
    -
    My Favourites
    -
      - <% current_user.favourited_measure_filters.each do |filter| %> -
    • - <%= h filter.name -%> -
    • - <% end %> -
    -
    - Manage -<% end %> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb index 4549dbbff09..373ddf45969 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/manage.html.erb @@ -16,7 +16,6 @@ star.removeClass('fav').addClass('notfav'); star.attr('title', '<%= escape_javascript message('click_to_add_to_favourites') -%>'); } - $j('#filters-sidebar').load(baseUrl + '/measures/filters'); } }); }); @@ -24,124 +23,99 @@ <% end %> -
    -
    - - -
    - <%= render :partial => 'measures/filters' -%> -
    -
    - -
    -

    My Measure Filters

    - - - - - - - +

    My Measure Filters

    +
    <%= message('name') -%><%= message('measure_filter.sharing') -%><%= message('operations') -%>
    + + + + + + + + + + <% if current_user.measure_filters.empty? %> + + + + <% else %> + <% current_user.measure_filters.each do |filter| %> + + + + + - - - <% if current_user.measure_filters.empty? %> - - - - <% else %> - <% current_user.measure_filters.each do |filter| %> - - - - - - - <% end %> - <% end %> - -
    <%= message('name') -%><%= message('measure_filter.sharing') -%><%= message('operations') -%>
    <%= message('filters.no_filters') -%>
    + <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> + + <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> + <% if filter.description %> +
    <%= h filter.description -%>
    + <% end %> +
    + <% if filter.shared %> + Shared with all users + <% else %> + Private + <% end %> + + <%= message('edit') -%> +   + <%= message('copy') -%> +   + <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", + :class => 'link-action link-red', + :id => "delete_#{filter.name.parameterize}", + :confirm_button => message('delete'), + :confirm_title => 'measure_filter.delete_confirm_title', + :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', + :confirm_msg_params => [filter.name] -%> +
    <%= message('filters.no_filters') -%>
    - <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> -
    <%= h filter.description -%>
    - <% end %> -
    - <% if filter.shared %> - Shared with all users - <% else %> - Private - <% end %> - - <%= message('edit') -%> -   - <%= message('copy') -%> -   - <%= link_to_action message('delete'), "#{ApplicationController.root_context}/measures/delete/#{filter.id}", - :class => 'link-action link-red', - :id => "delete_#{filter.name.parameterize}", - :confirm_button => message('delete'), - :confirm_title => 'measure_filter.delete_confirm_title', - :confirm_msg => 'measure_filter.are_you_sure_want_delete_filter_x', - :confirm_msg_params => [filter.name] -%> -
    - -
    - -

    Shared Measure Filters

    - - - - - - - + <% end %> + <% end %> + +
    <%= message('name') -%><%= message('shared_by') -%><%= message('operations') -%>
    + +
    + +

    Shared Measure Filters

    + + + + + + + + + + + <% if @shared_filters.empty? %> + + + + <% else %> + <% @shared_filters.each do |filter| %> + + + + + - - - <% if @shared_filters.empty? %> - - - - <% else %> - <% @shared_filters.each do |filter| %> - - - - - - - - <% end %> - <% end %> - -
    <%= message('name') -%><%= message('shared_by') -%><%= message('operations') -%>
    <%= message('filters.no_filters') -%>
    + <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> + + <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> + <% if filter.description %> +
    <%= h filter.description -%>
    + <% end %> +
    + <%= filter.user ? h(filter.user.name) : '-' -%> + + <%= message('copy') -%> +
    <%= message('filters.no_filters') -%>
    - <%= measure_filter_star(filter, @fav_filter_ids.include?(filter.id)) -%> - - <%= link_to h(filter.name), :action => 'filter', :id => filter.id -%> - <% if filter.description %> -
    <%= h filter.description -%>
    - <% end %> -
    - <%= filter.user ? h(filter.user.name) : '-' -%> - - <%= message('copy') -%> -
    - -
    - -
    - - - - - - - + <% end %> + <% end %> + + diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb index 92dfe690edd..eb0ab93c6a6 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb @@ -16,6 +16,14 @@ } <% end %> +<% + hidden_condition_indexes = [] + for i in 1..3 do + unless @filter.criteria("c#{i}_metric") && @filter.criteria("c#{i}_val") + hidden_condition_indexes << i + end + end +%> <% content_for :script do %> <% end %> -
    +
    - - + <% if logged_in? %> +
      + <% current_user.favourited_measure_filters.each do |filter| %> +
    • + <%= h filter.name -%> +
    • + <% end %> +
    + <%= message('manage') %> +
    + <% end %> +
    <% if @filter.id %> @@ -85,49 +107,40 @@ end end %> - +
    - - - - - - + > - - > + + - - > + - + > <% condition_metrics = Metric.all.select { |m| m.numeric? } %> - - - - - + <% for i in 1..3 %> + > + + + <% end %> + > - - - - - - - - + > - - + + @@ -193,46 +204,47 @@ <% if @filter.results && @filter.display %> -
    +
    +
    - <% if @filter.name %> -

    - <%= h @filter.name -%> - <% if @filter.description.present? %> - - <%= h @filter.description -%> - <% end %> -

    - <% end %> + <% if @filter.name %> +

    + <%= h @filter.name -%> + <% if @filter.description.present? %> + - <%= h @filter.description -%> + <% end %> +

    + <% end %> - <% - edit_mode = (params[:edit]=='true') - unless edit_mode - %> -
    - Base:
    - <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', :selected_resource => @filter.base_resource -%> -
    - On components:
    - <%= check_box_tag 'onBaseComponents', 'true', @filter.criteria['onBaseComponents'] -%> +
    + <%= resource_select_tag 'baseId', :resource_type_property => 'supportsGlobalDashboards', :width => '100%', :selected_resource => @filter.base_resource, :placeholder => 'Path' -%>
    - Qualifiers:
    +
    <% - qualifiers = Api::Utils.java_facade.getResourceTypesForFilter().map do |resource_type| + qualifiers = [['Components', 'components']].concat(Api::Utils.java_facade.getResourceTypesForFilter().map do |resource_type| [message("qualifiers.#{resource_type.getQualifier()}"), resource_type.getQualifier()] - end + end) %> - <%= select_tag 'qualifiers[]', options_for_select([[message('any'), '']].concat(qualifiers), @filter.criteria['qualifiers']||''), :size => 5, :multiple => true, :class => 'large-input' -%> + <%= select_tag 'qualifiers[]', options_for_select(qualifiers, @filter.criteria['qualifiers']||''), :multiple => true, :id => 'select-qualifiers' -%>
    - Language:
    - <% languages = [[message('any'), '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> - <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']||''), :size => 5, :multiple => true, :class => 'large-input' -%> + <% languages = [['', '']].concat(Api::Utils.languages.map { |lang| [lang.name, lang.key] }) %> + <%= select_tag 'languages[]', options_for_select(languages, @filter.criteria['languages']), :multiple => true, :id => 'select-lang', 'data-placeholder' => 'Languages' -%>
    +
    <%= message('measure_filter.name_contains') -%>:
    -
    +
    <%= message('measure_filter.key_like') -%>:
    <%= message 'measure_filter.only_favourites' %>:
    <%= check_box_tag 'onFavourites', 'true', @filter.criteria['onFavourites']=='true' -%> @@ -135,55 +148,53 @@
    -
    - <%= metric_select_tag 'c1_metric', condition_metrics, :allow_empty => true, :selected_key => @filter.criteria('c1_metric'), :width => '180px' -%> - <%= select_tag 'c1_period', options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria('c1_period')) -%> - <%= select_tag 'c1_op', options_for_select([['Equals', 'eq'], ['Less than', 'lt'], ['Less or equals', 'lte'], ['Greater than', 'gt'], ['Greater or equals', 'gte']], @filter.criteria('c1_op')) -%> - -

    -
    + <%= metric_select_tag "c#{i}_metric", condition_metrics, :allow_empty => true, :selected_key => @filter.criteria("c#{i}_metric"), :width => '100%', :placeholder => 'Metric' -%> + <%= select_tag "c#{i}_period", options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria("c#{i}_period")) -%> +
    + <%= select_tag "c#{i}_op", options_for_select([['=', 'eq'], ['<', 'lt'], ['<=', 'lte'], ['>', 'gt'], ['>=', 'gte']], @filter.criteria("c#{i}_op")) -%> + "> +
    + From date: +
    - <%= metric_select_tag 'c2_metric', condition_metrics, :allow_empty => true, :selected_key => @filter.criteria('c2_metric'), :width => '180px' -%> - <%= select_tag 'c2_period', options_for_select([['Value', ''], ['Period 1', '1'], ['Period 2', '2'], ['Period 3', '3']], @filter.criteria('c2_period')) -%> - <%= select_tag 'c2_op', options_for_select([['Equals', 'eq'], ['Less than', 'lt'], ['Less or equals', 'lte'], ['Greater than', 'gt'], ['Greater or equals', 'gte']], @filter.criteria('c2_op')) -%> - -

    -
    - From date:
    - -
    - To date:
    - + To date: +
    + year-month-day (2012-01-31)
    - More than:
    - days ago + More than + days ago +
    Within the last + days
    Within the last:
    - days +
    +
    -
    - + New search
    - - +
    - Display as: - <% MeasureFilterDisplay.keys.each do |display_key| %> - <%= link_to_if display_key!=@filter.display.key, display_key, params.merge(:action => 'search', :display => display_key, :id => @filter.id) -%> - <% end %> - - <%= message('configure') -%> - <% if logged_in? %> - <% if @filter.id==nil || @filter.user_id==current_user.id %> - <%= message('save') -%> + <% + edit_mode = (params[:edit]=='true') + unless edit_mode + %> + + + -
    + Display as: + <% MeasureFilterDisplay.keys.each do |display_key| %> + <%= link_to_if display_key!=@filter.display.key, display_key, params.merge(:action => 'search', :display => display_key, :id => @filter.id) -%> <% end %> - <% if @filter.id %> - <%= message('copy') -%> + + <%= message('configure') -%> + <% if logged_in? %> + <% if @filter.id==nil || @filter.user_id==current_user.id %> + <%= message('save') -%> + <% end %> + <% if @filter.id %> + <%= message('copy') -%> + <% end %> <% end %> - <% end %> -
    - <% end %> - <% if @filter.security_exclusions %> -

    <%= message('results_not_display_due_to_security') -%>

    - <% end %> - <%= render :partial => "measures/display_#{@filter.display.class::KEY}", :locals => {:edit_mode => edit_mode} -%> +
    + <% end %> + <% if @filter.security_exclusions %> +

    <%= message('results_not_display_due_to_security') -%>

    + <% end %> + <%= render :partial => "measures/display_#{@filter.display.class::KEY}", :locals => {:edit_mode => edit_mode} -%> +
    <% end %> -
    \ No newline at end of file diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/system_measure_filters/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/system_measure_filters/index.html.erb deleted file mode 100644 index 611351adecd..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/system_measure_filters/index.html.erb +++ /dev/null @@ -1,71 +0,0 @@ -

    <%= h message('measure_filter.title_system_filters') %>

    - - - - - - - - - - <% if @system_filters.empty? %> - - - - <% else %> - <% @system_filters.each do |filter| %> - - - - - - <% end %> - <% end %> - -
    <%= message('name') -%><%= message('shared_by') -%><%= message('operations') -%>
    <%= message('filters.no_filters') -%>
    - <%= link_to h(filter.name), :controller => 'measures', :action => 'filter', :id => filter.id -%> - <% if filter.description %> -
    <%= h filter.description -%>
    - <% end %> -
    - <%= filter.user ? h(filter.user.name) : '-' -%> - - <%= link_to message('measure_filter.remove_from_system'), {:action => :remove, :id => filter.id}, {:class => 'button', :method => :post} -%> -
    - -
    - -

    <%= h message('measure_filter.title_shared_filters') %>

    - - - - - - - - - - <% if @shared_filters.empty? %> - - - - <% else %> - <% @shared_filters.each do |filter| %> - - - - - - <% end %> - <% end %> - -
    <%= message('name') -%><%= message('shared_by') -%><%= message('operations') -%>
    <%= message('filters.no_filters') -%>
    - <%= link_to h(filter.name), :controller => 'measures', :action => 'filter', :id => filter.id -%> - <% if filter.description %> -
    <%= h filter.description -%>
    - <% end %> -
    - <%= filter.user ? h(filter.user.name) : '-' -%> - - <%= link_to message('measure_filter.add_to_system'), {:action => :add, :id => filter.id}, {:class => 'button', :method => :post} -%> -
    diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/356_create_measure_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/356_create_measure_filters.rb index b7066509f5f..30f5210435a 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/356_create_measure_filters.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/356_create_measure_filters.rb @@ -27,7 +27,6 @@ class CreateMeasureFilters < ActiveRecord::Migration t.column 'name', :string, :null => false, :limit => 100 t.column 'user_id', :integer, :null => true t.column 'shared', :boolean, :default => false, :null => false - t.column 'system', :boolean t.column 'description', :string, :null => true, :limit => 4000 t.column 'data', :text, :null => true t.timestamps diff --git a/sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb b/sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb index ca5b45c4422..de458816e19 100644 --- a/sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb +++ b/sonar-server/src/main/webapp/WEB-INF/db/migrate/357_move_existing_measure_filters.rb @@ -57,13 +57,12 @@ class MoveExistingMeasureFilters < ActiveRecord::Migration new_filter = MeasureFilter.new new_filter.name = old_filter.name new_filter.user_id = old_filter.user_id - new_filter.system = old_filter.user_id.nil? new_filter.shared = (old_filter.shared || old_filter.user_id.nil?) data = [] data << 'onFavourites=true' if old_filter.favourites data << "baseId=#{old_filter.resource_id}" if old_filter.resource_id data << "pageSize=#{old_filter.page_size}" if old_filter.page_size - data << "display=#{old_filter.default_value || 'list'}" + data << "display=#{old_filter.default_view || 'list'}" columns = [] asc = nil diff --git a/sonar-server/src/main/webapp/stylesheets/layout.css b/sonar-server/src/main/webapp/stylesheets/layout.css index caebd92a378..3b23ed5a9d0 100644 --- a/sonar-server/src/main/webapp/stylesheets/layout.css +++ b/sonar-server/src/main/webapp/stylesheets/layout.css @@ -218,11 +218,6 @@ body, a { margin: 0 8px; } -#content { - padding-top: 8px; - width: auto; -} - #sb { width: 150px; position: absolute; @@ -302,22 +297,23 @@ body, a { min-width: 180px; width: 180px; margin: 0; - -moz-box-sizing: border-box; display: table-cell; vertical-align: top; background-color: #EFEFEF; border: 1px solid #CCC; color: #666; line-height: 1.1em; - padding: 10px; + border-top: none; + border-left: none; + padding: 10px 5px; } .page-split-right { position: relative; - padding: 10px 0 0 10px; -moz-box-sizing: border-box; display: table-cell; margin: 0; vertical-align: top; width: 100%; + padding: 0 0 0 10px; } \ No newline at end of file diff --git a/sonar-server/src/main/webapp/stylesheets/style.css b/sonar-server/src/main/webapp/stylesheets/style.css index 698d1165c0e..fec5df6f81f 100644 --- a/sonar-server/src/main/webapp/stylesheets/style.css +++ b/sonar-server/src/main/webapp/stylesheets/style.css @@ -2268,7 +2268,7 @@ td.spacer-top { } select:not([multiple]) { - padding: 2px 5px; + padding: 1px 3px; } select.small-width { @@ -2386,39 +2386,4 @@ textarea.width100 { .property table.data > thead > tr > th { vertical-align: top; -} - -.nav-pills:before, .nav-pills:after { - content: ""; - display: table; - line-height: 0; -} - -.nav-pills:after { - clear: both; -} - -.nav-pills > li { - float: left; -} - -.nav-pills > li > a { - line-height: 14px; - margin-right: 2px; - padding-left: 10px; - padding-right: 10px; - display: block; -} - -.nav-pills > li > a { - border-radius: 5px 5px 5px 5px; - margin-bottom: 2px; - margin-top: 2px; - padding-bottom: 6px; - padding-top: 6px; -} - -.nav-pills > .active > a, .nav-pills > .active > a:hover { - background-color: #4b9fd5; - color: #FFFFFF; } \ No newline at end of file -- 2.39.5