]> source.dussan.org Git - sonarqube.git/commitdiff
SONAR-5851 clean up profiles ui
authorStas Vilchik <vilchiks@gmail.com>
Mon, 13 Apr 2015 11:36:04 +0000 (13:36 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 13 Apr 2015 11:36:12 +0000 (13:36 +0200)
server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-layout.hbs
server/sonar-web/src/main/hbs/quality-profiles/quality-profiles-profile-details.hbs
server/sonar-web/src/main/js/application.js
server/sonar-web/src/main/js/quality-profiles/controller.js
server/sonar-web/src/main/js/quality-profiles/layout.js
server/sonar-web/src/main/js/quality-profiles/profile-details-view.js
server/sonar-web/src/main/less/components/columns.less
server/sonar-web/src/main/less/components/panels.less
server/sonar-web/src/main/less/pages/coding-rules.less
sonar-core/src/main/resources/org/sonar/l10n/core.properties

index e171121f21aaec51e18fd0cae07c832082d9f3a7..d6ccad88da649507833e34bd77c9436d76d97a42 100644 (file)
@@ -9,5 +9,5 @@
 
 <div class="search-navigator-workspace">
   <div class="search-navigator-workspace-header"></div>
-  <div class="search-navigator-workspace-list"></div>
+  <div class="search-navigator-workspace-details"></div>
 </div>
index ea796d3189beae5731d7700e076da9bb7b6427d4..2dbd17a71cadcc85f9340f4dfdc9bef72b1fef2b 100644 (file)
@@ -1,33 +1,56 @@
-<h3>{{t 'coding_rules'}}</h3>
-<p class="spacer-top">Total: <a href="{{link rulesSearchUrl}}">{{formatMeasure activeRuleCount 'INT'}}</a></p>
-{{#notEmpty rulesSeverities}}
-  <ul class="spacer-top list-inline">
-    {{#each rulesSeverities}}
-      <li>
-        {{severity val}}
-        <a href="{{link ../rulesSearchUrl '|severities=' val}}">{{formatMeasure count 'INT'}}</a>
-      </li>
-    {{/each}}
-  </ul>
-{{/notEmpty}}
-
-<hr class="spacer-top spacer-bottom">
-
-<h3>{{t 'projects'}}</h3>
-{{#if isDefault}}
-  <p class="alert alert-info">{{t 'quality_profiles.projects_for_default.edit'}}</p>
-{{else}}
-  <div id="quality-profile-projects"></div>
-{{/if}}
-
-<hr class="spacer-top spacer-bottom">
+<div class="panel panel-vertical" id="quality-profile-rules">
+  <header class="page-header">
+    <h3 class="page-title">{{t 'coding_rules'}}</h3>
+  </header>
+  <p>
+    <a class="big" href="{{link rulesSearchUrl}}">{{formatMeasure activeRuleCount 'INT'}}</a>
+    activate rules
+  </p>
+  {{#notEmpty rulesSeverities}}
+    <div class="abs-width-400 spacer-top">
+      <div class="columns">
+        <div class="column-half">
+          {{#eachEven rulesSeverities}}
+            <p class="spacer-top">
+              {{severityIcon val}}
+              <a href="{{link ../rulesSearchUrl '|severities=' val}}">{{formatMeasure count 'INT'}}</a>
+              <span class="text-lowercase">{{t 'severity' val}}</span>
+            </p>
+          {{/eachEven}}
+        </div>
+        <div class="column-half">
+          {{#eachOdd rulesSeverities}}
+            <p class="spacer-top">
+              {{severityIcon val}}
+              <a href="{{link ../rulesSearchUrl '|severities=' val}}">{{formatMeasure count 'INT'}}</a>
+              <span class="text-lowercase">{{t 'severity' val}}</span>
+            </p>
+          {{/eachOdd}}
+        </div>
+      </div>
+    </div>
+  {{/notEmpty}}
+</div>
 
-<h3>{{t 'permalinks'}}</h3>
-<p class="alert alert-warning">Coming soon...</p>
+<div class="panel panel-vertical" id="quality-profile-projects">
+  <header class="page-header">
+    <h3 class="page-title">{{t 'projects'}}</h3>
+  </header>
+  {{#if isDefault}}
+    <p class="alert alert-info">{{t 'quality_profiles.projects_for_default.edit'}}</p>
+  {{else}}
+    <div id="quality-profile-projects-list"></div>
+  {{/if}}
+</div>
 
-<hr class="spacer-top spacer-bottom">
+<div class="panel panel-vertical" id="quality-profile-permalinks">
+  <header class="page-header">
+    <h3 class="page-title">{{t 'permalinks'}}</h3>
+  </header>
+  <p class="alert alert-warning">Coming soon...</p>
+</div>
 
-<div id="quality-profile-inheritance">
+<div class="panel panel-vertical" id="quality-profile-inheritance">
   <header class="page-header">
     <h3 class="page-title">{{t 'quality_profiles.profile_inheritance'}}</h3>
     <div class="page-actions">
   </div>
 </div>
 
-<hr class="spacer-top spacer-bottom">
-
-<h3>{{t 'changelog'}}</h3>
-<p class="alert alert-warning">Coming soon...</p>
+<div class="panel panel-vertical" id="quality-profile-changelog">
+  <header class="page-header">
+    <h3 class="page-title">{{t 'changelog'}}</h3>
+  </header>
+  <p class="alert alert-warning">Coming soon...</p>
+</div>
index c6af8866c871be57c87dd623372b11d28073882c..d71b61294c79d1958af66bb9a6e61b9ad7e5c273 100644 (file)
@@ -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 () {
 
index 107cfde981580232120455c8d164b7f811d9fbaa..7a71e1e71e644b749582f10d22915ddf6c344978 100644 (file)
@@ -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 });
         }
       });
     },
index 5a0b5686d775e2e157975c65e9a76697e1be3559..d2882a0a1479483f964c65a8aa9ed576c59ebae1 100644 (file)
@@ -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();
index 9c08fb31ac8889bc9fdee269f078fe6b899425ea..8a3ab3fcc5167aa58a1afaa88a5f69ca705f75f6 100644 (file)
@@ -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,
index 699573084eea24e56af326fde6f22732fb9448ca..a34e4d2840191190c9f8c7e77b0c369163538ed1 100644 (file)
@@ -23,7 +23,9 @@
 
 .columns {
   .clearfix;
-  margin: 0 -10px;
+  margin-left: -10px;
+  margin-right: -10px;
+  overflow: hidden;
 }
 
 .column-half {
index 8105fdc55b6532ff0ce717b3cc5fa53c7977fabd..44c2e82b69d5793fb0c0bfe614754cd34375846e 100644 (file)
   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;
index d7f78cee0106a3b3bde48217edb9bd0169150e90..118028e77b3b1fa2da603571982847fc12b0f6ef 100644 (file)
 .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;
 
 .coding-rules-detail-title {
   display: inline-block;
-  margin-top: 2em;
+}
+
+.coding-rules-detail-title-first {
+  margin-top: 6px;
 }
 
 .coding-rules-detail-permalink {
index e53516e2b183a3a89b80efc27c45c56e259577b3..bd28ae542dbfc6460ca2007a86fa5cc622db1fc4 100644 (file)
@@ -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}".