From: Stas Vilchik Date: Mon, 8 Jun 2015 15:25:39 +0000 (+0200) Subject: return backgrounds for failed analysis X-Git-Tag: 5.2-RC1~1567 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=ec0dc9b0b2f66b6749a44d1d1a439b553fe5c80b;p=sonarqube.git return backgrounds for failed analysis --- diff --git a/server/sonar-web/src/main/js/apps/computation/list-item-view.js b/server/sonar-web/src/main/js/apps/computation/list-item-view.js index 5545f2ba0ac..e457b39c2f3 100644 --- a/server/sonar-web/src/main/js/apps/computation/list-item-view.js +++ b/server/sonar-web/src/main/js/apps/computation/list-item-view.js @@ -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() }); } }); diff --git a/server/sonar-web/src/main/js/apps/computation/report.js b/server/sonar-web/src/main/js/apps/computation/report.js index 1131c24c1e9..2eac3f23e84 100644 --- a/server/sonar-web/src/main/js/apps/computation/report.js +++ b/server/sonar-web/src/main/js/apps/computation/report.js @@ -16,6 +16,11 @@ define(function () { }; } return duration; + }, + + isDanger: function () { + var dangerStatuses = ['CANCELLED', 'FAILED']; + return dangerStatuses.indexOf(this.get('status')) !== -1; } }); diff --git a/server/sonar-web/src/main/js/apps/computation/templates/computation-list-item.hbs b/server/sonar-web/src/main/js/apps/computation/templates/computation-list-item.hbs index ab30221734c..5a6ad8c3a24 100644 --- a/server/sonar-web/src/main/js/apps/computation/templates/computation-list-item.hbs +++ b/server/sonar-web/src/main/js/apps/computation/templates/computation-list-item.hbs @@ -27,6 +27,6 @@ {{/if}} -
+
#{{key}} {{status}}
diff --git a/server/sonar-web/src/main/less/components/panels.less b/server/sonar-web/src/main/less/components/panels.less index 55c32ad5de1..bc067a025c9 100644 --- a/server/sonar-web/src/main/less/components/panels.less +++ b/server/sonar-web/src/main/less/components/panels.less @@ -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; +} diff --git a/server/sonar-web/src/test/js/computation-spec.js b/server/sonar-web/src/test/js/computation-spec.js index 0922feb52b9..d73a5d14e0e 100644 --- a/server/sonar-web/src/test/js/computation-spec.js +++ b/server/sonar-web/src/test/js/computation-spec.js @@ -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 () { diff --git a/server/sonar-web/src/test/json/computation-spec/history-big-2.json b/server/sonar-web/src/test/json/computation-spec/history-big-2.json index f6fea2634a8..f0cd0fc3f8b 100644 --- a/server/sonar-web/src/test/json/computation-spec/history-big-2.json +++ b/server/sonar-web/src/test/json/computation-spec/history-big-2.json @@ -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", diff --git a/server/sonar-web/src/test/json/computation-spec/history.json b/server/sonar-web/src/test/json/computation-spec/history.json index fbc51a09bd3..1bb4198fced 100644 --- a/server/sonar-web/src/test/json/computation-spec/history.json +++ b/server/sonar-web/src/test/json/computation-spec/history.json @@ -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",