From: Stas Vilchik Date: Fri, 2 Oct 2015 09:01:38 +0000 (+0200) Subject: SONAR-6834 clean up old code X-Git-Tag: 5.2-RC1~119 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b9f6543107319cb830dbc3f47900bdb6494077ea;p=sonarqube.git SONAR-6834 clean up old code --- diff --git a/server/sonar-web/Gruntfile.coffee b/server/sonar-web/Gruntfile.coffee index f18ddd4b0d4..e2eecf52e60 100644 --- a/server/sonar-web/Gruntfile.coffee +++ b/server/sonar-web/Gruntfile.coffee @@ -144,7 +144,6 @@ module.exports = (grunt) -> 'build-app:api-documentation' 'build-app:background-tasks' 'build-app:coding-rules' - 'build-app:computation' 'build-app:custom-measures' 'build-app:drilldown' 'build-app:global-permissions' @@ -228,9 +227,6 @@ module.exports = (grunt) -> '<%= BUILD_PATH %>/js/apps/groups/templates.js': [ '<%= SOURCE_PATH %>/js/apps/groups/templates/**/*.hbs' ] - '<%= BUILD_PATH %>/js/apps/computation/templates.js': [ - '<%= SOURCE_PATH %>/js/apps/computation/templates/**/*.hbs' - ] '<%= BUILD_PATH %>/js/apps/metrics/templates.js': [ '<%= SOURCE_PATH %>/js/apps/metrics/templates/**/*.hbs' ] diff --git a/server/sonar-web/src/main/js/apps/computation/app.js b/server/sonar-web/src/main/js/apps/computation/app.js deleted file mode 100644 index ed7d8ede521..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/app.js +++ /dev/null @@ -1,57 +0,0 @@ -import Backbone from 'backbone'; -import Marionette from 'backbone.marionette'; -import Router from './router'; -import Layout from './layout'; -import Reports from './reports'; -import HeaderView from './header-view'; -import SearchView from './search-view'; -import ListView from './list-view'; -import ListFooterView from './list-footer-view'; - -var App = new Marionette.Application(), - init = function (options) { - // Collection - this.reports = new Reports(); - - // Router - this.router = new Router({ reports: this.reports }); - - // Layout - this.layout = new Layout({ el: options.el }); - this.layout.render(); - - // Header View - this.headerView = new HeaderView({ collection: this.reports }); - this.layout.headerRegion.show(this.headerView); - - // Search View - this.searchView = new SearchView({ - collection: this.reports, - router: this.router - }); - this.layout.searchRegion.show(this.searchView); - - // List View - this.listView = new ListView({ collection: this.reports }); - this.layout.listRegion.show(this.listView); - - // List Footer View - this.listFooterView = new ListFooterView({ collection: this.reports }); - this.layout.listFooterRegion.show(this.listFooterView); - - // Go! - Backbone.history.start({ - pushState: true, - root: options.urlRoot - }); - }; - -App.on('start', function (options) { - window.requestMessages().done(function () { - init.call(App, options); - }); -}); - -export default App; - - diff --git a/server/sonar-web/src/main/js/apps/computation/header-view.js b/server/sonar-web/src/main/js/apps/computation/header-view.js deleted file mode 100644 index 570ea82cde2..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/header-view.js +++ /dev/null @@ -1,8 +0,0 @@ -import Marionette from 'backbone.marionette'; -import './templates'; - -export default Marionette.ItemView.extend({ - template: Templates['computation-header'] -}); - - diff --git a/server/sonar-web/src/main/js/apps/computation/layout.js b/server/sonar-web/src/main/js/apps/computation/layout.js deleted file mode 100644 index 7ac5b7007bd..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/layout.js +++ /dev/null @@ -1,15 +0,0 @@ -import Marionette from 'backbone.marionette'; -import './templates'; - -export default Marionette.LayoutView.extend({ - template: Templates['computation-layout'], - - regions: { - headerRegion: '#computation-header', - searchRegion: '#computation-search', - listRegion: '#computation-list', - listFooterRegion: '#computation-list-footer' - } -}); - - diff --git a/server/sonar-web/src/main/js/apps/computation/list-footer-view.js b/server/sonar-web/src/main/js/apps/computation/list-footer-view.js deleted file mode 100644 index 89ee3120934..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/list-footer-view.js +++ /dev/null @@ -1,34 +0,0 @@ -import _ from 'underscore'; -import Marionette from 'backbone.marionette'; -import './templates'; - -export default Marionette.ItemView.extend({ - template: Templates['computation-list-footer'], - - collectionEvents: { - 'all': 'render' - }, - - events: { - 'click #computation-fetch-more': 'onMoreClick' - }, - - onMoreClick: function (e) { - e.preventDefault(); - this.fetchMore(); - }, - - fetchMore: function () { - this.collection.fetchMore(); - }, - - serializeData: function () { - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - total: this.collection.total, - count: this.collection.length, - more: this.collection.hasMore() - }); - } -}); - - 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 deleted file mode 100644 index e891effd244..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/list-item-view.js +++ /dev/null @@ -1,27 +0,0 @@ -import _ from 'underscore'; -import Marionette from 'backbone.marionette'; -import './templates'; - -export default Marionette.ItemView.extend({ - tagName: 'li', - 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' }); - }, - - onDestroy: function () { - this.$('[data-toggle="tooltip"]').tooltip('destroy'); - }, - - serializeData: function () { - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - duration: this.model.getDuration() - }); - } -}); - - diff --git a/server/sonar-web/src/main/js/apps/computation/list-view.js b/server/sonar-web/src/main/js/apps/computation/list-view.js deleted file mode 100644 index 695bf2ac034..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/list-view.js +++ /dev/null @@ -1,10 +0,0 @@ -import Marionette from 'backbone.marionette'; -import ListItemView from './list-item-view'; -import './templates'; - -export default Marionette.CollectionView.extend({ - tagName: 'ul', - childView: ListItemView -}); - - diff --git a/server/sonar-web/src/main/js/apps/computation/report.js b/server/sonar-web/src/main/js/apps/computation/report.js deleted file mode 100644 index 3dec4d50324..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/report.js +++ /dev/null @@ -1,26 +0,0 @@ -import Backbone from 'backbone'; - -export default Backbone.Model.extend({ - idAttribute: 'id', - - getDuration: function () { - var duration = null; - if (this.has('startedAt')) { - var startedAtMoment = moment(this.get('startedAt')), - finishedAtMoment = moment(this.get('executedAt') || 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 = ['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 deleted file mode 100644 index 2281cc88150..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/reports.js +++ /dev/null @@ -1,33 +0,0 @@ -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; - } - -}); - diff --git a/server/sonar-web/src/main/js/apps/computation/router.js b/server/sonar-web/src/main/js/apps/computation/router.js deleted file mode 100644 index a7543e934a5..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/router.js +++ /dev/null @@ -1,28 +0,0 @@ -import Backbone from 'backbone'; - -export default Backbone.Router.extend({ - routes: { - '': 'index', - 'index': 'index', - 'current': 'current', - 'past': 'past' - }, - - initialize: function (options) { - this.options = options; - }, - - index: function () { - this.navigate('current'); - this.current(); - }, - - current: function () { - this.options.reports.fetch({ q: 'queue' }); - }, - - past: function () { - this.options.reports.fetch({ q: 'activity' }); - } -}); - diff --git a/server/sonar-web/src/main/js/apps/computation/search-view.js b/server/sonar-web/src/main/js/apps/computation/search-view.js deleted file mode 100644 index 1e896df0c16..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/search-view.js +++ /dev/null @@ -1,34 +0,0 @@ -import _ from 'underscore'; -import Marionette from 'backbone.marionette'; -import './templates'; - -export default Marionette.ItemView.extend({ - template: Templates['computation-search'], - - collectionEvents: { - 'all': 'render' - }, - - events: { - 'click .js-queue': 'queue', - 'click .js-history': 'history' - }, - - queue: function (e) { - e.preventDefault(); - this.options.router.navigate('current', { trigger: true }); - }, - - history: function (e) { - e.preventDefault(); - this.options.router.navigate('past', { trigger: true }); - }, - - serializeData: function () { - return _.extend(Marionette.ItemView.prototype.serializeData.apply(this, arguments), { - tab: this.collection.q - }); - } -}); - - diff --git a/server/sonar-web/src/main/js/apps/computation/templates/computation-header.hbs b/server/sonar-web/src/main/js/apps/computation/templates/computation-header.hbs deleted file mode 100644 index 1995afdb34c..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/templates/computation-header.hbs +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/server/sonar-web/src/main/js/apps/computation/templates/computation-layout.hbs b/server/sonar-web/src/main/js/apps/computation/templates/computation-layout.hbs deleted file mode 100644 index 0d6d7f04ac5..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/templates/computation-layout.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
-
- -
- -
diff --git a/server/sonar-web/src/main/js/apps/computation/templates/computation-list-footer.hbs b/server/sonar-web/src/main/js/apps/computation/templates/computation-list-footer.hbs deleted file mode 100644 index 5a612644148..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/templates/computation-list-footer.hbs +++ /dev/null @@ -1,6 +0,0 @@ - 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 deleted file mode 100644 index dcc4feb1bfc..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/templates/computation-list-item.hbs +++ /dev/null @@ -1,32 +0,0 @@ -
- - {{componentName}} -
- -
- -
- - -{{#if duration}} -
- Duration: - {{#gt duration.hours 0}}{{duration.hours}}h{{/gt}} - {{#gt duration.minutes 0}}{{duration.minutes}}m{{/gt}} - {{duration.seconds}}s -
-{{/if}} - -
- {{status}} -
diff --git a/server/sonar-web/src/main/js/apps/computation/templates/computation-search.hbs b/server/sonar-web/src/main/js/apps/computation/templates/computation-search.hbs deleted file mode 100644 index a41e880792d..00000000000 --- a/server/sonar-web/src/main/js/apps/computation/templates/computation-search.hbs +++ /dev/null @@ -1,6 +0,0 @@ -
- -
diff --git a/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx b/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx index b6f77e505fe..e6e316a9ed4 100644 --- a/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx +++ b/server/sonar-web/src/main/js/apps/nav/settings/settings-nav.jsx @@ -57,8 +57,6 @@ export default React.createClass({ diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/computation_controller.rb b/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/computation_controller.rb deleted file mode 100644 index 5d825bd26a6..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/controllers/computation_controller.rb +++ /dev/null @@ -1,39 +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. -# - -class ComputationController < ApplicationController - - before_filter :admin_required - - SECTION=Navigation::SECTION_CONFIGURATION - - def index - render :action => 'index' - end - - def current - render :action => 'index' - end - - def past - render :action => 'index' - end - -end diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb deleted file mode 100644 index 1e7b45c9f6c..00000000000 --- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/computation/index.html.erb +++ /dev/null @@ -1,7 +0,0 @@ -<% content_for :extra_script do %> - -<% end %> diff --git a/server/sonar-web/test/json/computation-spec/history-big-1.json b/server/sonar-web/test/json/computation-spec/history-big-1.json deleted file mode 100644 index 2007319f5e8..00000000000 --- a/server/sonar-web/test/json/computation-spec/history-big-1.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "paging": { - "pageIndex": 1, - "pageSize": 2, - "total": 3 - }, - "tasks": [ - { - "id": "AU_fwURCrnmp3Ks0AiQq", - "type": "REPORT", - "componentId": "AU_VQoJCzEjRSwxhFuns", - "componentKey": "com.sonarsource.rule-api:rule-api", - "componentName": "SonarSource :: Rule API", - "status": "SUCCESS", - "submittedAt": "2015-09-18T11:20:43+0200", - "startedAt": "2015-09-18T11:20:37+0200", - "executedAt": "2015-09-18T11:20:43+0200", - "executionTimeMs": 6030 - }, - { - "id": "AU_fvdwNrnmp3Ks0AiLg", - "type": "REPORT", - "componentId": "AU_VQoJCzEjRSwxhFuns", - "componentKey": "com.sonarsource.rule-api:rule-api", - "componentName": "SonarSource :: Rule API", - "status": "SUCCESS", - "submittedAt": "2015-09-18T11:16:56+0200", - "startedAt": "2015-09-18T11:16:47+0200", - "executedAt": "2015-09-18T11:16:56+0200", - "executionTimeMs": 8671 - } - ] -} diff --git a/server/sonar-web/test/json/computation-spec/history-big-2.json b/server/sonar-web/test/json/computation-spec/history-big-2.json deleted file mode 100644 index 82bb0687ca6..00000000000 --- a/server/sonar-web/test/json/computation-spec/history-big-2.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "paging": { - "pageIndex": 2, - "pageSize": 2, - "total": 3 - }, - "tasks": [ - { - "id": "AU_fvdwNrnmp5Ks0AiLg", - "type": "REPORT", - "componentId": "AU_VQoJCzEjRSwxhFuns", - "componentKey": "com.sonarsource.rule-api:rule-api", - "componentName": "SonarSource :: Rule API", - "status": "SUCCESS", - "submittedAt": "2015-09-18T11:16:56+0200", - "startedAt": "2015-09-18T11:16:47+0200", - "executedAt": "2015-09-18T11:16:56+0200", - "executionTimeMs": 8671 - } - ] -} diff --git a/server/sonar-web/test/json/computation-spec/history.json b/server/sonar-web/test/json/computation-spec/history.json deleted file mode 100644 index 2aa4f0265f9..00000000000 --- a/server/sonar-web/test/json/computation-spec/history.json +++ /dev/null @@ -1,33 +0,0 @@ -{ - "paging": { - "pageIndex": 1, - "pageSize": 2, - "total": 2 - }, - "tasks": [ - { - "id": "AU_fwURCrnmp3Ks0AiQq", - "type": "REPORT", - "componentId": "AU_VQoJCzEjRSwxhFuns", - "componentKey": "com.sonarsource.rule-api:rule-api", - "componentName": "SonarSource :: Rule API", - "status": "SUCCESS", - "submittedAt": "2015-09-18T11:20:43+0200", - "startedAt": "2015-09-18T11:20:37+0200", - "executedAt": "2015-09-18T11:20:43+0200", - "executionTimeMs": 6030 - }, - { - "id": "AU_fvdwNrnmp3Ks0AiLg", - "type": "REPORT", - "componentId": "AU_VQoJCzEjRSwxhFuns", - "componentKey": "com.sonarsource.rule-api:rule-api", - "componentName": "SonarSource :: Rule API", - "status": "SUCCESS", - "submittedAt": "2015-09-18T11:16:56+0200", - "startedAt": "2015-09-18T11:16:47+0200", - "executedAt": "2015-09-18T11:16:56+0200", - "executionTimeMs": 8671 - } - ] -} diff --git a/server/sonar-web/test/json/computation-spec/queue.json b/server/sonar-web/test/json/computation-spec/queue.json deleted file mode 100644 index a4dfb5b7646..00000000000 --- a/server/sonar-web/test/json/computation-spec/queue.json +++ /dev/null @@ -1,13 +0,0 @@ -{ - "tasks": [ - { - "id": "AU_fvdwNrnmp5Ks0AiLg", - "type": "REPORT", - "componentId": "AU_VQoJCzEjRSwxhFuns", - "componentKey": "com.sonarsource.rule-api:rule-api", - "componentName": "SonarSource :: Rule API", - "status": "PENDING", - "submittedAt": "2015-09-18T11:16:56+0200" - } - ] -} diff --git a/server/sonar-web/test/medium/computation.spec.js b/server/sonar-web/test/medium/computation.spec.js deleted file mode 100644 index 52b23a5391d..00000000000 --- a/server/sonar-web/test/medium/computation.spec.js +++ /dev/null @@ -1,37 +0,0 @@ -define(function (require) { - var bdd = require('intern!bdd'); - require('../helpers/test-page'); - - bdd.describe('Computation Page', function () { - bdd.it('should show list', function () { - return this.remote - .open() - .mockFromFile('/api/ce/queue', 'computation-spec/queue.json') - .mockFromFile('/api/ce/activity', 'computation-spec/history.json') - .startApp('computation', { urlRoot: '/test/medium/base.html' }) - .checkElementCount('#computation-list li[data-id]', 1) - .checkElementInclude('#computation-list', 'SonarSource :: Rule API') - .checkElementInclude('#computation-list-footer', '1') - .checkElementExist('.js-queue.selected') - .clickElement('.js-history') - .checkElementCount('#computation-list li[data-id]', 2) - .checkElementInclude('#computation-list', 'Duration') - .checkElementExist('.js-history.selected') - .clickElement('.js-queue') - .checkElementCount('#computation-list li[data-id]', 1); - }); - - bdd.it('should show more', function () { - return this.remote - .open('#past') - .mockFromFile('/api/ce/queue', 'computation-spec/queue.json') - .mockFromFile('/api/ce/activity', 'computation-spec/history-big-1.json') - .startApp('computation', { urlRoot: '/test/medium/base.html' }) - .checkElementCount('#computation-list li[data-id]', 2) - .clearMocks() - .mockFromFile('/api/ce/activity', 'computation-spec/history-big-2.json', { data: { p: 2 } }) - .clickElement('#computation-fetch-more') - .checkElementCount('#computation-list li[data-id]', 3); - }); - }); -});