From: Stas Vilchik Date: Mon, 13 Apr 2015 11:36:04 +0000 (+0200) Subject: SONAR-5851 clean up profiles ui X-Git-Tag: 5.2-RC1~2301 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=4fabf1ed5f71619481f54b95cd1b6ce447d81799;p=sonarqube.git SONAR-5851 clean up profiles ui --- diff --git a/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-layout.hbs b/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-layout.hbs index e171121f21a..d6ccad88da6 100644 --- a/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-layout.hbs +++ b/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-layout.hbs @@ -9,5 +9,5 @@
-
+
diff --git a/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-profile-details.hbs b/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-profile-details.hbs index ea796d3189b..2dbd17a71ca 100644 --- a/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-profile-details.hbs +++ b/server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-profile-details.hbs @@ -1,33 +1,56 @@ -

{{t 'coding_rules'}}

-

Total: {{formatMeasure activeRuleCount 'INT'}}

-{{#notEmpty rulesSeverities}} - -{{/notEmpty}} - -
- -

{{t 'projects'}}

-{{#if isDefault}} -

{{t 'quality_profiles.projects_for_default.edit'}}

-{{else}} -
-{{/if}} - -
+
+ +

+ {{formatMeasure activeRuleCount 'INT'}} + activate rules +

+ {{#notEmpty rulesSeverities}} +
+
+
+ {{#eachEven rulesSeverities}} +

+ {{severityIcon val}} + {{formatMeasure count 'INT'}} + {{t 'severity' val}} +

+ {{/eachEven}} +
+
+ {{#eachOdd rulesSeverities}} +

+ {{severityIcon val}} + {{formatMeasure count 'INT'}} + {{t 'severity' val}} +

+ {{/eachOdd}} +
+
+
+ {{/notEmpty}} +
-

{{t 'permalinks'}}

-

Coming soon...

+
+ + {{#if isDefault}} +

{{t 'quality_profiles.projects_for_default.edit'}}

+ {{else}} +
+ {{/if}} +
-
+ -
+
-
- -

{{t 'changelog'}}

-

Coming soon...

+
+ +

Coming soon...

+
diff --git a/server/sonar-web/src/main/js/application.js b/server/sonar-web/src/main/js/application.js index c6af8866c87..d71b61294c7 100644 --- a/server/sonar-web/src/main/js/application.js +++ b/server/sonar-web/src/main/js/application.js @@ -477,6 +477,38 @@ function closeModalWindow () { * Misc */ +(function () { + + /** + * Comparator for _.sortBy()-like functions + * + * Fit for natural severities order + * @param {string} severity + * @returns {number} + */ + window.severityComparator = function (severity) { + var SEVERITIES_ORDER = ['BLOCKER', 'CRITICAL', 'MAJOR', 'MINOR', 'INFO']; + return SEVERITIES_ORDER.indexOf(severity); + }; + + + /** + * Comparator for _.sortBy()-like functions + * + * Fit for facet-like display: + * BLOCKER MINOR + * CRITICAL INFO + * MAJOR + * @param {string} severity + * @returns {number} + */ + window.severityColumnsComparator = function (severity) { + var SEVERITIES_ORDER = ['BLOCKER', 'MINOR', 'CRITICAL', 'INFO', 'MAJOR']; + return SEVERITIES_ORDER.indexOf(severity); + }; + +})(); + (function () { jQuery(function () { diff --git a/server/sonar-web/src/main/js/quality-profiles/controller.js b/server/sonar-web/src/main/js/quality-profiles/controller.js index 107cfde9815..7a71e1e71e6 100644 --- a/server/sonar-web/src/main/js/quality-profiles/controller.js +++ b/server/sonar-web/src/main/js/quality-profiles/controller.js @@ -94,14 +94,19 @@ define([ key = profile.get('key'), options = { ps: 1, - facets: 'severities', + facets: 'severities,tags', qprofile: key, activation: 'true' }; return $.get(url, options).done(function (r) { var severityFacet = _.findWhere(r.facets, { property: 'severities' }); if (severityFacet != null) { - profile.set({ rulesSeverities: severityFacet.values }); + var severities = severityFacet.values, + severityComparator = function (s) { + return window.severityColumnsComparator(s.val); + }, + sortedSeverities = _.sortBy(severities, severityComparator); + profile.set({ rulesSeverities: sortedSeverities }); } }); }, diff --git a/server/sonar-web/src/main/js/quality-profiles/layout.js b/server/sonar-web/src/main/js/quality-profiles/layout.js index 5a0b5686d77..d2882a0a147 100644 --- a/server/sonar-web/src/main/js/quality-profiles/layout.js +++ b/server/sonar-web/src/main/js/quality-profiles/layout.js @@ -30,12 +30,12 @@ define([ headerRegion: '.search-navigator-workspace-header', actionsRegion: '.search-navigator-filters', resultsRegion: '.quality-profiles-results', - detailsRegion: '.search-navigator-workspace-list' + detailsRegion: '.search-navigator-workspace-details' }, onRender: function () { var navigator = $('.search-navigator'); - navigator.addClass('sticky'); + navigator.addClass('sticky search-navigator-extended-view'); var top = navigator.offset().top; this.$('.search-navigator-workspace-header').css({ top: top }); this.$('.search-navigator-side').css({ top: top }).isolatedScroll(); diff --git a/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js b/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js index 9c08fb31ac8..8a3ab3fcc51 100644 --- a/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js +++ b/server/sonar-web/src/main/js/quality-profiles/profile-details-view.js @@ -42,7 +42,7 @@ define([ var key = this.model.get('key'); if (!this.model.get('isDefault')) { new SelectList({ - el: this.$('#quality-profile-projects'), + el: this.$('#quality-profile-projects-list'), width: '100%', readOnly: false, focusSearch: false, diff --git a/server/sonar-web/src/main/less/components/columns.less b/server/sonar-web/src/main/less/components/columns.less index 699573084ee..a34e4d28401 100644 --- a/server/sonar-web/src/main/less/components/columns.less +++ b/server/sonar-web/src/main/less/components/columns.less @@ -23,7 +23,9 @@ .columns { .clearfix; - margin: 0 -10px; + margin-left: -10px; + margin-right: -10px; + overflow: hidden; } .column-half { diff --git a/server/sonar-web/src/main/less/components/panels.less b/server/sonar-web/src/main/less/components/panels.less index 8105fdc55b6..44c2e82b69d 100644 --- a/server/sonar-web/src/main/less/components/panels.less +++ b/server/sonar-web/src/main/less/components/panels.less @@ -24,6 +24,17 @@ padding: 10px; } +.panel + .panel { + margin-top: 20px; + padding-top: 20px; + border-top: 1px solid @barBorderColor; +} + +.panel-vertical { + padding-left: 0; + padding-right: 0; +} + .panel-info { border: 1px solid @blue; background-color: @lightBlue; diff --git a/server/sonar-web/src/main/less/pages/coding-rules.less b/server/sonar-web/src/main/less/pages/coding-rules.less index d7f78cee010..118028e77b3 100644 --- a/server/sonar-web/src/main/less/pages/coding-rules.less +++ b/server/sonar-web/src/main/less/pages/coding-rules.less @@ -77,12 +77,17 @@ .coding-rules-detail-header, .coding-rules-detail-title { position: relative; - margin: 1em 0; line-height: 1.5; font-size: @bigFontSize; font-weight: 400; } +.coding-rules-detail-header, +.coding-rules-detail-title, +.coding-rules-detail-actions { + margin: 16px 0; +} + .coding-rules-detail-header { margin: 0; padding-right: 100px; @@ -91,7 +96,10 @@ .coding-rules-detail-title { display: inline-block; - margin-top: 2em; +} + +.coding-rules-detail-title-first { + margin-top: 6px; } .coding-rules-detail-permalink { diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties index e53516e2b18..bd28ae542db 100644 --- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties +++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties @@ -1737,7 +1737,7 @@ quality_profiles.name_for_new_profile=Name for the new profile quality_profiles.delete_confirm_title=Delete Profile quality_profiles.are_you_sure_want_delete_profile_x_and_descendants=Are you sure that you want to delete the profile "{0}" and all its descendants? quality_profiles.editing_profile=Editing profile -quality_profiles.profile_inheritance=Profile inheritance +quality_profiles.profile_inheritance=Inheritance quality_profiles.available_projects=Available projects quality_profiles.associated_projects=Associated projects quality_profiles.no_projects_associated_to_profile_x=No projects are explicitly associated to the profile "{0}".