import Backbone from 'backbone';
-<<<<<<< d3fd3a3175fac49d0c2874dc33e06497d4505de1
export default Backbone.Model.extend({
- idAttribute: 'key',
+ idAttribute: 'id',
getDuration: function () {
var duration = null;
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;
}
});
-
-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;
- }
-
- });
});
-
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' });
}
});
-
+++ /dev/null
-#
-# 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
--- /dev/null
+#
+# 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
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 () {
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 () {
.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');
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
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;
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);
}
}