'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'
'<%= 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'
]
+++ /dev/null
-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;
-
-
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import './templates';
-
-export default Marionette.ItemView.extend({
- template: Templates['computation-header']
-});
-
-
+++ /dev/null
-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'
- }
-});
-
-
+++ /dev/null
-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()
- });
- }
-});
-
-
+++ /dev/null
-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()
- });
- }
-});
-
-
+++ /dev/null
-import Marionette from 'backbone.marionette';
-import ListItemView from './list-item-view';
-import './templates';
-
-export default Marionette.CollectionView.extend({
- tagName: 'ul',
- childView: ListItemView
-});
-
-
+++ /dev/null
-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;
- }
-});
-
+++ /dev/null
-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;
- }
-
-});
-
+++ /dev/null
-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' });
- }
-});
-
+++ /dev/null
-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
- });
- }
-});
-
-
+++ /dev/null
-<header class="page-header">
- <h1 class="page-title">Project Computation</h1>
- <p class="page-description">The server is in charge to process reports submitted by batch analyses. This page allows
- to monitor the queue of pending reports to process, and gives access to the history of past analyses.</p>
-</header>
+++ /dev/null
-<div class="page">
- <div id="computation-header"></div>
- <div id="computation-search"></div>
- <div id="computation-list"></div>
- <div id="computation-list-footer"></div>
-</div>
+++ /dev/null
-<footer class="spacer-top note text-center">
- {{count}}/{{total}} shown
- {{#if more}}
- <a id="computation-fetch-more" class="spacer-left" href="#">show more</a>
- {{/if}}
-</footer>
+++ /dev/null
-<div class="display-inline-block text-top width-30">
- <i class="icon-qualifier-trk"></i>
- <a href="{{dashboardUrl componentKey}}">{{componentName}}</a>
-</div>
-
-<div class="display-inline-block text-top width-30">
- <ul>
- {{#if submittedAt}}
- <li>Submitted: {{dt submittedAt}}</li>
- {{/if}}
- {{#if startedAt}}
- <li>Started: {{dt startedAt}}</li>
- {{/if}}
- {{#if executedAt}}
- <li>Executed: {{dt executedAt}}</li>
- {{/if}}
- </ul>
-</div>
-
-
-{{#if duration}}
- <div class="display-inline-block text-top width-30">
- Duration:
- {{#gt duration.hours 0}}{{duration.hours}}h{{/gt}}
- {{#gt duration.minutes 0}}{{duration.minutes}}m{{/gt}}
- {{duration.seconds}}s
- </div>
-{{/if}}
-
-<div class="pull-right">
- {{status}}
-</div>
+++ /dev/null
-<div class="spacer-top">
- <ul class="tabs">
- <li><a class="js-queue {{#eq tab 'queue'}}selected{{/eq}}">{{t 'analysis_reports.current_activity'}}</a></li>
- <li><a class="js-history {{#eq tab 'activity'}}selected{{/eq}}">{{t 'analysis_reports.past_reports'}}</a></li>
- </ul>
-</div>
<ul className="dropdown-menu">
{this.renderLink('/projects', 'Management')}
{this.renderLink('/background_tasks', 'Background Tasks')}
- <li className="divider"/>
- {this.renderLink('/computation', window.t('analysis_reports.page'))}
</ul>
</li>
+++ /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.
-#
-
-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
+++ /dev/null
-<% content_for :extra_script do %>
- <script>
- require(['apps/computation/app'], function (App) {
- App.start({ el: '#content', urlRoot: baseUrl + '/computation' });
- });
- </script>
-<% end %>
+++ /dev/null
-{
- "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
- }
- ]
-}
+++ /dev/null
-{
- "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
- }
- ]
-}
+++ /dev/null
-{
- "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
- }
- ]
-}
+++ /dev/null
-{
- "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"
- }
- ]
-}
+++ /dev/null
-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);
- });
- });
-});