From f196444c5c437f9b1d34c75ebf59c1968fed9571 Mon Sep 17 00:00:00 2001 From: Stas Vilchik Date: Tue, 11 Mar 2014 13:33:44 +0600 Subject: [PATCH] SONAR-5007 Rework quality profiles part --- .../app/views/coding_rules/index.html.erb | 1 - .../_coding_rules_detail_template.hbs.erb | 24 +++--- ...s_header_quality_profiles_template.hbs.erb | 17 ----- .../_coding_rules_header_template.hbs.erb | 10 +-- .../_coding_rules_list_item_template.hbs.erb | 5 +- .../javascripts/coding-rules/app.coffee | 21 +++-- .../webapp/javascripts/coding-rules/app.js | 29 +++++-- .../javascripts/coding-rules/mockjax.coffee | 18 +++-- .../javascripts/coding-rules/mockjax.js | 25 +++--- .../views/coding-rules-detail-view.coffee | 5 ++ .../views/coding-rules-detail-view.js | 8 ++ .../views/coding-rules-list-item-view.coffee | 8 +- .../views/coding-rules-list-item-view.js | 7 ++ .../views/header-quality-profiles-view.coffee | 19 ----- .../views/header-quality-profiles-view.js | 34 --------- .../coding-rules/views/header-view.coffee | 40 +--------- .../coding-rules/views/header-view.js | 44 ++--------- .../main/webapp/stylesheets/coding-rules.css | 71 ++++++++++------- .../main/webapp/stylesheets/coding-rules.less | 76 ++++++++++++------- .../src/main/webapp/stylesheets/navigator.css | 38 +++++----- .../webapp/stylesheets/navigator/base.css | 38 +++++----- .../webapp/stylesheets/navigator/base.less | 41 +++++----- .../webapp/stylesheets/navigator/config.less | 2 +- 23 files changed, 263 insertions(+), 318 deletions(-) delete mode 100644 sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_quality_profiles_template.hbs.erb delete mode 100644 sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.coffee delete mode 100644 sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.js diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb index 9f1751d81da..8c33c7b7a96 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/index.html.erb @@ -11,7 +11,6 @@ <%= render :partial => '/navigator/filter_templates' -%> <%= render :partial => '/coding_rules/templates/coding_rules_layout.hbs' -%> <%= render :partial => '/coding_rules/templates/coding_rules_header_template.hbs' -%> -<%= render :partial => '/coding_rules/templates/coding_rules_header_quality_profiles_template.hbs' -%> <%= render :partial => '/coding_rules/templates/coding_rules_actions_template.hbs' -%> <%= render :partial => '/coding_rules/templates/coding_rules_filter_bar_template.hbs' -%> <%= render :partial => '/coding_rules/templates/coding_rules_list_item_template.hbs' -%> diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb index 18aad2a85ca..a392dacf13d 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_detail_template.hbs.erb @@ -3,17 +3,19 @@
{{language}}
{{{description}}}
-

{{t 'coding_rules.quality_profiles'}}

+

+ {{t 'coding_rules.quality_profiles'}} + +
+ +
+

+ -
- -
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_quality_profiles_template.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_quality_profiles_template.hbs.erb deleted file mode 100644 index 5f49de9c75b..00000000000 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_quality_profiles_template.hbs.erb +++ /dev/null @@ -1,17 +0,0 @@ - diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_template.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_template.hbs.erb index a628448a514..e28cd814735 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_template.hbs.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_header_template.hbs.erb @@ -1,13 +1,7 @@ diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_list_item_template.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_list_item_template.hbs.erb index 82f12144bbe..cdd992740be 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_list_item_template.hbs.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/coding_rules/templates/_coding_rules_list_item_template.hbs.erb @@ -1,4 +1,7 @@ diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/app.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/app.coffee index ac7ee48060f..b8c776fa08b 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/app.coffee +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/app.coffee @@ -143,6 +143,11 @@ requirejs [ App.fetchList false + App.getActiveQualityProfile = -> + value = @activeInFilter.get('value') + if value? && value.length == 1 then value[0] else null + + # Construct layout App.addInitializer -> @layout = new CodingRulesLayout app: @ @@ -246,19 +251,23 @@ requirejs [ 'unused': 'unused' 'unused-code': 'unused-code' - @filters.add new BaseFilters.Filter + @activeInFilter = new BaseFilters.Filter name: t 'coding_rules.filters.active_in' property: 'active_in' type: QualityProfileFilterView - enabled: false, - optional: true + single: true + enabled: true + optional: false + @filters.add @activeInFilter - @filters.add new BaseFilters.Filter + @inactiveInFilter = new BaseFilters.Filter name: t 'coding_rules.filters.inactive_in' property: 'inactive_in' type: QualityProfileFilterView - enabled: false, - optional: true + single: true + enabled: true + optional: false + @filters.add @inactiveInFilter @filterBarView = new CodingRulesFilterBarView app: @ diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/app.js b/sonar-server/src/main/webapp/javascripts/coding-rules/app.js index 886acdb867a..129cdaa5dab 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/app.js +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/app.js @@ -110,6 +110,15 @@ return App.fetchList(false); } }; + App.getActiveQualityProfile = function() { + var value; + value = this.activeInFilter.get('value'); + if ((value != null) && value.length === 1) { + return value[0]; + } else { + return null; + } + }; App.addInitializer(function() { this.layout = new CodingRulesLayout({ app: this @@ -213,20 +222,24 @@ 'unused-code': 'unused-code' } })); - this.filters.add(new BaseFilters.Filter({ + this.activeInFilter = new BaseFilters.Filter({ name: t('coding_rules.filters.active_in'), property: 'active_in', type: QualityProfileFilterView, - enabled: false, - optional: true - })); - this.filters.add(new BaseFilters.Filter({ + single: true, + enabled: true, + optional: false + }); + this.filters.add(this.activeInFilter); + this.inactiveInFilter = new BaseFilters.Filter({ name: t('coding_rules.filters.inactive_in'), property: 'inactive_in', type: QualityProfileFilterView, - enabled: false, - optional: true - })); + single: true, + enabled: true, + optional: false + }); + this.filters.add(this.inactiveInFilter); this.filterBarView = new CodingRulesFilterBarView({ app: this, collection: this.filters, diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee index 587605045f5..80b4092174a 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.coffee @@ -50,22 +50,27 @@ define ['jquery.mockjax'], -> { name: 'Array designators "[]" should be located after the type in method signatures' language: 'Java' + severity: 'MAJOR' }, { name: 'Avoid Array Loops' language: 'Java' + severity: 'CRITICAL' }, { name: 'Bad practice - Abstract class defines covariant compareTo() method' language: 'Java' + severity: 'MAJOR' }, { name: 'Correctness - Use of class without a hashCode() method in a hashed data structure' language: 'Java' + severity: 'MINOR' }, { name: 'Useless Operation On Immutable' language: 'Java' + severity: 'MAJOR' } ] paging: @@ -92,8 +97,9 @@ define ['jquery.mockjax'], ->

For compatibility with older versions of the Java SE platform,
-            the declaration of a method that returns an array is allowed to place (some or all of) the empty bracket pairs that form the declaration of the array type after the formal parameter list.
-            This obsolescent syntax should not be used in new code.
+            the declaration of a method that returns an array is allowed to place (some or all of)
+            the empty bracket pairs that form the declaration of the array type after
+            the formal parameter list. This obsolescent syntax should not be used in new code.
             

The following code snippet illustrates this rule:

@@ -111,8 +117,8 @@ define ['jquery.mockjax'], -> { name: 'SonarWay' severity: 'MINOR' - canDeactivate: false - canUpdate: false + canDeactivate: true + canUpdate: true parameters: [ { key: 'max', value: 8 } ] @@ -121,8 +127,8 @@ define ['jquery.mockjax'], -> { name: 'Quality Profile 1' severity: 'MAJOR' - canDeactivate: true - canUpdate: true + canDeactivate: false + canUpdate: false parameters: [ { key: 'max', value: 6 } ] diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js index 27408d8285b..e8a5a7d9760 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/mockjax.js @@ -52,19 +52,24 @@ codingrules: [ { name: 'Array designators "[]" should be located after the type in method signatures', - language: 'Java' + language: 'Java', + severity: 'MAJOR' }, { name: 'Avoid Array Loops', - language: 'Java' + language: 'Java', + severity: 'CRITICAL' }, { name: 'Bad practice - Abstract class defines covariant compareTo() method', - language: 'Java' + language: 'Java', + severity: 'MAJOR' }, { name: 'Correctness - Use of class without a hashCode() method in a hashed data structure', - language: 'Java' + language: 'Java', + severity: 'MINOR' }, { name: 'Useless Operation On Immutable', - language: 'Java' + language: 'Java', + severity: 'MAJOR' } ], paging: { @@ -91,13 +96,13 @@ codingrule: { name: 'Array designators "[]" should be located after the type in method signatures', language: 'Java', - description: '

\nAccording to the Java Language Specification:\n

\n\n
For compatibility with older versions of the Java SE platform,\nthe declaration of a method that returns an array is allowed to place (some or all of) the empty bracket pairs that form the declaration of the array type after the formal parameter list.\nThis obsolescent syntax should not be used in new code.\n
\n\n

The following code snippet illustrates this rule:

\n\n
public int getVector()[] { /* ... */ }    // Non-Compliant\n\npublic int[] getVector() { /* ... */ }    // Compliant\n\npublic int[] getMatrix()[] { /* ... */ }  // Non-Compliant\n\npublic int[][] getMatrix() { /* ... */ }  // Compliant\n
', + description: '

\nAccording to the Java Language Specification:\n

\n\n
For compatibility with older versions of the Java SE platform,\nthe declaration of a method that returns an array is allowed to place (some or all of)\nthe empty bracket pairs that form the declaration of the array type after\nthe formal parameter list. This obsolescent syntax should not be used in new code.\n
\n\n

The following code snippet illustrates this rule:

\n\n
public int getVector()[] { /* ... */ }    // Non-Compliant\n\npublic int[] getVector() { /* ... */ }    // Compliant\n\npublic int[] getMatrix()[] { /* ... */ }  // Non-Compliant\n\npublic int[][] getMatrix() { /* ... */ }  // Compliant\n
', qualityProfiles: [ { name: 'SonarWay', severity: 'MINOR', - canDeactivate: false, - canUpdate: false, + canDeactivate: true, + canUpdate: true, parameters: [ { key: 'max', @@ -107,8 +112,8 @@ }, { name: 'Quality Profile 1', severity: 'MAJOR', - canDeactivate: true, - canUpdate: true, + canDeactivate: false, + canUpdate: false, parameters: [ { key: 'max', diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.coffee index 0f5c741241e..9ff525e9a62 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.coffee +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.coffee @@ -7,3 +7,8 @@ define [ class CodingRulesDetailView extends Marionette.ItemView template: getTemplate '#coding-rules-detail-template' + + + onRender: -> + qp = @options.app.getActiveQualityProfile() + @$('.coding-rules-detail-quality-profile').first().addClass 'active' if qp? diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.js b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.js index 06fd6527ad6..ae0db796904 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.js +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-detail-view.js @@ -15,6 +15,14 @@ CodingRulesDetailView.prototype.template = getTemplate('#coding-rules-detail-template'); + CodingRulesDetailView.prototype.onRender = function() { + var qp; + qp = this.options.app.getActiveQualityProfile(); + if (qp != null) { + return this.$('.coding-rules-detail-quality-profile').first().addClass('active'); + } + }; + return CodingRulesDetailView; })(Marionette.ItemView); diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.coffee index 4d109e4fe07..456c61e35b5 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.coffee +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.coffee @@ -26,5 +26,11 @@ define [ url: "#{baseUrl}/api/codingrules/show" .done (r) => @model.set r.codingrule - detailView = new CodingRulesDetailView model: @model + detailView = new CodingRulesDetailView + app: @options.app + model: @model @options.app.layout.detailsRegion.show detailView + + + serializeData: -> + _.extend super, qualityProfile: @options.app.getActiveQualityProfile() diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.js b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.js index 87ba12db6f5..7cb2d9709bc 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.js +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/views/coding-rules-list-item-view.js @@ -36,12 +36,19 @@ var detailView; _this.model.set(r.codingrule); detailView = new CodingRulesDetailView({ + app: _this.options.app, model: _this.model }); return _this.options.app.layout.detailsRegion.show(detailView); }); }; + CodingRulesListItemView.prototype.serializeData = function() { + return _.extend(CodingRulesListItemView.__super__.serializeData.apply(this, arguments), { + qualityProfile: this.options.app.getActiveQualityProfile() + }); + }; + return CodingRulesListItemView; })(Marionette.ItemView); diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.coffee deleted file mode 100644 index c6053aa88b9..00000000000 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.coffee +++ /dev/null @@ -1,19 +0,0 @@ -define [ - 'backbone.marionette', - 'common/handlebars-extensions' -], ( - Marionette -) -> - - class HeaderQualityProfilesView extends Marionette.ItemView - className: 'coding-rules-header-quality-profiles' - template: getTemplate '#coding-rules-header-quality-profiles-template' - - - events: - 'click label': 'selectQualityProfile' - - - selectQualityProfile: (e)-> - @options.app.header = jQuery(e.target).html() - @options.headerView.render() diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.js b/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.js deleted file mode 100644 index 67e4641d913..00000000000 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-quality-profiles-view.js +++ /dev/null @@ -1,34 +0,0 @@ -// Generated by CoffeeScript 1.6.3 -(function() { - var __hasProp = {}.hasOwnProperty, - __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - - define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) { - var HeaderQualityProfilesView, _ref; - return HeaderQualityProfilesView = (function(_super) { - __extends(HeaderQualityProfilesView, _super); - - function HeaderQualityProfilesView() { - _ref = HeaderQualityProfilesView.__super__.constructor.apply(this, arguments); - return _ref; - } - - HeaderQualityProfilesView.prototype.className = 'coding-rules-header-quality-profiles'; - - HeaderQualityProfilesView.prototype.template = getTemplate('#coding-rules-header-quality-profiles-template'); - - HeaderQualityProfilesView.prototype.events = { - 'click label': 'selectQualityProfile' - }; - - HeaderQualityProfilesView.prototype.selectQualityProfile = function(e) { - this.options.app.header = jQuery(e.target).html(); - return this.options.headerView.render(); - }; - - return HeaderQualityProfilesView; - - })(Marionette.ItemView); - }); - -}).call(this); diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.coffee b/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.coffee index c648f7a3019..ddf75bc5f53 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.coffee +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.coffee @@ -1,49 +1,17 @@ define [ 'backbone.marionette', - 'coding-rules/views/header-quality-profiles-view', 'common/handlebars-extensions' ], ( - Marionette, - HeaderQualityProfilesView + Marionette ) -> class CodingRulesHeaderView extends Marionette.ItemView template: getTemplate '#coding-rules-header-template' - ui: - menuToggle: '.navigator-header-menu-toggle' - - events: - 'click @ui.menuToggle': 'toggleQualityProfiles' - - - initialize: -> - @qualityProfilesView = new HeaderQualityProfilesView - app: @options.app - collection: new Backbone.Collection @options.app.qualityProfiles - headerView: @ - jQuery('body').on 'click', => - @qualityProfilesView.$el.hide() - @ui.menuToggle.removeClass 'active' - - - onRender: -> - @qualityProfilesView.render().$el.detach().appendTo jQuery('body') - - - onDomRefresh: -> - @qualityProfilesView.$el.css - top: @$el.offset().top + @$el.outerHeight() - left: @$el.offset().left + @ui.menuToggle.css('margin-left') - - - toggleQualityProfiles: (e) -> - e.stopPropagation() - @qualityProfilesView.$el.toggle() - @ui.menuToggle.toggleClass 'active' + 'click #coding-rules-new-search': 'newSearch' - serializeData: -> - _.extend super, header: @options.app.header + newSearch: -> + @options.app.router.navigate '', trigger: true diff --git a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.js b/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.js index 887d06b8c75..b1d052db9d3 100644 --- a/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.js +++ b/sonar-server/src/main/webapp/javascripts/coding-rules/views/header-view.js @@ -3,7 +3,7 @@ var __hasProp = {}.hasOwnProperty, __extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; }; - define(['backbone.marionette', 'coding-rules/views/header-quality-profiles-view', 'common/handlebars-extensions'], function(Marionette, HeaderQualityProfilesView) { + define(['backbone.marionette', 'common/handlebars-extensions'], function(Marionette) { var CodingRulesHeaderView, _ref; return CodingRulesHeaderView = (function(_super) { __extends(CodingRulesHeaderView, _super); @@ -15,47 +15,13 @@ CodingRulesHeaderView.prototype.template = getTemplate('#coding-rules-header-template'); - CodingRulesHeaderView.prototype.ui = { - menuToggle: '.navigator-header-menu-toggle' - }; - CodingRulesHeaderView.prototype.events = { - 'click @ui.menuToggle': 'toggleQualityProfiles' - }; - - CodingRulesHeaderView.prototype.initialize = function() { - var _this = this; - this.qualityProfilesView = new HeaderQualityProfilesView({ - app: this.options.app, - collection: new Backbone.Collection(this.options.app.qualityProfiles), - headerView: this - }); - return jQuery('body').on('click', function() { - _this.qualityProfilesView.$el.hide(); - return _this.ui.menuToggle.removeClass('active'); - }); - }; - - CodingRulesHeaderView.prototype.onRender = function() { - return this.qualityProfilesView.render().$el.detach().appendTo(jQuery('body')); - }; - - CodingRulesHeaderView.prototype.onDomRefresh = function() { - return this.qualityProfilesView.$el.css({ - top: this.$el.offset().top + this.$el.outerHeight(), - left: this.$el.offset().left + this.ui.menuToggle.css('margin-left') - }); - }; - - CodingRulesHeaderView.prototype.toggleQualityProfiles = function(e) { - e.stopPropagation(); - this.qualityProfilesView.$el.toggle(); - return this.ui.menuToggle.toggleClass('active'); + 'click #coding-rules-new-search': 'newSearch' }; - CodingRulesHeaderView.prototype.serializeData = function() { - return _.extend(CodingRulesHeaderView.__super__.serializeData.apply(this, arguments), { - header: this.options.app.header + CodingRulesHeaderView.prototype.newSearch = function() { + return this.options.app.router.navigate('', { + trigger: true }); }; diff --git a/sonar-server/src/main/webapp/stylesheets/coding-rules.css b/sonar-server/src/main/webapp/stylesheets/coding-rules.css index a4c405b08db..7f9f781a642 100644 --- a/sonar-server/src/main/webapp/stylesheets/coding-rules.css +++ b/sonar-server/src/main/webapp/stylesheets/coding-rules.css @@ -15,10 +15,10 @@ } .coding-rules-page .navigator-actions, .coding-rules-page .navigator-details { - top: 324px; + top: 194px; } .coding-rules-page .navigator-results { - top: 354px; + top: 224px; } /* * Detail @@ -44,22 +44,46 @@ padding-bottom: 0; } .coding-rules-detail-quality-profiles-header { - margin-top: 20px; + margin-top: 30px; } -.coding-rules-detail-quality-profile + .coding-rules-detail-quality-profile { - margin-top: 10px; +.coding-rules-detail-quality-profiles { + font-size: 0; } -.coding-rules-detail-quality-profile-severity, -.coding-rules-detail-quality-profile-name, -.coding-rules-detail-quality-profile-actions { +.coding-rules-detail-quality-profile { display: inline-block; - vertical-align: middle; + vertical-align: top; + width: 240px; + margin-right: 20px; + -moz-box-sizing: border-box; + box-sizing: border-box; + font-size: 13px; +} +.coding-rules-detail-quality-profile.active { + background-color: #CAE3F2; + border-color: #4b9fd5; +} +.coding-rules-detail-quality-profile.active .coding-rules-detail-quality-profile-name { + background-color: #4b9fd5; + color: #fff; +} +.coding-rules-detail-quality-profile-severity { + padding: 5px; + font-size: 11px; +} +.coding-rules-detail-quality-profile-name { + padding: 5px; + background-color: #efefef; + line-height: 1; + font-weight: bold; +} +.coding-rules-detail-quality-profile-actions { + padding: 5px; } .coding-rules-detail-quality-profile-parameters { - padding-left: 30px; + padding: 5px; } .coding-rules-detail-quality-profile-parameter { - margin: 5px; + white-space: nowrap; } .coding-rules-detail-quality-profile-parameter-key, .coding-rules-detail-quality-profile-parameter-value, @@ -69,22 +93,13 @@ .coding-rules-detail-quality-profile-parameter-key:after { content: ":"; } +.coding-rules-detail-quality-profile-parameter-value { + width: 110px; +} +.coding-rules-detail-quality-profile-parameter-actions { + float: right; +} .coding-rules-detail-quality-profiles-activation { - margin-top: 10px; -} -.coding-rules-header-quality-profiles { - position: absolute; - z-index: 1200; - display: none; - max-width: 300px; - border-right: 1px solid #cdcdcd; - border-bottom: 1px solid #cdcdcd; - background: #fff; - box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5); -} -.coding-rules-header-quality-profiles .navigator-filter-select-list { - max-width: 600px; -} -.coding-rules-header-quality-profiles .navigator-filter-select-list label > span { - width: auto; + margin-top: -3px; + margin-left: 10px; } diff --git a/sonar-server/src/main/webapp/stylesheets/coding-rules.less b/sonar-server/src/main/webapp/stylesheets/coding-rules.less index 842bfa069d9..78ee8871a4d 100644 --- a/sonar-server/src/main/webapp/stylesheets/coding-rules.less +++ b/sonar-server/src/main/webapp/stylesheets/coding-rules.less @@ -52,27 +52,57 @@ } } + +// Quality Profiles .coding-rules-detail-quality-profiles-header { - margin-top: 2 * @navigatorPadding; + margin-top: 3 * @navigatorPadding; } -.coding-rules-detail-quality-profile + .coding-rules-detail-quality-profile { - margin-top: @navigatorPadding; +.coding-rules-detail-quality-profiles { + font-size: 0; } -.coding-rules-detail-quality-profile-severity, -.coding-rules-detail-quality-profile-name, -.coding-rules-detail-quality-profile-actions { +.coding-rules-detail-quality-profile { display: inline-block; - vertical-align: middle; + vertical-align: top; + width: 240px; + margin-right: 2 * @navigatorPadding; + .box-sizing(border-box); + font-size: @baseFontSize; + + &.active { + background-color: #CAE3F2; + border-color: @highlighted; + + .coding-rules-detail-quality-profile-name { + background-color: @highlighted; + color: #fff; + } + } +} + +.coding-rules-detail-quality-profile-severity { + padding: @navigatorPadding / 2; + font-size: @smallFontSize; +} + +.coding-rules-detail-quality-profile-name { + padding: @navigatorPadding / 2; + background-color: @navigatorBarBackground; + line-height: 1; + font-weight: bold; +} + +.coding-rules-detail-quality-profile-actions { + padding: @navigatorPadding / 2; } .coding-rules-detail-quality-profile-parameters { - padding-left: 3 * @navigatorPadding; + padding: @navigatorPadding / 2; } .coding-rules-detail-quality-profile-parameter { - margin: @navigatorPadding / 2; + white-space: nowrap; } .coding-rules-detail-quality-profile-parameter-key, @@ -87,27 +117,15 @@ } } -.coding-rules-detail-quality-profiles-activation { - margin-top: @navigatorPadding; +.coding-rules-detail-quality-profile-parameter-value { + width: 110px; } +.coding-rules-detail-quality-profile-parameter-actions { + float: right; +} - -.coding-rules-header-quality-profiles { - position: absolute; - z-index: 1200; - display: none; - max-width: 300px; - border-right: 1px solid @darkGrey; - border-bottom: 1px solid @darkGrey; - background: #fff; - box-shadow: 10px 10px 20px rgba(0, 0, 0, 0.5); - - .navigator-filter-select-list { - max-width: 600px; - } - - .navigator-filter-select-list label > span { - width: auto; - } +.coding-rules-detail-quality-profiles-activation { + margin-top: -3px; + margin-left: @navigatorPadding; } diff --git a/sonar-server/src/main/webapp/stylesheets/navigator.css b/sonar-server/src/main/webapp/stylesheets/navigator.css index b61e2c41b74..3f4111a724a 100644 --- a/sonar-server/src/main/webapp/stylesheets/navigator.css +++ b/sonar-server/src/main/webapp/stylesheets/navigator.css @@ -38,7 +38,7 @@ top: 104px; left: 0; width: 100%; - height: 220px; + height: 90px; } .navigator-results { position: fixed; @@ -199,43 +199,39 @@ border-bottom: 1px solid #cdcdcd; background-color: #efefef; } -.navigator-facets-list { - display: table; - height: 100%; -} -.navigator-facets-list-item { - display: table-cell; -} .navigator-facets-list-item { - padding-right: 20px; + font-size: 0; } .navigator-facets-list-item + .navigator-facets-list-item { - padding-left: 20px; - border-left: 1px solid #e1e1e1; + margin-top: 10px; } .navigator-facets-list-item-name { + display: inline-block; + vertical-align: middle; + margin-right: 10px; + font-size: 13px; font-weight: bold; text-transform: uppercase; } .navigator-facets-list-item-options { - margin-top: 6.666666666666667px; + display: inline-block; + vertical-align: middle; } .navigator-facets-list-item-option { - margin-bottom: -1em; - padding: 3.3333333333333335px 0; + display: inline-block; + vertical-align: middle; + margin: 0 10px; + font-size: 13px; cursor: pointer; - text-align: justify; } .navigator-facets-list-item-option:hover .navigator-facets-list-item-option-name { text-decoration: underline; } -.navigator-facets-list-item-option:after { - content: ''; - display: inline-block; - width: 100%; +.navigator-facets-list-item-option-stat:before { + content: "("; } -.navigator-facets-list-item-option-name { - padding-right: 10px; +.navigator-facets-list-item-option-stat:after { + content: ")"; } .navigator-results { border-right: 1px solid #e1e1e1; diff --git a/sonar-server/src/main/webapp/stylesheets/navigator/base.css b/sonar-server/src/main/webapp/stylesheets/navigator/base.css index 879cc350eec..869c2fcc289 100644 --- a/sonar-server/src/main/webapp/stylesheets/navigator/base.css +++ b/sonar-server/src/main/webapp/stylesheets/navigator/base.css @@ -38,7 +38,7 @@ top: 104px; left: 0; width: 100%; - height: 220px; + height: 90px; } .navigator-results { position: fixed; @@ -199,43 +199,39 @@ border-bottom: 1px solid #cdcdcd; background-color: #efefef; } -.navigator-facets-list { - display: table; - height: 100%; -} -.navigator-facets-list-item { - display: table-cell; -} .navigator-facets-list-item { - padding-right: 20px; + font-size: 0; } .navigator-facets-list-item + .navigator-facets-list-item { - padding-left: 20px; - border-left: 1px solid #e1e1e1; + margin-top: 10px; } .navigator-facets-list-item-name { + display: inline-block; + vertical-align: middle; + margin-right: 10px; + font-size: 13px; font-weight: bold; text-transform: uppercase; } .navigator-facets-list-item-options { - margin-top: 6.666666666666667px; + display: inline-block; + vertical-align: middle; } .navigator-facets-list-item-option { - margin-bottom: -1em; - padding: 3.3333333333333335px 0; + display: inline-block; + vertical-align: middle; + margin: 0 10px; + font-size: 13px; cursor: pointer; - text-align: justify; } .navigator-facets-list-item-option:hover .navigator-facets-list-item-option-name { text-decoration: underline; } -.navigator-facets-list-item-option:after { - content: ''; - display: inline-block; - width: 100%; +.navigator-facets-list-item-option-stat:before { + content: "("; } -.navigator-facets-list-item-option-name { - padding-right: 10px; +.navigator-facets-list-item-option-stat:after { + content: ")"; } .navigator-results { border-right: 1px solid #e1e1e1; diff --git a/sonar-server/src/main/webapp/stylesheets/navigator/base.less b/sonar-server/src/main/webapp/stylesheets/navigator/base.less index f4c7b070d41..378a576d37b 100644 --- a/sonar-server/src/main/webapp/stylesheets/navigator/base.less +++ b/sonar-server/src/main/webapp/stylesheets/navigator/base.less @@ -224,55 +224,52 @@ } .navigator-facets-list { - display: table; - height: 100%; -} -.navigator-facets-list-item { - display: table-cell; } .navigator-facets-list-item { - padding-right: 2 * @navigatorPadding; + font-size: 0; } .navigator-facets-list-item + .navigator-facets-list-item { - padding-left: 2 * @navigatorPadding; - border-left: 1px solid @navigatorBorderLightColor; + margin-top: @navigatorPadding; } .navigator-facets-list-item-name { + display: inline-block; + vertical-align: middle; + margin-right: @navigatorPadding; + font-size: @baseFontSize; font-weight: bold; text-transform: uppercase; } .navigator-facets-list-item-options { - margin-top: @navigatorPadding / 3 * 2; + display: inline-block; + vertical-align: middle; } .navigator-facets-list-item-option { - margin-bottom: -1em; - padding: @navigatorPadding / 3 0; + display: inline-block; + vertical-align: middle; + margin: 0 @navigatorPadding; + font-size: @baseFontSize; cursor: pointer; - text-align: justify; - &:hover .navigator-facets-list-item-option-name { - text-decoration: underline; - } - - &:after { - content: ''; - display: inline-block; - width: 100%; + &:hover { + .navigator-facets-list-item-option-name { + text-decoration: underline; + } } } .navigator-facets-list-item-option-name { - padding-right: @navigatorPadding; + } .navigator-facets-list-item-option-stat { - + &:before { content: "("; } + &:after { content: ")"; } } diff --git a/sonar-server/src/main/webapp/stylesheets/navigator/config.less b/sonar-server/src/main/webapp/stylesheets/navigator/config.less index b8f1e42bbcb..2d920ff7e4c 100644 --- a/sonar-server/src/main/webapp/stylesheets/navigator/config.less +++ b/sonar-server/src/main/webapp/stylesheets/navigator/config.less @@ -6,7 +6,7 @@ @navigatorHeaderHeight: 37px; @navigatorFiltersHeight: 37px; -@navigatorFacetsHeight: 220px; +@navigatorFacetsHeight: 90px; @navigatorStatusHeight: 30px; @navigatorNotesHeight: 20px; -- 2.39.5