]> source.dussan.org Git - sonarqube.git/commitdiff
return backgrounds for failed analysis
authorStas Vilchik <vilchiks@gmail.com>
Mon, 8 Jun 2015 15:25:39 +0000 (17:25 +0200)
committerStas Vilchik <vilchiks@gmail.com>
Mon, 8 Jun 2015 15:25:39 +0000 (17:25 +0200)
server/sonar-web/src/main/js/apps/computation/list-item-view.js
server/sonar-web/src/main/js/apps/computation/report.js
server/sonar-web/src/main/js/apps/computation/templates/computation-list-item.hbs
server/sonar-web/src/main/less/components/panels.less
server/sonar-web/src/test/js/computation-spec.js
server/sonar-web/src/test/json/computation-spec/history-big-2.json
server/sonar-web/src/test/json/computation-spec/history.json

index 5545f2ba0acf4e0e5a762cde8f503bdfc2a6cd79..e457b39c2f37837401057fe3217cbfede4d35a4d 100644 (file)
@@ -4,11 +4,12 @@ define([
 
   return Marionette.ItemView.extend({
     tagName: 'li',
-    className: 'panel panel-vertical',
+    className: 'panel',
     template: Templates['computation-list-item'],
 
     onRender: function () {
       this.$el.attr('data-id', this.model.id);
+      this.$el.toggleClass('panel-danger', this.model.isDanger());
       this.$('[data-toggle="tooltip"]').tooltip({ container: 'body', placement: 'bottom' });
     },
 
@@ -17,10 +18,8 @@ define([
     },
 
     serializeData: function () {
-      var dangerStatuses = ['CANCELLED', 'FAIL'];
       return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), {
-        duration: this.model.getDuration(),
-        danger: dangerStatuses.indexOf(this.model.get('status')) !== -1
+        duration: this.model.getDuration()
       });
     }
   });
index 1131c24c1e9178be6c5c548694281318bfa79f46..2eac3f23e8469e96d603c339c6c75220b4853dfd 100644 (file)
@@ -16,6 +16,11 @@ define(function () {
         };
       }
       return duration;
+    },
+
+    isDanger: function () {
+      var dangerStatuses = ['CANCELLED', 'FAILED'];
+      return dangerStatuses.indexOf(this.get('status')) !== -1;
     }
   });
 
index ab30221734c486d4cf215dd786ccf013a4fb1ced..5a6ad8c3a243da5018768b4d2109fbd1471a5353 100644 (file)
@@ -27,6 +27,6 @@
   </div>
 {{/if}}
 
-<div class="pull-right {{#if danger}}text-danger{{/if}}">
+<div class="pull-right">
   #{{key}} {{status}}
 </div>
index 55c32ad5de12e0113c8f0e78054ddc6855c200da..bc067a025c9bc70411a7fd1b343a6dcdd0dcf123 100644 (file)
@@ -19,6 +19,7 @@
  */
 @import (reference) "../variables";
 @import (reference) "../mixins";
+@import (reference) "../init/misc";
 
 .panel {
   padding: 10px;
@@ -39,3 +40,9 @@
   border: 1px solid @blue;
   background-color: @lightBlue;
 }
+
+.panel-danger {
+  border-color: transparent !important;
+  background-color: #f2dede;
+  color: #a94442;
+}
index 0922feb52b91452e7b36c79b43e5aedd5d7ea16a..d73a5d14e0e604f0e81a597434471314962429d2 100644 (file)
@@ -6,7 +6,7 @@ lib.initMessages();
 lib.changeWorkingDirectory('computation-spec');
 lib.configureCasper();
 
-casper.test.begin(testName('List'), 8, function (test) {
+casper.test.begin(testName('List'), 9, function (test) {
   casper
       .start(lib.buildUrl('computation'), function () {
         lib.setDefaultViewport();
@@ -42,6 +42,7 @@ casper.test.begin(testName('List'), 8, function (test) {
         test.assertElementCount('#computation-list li[data-id]', 3);
         test.assertSelectorContains('#computation-list', 'Duration');
         test.assertExists('.js-history.selected');
+        test.assertExists('.panel-danger[data-id="3"]');
       })
 
       .then(function () {
index f6fea2634a8c8ffcc5f2ee1bc231ed95ce0d8d68..f0cd0fc3f8b057e923261bd041f7b670d742c2f9 100644 (file)
@@ -5,7 +5,7 @@
   "reports": [
     {
       "submittedAt": "2015-05-13T15:44:15+0200",
-      "status": "FAIL",
+      "status": "FAILED",
       "finishedAt": "2015-05-13T15:44:18+0200",
       "startedAt": "2015-05-13T15:44:15+0200",
       "projectUuid": "id-sonarqube",
index fbc51a09bd33a23576d8c09df52f8bad82b1c0db..1bb4198fcedd8f9f8b9ad6ee9f1634bdc62547eb 100644 (file)
@@ -5,7 +5,7 @@
   "reports": [
     {
       "submittedAt": "2015-05-13T15:44:15+0200",
-      "status": "FAIL",
+      "status": "FAILED",
       "finishedAt": "2015-05-13T15:44:18+0200",
       "startedAt": "2015-05-13T15:44:15+0200",
       "projectUuid": "id-sonarqube",