aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@sonarsource.com>2015-09-19 00:08:53 +0200
committerSimon Brandhof <simon.brandhof@sonarsource.com>2015-09-19 08:56:41 +0200
commit1930d3927a57af7007c46605ae2a99357218b4ed (patch)
treee67c9ca4479c6c5065e8edbad6c193acd36f84f2
parent1ce6cafa3757ce187cf66bc24b780680452808c1 (diff)
downloadsonarqube-1930d3927a57af7007c46605ae2a99357218b4ed.tar.gz
sonarqube-1930d3927a57af7007c46605ae2a99357218b4ed.zip
Fix merge of branch feature/ce-monitoring
- JS changes (ES2015) - DB migration conflicts
-rw-r--r--server/sonar-web/src/main/js/apps/computation/report.js27
-rw-r--r--server/sonar-web/src/main/js/apps/computation/reports.js62
-rw-r--r--server/sonar-web/src/main/js/apps/computation/router.js14
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/db/migrate/937_increase_precision_of_numerics.rb (renamed from server/sonar-web/src/main/webapp/WEB-INF/db/migrate/931_increase_precision_of_numerics.rb)0
-rw-r--r--server/sonar-web/src/test/js/computation-spec.js8
-rw-r--r--sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java2
-rw-r--r--sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql1
-rw-r--r--sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java2
8 files changed, 40 insertions, 76 deletions
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 6296f0bcaa0..a8bbec66824 100644
--- a/server/sonar-web/src/main/js/apps/computation/report.js
+++ b/server/sonar-web/src/main/js/apps/computation/report.js
@@ -1,8 +1,7 @@
import Backbone from 'backbone';
-<<<<<<< d3fd3a3175fac49d0c2874dc33e06497d4505de1
export default Backbone.Model.extend({
- idAttribute: 'key',
+ idAttribute: 'id',
getDuration: function () {
var duration = null;
@@ -15,35 +14,13 @@ export default Backbone.Model.extend({
minutes: Math.floor(diff / (1000 * 60)) % 60,
hours: Math.floor(diff / (1000 * 60 * 60)) % 24
};
-=======
- return Backbone.Model.extend({
- getDuration: function () {
- var duration = null;
- if (this.has('startedAt')) {
- var startedAtMoment = moment(this.get('startedAt')),
- finishedAtMoment = moment(this.get('finishedAt') || new Date()),
- diff = finishedAtMoment.diff(startedAtMoment);
- duration = {
- seconds: Math.floor(diff / 1000) % 60,
- minutes: Math.floor(diff / (1000 * 60)) % 60,
- hours: Math.floor(diff / (1000 * 60 * 60)) % 24
- };
- }
- return duration;
- },
-
- isDanger: function () {
- var dangerStatuses = ['CANCELLED', 'FAILED'];
- return dangerStatuses.indexOf(this.get('status')) !== -1;
->>>>>>> SONAR-6834 use new API
}
return duration;
},
isDanger: function () {
- var dangerStatuses = ['CANCELLED', 'FAILED'];
+ var dangerStatuses = ['CANCELED', 'FAILED'];
return dangerStatuses.indexOf(this.get('status')) !== -1;
}
});
-
diff --git a/server/sonar-web/src/main/js/apps/computation/reports.js b/server/sonar-web/src/main/js/apps/computation/reports.js
index e284d27ee68..2281cc88150 100644
--- a/server/sonar-web/src/main/js/apps/computation/reports.js
+++ b/server/sonar-web/src/main/js/apps/computation/reports.js
@@ -1,35 +1,33 @@
-define([
- './report'
-], function (Report) {
+import _ from 'underscore';
+import Backbone from 'backbone';
+import Report from './report';
+
+export default Backbone.Collection.extend({
+ model: Report,
+ url: '',
+
+ parse: function (r) {
+ this.total = (r.paging && r.paging.total) || r.tasks.length;
+ this.p = (r.paging && r.paging.pageIndex) || 1;
+ this.ps = r.paging && r.paging.pageSize;
+ return r.tasks;
+ },
+
+ fetch: function (options) {
+ var opts = _.defaults(options || {}, { q: this.q }, { q: 'activity', data: { ps: 250 } });
+ opts.url = baseUrl + '/api/ce/' + opts.q;
+ this.q = opts.q;
+ return Backbone.Collection.prototype.fetch.call(this, opts);
+ },
+
+ fetchMore: function () {
+ var p = this.p + 1;
+ return this.fetch({ add: true, remove: false, data: { p: p, ps: this.ps } });
+ },
+
+ hasMore: function () {
+ return this.total > this.p * this.ps;
+ }
- return Backbone.Collection.extend({
- model: Report,
- url: '',
-
- parse: function (r) {
- this.total = (r.paging && r.paging.total) || r.tasks.length;
- this.p = (r.paging && r.paging.pageIndex) || 1;
- this.ps = r.paging && r.paging.pageSize;
- return r.tasks;
- },
-
- fetch: function (options) {
- var opts = _.defaults(options || {}, { q: this.q }, { q: 'activity', data: { ps: 250 } });
- opts.url = baseUrl + '/api/ce/' + opts.q;
- this.q = opts.q;
- return Backbone.Collection.prototype.fetch.call(this, opts);
- },
-
- fetchMore: function () {
- var p = this.p + 1;
- return this.fetch({ add: true, remove: false, data: { p: p, ps: this.ps } });
- },
-
- hasMore: function () {
- return this.total > this.p * this.ps;
- }
-
- });
});
-
diff --git a/server/sonar-web/src/main/js/apps/computation/router.js b/server/sonar-web/src/main/js/apps/computation/router.js
index 6ecfb238617..a7543e934a5 100644
--- a/server/sonar-web/src/main/js/apps/computation/router.js
+++ b/server/sonar-web/src/main/js/apps/computation/router.js
@@ -17,24 +17,12 @@ export default Backbone.Router.extend({
this.current();
},
-<<<<<<< d3fd3a3175fac49d0c2874dc33e06497d4505de1
current: function () {
this.options.reports.fetch({ q: 'queue' });
},
-=======
- current: function () {
- this.options.reports.fetch({ q: 'queue' });
- },
-
- past: function () {
- this.options.reports.fetch({ q: 'activity' });
- }
- });
->>>>>>> SONAR-6834 use new API
past: function () {
- this.options.reports.fetch({ q: 'history' });
+ this.options.reports.fetch({ q: 'activity' });
}
});
-
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/931_increase_precision_of_numerics.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/937_increase_precision_of_numerics.rb
index aa86563db8f..aa86563db8f 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/931_increase_precision_of_numerics.rb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/937_increase_precision_of_numerics.rb
diff --git a/server/sonar-web/src/test/js/computation-spec.js b/server/sonar-web/src/test/js/computation-spec.js
index 2cf0c2418d3..97e4638a0d9 100644
--- a/server/sonar-web/src/test/js/computation-spec.js
+++ b/server/sonar-web/src/test/js/computation-spec.js
@@ -10,8 +10,8 @@ casper.test.begin(testName('List'), 9, function (test) {
casper
.start(lib.buildUrl('base'), function () {
lib.setDefaultViewport();
- lib.mockRequestFromFile('/api/computation/queue', 'queue.json');
- lib.mockRequestFromFile('/api/computation/history', 'history.json');
+ lib.mockRequestFromFile('/api/ce/queue', 'queue.json');
+ lib.mockRequestFromFile('/api/ce/activity', 'history.json');
})
.then(function () {
@@ -67,7 +67,7 @@ casper.test.begin(testName('Show More'), 2, function (test) {
casper
.start(lib.buildUrl('base#past'), function () {
lib.setDefaultViewport();
- this.searchMock = lib.mockRequestFromFile('/api/computation/history', 'history-big-1.json');
+ this.searchMock = lib.mockRequestFromFile('/api/ce/activity', 'history-big-1.json');
})
.then(function () {
@@ -85,7 +85,7 @@ casper.test.begin(testName('Show More'), 2, function (test) {
.then(function () {
test.assertElementCount('#computation-list li[data-id]', 2);
lib.clearRequestMock(this.searchMock);
- this.searchMock = lib.mockRequestFromFile('/api/computation/history', 'history-big-2.json',
+ this.searchMock = lib.mockRequestFromFile('/api/ce/activity', 'history-big-2.json',
{ data: { p: '2' } });
casper.click('#computation-fetch-more');
casper.waitForSelectorTextChange('#computation-list-footer');
diff --git a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
index bc7cfd3c9fa..04df75b3b78 100644
--- a/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
+++ b/sonar-db/src/main/java/org/sonar/db/version/DatabaseVersion.java
@@ -29,7 +29,7 @@ import org.sonar.db.MyBatis;
public class DatabaseVersion {
- public static final int LAST_VERSION = 936;
+ public static final int LAST_VERSION = 937;
/**
* The minimum supported version which can be upgraded. Lower
diff --git a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
index 1f670faabea..5d5904a92d7 100644
--- a/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
+++ b/sonar-db/src/main/resources/org/sonar/db/version/rows-h2.sql
@@ -355,6 +355,7 @@ INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('933');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('934');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('935');
INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('936');
+INSERT INTO SCHEMA_MIGRATIONS(VERSION) VALUES ('937');
INSERT INTO USERS(ID, LOGIN, NAME, EMAIL, CRYPTED_PASSWORD, SALT, CREATED_AT, UPDATED_AT, REMEMBER_TOKEN, REMEMBER_TOKEN_EXPIRES_AT) VALUES (1, 'admin', 'Administrator', '', 'a373a0e667abb2604c1fd571eb4ad47fe8cc0878', '48bc4b0d93179b5103fd3885ea9119498e9d161b', '1418215735482', '1418215735482', null, null);
ALTER TABLE USERS ALTER COLUMN ID RESTART WITH 2;
diff --git a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java
index 933def51755..bbb1432b157 100644
--- a/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java
+++ b/sonar-db/src/test/java/org/sonar/db/version/MigrationStepModuleTest.java
@@ -29,6 +29,6 @@ public class MigrationStepModuleTest {
public void verify_count_of_added_MigrationStep_types() {
ComponentContainer container = new ComponentContainer();
new MigrationStepModule().configure(container);
- assertThat(container.size()).isEqualTo(39);
+ assertThat(container.size()).isEqualTo(40);
}
}