From: Simon Brandhof Date: Fri, 18 Sep 2015 22:08:53 +0000 (+0200) Subject: Fix merge of branch feature/ce-monitoring X-Git-Tag: 5.2-RC1~321 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=1930d3927a57af7007c46605ae2a99357218b4ed;p=sonarqube.git Fix merge of branch feature/ce-monitoring - JS changes (ES2015) - DB migration conflicts --- 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/931_increase_precision_of_numerics.rb deleted file mode 100644 index aa86563db8f..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/931_increase_precision_of_numerics.rb +++ /dev/null @@ -1,31 +0,0 @@ -# -# SonarQube, open source software quality management tool. -# Copyright (C) 2008-2014 SonarSource -# mailto:contact AT sonarsource DOT com -# -# SonarQube is free software; you can redistribute it and/or -# modify it under the terms of the GNU Lesser General Public -# License as published by the Free Software Foundation; either -# version 3 of the License, or (at your option) any later version. -# -# SonarQube is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -# Lesser General Public License for more details. -# -# You should have received a copy of the GNU Lesser General Public License -# along with this program; if not, write to the Free Software Foundation, -# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -# - -# -# SonarQube 5.2 -# SONAR-6710 -# -class IncreasePrecisionOfNumerics < ActiveRecord::Migration - - def self.up - execute_java_migration('org.sonar.db.version.v52.IncreasePrecisionOfNumerics') - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/937_increase_precision_of_numerics.rb b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/937_increase_precision_of_numerics.rb new file mode 100644 index 00000000000..aa86563db8f --- /dev/null +++ b/server/sonar-web/src/main/webapp/WEB-INF/db/migrate/937_increase_precision_of_numerics.rb @@ -0,0 +1,31 @@ +# +# SonarQube, open source software quality management tool. +# Copyright (C) 2008-2014 SonarSource +# mailto:contact AT sonarsource DOT com +# +# SonarQube is free software; you can redistribute it and/or +# modify it under the terms of the GNU Lesser General Public +# License as published by the Free Software Foundation; either +# version 3 of the License, or (at your option) any later version. +# +# SonarQube is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# Lesser General Public License for more details. +# +# You should have received a copy of the GNU Lesser General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +# + +# +# SonarQube 5.2 +# SONAR-6710 +# +class IncreasePrecisionOfNumerics < ActiveRecord::Migration + + def self.up + execute_java_migration('org.sonar.db.version.v52.IncreasePrecisionOfNumerics') + end + +end 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); } }