summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Brandhof <simon.brandhof@gmail.com>2014-02-14 18:36:19 +0100
committerSimon Brandhof <simon.brandhof@gmail.com>2014-02-14 18:36:19 +0100
commit0d0d98cfe42511d55991bc378ed9700d9f62d1c4 (patch)
treeab44a8ad7c3f72d2bc09735969f2a69ebd444433
parent12f2cdea302ac98c3314301b525b2244670fbb8f (diff)
downloadsonarqube-0d0d98cfe42511d55991bc378ed9700d9f62d1c4.tar.gz
sonarqube-0d0d98cfe42511d55991bc378ed9700d9f62d1c4.zip
Revert "Integrate require.js"
This reverts commit 71ae45e4594ae09398c389f0f48edffbf35e352f.
-rw-r--r--sonar-server/karma.conf.js6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb10
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_inner.hbs.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb25
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb15
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb4
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb4
-rw-r--r--sonar-server/src/main/webapp/javascripts/issues-extra.js1194
-rw-r--r--sonar-server/src/main/webapp/javascripts/issues.js375
-rw-r--r--sonar-server/src/main/webapp/javascripts/measures.js210
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js41
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/base-filters.js118
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/checkbox-filters.js20
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/context-filters.js20
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/favorite-filters.js18
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/filter-bar.js102
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/metric-filters.js24
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/more-criteria-filters.js19
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/range-filters.js18
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js22
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/string-filters.js26
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/handlebars-extensions.js (renamed from sonar-server/src/main/webapp/javascripts/handlebars-extensions.js)4
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/issues-app-old.js130
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/issues-app.js338
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/issues.js1206
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/measures-app.js170
-rw-r--r--sonar-server/src/main/webapp/javascripts/select-list.js646
-rw-r--r--sonar-server/src/main/webapp/javascripts/third-party/backbone-min.js (renamed from sonar-server/src/main/webapp/javascripts/third-party/backbone.js)0
-rw-r--r--sonar-server/src/main/webapp/javascripts/third-party/backbone.marionette.min.js (renamed from sonar-server/src/main/webapp/javascripts/third-party/backbone.marionette.js)0
-rw-r--r--sonar-server/src/main/webapp/javascripts/third-party/require.js36
-rw-r--r--sonar-server/src/main/webapp/javascripts/third-party/underscore-min.js (renamed from sonar-server/src/main/webapp/javascripts/third-party/underscore.js)0
-rw-r--r--sonar-server/wro.xml24
35 files changed, 2484 insertions, 2357 deletions
diff --git a/sonar-server/karma.conf.js b/sonar-server/karma.conf.js
index 9619bdfee07..269a010f7ca 100644
--- a/sonar-server/karma.conf.js
+++ b/sonar-server/karma.conf.js
@@ -25,9 +25,9 @@ module.exports = function(config) {
files: [
// dependencies
'third-party/jquery.min.js',
- 'third-party/underscore.js',
- 'third-party/backbone.js',
- 'third-party/backbone.marionette.js',
+ 'third-party/underscore-min.js',
+ 'third-party/backbone-min.js',
+ 'third-party/backbone.marionette.min.js',
// app
'navigator/filters/base-filters.js',
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb
index 229d1dda198..fde1b1f39e6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/groups/index.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/select-list.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
<div>
<% if profiles_administrator? %>
<ul style="float: right" class="horizontal">
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
index 722fae1fa1c..da0af92c124 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/search.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/issues.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
<div class="navigator">
<div class="navigator-header"></div>
<div class="navigator-notes">
@@ -33,8 +29,6 @@
<%= render :partial => '/issues/templates/issue_detail_plan_form.hbs' -%>
<script>
- window.SS = {};
-
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g,
evaluate: /\{\[(.+?)\]\}/g,
@@ -116,4 +110,8 @@
}
}
});
+
+ jQuery(function() {
+ window.SS.IssuesNavigatorApp.start();
+ });
</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_inner.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_inner.hbs.erb
index 661c0e07d9f..c41b006953f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_inner.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail_inner.hbs.erb
@@ -164,3 +164,7 @@
</div>
</div>
</script>
+
+<script>
+ Handlebars.registerPartial('detailInnerTemplate', jQuery('#issue-detail-inner-template').html())
+</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
index e1dbf994ae2..9a8ffb17f80 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/layouts/_head.html.erb
@@ -43,7 +43,10 @@
<%= javascript_include_tag 'third-party/jquery-ui.min' %>
<%= javascript_include_tag 'third-party/jquery-ui.tabs' %>
<%= javascript_include_tag 'third-party/d3.v3.min' %>
- <%= javascript_include_tag 'third-party/underscore' %>
+ <%= javascript_include_tag 'third-party/underscore-min' %>
+ <%= javascript_include_tag 'third-party/backbone-min' %>
+ <%= javascript_include_tag 'third-party/backbone.marionette.min' %>
+ <%= javascript_include_tag 'third-party/handlebars' %>
<%= javascript_include_tag 'third-party/jquery.ba-throttle-debounce.min.js' %>
<%= javascript_include_tag 'third-party/select2.min' %>
@@ -54,9 +57,29 @@
<%= javascript_include_tag 'widgets/pie-chart' %>
<%= javascript_include_tag 'widgets/histogram' %>
+ <%= javascript_include_tag 'select-list' %>
<%= javascript_include_tag 'top-search' %>
<%= javascript_include_tag 'sortable' %>
+ <%= javascript_include_tag 'navigator/handlebars-extensions' %>
+
+ <%= javascript_include_tag 'navigator/filters/base-filters' %>
+ <%= javascript_include_tag 'navigator/filters/select-filters' %>
+ <%= javascript_include_tag 'navigator/filters/ajax-select-filters' %>
+ <%= javascript_include_tag 'navigator/filters/range-filters' %>
+ <%= javascript_include_tag 'navigator/filters/checkbox-filters' %>
+ <%= javascript_include_tag 'navigator/filters/string-filters' %>
+ <%= javascript_include_tag 'navigator/filters/metric-filters' %>
+ <%= javascript_include_tag 'navigator/filters/favorite-filters' %>
+ <%= javascript_include_tag 'navigator/filters/more-criteria-filters' %>
+ <%= javascript_include_tag 'navigator/filters/context-filters' %>
+
+ <%= javascript_include_tag 'navigator/issues' %>
+ <%= javascript_include_tag 'navigator/issues-app' %>
+ <%= javascript_include_tag 'navigator/issues-app-old' %>
+
+ <%= javascript_include_tag 'navigator/measures-app' %>
+
<%= javascript_include_tag 'application' %>
<%= javascript_include_tag 'dashboard' %>
<%= javascript_include_tag 'duplication' %>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
index b66d449d89a..709e1caf4d3 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/measures/search.html.erb
@@ -1,8 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/measures.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
-
<div class="navigator navigator-simple">
<div class="navigator-filters"></div>
@@ -47,7 +42,12 @@
<script>
- window.SS = typeof window.SS === 'object' ? window.SS : {};
+ _.templateSettings = {
+ interpolate: /\{\{(.+?)\}\}/g,
+ evaluate: /\{\[(.+?)\]\}/g,
+ escape: /\{\{\{(.+?)\}\}\}/g
+ };
+
_.extend(window.SS, {
qualifiers: <%= render :partial => 'measures/qualifiers' -%>,
@@ -116,4 +116,7 @@
{ key: 'nameSearch', value: '<%= h @filter.criteria['nameSearch'] -%>' }
];
+
+ window.SS.MeasuresNavigatorApp.start();
+ window.SS.MeasuresNavigatorApp.filterBarView.restoreFromQuery(queryParams);
</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
index f3a0524a5fa..980b4ef6f9f 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/permission_templates/index.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/select-list.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
<h1 class="admin-page-title"><%= message 'roles.page' -%></h1>
<p class="admin-page-description"><%= message('roles.page.description') -%></p>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
index 13dc30dbba9..13ac5b37633 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/global.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/select-list.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
<h1 class="admin-page-title"><%= h message 'global_permissions.page' -%></h1>
<p class="admin-page-description"><%= message('global_permissions.page.description') -%> </p>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
index bea1301a649..ad62cb09d20 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/roles/projects.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/select-list.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
<h1 class="admin-page-title"><%= message 'roles.page' -%></h1>
<p class="admin-page-description"><%= message('roles.page.description2') -%></p>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb
index 382c7909fdf..acce0f46bb6 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/users/index.html.erb
@@ -1,7 +1,3 @@
-<% content_for :script do %>
- <script data-main="<%= ApplicationController.root_context -%>/javascripts/select-list.js" src="<%= ApplicationController.root_context -%>/javascripts/third-party/require.js"></script>
-<% end %>
-
<div>
<% if profiles_administrator? %>
<ul style="float: right" class="horizontal">
diff --git a/sonar-server/src/main/webapp/javascripts/issues-extra.js b/sonar-server/src/main/webapp/javascripts/issues-extra.js
deleted file mode 100644
index ffd9155654b..00000000000
--- a/sonar-server/src/main/webapp/javascripts/issues-extra.js
+++ /dev/null
@@ -1,1194 +0,0 @@
-define(
- [
- 'backbone', 'backbone.marionette',
- 'navigator/filters/filter-bar',
- 'navigator/filters/base-filters',
- 'navigator/filters/favorite-filters'
- ],
- function (Backbone, Marionette, FilterBarView, BaseFilters, FavoriteFiltersModule) {
-
- var AppState = Backbone.Model.extend({
-
- defaults: {
- canManageFilter: false,
- canBulkChange: false
- },
-
-
- url: function () {
- return baseUrl + '/api/issue_filters/page';
- }
-
- });
-
-
- var Issue = Backbone.Model.extend({
-
- url: function () {
- return baseUrl + '/api/issues/show?key=' + this.get('key');
- },
-
-
- parse: function (r) {
- return r.issue ? r.issue : r;
- }
-
- });
-
-
- var Issues = Backbone.Collection.extend({
- model: Issue,
-
-
- url: function () {
- return baseUrl + '/api/issues/search';
- },
-
-
- parse: function (r) {
-
- function find(source, key, keyField) {
- var searchDict = {};
- searchDict[keyField || 'key'] = key;
- return _.findWhere(source, searchDict) || key;
- }
-
- this.paging = r.paging;
- this.maxResultsReached = r.maxResultsReached;
-
- return r.issues.map(function (issue) {
- var component = find(r.components, issue.component),
- project = find(r.projects, issue.project),
- rule = find(r.rules, issue.rule);
-
- if (component) {
- _.extend(issue, {
- componentLongName: component.longName,
- componentQualifier: component.qualifier
- });
- }
-
- if (project) {
- _.extend(issue, {
- projectLongName: project.longName
- });
- }
-
- if (rule) {
- _.extend(issue, {
- ruleName: rule.name
- });
- }
-
- return issue;
- });
-
- }
- });
-
-
- var FavoriteFilter = Backbone.Model.extend({
-
- url: function () {
- return baseUrl + '/api/issue_filters/show/' + this.get('id');
- },
-
-
- parse: function (r) {
- return r.filter ? r.filter : r;
- }
- });
-
-
- var FavoriteFilters = Backbone.Collection.extend({
- model: FavoriteFilter,
-
-
- url: function () {
- return baseUrl + '/api/issue_filters/favorites';
- },
-
-
- parse: function (r) {
- return r.favoriteFilters;
- }
- });
-
-
- var Rule = Backbone.Model.extend({
-
- url: function () {
- return baseUrl + '/api/rules/show/?key=' + this.get('key');
- },
-
-
- parse: function (r) {
- return r.rule ? r.rule : r;
- }
- });
-
-
- var ActionPlans = Backbone.Collection.extend({
-
- url: function () {
- return baseUrl + '/api/action_plans/search';
- },
-
-
- parse: function (r) {
- return r.actionPlans;
- }
-
- });
-
-
- var IssueView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issue-template').html() || ''),
- tagName: 'li',
-
-
- ui: {
- component: '.component'
- },
-
-
- events: {
- 'click': 'showDetails'
- },
-
-
- modelEvents: {
- 'change': 'render'
- },
-
-
- showDetails: function () {
- this.$el.parent().children().removeClass('active');
- this.$el.addClass('active');
-
- var that = this,
- app = this.options.app,
- detailView = new IssueDetailView({
- model: this.model
- }),
- showCallback = function () {
- jQuery('.navigator-details').removeClass('navigator-fetching');
- app.detailsRegion.show(detailView);
- };
-
- jQuery('.navigator-details').empty().addClass('navigator-fetching');
- jQuery.when(detailView.model.fetch()).done(function () {
- if (that.model.get('status') !== 'CLOSED') {
- that.fetchSource(detailView, showCallback);
- } else {
- showCallback();
- }
-
- });
- },
-
-
- fetchSource: function (view, callback) {
- var line = this.model.get('line') || 0,
- from = line >= 10 ? line - 10 : 0,
- to = line + 30;
-
- return jQuery
- .ajax({
- type: 'GET',
- url: baseUrl + '/api/sources/show',
- data: {
- key: this.model.get('component'),
- from: from,
- to: to,
- format: 'json'
- }
- })
- .done(function (r) {
- if (_.isObject(r) && r.source) {
- view.source = r.source;
- }
- if (_.isObject(r) && r.scm) {
- view.scm = r.scm;
- }
- })
- .always(callback);
- },
-
-
- serializeData: function () {
- var projectFilter = this.options.app.filters.findWhere({ property: 'componentRoots' }),
- singleProject = _.isArray(projectFilter.get('value')) && projectFilter.get('value').length === 1;
-
- return _.extend({
- singleProject: singleProject
- }, this.model.toJSON());
- }
- });
-
-
- var NoIssuesView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#no-issues-template').html() || '')
- });
-
-
- var IssuesView = Marionette.CollectionView.extend({
- tagName: 'ol',
- className: 'navigator-results-list',
- itemView: IssueView,
- emptyView: NoIssuesView,
-
-
- itemViewOptions: function () {
- return {
- issuesView: this,
- app: this.options.app
- };
- },
-
-
- onRender: function () {
- var $scrollEl = jQuery('.navigator-results'),
- scrollEl = $scrollEl.get(0),
- onScroll = function () {
- if (scrollEl.offsetHeight + scrollEl.scrollTop >= scrollEl.scrollHeight) {
- window.SS.IssuesNavigatorApp.fetchNextPage();
- }
- },
- throttledScroll = _.throttle(onScroll, 300);
- $scrollEl.off('scroll').on('scroll', throttledScroll);
- },
-
-
- onAfterItemAdded: function () {
- var showLimitNotes = this.collection.maxResultsReached != null && this.collection.maxResultsReached;
- jQuery('.navigator').toggleClass('navigator-with-notes', showLimitNotes);
- jQuery('.navigator-notes').toggle(showLimitNotes);
- },
-
-
- close: function () {
- var scrollEl = jQuery('.navigator-results');
- scrollEl.off('scroll');
- Marionette.CollectionView.prototype.close.call(this);
- }
-
- });
-
-
- var IssuesActionsView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issues-actions-template').html() || ''),
-
-
- collectionEvents: {
- 'sync': 'render'
- },
-
-
- events: {
- 'click .navigator-actions-order': 'toggleOrderChoices',
- 'click .navigator-actions-order-choices': 'sort'
- },
-
-
- ui: {
- orderChoices: '.navigator-actions-order-choices'
- },
-
-
- onRender: function () {
- if (!this.collection.sorting.sortText) {
- this.collection.sorting.sortText = this.$('[data-sort=' + this.collection.sorting.sort + ']:first').text();
- this.render();
- return;
- }
-
- this.$('.open-modal').modal();
- },
-
-
- toggleOrderChoices: function (e) {
- e.stopPropagation();
- this.ui.orderChoices.toggleClass('open');
- if (this.ui.orderChoices.is('.open')) {
- var that = this;
- jQuery('body').on('click.issues_actions', function () {
- that.ui.orderChoices.removeClass('open');
- });
- }
- },
-
-
- sort: function (e) {
- e.stopPropagation();
- this.ui.orderChoices.removeClass('open');
- jQuery('body').off('click.issues_actions');
- var el = jQuery(e.target),
- sort = el.data('sort'),
- asc = el.data('asc');
-
- if (sort != null && asc != null) {
- this.collection.sorting = {
- sort: sort,
- sortText: el.text(),
- asc: asc
- };
- this.options.app.fetchFirstPage();
- }
- },
-
-
- serializeData: function () {
- var data = Marionette.ItemView.prototype.serializeData.apply(this, arguments);
- return _.extend(data || {}, {
- paging: this.collection.paging,
- sorting: this.collection.sorting,
- maxResultsReached: this.collection.maxResultsReached,
- appState: window.SS.appState.toJSON(),
- query: (Backbone.history.fragment || '').replace(/\|/g, '&')
- });
- }
- });
-
-
- var IssuesFilterBarView = FilterBarView.extend({
-
- collectionEvents: {
- 'change:enabled': 'changeEnabled'
- },
-
-
- events: {
- 'click .navigator-filter-submit': 'search'
- },
-
-
- getQuery: function () {
- var query = {};
- this.collection.each(function (filter) {
- _.extend(query, filter.view.formatValue());
- });
- return query;
- },
-
-
- onAfterItemAdded: function (itemView) {
- if (itemView.model.get('type') === FavoriteFiltersModule.FavoriteFilterView ||
- itemView.model.get('type') === IssuesFavoriteFilterView) {
- jQuery('.navigator-header').addClass('navigator-header-favorite');
- }
- },
-
-
- search: function () {
- this.options.app.state.set({
- query: this.options.app.getQuery(),
- search: true
- });
- this.options.app.fetchFirstPage();
- },
-
-
- fetchNextPage: function () {
- this.options.app.fetchNextPage();
- }
-
- });
-
-
- var IssuesHeaderView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issues-header-template').html() || ''),
-
-
- modelEvents: {
- 'change': 'render'
- },
-
-
- events: {
- 'click #issues-new-search': 'newSearch',
- 'click #issues-filter-save-as': 'saveAs',
- 'click #issues-filter-save': 'save',
- 'click #issues-filter-copy': 'copy',
- 'click #issues-filter-edit': 'edit'
- },
-
-
- initialize: function (options) {
- Marionette.ItemView.prototype.initialize.apply(this, arguments);
- this.listenTo(options.app.state, 'change', this.render);
- },
-
-
- newSearch: function () {
- this.model.clear();
- this.options.app.router.navigate('statuses=OPEN,REOPENED', { trigger: true, replace: true });
- },
-
-
- saveAs: function () {
- var url = baseUrl + '/issues/save_as_form?' + (Backbone.history.fragment || '').replace(/\|/g, '&');
- openModalWindow(url, {});
- },
-
-
- save: function () {
- var that = this;
- url = baseUrl + '/issues/save/' + this.model.id + '?' + (Backbone.history.fragment || '').replace(/\|/g, '&');
- jQuery.ajax({
- type: 'POST',
- url: url
- }).done(function () {
- that.options.app.state.set('search', false);
- });
- },
-
-
- copy: function () {
- var url = baseUrl + '/issues/copy_form/' + this.model.id;
- openModalWindow(url, {});
- },
-
-
- edit: function () {
- var url = baseUrl + '/issues/edit_form/' + this.model.id;
- openModalWindow(url, {});
- },
-
-
- serializeData: function () {
- return _.extend({
- canSave: this.model.id && this.options.app.state.get('search'),
- appState: window.SS.appState.toJSON()
- }, this.model.toJSON());
- }
-
- });
-
-
- var IssueDetailCommentFormView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issue-detail-comment-form-template').html() || ''),
-
-
- ui: {
- textarea: '#issue-comment-text',
- cancelButton: '#issue-comment-cancel',
- submitButton: '#issue-comment-submit'
- },
-
-
- events: {
- 'keyup #issue-comment-text': 'toggleSubmit',
- 'click #issue-comment-cancel': 'cancel',
- 'click #issue-comment-submit': 'submit'
- },
-
-
- onDomRefresh: function () {
- this.ui.textarea.focus();
- },
-
-
- toggleSubmit: function () {
- this.ui.submitButton.prop('disabled', this.ui.textarea.val().length === 0);
- },
-
-
- cancel: function () {
- this.options.detailView.updateAfterAction(false);
- },
-
-
- submit: function () {
- var that = this,
- text = this.ui.textarea.val(),
- update = this.model && this.model.has('key'),
- url = baseUrl + '/api/issues/' + (update ? 'edit_comment' : 'add_comment'),
- data = { text: text };
-
- if (update) {
- data.key = this.model.get('key');
- } else {
- data.issue = this.options.issue.get('key');
- }
-
- this.options.detailView.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: url,
- data: data
- })
- .done(function () {
- that.options.detailView.updateAfterAction(true);
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.options.detailView.hideActionSpinner();
- });
- }
- });
-
-
- var IssueDetailSetSeverityFormView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issue-detail-set-severity-form-template').html() || ''),
-
-
- ui: {
- select: '#issue-set-severity-select'
- },
-
-
- events: {
- 'click #issue-set-severity-cancel': 'cancel',
- 'click #issue-set-severity-submit': 'submit'
- },
-
-
- onRender: function () {
- this.ui.select.select2({
- minimumResultsForSearch: 100
- });
- },
-
-
- cancel: function () {
- this.options.detailView.updateAfterAction(false);
- },
-
-
- submit: function () {
- var that = this;
-
- this.options.detailView.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: baseUrl + '/api/issues/set_severity',
- data: {
- issue: this.options.issue.get('key'),
- severity: this.ui.select.val()
- }
- })
- .done(function () {
- that.options.detailView.updateAfterAction(true);
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.options.detailView.hideActionSpinner();
- });
- }
- });
-
-
- var IssueDetailAssignFormView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issue-detail-assign-form-template').html() || ''),
-
-
- ui: {
- select: '#issue-assignee-select'
- },
-
-
- events: {
- 'click #issue-assign-cancel': 'cancel',
- 'click #issue-assign-submit': 'submit'
- },
-
-
- onRender: function () {
- var currentUser = window.SS.currentUser,
- assignee = this.options.issue.get('assignee'),
- additionalChoices = [];
-
- if (!assignee || currentUser !== assignee) {
- additionalChoices.push({
- id: currentUser,
- text: window.SS.phrases.assignedToMe
- });
- }
-
- if (!!assignee) {
- additionalChoices.push({
- id: '',
- text: window.SS.phrases.unassigned
- });
- }
-
- var select2Options = {
- allowClear: false,
- width: '250px',
- formatNoMatches: function () {
- return window.SS.phrases.select2.noMatches;
- },
- formatSearching: function () {
- return window.SS.phrases.select2.searching;
- },
- formatInputTooShort: function () {
- return window.SS.phrases.select2.tooShort;
- }
- };
-
- if (additionalChoices.length > 0) {
- select2Options.minimumInputLength = 0;
- select2Options.query = function (query) {
- if (query.term.length == 0) {
- query.callback({ results: additionalChoices });
- } else if (query.term.length >= 2) {
- jQuery.ajax({
- url: baseUrl + '/api/users/search?f=s2',
- data: { s: query.term },
- dataType: 'jsonp'
- }).done(function (data) {
- query.callback(data);
- });
- }
- }
- } else {
- select2Options.minimumInputLength = 2;
- select2Options.ajax = {
- quietMillis: 300,
- url: baseUrl + '/api/users/search?f=s2',
- data: function (term, page) {
- return {s: term, p: page}
- },
- results: function (data) {
- return { more: data.more, results: data.results }
- }
- };
- }
-
- this.ui.select.select2(select2Options).select2('open');
- },
-
-
- cancel: function () {
- this.options.detailView.updateAfterAction(false);
- },
-
-
- submit: function () {
- var that = this;
-
- this.options.detailView.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: baseUrl + '/api/issues/assign',
- data: {
- issue: this.options.issue.get('key'),
- assignee: this.ui.select.val()
- }
- })
- .done(function () {
- that.options.detailView.updateAfterAction(true);
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.options.detailView.hideActionSpinner();
- });
- }
- });
-
-
- var IssueDetailPlanFormView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issue-detail-plan-form-template').html() || ''),
-
-
- collectionEvents: {
- 'reset': 'render'
- },
-
-
- ui: {
- select: '#issue-detail-plan-select'
- },
-
-
- events: {
- 'click #issue-plan-cancel': 'cancel',
- 'click #issue-plan-submit': 'submit'
- },
-
-
- onRender: function () {
- this.ui.select.select2({
- width: '250px',
- minimumResultsForSearch: 100
- });
-
- this.$('.error a')
- .prop('href', baseUrl + '/action_plans/index/' + this.options.issue.get('project'));
- },
-
-
- cancel: function () {
- this.options.detailView.updateAfterAction(false);
- },
-
-
- submit: function () {
- var that = this,
- plan = this.ui.select.val();
-
- this.options.detailView.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: baseUrl + '/api/issues/plan',
- data: {
- issue: this.options.issue.get('key'),
- plan: plan === '#unplan' ? '' : plan
- }
- })
- .done(function () {
- that.options.detailView.updateAfterAction(true);
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.options.detailView.hideActionSpinner();
- });
- },
-
-
- serializeData: function () {
- return {
- items: this.collection.toJSON(),
- issue: this.options.issue.toJSON()
- }
- }
- });
-
-
- var IssueDetailRuleView = Marionette.ItemView.extend({
- template: Handlebars.compile(jQuery('#issue-detail-rule-template').html() || ''),
- className: 'rule-desc',
- modelEvents: { 'change': 'render' },
-
-
- serializeData: function () {
- return _.extend({
- characteristic: this.options.issue.get('characteristic'),
- subCharacteristic: this.options.issue.get('subCharacteristic')
- }, this.model.toJSON());
- }
- });
-
-
- var IssueDetailView = Marionette.Layout.extend({
- template: Handlebars.compile(jQuery('#issue-detail-template').html() || ''),
-
-
- regions: {
- formRegion: '.code-issue-form',
- ruleRegion: '#tab-issue-rule'
- },
-
-
- events: {
- 'click .code-issue-toggle': 'toggleCollapsed',
-
- 'click [href=#tab-issue-rule]': 'fetchRule',
-
- 'click #issue-comment': 'comment',
- 'click .issue-comment-edit': 'editComment',
- 'click .issue-comment-delete': 'deleteComment',
- 'click .issue-transition': 'transition',
- 'click #issue-set-severity': 'setSeverity',
- 'click #issue-assign': 'assign',
- 'click #issue-assign-to-me': 'assignToMe',
- 'click #issue-plan': 'plan',
- 'click .issue-action': 'action'
- },
-
-
- modelEvents: {
- 'change': 'render'
- },
-
-
- onRender: function () {
- this.$('.code-issue-details').tabs();
- this.$('.code-issue-form').hide();
- this.rule = new Rule({ key: this.model.get('rule') });
- this.ruleRegion.show(new IssueDetailRuleView({
- model: this.rule,
- issue: this.model
- }));
- this.initReferenceLinks();
- },
-
-
- initReferenceLinks: function () {
- var sourcesId = 'sources_' + this.model.get('key');
- this.$('#' + sourcesId).on('click', 'span.sym', { id: sourcesId }, highlight_usages);
- },
-
-
- onDomRefresh: function () {
- var sourceTitleHeight = this.$('.source_title').outerHeight();
- jQuery('.navigator-details').css('padding-top', (sourceTitleHeight + 10) + 'px');
- },
-
-
- onClose: function () {
- if (this.ruleRegion) {
- this.ruleRegion.reset();
- }
- },
-
-
- resetIssue: function (options) {
- var key = this.model.get('key');
- this.model.clear({ silent: true });
- this.model.set({ key: key }, { silent: true });
- return this.model.fetch(options);
- },
-
-
- toggleCollapsed: function () {
- this.$('.code-issue').toggleClass('code-issue-collapsed');
- this.fetchRule();
- },
-
-
- fetchRule: function () {
- var that = this;
- if (!this.rule.has('name')) {
- this.$('#tab-issue-rule').addClass('navigator-fetching');
- this.rule.fetch({
- success: function () {
- that.$('#tab-issue-rule').removeClass('navigator-fetching');
- }
- });
- }
- },
-
-
- showActionView: function (view) {
- this.$('.code-issue-actions').hide();
- this.$('.code-issue-form').show();
- this.formRegion.show(view);
- },
-
-
- showActionSpinner: function () {
- this.$('.code-issue-actions').addClass('navigator-fetching');
- },
-
-
- hideActionSpinner: function () {
- this.$('.code-issue-actions').removeClass('navigator-fetching');
- },
-
-
- updateAfterAction: function (fetch) {
- var that = this;
-
- that.formRegion.reset();
- that.$('.code-issue-actions').show();
- that.$('.code-issue-form').hide();
- that.$('[data-comment-key]').show();
-
- if (fetch) {
- jQuery.when(this.resetIssue()).done(function () {
- that.hideActionSpinner();
- });
- }
- },
-
-
- comment: function () {
- var commentFormView = new IssueDetailCommentFormView({
- issue: this.model,
- detailView: this
- });
- this.showActionView(commentFormView);
- },
-
-
- editComment: function (e) {
- var commentEl = jQuery(e.target).closest('[data-comment-key]'),
- commentKey = commentEl.data('comment-key'),
- comment = _.findWhere(this.model.get('comments'), { key: commentKey });
-
- commentEl.hide();
-
- var commentFormView = new IssueDetailCommentFormView({
- model: new Backbone.Model(comment),
- issue: this.model,
- detailView: this
- });
- this.showActionView(commentFormView);
- },
-
-
- deleteComment: function (e) {
- var that = this,
- commentKey = jQuery(e.target).closest('[data-comment-key]').data('comment-key'),
- confirmMsg = jQuery(e.target).data('confirm-msg');
-
- if (confirm(confirmMsg)) {
- this.showActionSpinner();
-
- jQuery.ajax({
- type: "POST",
- url: baseUrl + "/issue/delete_comment?id=" + commentKey
- })
- .done(function () {
- that.updateAfterAction(true);
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.hideActionSpinner();
- });
- }
- },
-
-
- transition: function (e) {
- var that = this;
-
- this.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: baseUrl + '/api/issues/do_transition',
- data: {
- issue: this.model.get('key'),
- transition: jQuery(e.target).data('transition')
- }
- })
- .done(function () {
- that.resetIssue();
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.hideActionSpinner();
- });
- },
-
-
- setSeverity: function () {
- var setSeverityFormView = new IssueDetailSetSeverityFormView({
- issue: this.model,
- detailView: this
- });
- this.showActionView(setSeverityFormView);
- },
-
-
- assign: function () {
- var assignFormView = new IssueDetailAssignFormView({
- issue: this.model,
- detailView: this
- });
- this.showActionView(assignFormView);
- },
-
-
- assignToMe: function () {
- var that = this;
-
- this.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: baseUrl + '/api/issues/assign',
- data: {
- issue: this.model.get('key'),
- assignee: window.SS.currentUser
- }
- })
- .done(function () {
- that.resetIssue();
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.hideActionSpinner();
- });
- },
-
-
- plan: function () {
- var that = this,
- actionPlans = new ActionPlans(),
- planFormView = new IssueDetailPlanFormView({
- collection: actionPlans,
- issue: this.model,
- detailView: this
- });
-
- this.showActionSpinner();
-
- actionPlans.fetch({
- reset: true,
- data: { project: this.model.get('project') },
- success: function () {
- that.hideActionSpinner();
- that.showActionView(planFormView);
- }
- });
- },
-
- action: function (e) {
- var that = this,
- actionKey = jQuery(e.target).data('action');
-
- this.showActionSpinner();
-
- jQuery.ajax({
- type: 'POST',
- url: baseUrl + '/api/issues/do_action',
- data: {
- issue: this.model.get('key'),
- actionKey: actionKey
- }
- })
- .done(function () {
- that.resetIssue();
- })
- .fail(function (r) {
- alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
- that.hideActionSpinner();
- });
- },
-
-
- serializeData: function () {
- return _.extend({
- source: this.source,
- scm: this.scm
- }, this.model.toJSON());
- }
-
- });
-
-
- var IssuesDetailsFavoriteFilterView = FavoriteFiltersModule.DetailsFavoriteFilterView.extend({
- template: Handlebars.compile(jQuery('#issues-details-favorite-filter-template').html() || ''),
-
-
- applyFavorite: function (e) {
- var id = $j(e.target).data('id'),
- filter = new window.SS.FavoriteFilter({ id: id }),
- app = this.options.filterView.options.app;
-
- filter.fetch({
- success: function () {
- app.state.set('search', false);
- app.favoriteFilter.clear({ silent: true });
- app.favoriteFilter.set(filter.toJSON());
- }
- });
-
- this.options.filterView.hideDetails();
- },
-
-
- serializeData: function () {
- return _.extend({}, this.model.toJSON(), {
- items: this.model.get('choices')
- });
- }
- });
-
-
- var IssuesFavoriteFilterView = FavoriteFiltersModule.FavoriteFilterView.extend({
-
- initialize: function () {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
- detailsView: IssuesDetailsFavoriteFilterView
- });
-
- this.listenTo(window.SS.appState, 'change:favorites', this.updateFavorites);
- },
-
-
- updateFavorites: function () {
- this.model.set('choices', window.SS.appState.get('favorites'));
- this.render();
- }
- });
-
-
- var IssuesRouter = Backbone.Router.extend({
-
- routes: {
- '': 'emptyQuery',
- ':query': 'index'
- },
-
-
- initialize: function (options) {
- this.app = options.app;
- },
-
-
- parseQuery: function (query, separator) {
- return (query || '').split(separator || '|').map(function (t) {
- var tokens = t.split('=');
- return {
- key: tokens[0],
- value: decodeURIComponent(tokens[1])
- }
- });
- },
-
-
- emptyQuery: function () {
- this.navigate('statuses=OPEN,REOPENED', { trigger: true, replace: true });
- },
-
-
- index: function (query) {
- var params = this.parseQuery(query);
-
- var idObj = _.findWhere(params, { key: 'id' });
- if (idObj) {
- var that = this,
- f = this.app.favoriteFilter;
- this.app.canSave = false;
- f.set('id', idObj.value);
- f.fetch({
- success: function () {
- params = _.extend({}, that.parseQuery(f.get('query')), params);
- that.loadResults(params);
- }
- });
- } else {
- this.loadResults(params);
- }
- },
-
-
- loadResults: function (params) {
- this.app.filterBarView.restoreFromQuery(params);
- this.app.restoreSorting(params);
- this.app.fetchFirstPage();
- }
-
- });
-
-
- /*
- * Export public classes
- */
-
- return {
- AppState: AppState,
- Issue: Issue,
- Issues: Issues,
- FavoriteFilter: FavoriteFilter,
- FavoriteFilters: FavoriteFilters,
- IssueView: IssueView,
- IssuesView: IssuesView,
- IssuesActionsView: IssuesActionsView,
- IssuesFilterBarView: IssuesFilterBarView,
- IssuesHeaderView: IssuesHeaderView,
- IssuesFavoriteFilterView: IssuesFavoriteFilterView,
- IssueDetailView: IssueDetailView,
- IssuesRouter: IssuesRouter
- };
-
- });
diff --git a/sonar-server/src/main/webapp/javascripts/issues.js b/sonar-server/src/main/webapp/javascripts/issues.js
deleted file mode 100644
index 1a06a92f4ad..00000000000
--- a/sonar-server/src/main/webapp/javascripts/issues.js
+++ /dev/null
@@ -1,375 +0,0 @@
-requirejs.config({
-
- paths: {
- 'backbone': 'third-party/backbone',
- 'backbone.marionette': 'third-party/backbone.marionette',
- 'handlebars': 'third-party/handlebars'
- },
-
- shim: {
- 'backbone.marionette': {
- deps: ['backbone'],
- exports: 'Marionette'
- },
- 'backbone': {
- exports: 'Backbone'
- },
- 'handlebars': {
- exports: 'Handlebars'
- }
- }
-
-});
-
-requirejs(
- [
- 'backbone', 'backbone.marionette', 'handlebars',
- 'issues-extra',
- 'navigator/filters/filter-bar',
- 'navigator/filters/base-filters',
- 'navigator/filters/checkbox-filters',
- 'navigator/filters/select-filters',
- 'navigator/filters/ajax-select-filters',
- 'navigator/filters/favorite-filters',
- 'navigator/filters/range-filters',
- 'navigator/filters/context-filters',
-
- 'handlebars-extensions'
- ],
- function (Backbone, Marionette, Handlebars, Extra, FilterBar, BaseFilters, CheckboxFilterView, SelectFilters, AjaxSelectFilters, FavoriteFilters, RangeFilters, ContextFilterView) {
- Handlebars.registerPartial('detailInnerTemplate', jQuery('#issue-detail-inner-template').html());
-
-
- var NavigatorApp = new Marionette.Application();
-
-
- NavigatorApp.addRegions({
- headerRegion: '.navigator-header',
- filtersRegion: '.navigator-filters',
- resultsRegion: '.navigator-results',
- actionsRegion: '.navigator-actions',
- detailsRegion: '.navigator-details'
- });
-
-
- NavigatorApp.addInitializer(function () {
- jQuery('html').addClass('issues-page');
-
- this.appState = new Extra.AppState();
- window.SS.appState = this.appState;
-
- this.state = new Backbone.Model({
- query: ''
- });
-
- this.issues = new Extra.Issues();
- this.issues.sorting = {
- sort: 'UPDATE_DATE',
- asc: false
- };
- this.issuesPage = 1;
-
- this.filters = new BaseFilters.Filters();
-
- this.favoriteFilter = new Extra.FavoriteFilter();
- this.issuesHeaderView = new Extra.IssuesHeaderView({
- app: this,
- model: this.favoriteFilter
- });
- this.headerRegion.show(this.issuesHeaderView);
-
- this.issuesView = new Extra.IssuesView({
- app: this,
- collection: this.issues
- });
- this.resultsRegion.show(this.issuesView);
-
- this.issuesActionsView = new Extra.IssuesActionsView({
- app: this,
- collection: this.issues
- });
- this.actionsRegion.show(this.issuesActionsView);
- });
-
-
- NavigatorApp.addInitializer(function () {
- this.filters.add([
- new BaseFilters.Filter({
- name: window.SS.phrases.project,
- property: 'componentRoots',
- type: AjaxSelectFilters.ProjectFilterView,
- enabled: true,
- optional: false
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.severity,
- property: 'severities',
- type: SelectFilters.SelectFilterView,
- enabled: true,
- optional: false,
- choices: {
- 'BLOCKER': window.SS.phrases.severities.BLOCKER,
- 'CRITICAL': window.SS.phrases.severities.CRITICAL,
- 'MAJOR': window.SS.phrases.severities.MAJOR,
- 'MINOR': window.SS.phrases.severities.MINOR,
- 'INFO': window.SS.phrases.severities.INFO
- },
- choiceIcons: {
- 'BLOCKER': 'severity-blocker',
- 'CRITICAL': 'severity-critical',
- 'MAJOR': 'severity-major',
- 'MINOR': 'severity-minor',
- 'INFO': 'severity-info'
- }
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.status,
- property: 'statuses',
- type: SelectFilters.SelectFilterView,
- enabled: true,
- optional: false,
- choices: {
- 'OPEN': window.SS.phrases.statuses.OPEN,
- 'CONFIRMED': window.SS.phrases.statuses.CONFIRMED,
- 'REOPENED': window.SS.phrases.statuses.REOPENED,
- 'RESOLVED': window.SS.phrases.statuses.RESOLVED,
- 'CLOSED': window.SS.phrases.statuses.CLOSED
- },
- choiceIcons: {
- 'OPEN': 'status-open',
- 'CONFIRMED': 'status-confirmed',
- 'REOPENED': 'status-reopened',
- 'RESOLVED': 'status-resolved',
- 'CLOSED': 'status-closed'
- }
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.assignee,
- property: 'assignees',
- type: AjaxSelectFilters.AssigneeFilterView,
- enabled: true,
- optional: false
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.resolution,
- property: 'resolutions',
- type: SelectFilters.SelectFilterView,
- enabled: false,
- optional: true,
- choices: {
- 'FALSE-POSITIVE': window.SS.phrases.resolutions['FALSE-POSITIVE'],
- 'FIXED': window.SS.phrases.resolutions.FIXED,
- 'REMOVED': window.SS.phrases.resolutions.REMOVED
- }
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.reporter,
- property: 'reporters',
- type: AjaxSelectFilters.ReporterFilterView,
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.created,
- propertyFrom: 'createdAfter',
- propertyTo: 'createdBefore',
- type: RangeFilters.DateRangeFilterView,
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- property: 'resolved',
- type: ContextFilterView,
- enabled: true,
- optional: false
- }),
-
- new BaseFilters.Filter({
- property: 'actionPlans',
- type: ContextFilterView,
- enabled: true,
- optional: false
- }),
-
- new BaseFilters.Filter({
- property: 'createdAt',
- type: ContextFilterView,
- enabled: true,
- optional: false
- })
- ]);
-
-
- this.filterBarView = new Extra.IssuesFilterBarView({
- app: this,
- collection: this.filters,
- extra: {
- sort: '',
- asc: false
- }
- });
-
- this.filtersRegion.show(this.filterBarView);
- });
-
-
- NavigatorApp.addInitializer(function () {
- var app = this;
-
- jQuery.when(this.appState.fetch()).done(function () {
-
- if (app.appState.get('favorites')) {
- app.filters.unshift(
- new BaseFilters.Filter({
- type: Extra.IssuesFavoriteFilterView,
- enabled: true,
- optional: false,
- choices: app.appState.get('favorites'),
- manageUrl: '/issues/manage'
- })
- );
- }
-
- app.router = new Extra.IssuesRouter({
- app: app
- });
- Backbone.history.start();
-
- app.favoriteFilter.on('change:query', function (model, query) {
- app.router.navigate(query, { trigger: true, replace: true });
- });
- });
- });
-
-
- NavigatorApp.addInitializer(function () {
- var app = this;
-
- window.onBulkIssues = function () {
- app.fetchFirstPage();
- jQuery('.ui-dialog, .ui-widget-overlay').remove();
- };
-
- window.onSaveAs = window.onCopy = window.onEdit = function (id) {
- jQuery('#modal').dialog('close');
- app.appState.fetch();
-
- var filter = new Extra.FavoriteFilter({ id: id });
- filter.fetch({
- success: function () {
- app.state.set('search', false);
- app.favoriteFilter.set(filter.toJSON());
- app.fetchFirstPage();
- }
- });
- };
- });
-
-
- NavigatorApp.getQuery = function (withoutId) {
- var query = this.filterBarView.getQuery();
- if (!withoutId && this.favoriteFilter.id) {
- query['id'] = this.favoriteFilter.id;
- }
- return query;
- };
-
-
- NavigatorApp.storeQuery = function (query, sorting) {
- if (sorting) {
- _.extend(query, {
- sort: sorting.sort,
- asc: '' + sorting.asc
- });
- }
-
- var queryString = _.map(query,function (v, k) {
- return [k, encodeURIComponent(v)].join('=');
- }).join('|');
- this.router.navigate(queryString, { replace: true });
- };
-
-
- NavigatorApp.restoreSorting = function (query) {
- var sort = _.findWhere(query, { key: 'sort' }),
- asc = _.findWhere(query, { key: 'asc' });
-
- if (sort && asc) {
- this.issues.sorting = {
- sort: sort.value,
- sortText: jQuery('[data-sort=' + sort.value + ']:first').text(),
- asc: asc.value === 'true'
- }
- }
- };
-
-
- NavigatorApp.fetchIssues = function (firstPage) {
- var query = this.getQuery(),
- fetchQuery = _.extend({
- pageIndex: this.issuesPage
- }, query);
-
- if (this.issues.sorting) {
- _.extend(fetchQuery, {
- sort: this.issues.sorting.sort,
- asc: this.issues.sorting.asc
- });
- }
-
- _.extend(fetchQuery, {
- hideRules: true
- });
-
- if (this.favoriteFilter.id) {
- query['id'] = this.favoriteFilter.id;
- fetchQuery['id'] = this.favoriteFilter.id;
- }
-
- this.storeQuery(query, this.issues.sorting);
-
- var that = this;
- this.issuesView.$el.addClass('navigator-fetching');
- if (firstPage) {
- this.issues.fetch({
- data: fetchQuery,
- success: function () {
- that.issuesView.$el.removeClass('navigator-fetching');
- }
- });
- this.detailsRegion.reset();
- } else {
- this.issues.fetch({
- data: fetchQuery,
- remove: false,
- success: function () {
- that.issuesView.$el.removeClass('navigator-fetching');
- }
- });
- }
- };
-
-
- NavigatorApp.fetchFirstPage = function () {
- this.issuesPage = 1;
- this.fetchIssues(true);
- };
-
-
- NavigatorApp.fetchNextPage = function () {
- if (this.issuesPage < this.issues.paging.pages) {
- this.issuesPage++;
- this.fetchIssues(false);
- }
- };
-
- NavigatorApp.start();
-
- });
diff --git a/sonar-server/src/main/webapp/javascripts/measures.js b/sonar-server/src/main/webapp/javascripts/measures.js
deleted file mode 100644
index 4f6e7278d00..00000000000
--- a/sonar-server/src/main/webapp/javascripts/measures.js
+++ /dev/null
@@ -1,210 +0,0 @@
-requirejs.config({
-
- paths: {
- 'backbone': 'third-party/backbone',
- 'backbone.marionette': 'third-party/backbone.marionette',
- 'handlebars': 'third-party/handlebars'
- },
-
- shim: {
- 'backbone.marionette': {
- deps: ['backbone'],
- exports: 'Marionette'
- },
- 'backbone': {
- exports: 'Backbone'
- }
- }
-
-});
-
-requirejs(
- [
- 'backbone', 'backbone.marionette',
- 'navigator/filters/filter-bar',
- 'navigator/filters/base-filters',
- 'navigator/filters/checkbox-filters',
- 'navigator/filters/select-filters',
- 'navigator/filters/ajax-select-filters',
- 'navigator/filters/favorite-filters',
- 'navigator/filters/range-filters',
- 'navigator/filters/string-filters',
- 'navigator/filters/metric-filters'
- ],
- function (Backbone, Marionette, FilterBar, BaseFilters, CheckboxFilterView, SelectFilters, AjaxSelectFilters,
- FavoriteFilters, RangeFilters, StringFilterView, MetricFilterView) {
-
- _.templateSettings = {
- interpolate: /\{\{(.+?)\}\}/g,
- evaluate: /\{\[(.+?)\]\}/g,
- escape: /\{\{\{(.+?)\}\}\}/g
- };
-
- var NavigatorApp = new Marionette.Application();
-
-
- NavigatorApp.addRegions({
- filtersRegion: '.navigator-filters'
- });
-
-
- NavigatorApp.addInitializer(function () {
- this.filters = new BaseFilters.Filters();
-
- if (_.isObject(window.SS.favorites)) {
- this.filters.add([
- new BaseFilters.Filter({
- type: FavoriteFilters.FavoriteFilterView,
- enabled: true,
- optional: false,
- choices: window.SS.favorites,
- favoriteUrl: '/measures/filter',
- manageUrl: '/measures/manage'
- })]);
- }
-
- this.filters.add([
- new BaseFilters.Filter({
- name: window.SS.phrases.components,
- property: 'qualifiers[]',
- type: SelectFilters.SelectFilterView,
- enabled: true,
- optional: false,
- choices: window.SS.qualifiers,
- defaultValue: window.SS.phrases.any
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.alert,
- property: 'alertLevels[]',
- type: SelectFilters.SelectFilterView,
- enabled: false,
- optional: true,
- choices: {
- 'error': window.SS.phrases.error,
- 'warn': window.SS.phrases.warning,
- 'ok': window.SS.phrases.ok
- }
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.componentsOf,
- property: 'base',
- type: AjaxSelectFilters.ComponentFilterView,
- multiple: false,
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.favoritesOnly,
- property: 'onFavourites',
- type: CheckboxFilterView,
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.date,
- propertyFrom: 'fromDate',
- propertyTo: 'toDate',
- type: RangeFilters.DateRangeFilterView,
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.keyContains,
- property: 'keySearch',
- type: StringFilterView,
- enabled: false,
- optional: true
- })
- ]);
-
- if (_.isObject(window.SS.languages) && _.size(window.SS.languages) > 1) {
- this.filters.add([
- new BaseFilters.Filter({
- name: window.SS.phrases.language,
- property: 'languages[]',
- type: SelectFilters.SelectFilterView,
- enabled: false,
- optional: true,
- choices: window.SS.languages
- })
- ]);
- }
-
- this.filters.add([
- new BaseFilters.Filter({
- name: window.SS.phrases.lastAnalysis,
- propertyFrom: 'ageMinDays',
- propertyTo: 'ageMaxDays',
- type: RangeFilters.RangeFilterView,
- placeholder: window.SS.phrases.days,
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.metric,
- property: 'c3',
- type: MetricFilterView,
- metrics: window.SS.metrics,
- periods: window.SS.metricPeriods,
- operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' },
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.metric,
- property: 'c2',
- type: MetricFilterView,
- metrics: window.SS.metrics,
- periods: window.SS.metricPeriods,
- operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' },
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.metric,
- property: 'c1',
- type: MetricFilterView,
- metrics: window.SS.metrics,
- periods: window.SS.metricPeriods,
- operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' },
- enabled: false,
- optional: true
- }),
-
- new BaseFilters.Filter({
- name: window.SS.phrases.nameContains,
- property: 'nameSearch',
- type: StringFilterView,
- enabled: false,
- optional: true
- })
- ]);
-
-
- this.filterBarView = new FilterBar({
- collection: this.filters,
- extra: {
- sort: '',
- asc: false
- }
- });
-
-
- this.filtersRegion.show(this.filterBarView);
- });
-
-
- NavigatorApp.start();
- if (window.queryParams) {
- NavigatorApp.filterBarView.restoreFromQuery(window.queryParams);
- }
-
- });
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js
index 9cd45f9491d..110722154c5 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/ajax-select-filters.js
@@ -1,4 +1,8 @@
-define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-filters'], function (Backbone, BaseFilters, SelectFilters) {
+/* global _:false, $j:false, Backbone:false, baseUrl:false */
+
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
var PAGE_SIZE = 100;
@@ -51,6 +55,16 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
+ var ProjectSuggestions = Suggestions.extend({
+
+ url: function() {
+ return baseUrl + '/api/resources/search?f=s2&q=TRK&display_key=true';
+ }
+
+ });
+
+
+
var ComponentSuggestions = Suggestions.extend({
url: function() {
@@ -79,10 +93,15 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
- var AjaxSelectDetailsFilterView = SelectFilters.DetailsSelectFilterView.extend({
+ var AjaxSelectDetailsFilterView = window.SS.DetailsSelectFilterView.extend({
template: '#ajaxSelectFilterTemplate',
+ initialize: function() {
+ window.SS.DetailsSelectFilterView.prototype.initialize.apply(this, arguments);
+ },
+
+
onRender: function() {
this.resetChoices();
@@ -157,7 +176,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
onShow: function() {
- SelectFilters.DetailsSelectFilterView.prototype.onShow.apply(this, arguments);
+ window.SS.DetailsSelectFilterView.prototype.onShow.apply(this, arguments);
this.$('.navigator-filter-search input').focus();
}
@@ -165,7 +184,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
- var AjaxSelectFilterView = SelectFilters.SelectFilterView.extend({
+ var AjaxSelectFilterView = window.SS.SelectFilterView.extend({
isDefaultValue: function() {
return this.selection.length === 0;
@@ -257,7 +276,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
var ComponentFilterView = AjaxSelectFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -289,7 +308,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
var ProjectFilterView = AjaxSelectFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -344,7 +363,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
var AssigneeFilterView = AjaxSelectFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: AssigneeDetailsFilterView
});
@@ -446,7 +465,7 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
var ReporterFilterView = AjaxSelectFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: AjaxSelectDetailsFilterView
});
@@ -479,11 +498,11 @@ define(['backbone', 'navigator/filters/base-filters', 'navigator/filters/select-
* Export public classes
*/
- return {
+ _.extend(window.SS, {
ProjectFilterView: ProjectFilterView,
ComponentFilterView: ComponentFilterView,
AssigneeFilterView: AssigneeFilterView,
ReporterFilterView: ReporterFilterView
- };
+ });
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/base-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/base-filters.js
index d3b764e23da..bdb6a80887e 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/base-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/base-filters.js
@@ -1,4 +1,8 @@
-define(['backbone', 'backbone.marionette'], function (Backbone, Marionette) {
+/* global _:false, $j:false, Backbone:false */
+
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
var Filter = Backbone.Model.extend({
@@ -17,7 +21,7 @@ define(['backbone', 'backbone.marionette'], function (Backbone, Marionette) {
- var DetailsFilterView = Marionette.ItemView.extend({
+ var DetailsFilterView = Backbone.Marionette.ItemView.extend({
template: '#detailsFilterTemplate',
className: 'navigator-filter-details',
@@ -35,7 +39,7 @@ define(['backbone', 'backbone.marionette'], function (Backbone, Marionette) {
- var BaseFilterView = Marionette.ItemView.extend({
+ var BaseFilterView = Backbone.Marionette.ItemView.extend({
template: '#baseFilterTemplate',
className: 'navigator-filter',
@@ -58,7 +62,7 @@ define(['backbone', 'backbone.marionette'], function (Backbone, Marionette) {
initialize: function(options) {
- Marionette.ItemView.prototype.initialize.apply(this, arguments);
+ Backbone.Marionette.ItemView.prototype.initialize.apply(this, arguments);
var detailsView = options.detailsView || DetailsFilterView;
this.detailsView = new detailsView({
@@ -92,7 +96,7 @@ define(['backbone', 'backbone.marionette'], function (Backbone, Marionette) {
renderBase: function() {
- Marionette.ItemView.prototype.render.apply(this, arguments);
+ Backbone.Marionette.ItemView.prototype.render.apply(this, arguments);
this.renderInput();
},
@@ -209,15 +213,111 @@ define(['backbone', 'backbone.marionette'], function (Backbone, Marionette) {
+ var FilterBarView = Backbone.Marionette.CompositeView.extend({
+ template: '#filterBarTemplate',
+ itemViewContainer: '.navigator-filters-list',
+
+
+ collectionEvents: {
+ 'change:enabled': 'changeEnabled'
+ },
+
+
+ getItemView: function(item) {
+ return item.get('type') || BaseFilterView;
+ },
+
+
+ itemViewOptions: function() {
+ return {
+ filterBarView: this,
+ app: this.options.app
+ };
+ },
+
+
+ initialize: function() {
+ Backbone.Marionette.CompositeView.prototype.initialize.apply(this, arguments);
+
+ var that = this;
+ $j('body').on('click', function() {
+ that.hideDetails();
+ });
+
+ var disabledFilters = this.collection.where({ enabled: false });
+ this.moreCriteriaFilter = new window.SS.Filter({
+ type: window.SS.MoreCriteriaFilterView,
+ enabled: true,
+ optional: false,
+ filters: disabledFilters
+ });
+ this.collection.add(this.moreCriteriaFilter);
+ },
+
+
+ onAfterItemAdded: function(itemView) {
+ if (itemView.model.get('type') === window.SS.FavoriteFilterView ||
+ itemView.model.get('type') === window.SS.IssuesFavoriteFilterView) {
+ this.$el.addClass('navigator-filter-list-favorite');
+ }
+ },
+
+
+ restoreFromQuery: function(q) {
+ this.collection.each(function(item) {
+ item.set('enabled', !item.get('optional'));
+ item.view.clear();
+ item.view.restoreFromQuery(q);
+ });
+ },
+
+
+ hideDetails: function() {
+ if (_.isObject(this.showedView)) {
+ this.showedView.hideDetails();
+ }
+ },
+
+
+ enableFilter: function(id) {
+ var filter = this.collection.get(id),
+ filterView = filter.view;
+
+ filterView.$el.detach().insertBefore(this.$('.navigator-filter-more-criteria'));
+ filter.set('enabled', true);
+ filterView.showDetails();
+ },
+
+
+ changeEnabled: function() {
+ var disabledFilters = this.collection
+ .where({ enabled: false })
+ .reject(function(filter) {
+ return filter.get('type') === window.SS.MoreCriteriaFilterView;
+ });
+
+ if (disabledFilters.length === 0) {
+ this.moreCriteriaFilter.set({ enabled: false }, { silent: true });
+ } else {
+ this.moreCriteriaFilter.set({ enabled: true }, { silent: true });
+ }
+ this.moreCriteriaFilter.set('filters', disabledFilters);
+ }
+
+ });
+
+
+
/*
* Export public classes
*/
- return {
+ _.extend(window.SS, {
Filter: Filter,
Filters: Filters,
BaseFilterView: BaseFilterView,
- DetailsFilterView: DetailsFilterView
- };
+ DetailsFilterView: DetailsFilterView,
+ FilterBarView: FilterBarView
+ });
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/checkbox-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/checkbox-filters.js
index 8e9e011272d..af04fe5662a 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/checkbox-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/checkbox-filters.js
@@ -1,6 +1,10 @@
-define(['backbone', 'backbone.marionette', 'navigator/filters/base-filters'], function (Backbone, Marionette, BaseFilters) {
+/* global _:false, $j:false */
- return BaseFilters.BaseFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var CheckboxFilterView = window.SS.BaseFilterView.extend({
template: '#checkboxFilterTemplate',
className: 'navigator-filter navigator-filter-inline',
@@ -47,4 +51,14 @@ define(['backbone', 'backbone.marionette', 'navigator/filters/base-filters'], fu
});
-});
+
+
+ /*
+ * Export public classes
+ */
+
+ _.extend(window.SS, {
+ CheckboxFilterView: CheckboxFilterView
+ });
+
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/context-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/context-filters.js
index ec71ff3f774..c74571bdf41 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/context-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/context-filters.js
@@ -1,6 +1,10 @@
-define(['backbone'], function (Backbone) {
+/* global _:false, $j:false, Backbone:false */
- return Backbone.View.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var ContextFilterView = Backbone.View.extend({
initialize: function() {
this.model.view = this;
@@ -63,4 +67,14 @@ define(['backbone'], function (Backbone) {
}
});
-});
+
+
+ /*
+ * Export public classes
+ */
+
+ _.extend(window.SS, {
+ ContextFilterView: ContextFilterView
+ });
+
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/favorite-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/favorite-filters.js
index 26ecad588ac..04bfde2afb2 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/favorite-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/favorite-filters.js
@@ -1,6 +1,10 @@
-define(['backbone', 'backbone.marionette', 'navigator/filters/base-filters', 'navigator/filters/select-filters'], function (Backbone, Marionette, BaseFilters, SelectFilters) {
+/* global _:false, $j:false, baseUrl:false */
- var DetailsFavoriteFilterView = BaseFilters.DetailsFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var DetailsFavoriteFilterView = window.SS.DetailsFilterView.extend({
template: '#detailsFavoriteFilterTemplate',
@@ -39,13 +43,13 @@ define(['backbone', 'backbone.marionette', 'navigator/filters/base-filters', 'na
- var FavoriteFilterView = SelectFilters.SelectFilterView.extend({
+ var FavoriteFilterView = window.SS.SelectFilterView.extend({
template: '#favoriteFilterTemplate',
className: 'navigator-filter navigator-filter-favorite',
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsFavoriteFilterView
});
},
@@ -71,9 +75,9 @@ define(['backbone', 'backbone.marionette', 'navigator/filters/base-filters', 'na
* Export public classes
*/
- return {
+ _.extend(window.SS, {
DetailsFavoriteFilterView: DetailsFavoriteFilterView,
FavoriteFilterView: FavoriteFilterView
- };
+ });
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/filter-bar.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/filter-bar.js
deleted file mode 100644
index 5f77a4cafc2..00000000000
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/filter-bar.js
+++ /dev/null
@@ -1,102 +0,0 @@
-define(
- [
- 'backbone.marionette',
- 'navigator/filters/base-filters',
- 'navigator/filters/more-criteria-filters',
- 'navigator/filters/favorite-filters'
- ],
- function (Marionette, BaseFilters) {
-
- return Marionette.CompositeView.extend({
- template: '#filterBarTemplate',
- itemViewContainer: '.navigator-filters-list',
-
-
- collectionEvents: {
- 'change:enabled': 'changeEnabled'
- },
-
-
- getItemView: function (item) {
- return item.get('type') || BaseFilters.BaseFilterView;
- },
-
-
- itemViewOptions: function () {
- return {
- filterBarView: this,
- app: this.options.app
- };
- },
-
-
- initialize: function () {
- Marionette.CompositeView.prototype.initialize.apply(this, arguments);
-
- var that = this;
- $j('body').on('click', function () {
- that.hideDetails();
- });
-
- var disabledFilters = this.collection.where({ enabled: false });
- this.moreCriteriaFilter = new BaseFilters.Filter({
- type: require('navigator/filters/more-criteria-filters').MoreCriteriaFilterView,
- enabled: true,
- optional: false,
- filters: disabledFilters
- });
- this.collection.add(this.moreCriteriaFilter);
- },
-
-
- onAfterItemAdded: function (itemView) {
- if (itemView.model.get('type') === require('navigator/filters/favorite-filters').FavoriteFilterView) {
- this.$el.addClass('navigator-filter-list-favorite');
- }
- },
-
-
- restoreFromQuery: function (q) {
- this.collection.each(function (item) {
- item.set('enabled', !item.get('optional'));
- item.view.clear();
- item.view.restoreFromQuery(q);
- });
- },
-
-
- hideDetails: function () {
- if (_.isObject(this.showedView)) {
- this.showedView.hideDetails();
- }
- },
-
-
- enableFilter: function (id) {
- var filter = this.collection.get(id),
- filterView = filter.view;
-
- filterView.$el.detach().insertBefore(this.$('.navigator-filter-more-criteria'));
- filter.set('enabled', true);
- filterView.showDetails();
- },
-
-
- changeEnabled: function () {
- var disabledFilters = this.collection
- .where({ enabled: false })
- .reject(function (filter) {
- return filter.get('type') === require('navigator/filters/more-criteria-filters').MoreCriteriaFilterView;
- });
-
- if (disabledFilters.length === 0) {
- this.moreCriteriaFilter.set({ enabled: false }, { silent: true });
- } else {
- this.moreCriteriaFilter.set({ enabled: true }, { silent: true });
- }
- this.moreCriteriaFilter.set('filters', disabledFilters);
- }
-
- });
-
- });
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/metric-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/metric-filters.js
index 9941b8e4461..f5ad6859d7e 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/metric-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/metric-filters.js
@@ -1,6 +1,10 @@
-define(['navigator/filters/base-filters'], function (BaseFilters) {
+/* global _:false, $j:false */
- var DetailsMetricFilterView = BaseFilters.DetailsFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var DetailsMetricFilterView = window.SS.DetailsFilterView.extend({
template: '#metricFilterTemplate',
@@ -54,10 +58,10 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
- return BaseFilters.BaseFilterView.extend({
+ var MetricFilterView = window.SS.BaseFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsMetricFilterView
});
@@ -145,4 +149,14 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
});
-});
+
+
+ /*
+ * Export public classes
+ */
+
+ _.extend(window.SS, {
+ MetricFilterView: MetricFilterView
+ });
+
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/more-criteria-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/more-criteria-filters.js
index 3dacc1c5a4c..81ce4fc69ab 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/more-criteria-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/more-criteria-filters.js
@@ -1,6 +1,10 @@
-define(['navigator/filters/base-filters', 'navigator/filters/select-filters'], function (BaseFilters, SelectFilters) {
+/* global _:false, $j:false */
- var DetailsMoreCriteriaFilterView = BaseFilters.DetailsFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var DetailsMoreCriteriaFilterView = window.SS.DetailsFilterView.extend({
template: '#detailsMoreCriteriaFilterTemplate',
@@ -19,13 +23,13 @@ define(['navigator/filters/base-filters', 'navigator/filters/select-filters'], f
- var MoreCriteriaFilterView = SelectFilters.SelectFilterView.extend({
+ var MoreCriteriaFilterView = window.SS.SelectFilterView.extend({
template: '#moreCriteriaFilterTemplate',
className: 'navigator-filter navigator-filter-more-criteria',
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsMoreCriteriaFilterView
});
},
@@ -51,9 +55,8 @@ define(['navigator/filters/base-filters', 'navigator/filters/select-filters'], f
* Export public classes
*/
- return {
- DetailsMoreCriteriaFilterView: DetailsMoreCriteriaFilterView,
+ _.extend(window.SS, {
MoreCriteriaFilterView: MoreCriteriaFilterView
- };
+ });
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/range-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/range-filters.js
index 3443caf0c66..eb12495b492 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/range-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/range-filters.js
@@ -1,6 +1,10 @@
-define(['navigator/filters/base-filters'], function (BaseFilters) {
+/* global _:false, $j:false */
- var DetailsRangeFilterView = BaseFilters.DetailsFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var DetailsRangeFilterView = window.SS.DetailsFilterView.extend({
template: '#rangeFilterTemplate',
@@ -46,10 +50,10 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
- var RangeFilterView = BaseFilters.BaseFilterView.extend({
+ var RangeFilterView = window.SS.BaseFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsRangeFilterView
});
},
@@ -187,9 +191,9 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
* Export public classes
*/
- return {
+ _.extend(window.SS, {
RangeFilterView: RangeFilterView,
DateRangeFilterView: DateRangeFilterView
- };
+ });
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js
index 7517356cc4e..0c93d19aff4 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js
@@ -1,6 +1,10 @@
-define(['navigator/filters/base-filters'], function (BaseFilters) {
+/* global _:false, $j:false, Backbone:false, baseUrl:false */
- var DetailsSelectFilterView = BaseFilters.DetailsFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var DetailsSelectFilterView = window.SS.DetailsFilterView.extend({
template: '#selectFilterTemplate',
itemTemplate: '#selectFilterItemTemplate',
@@ -14,7 +18,7 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
render: function() {
- BaseFilters.DetailsFilterView.prototype.render.apply(this, arguments);
+ window.SS.DetailsFilterView.prototype.render.apply(this, arguments);
this.updateLists();
},
@@ -175,12 +179,12 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
- var SelectFilterView = BaseFilters.BaseFilterView.extend({
+ var SelectFilterView = window.SS.BaseFilterView.extend({
className: 'navigator-filter',
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsSelectFilterView
});
@@ -250,7 +254,7 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
disable: function() {
this.choices.add(this.selection.models);
this.selection.reset([]);
- BaseFilters.BaseFilterView.prototype.disable.apply(this, arguments);
+ window.SS.BaseFilterView.prototype.disable.apply(this, arguments);
},
@@ -321,9 +325,9 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
* Export public classes
*/
- return {
+ _.extend(window.SS, {
DetailsSelectFilterView: DetailsSelectFilterView,
SelectFilterView: SelectFilterView
- };
+ });
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/filters/string-filters.js b/sonar-server/src/main/webapp/javascripts/navigator/filters/string-filters.js
index 56c73605e26..cae0ec9f7fa 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/filters/string-filters.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/filters/string-filters.js
@@ -1,6 +1,10 @@
-define(['navigator/filters/base-filters'], function (BaseFilters) {
+/* global _:false, $j:false */
- var DetailsStringFilterView = BaseFilters.DetailsFilterView.extend({
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var DetailsStringFilterView = window.SS.DetailsFilterView.extend({
template: '#stringFilterTemplate',
@@ -15,7 +19,7 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
onShow: function() {
- BaseFilters.DetailsFilterView.prototype.onShow.apply(this, arguments);
+ window.SS.DetailsFilterView.prototype.onShow.apply(this, arguments);
this.$(':input').focus();
},
@@ -30,10 +34,10 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
- return BaseFilters.BaseFilterView.extend({
+ var StringFilterView = window.SS.BaseFilterView.extend({
initialize: function() {
- BaseFilters.BaseFilterView.prototype.initialize.call(this, {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
detailsView: DetailsStringFilterView
});
},
@@ -74,4 +78,14 @@ define(['navigator/filters/base-filters'], function (BaseFilters) {
});
-});
+
+
+ /*
+ * Export public classes
+ */
+
+ _.extend(window.SS, {
+ StringFilterView: StringFilterView
+ });
+
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/handlebars-extensions.js b/sonar-server/src/main/webapp/javascripts/navigator/handlebars-extensions.js
index cb1a0241ea2..032346929c0 100644
--- a/sonar-server/src/main/webapp/javascripts/handlebars-extensions.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/handlebars-extensions.js
@@ -1,4 +1,4 @@
-define(['handlebars'], function (Handlebars) {
+(function() {
var defaultActions = ['comment', 'assign', 'assign_to_me', 'plan', 'set_severity'];
@@ -143,4 +143,4 @@ define(['handlebars'], function (Handlebars) {
}, '');
});
-});
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues-app-old.js b/sonar-server/src/main/webapp/javascripts/navigator/issues-app-old.js
new file mode 100644
index 00000000000..3cd84e31d78
--- /dev/null
+++ b/sonar-server/src/main/webapp/javascripts/navigator/issues-app-old.js
@@ -0,0 +1,130 @@
+/* global _:false, Backbone:false */
+
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var NavigatorApp = new Backbone.Marionette.Application();
+ window.SS.IssuesNavigatorAppOld = NavigatorApp;
+
+
+
+ NavigatorApp.addRegions({
+ filtersRegion: '.navigator-filters'
+ });
+
+
+ NavigatorApp.addInitializer(function() {
+ this.filters = new window.SS.Filters();
+
+ if (_.isObject(window.SS.favorites)) {
+ this.filters.add([
+ new window.SS.Filter({
+ type: window.SS.FavoriteFilterView,
+ enabled: true,
+ optional: false,
+ choices: window.SS.favorites,
+ favoriteUrl: '/issues/filter',
+ manageUrl: '/issues/manage'
+ })]);
+ }
+
+ this.filters.add([
+ new window.SS.Filter({
+ name: window.SS.phrases.project,
+ property: 'componentRoots',
+ type: window.SS.ProjectFilterView,
+ enabled: true,
+ optional: false
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.severity,
+ property: 'severities[]',
+ type: window.SS.SelectFilterView,
+ enabled: true,
+ optional: false,
+ choices: {
+ 'BLOCKER': window.SS.phrases.severities.blocker,
+ 'CRITICAL': window.SS.phrases.severities.critical,
+ 'MAJOR': window.SS.phrases.severities.major,
+ 'MINOR': window.SS.phrases.severities.minor,
+ 'INFO': window.SS.phrases.severities.info
+ },
+ choiceIcons: {
+ 'BLOCKER': '/images/priority/BLOCKER.png',
+ 'CRITICAL': '/images/priority/CRITICAL.png',
+ 'MAJOR': '/images/priority/MAJOR.png',
+ 'MINOR': '/images/priority/MINOR.png',
+ 'INFO': '/images/priority/INFO.png'
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.status,
+ property: 'statuses[]',
+ type: window.SS.SelectFilterView,
+ enabled: true,
+ optional: false,
+ choices: {
+ 'OPEN': window.SS.phrases.statuses.open,
+ 'CONFIRMED': window.SS.phrases.statuses.confirmed,
+ 'REOPENED': window.SS.phrases.statuses.reopened,
+ 'RESOLVED': window.SS.phrases.statuses.resolved,
+ 'CLOSED': window.SS.phrases.statuses.closed
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.assignee,
+ property: 'assignees',
+ type: window.SS.AssigneeFilterView,
+ enabled: true,
+ optional: false
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.resolution,
+ property: 'resolutions[]',
+ type: window.SS.SelectFilterView,
+ enabled: false,
+ optional: true,
+ choices: {
+ 'FALSE-POSITIVE': window.SS.phrases.resolutions.falsePositive,
+ 'FIXED': window.SS.phrases.resolutions.fixed,
+ 'REMOVED': window.SS.phrases.resolutions.removed
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.reporter,
+ property: 'reporters',
+ type: window.SS.ReporterFilterView,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.created,
+ propertyFrom: 'createdAfter',
+ propertyTo: 'createdBefore',
+ type: window.SS.DateRangeFilterView,
+ enabled: false,
+ optional: true
+ })
+ ]);
+
+
+ this.filterBarView = new window.SS.FilterBarView({
+ collection: this.filters,
+ extra: {
+ sort: '',
+ asc: false
+ }
+ });
+
+
+ this.filtersRegion.show(this.filterBarView);
+ });
+
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js b/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js
new file mode 100644
index 00000000000..97f6ccab543
--- /dev/null
+++ b/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js
@@ -0,0 +1,338 @@
+/* global _:false, Backbone:false */
+
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+jQuery(function() {
+
+ var NavigatorApp = new Backbone.Marionette.Application();
+ window.SS.IssuesNavigatorApp = NavigatorApp;
+
+
+ NavigatorApp.addRegions({
+ headerRegion: '.navigator-header',
+ filtersRegion: '.navigator-filters',
+ resultsRegion: '.navigator-results',
+ actionsRegion: '.navigator-actions',
+ detailsRegion: '.navigator-details'
+ });
+
+
+ NavigatorApp.addInitializer(function() {
+ jQuery('html').addClass('issues-page');
+
+ this.appState = new window.SS.AppState();
+ window.SS.appState = this.appState;
+
+ this.state = new Backbone.Model({
+ query: ''
+ });
+
+ this.issues = new window.SS.Issues();
+ this.issues.sorting = {
+ sort: 'UPDATE_DATE',
+ asc: false
+ };
+ this.issuesPage = 1;
+
+ this.filters = new window.SS.Filters();
+
+ this.favoriteFilter = new window.SS.FavoriteFilter();
+ this.issuesHeaderView = new window.SS.IssuesHeaderView({
+ app: this,
+ model: this.favoriteFilter
+ });
+ this.headerRegion.show(this.issuesHeaderView);
+
+ this.issuesView = new window.SS.IssuesView({
+ app: this,
+ collection: this.issues
+ });
+ this.resultsRegion.show(this.issuesView);
+
+ this.issuesActionsView = new window.SS.IssuesActionsView({
+ app: this,
+ collection: this.issues
+ });
+ this.actionsRegion.show(this.issuesActionsView);
+ });
+
+
+ NavigatorApp.addInitializer(function() {
+ this.filters.add([
+ new window.SS.Filter({
+ name: window.SS.phrases.project,
+ property: 'componentRoots',
+ type: window.SS.ProjectFilterView,
+ enabled: true,
+ optional: false
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.severity,
+ property: 'severities',
+ type: window.SS.SelectFilterView,
+ enabled: true,
+ optional: false,
+ choices: {
+ 'BLOCKER': window.SS.phrases.severities.BLOCKER,
+ 'CRITICAL': window.SS.phrases.severities.CRITICAL,
+ 'MAJOR': window.SS.phrases.severities.MAJOR,
+ 'MINOR': window.SS.phrases.severities.MINOR,
+ 'INFO': window.SS.phrases.severities.INFO
+ },
+ choiceIcons: {
+ 'BLOCKER': 'severity-blocker',
+ 'CRITICAL': 'severity-critical',
+ 'MAJOR': 'severity-major',
+ 'MINOR': 'severity-minor',
+ 'INFO': 'severity-info'
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.status,
+ property: 'statuses',
+ type: window.SS.SelectFilterView,
+ enabled: true,
+ optional: false,
+ choices: {
+ 'OPEN': window.SS.phrases.statuses.OPEN,
+ 'CONFIRMED': window.SS.phrases.statuses.CONFIRMED,
+ 'REOPENED': window.SS.phrases.statuses.REOPENED,
+ 'RESOLVED': window.SS.phrases.statuses.RESOLVED,
+ 'CLOSED': window.SS.phrases.statuses.CLOSED
+ },
+ choiceIcons: {
+ 'OPEN': 'status-open',
+ 'CONFIRMED': 'status-confirmed',
+ 'REOPENED': 'status-reopened',
+ 'RESOLVED': 'status-resolved',
+ 'CLOSED': 'status-closed'
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.assignee,
+ property: 'assignees',
+ type: window.SS.AssigneeFilterView,
+ enabled: true,
+ optional: false
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.resolution,
+ property: 'resolutions',
+ type: window.SS.SelectFilterView,
+ enabled: false,
+ optional: true,
+ choices: {
+ 'FALSE-POSITIVE': window.SS.phrases.resolutions['FALSE-POSITIVE'],
+ 'FIXED': window.SS.phrases.resolutions.FIXED,
+ 'REMOVED': window.SS.phrases.resolutions.REMOVED
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.reporter,
+ property: 'reporters',
+ type: window.SS.ReporterFilterView,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.created,
+ propertyFrom: 'createdAfter',
+ propertyTo: 'createdBefore',
+ type: window.SS.DateRangeFilterView,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ property: 'resolved',
+ type: window.SS.ContextFilterView,
+ enabled: true,
+ optional: false
+ }),
+
+ new window.SS.Filter({
+ property: 'actionPlans',
+ type: window.SS.ContextFilterView,
+ enabled: true,
+ optional: false
+ }),
+
+ new window.SS.Filter({
+ property: 'createdAt',
+ type: window.SS.ContextFilterView,
+ enabled: true,
+ optional: false
+ })
+ ]);
+
+
+ this.filterBarView = new window.SS.IssuesFilterBarView({
+ app: this,
+ collection: this.filters,
+ extra: {
+ sort: '',
+ asc: false
+ }
+ });
+
+ this.filtersRegion.show(this.filterBarView);
+ });
+
+
+ NavigatorApp.addInitializer(function() {
+ var app = this;
+
+ jQuery.when(this.appState.fetch()).done(function() {
+
+ if (app.appState.get('favorites')) {
+ app.filters.unshift(
+ new window.SS.Filter({
+ type: window.SS.IssuesFavoriteFilterView,
+ enabled: true,
+ optional: false,
+ choices: app.appState.get('favorites'),
+ manageUrl: '/issues/manage'
+ })
+ );
+ }
+
+ app.router = new window.SS.IssuesRouter({
+ app: app
+ });
+ Backbone.history.start();
+
+ app.favoriteFilter.on('change:query', function(model, query) {
+ app.router.navigate(query, { trigger: true, replace: true });
+ });
+ });
+ });
+
+
+ NavigatorApp.addInitializer(function() {
+ var app = this;
+
+ window.onBulkIssues = function() {
+ app.fetchFirstPage();
+ jQuery('.ui-dialog, .ui-widget-overlay').remove();
+ };
+
+ window.onSaveAs = window.onCopy = window.onEdit = function(id) {
+ jQuery('#modal').dialog('close');
+ app.appState.fetch();
+
+ var filter = new window.SS.FavoriteFilter({ id: id });
+ filter.fetch({
+ success: function() {
+ app.state.set('search', false);
+ app.favoriteFilter.set(filter.toJSON());
+ app.fetchFirstPage();
+ }
+ });
+ };
+ });
+
+
+ NavigatorApp.getQuery = function(withoutId) {
+ var query = this.filterBarView.getQuery();
+ if (!withoutId && this.favoriteFilter.id) {
+ query['id'] = this.favoriteFilter.id;
+ }
+ return query;
+ };
+
+
+ NavigatorApp.storeQuery = function(query, sorting) {
+ if (sorting) {
+ _.extend(query, {
+ sort: sorting.sort,
+ asc: '' + sorting.asc
+ });
+ }
+
+ var queryString = _.map(query, function(v, k) {
+ return [k, encodeURIComponent(v)].join('=');
+ }).join('|');
+ this.router.navigate(queryString, { replace: true });
+ };
+
+
+ NavigatorApp.restoreSorting = function(query) {
+ var sort = _.findWhere(query, { key: 'sort' }),
+ asc = _.findWhere(query, { key: 'asc' });
+
+ if (sort && asc) {
+ this.issues.sorting = {
+ sort: sort.value,
+ sortText: jQuery('[data-sort=' + sort.value + ']:first').text(),
+ asc: asc.value === 'true'
+ }
+ }
+ };
+
+
+ NavigatorApp.fetchIssues = function(firstPage) {
+ var query = this.getQuery(),
+ fetchQuery =_.extend({
+ pageIndex: this.issuesPage
+ }, query);
+
+ if (this.issues.sorting) {
+ _.extend(fetchQuery, {
+ sort: this.issues.sorting.sort,
+ asc: this.issues.sorting.asc
+ });
+ }
+
+ _.extend(fetchQuery, {
+ hideRules: true
+ });
+
+ if (this.favoriteFilter.id) {
+ query['id'] = this.favoriteFilter.id;
+ fetchQuery['id'] = this.favoriteFilter.id;
+ }
+
+ this.storeQuery(query, this.issues.sorting);
+
+ var that = this;
+ this.issuesView.$el.addClass('navigator-fetching');
+ if (firstPage) {
+ this.issues.fetch({
+ data: fetchQuery,
+ success: function() {
+ that.issuesView.$el.removeClass('navigator-fetching');
+ }
+ });
+ this.detailsRegion.reset();
+ } else {
+ this.issues.fetch({
+ data: fetchQuery,
+ remove: false,
+ success: function() {
+ that.issuesView.$el.removeClass('navigator-fetching');
+ }
+ });
+ }
+ };
+
+
+ NavigatorApp.fetchFirstPage = function() {
+ this.issuesPage = 1;
+ this.fetchIssues(true);
+ };
+
+
+ NavigatorApp.fetchNextPage = function() {
+ if (this.issuesPage < this.issues.paging.pages) {
+ this.issuesPage++;
+ this.fetchIssues(false);
+ }
+ };
+
+});
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues.js b/sonar-server/src/main/webapp/javascripts/navigator/issues.js
new file mode 100644
index 00000000000..d4111c6447b
--- /dev/null
+++ b/sonar-server/src/main/webapp/javascripts/navigator/issues.js
@@ -0,0 +1,1206 @@
+/* global _:false, Backbone:false, baseUrl:false */
+
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+jQuery(function() {
+
+ var AppState = Backbone.Model.extend({
+
+ defaults: {
+ canManageFilter: false,
+ canBulkChange: false
+ },
+
+
+ url: function() {
+ return baseUrl + '/api/issue_filters/page';
+ }
+
+ });
+
+
+
+ var Issue = Backbone.Model.extend({
+
+ url: function() {
+ return baseUrl + '/api/issues/show?key=' + this.get('key');
+ },
+
+
+ parse: function(r) {
+ return r.issue ? r.issue : r;
+ }
+
+ });
+
+
+
+ var Issues = Backbone.Collection.extend({
+ model: Issue,
+
+
+ url: function() {
+ return baseUrl + '/api/issues/search';
+ },
+
+
+ parse: function(r) {
+
+ function find(source, key, keyField) {
+ var searchDict = {};
+ searchDict[keyField || 'key'] = key;
+ return _.findWhere(source, searchDict) || key;
+ }
+
+ this.paging = r.paging;
+ this.maxResultsReached = r.maxResultsReached;
+
+ return r.issues.map(function(issue) {
+ var component = find(r.components, issue.component),
+ project = find(r.projects, issue.project),
+ rule = find(r.rules, issue.rule);
+
+ if (component) {
+ _.extend(issue, {
+ componentLongName: component.longName,
+ componentQualifier: component.qualifier
+ });
+ }
+
+ if (project) {
+ _.extend(issue, {
+ projectLongName: project.longName
+ });
+ }
+
+ if (rule) {
+ _.extend(issue, {
+ ruleName: rule.name
+ });
+ }
+
+ return issue;
+ });
+
+ }
+ });
+
+
+
+ var FavoriteFilter = Backbone.Model.extend({
+
+ url: function() {
+ return baseUrl + '/api/issue_filters/show/' + this.get('id');
+ },
+
+
+ parse: function(r) {
+ return r.filter ? r.filter : r;
+ }
+ });
+
+
+
+ var FavoriteFilters = Backbone.Collection.extend({
+ model: FavoriteFilter,
+
+
+ url: function() {
+ return baseUrl + '/api/issue_filters/favorites';
+ },
+
+
+ parse: function(r) {
+ return r.favoriteFilters;
+ }
+ });
+
+
+ var Rule = Backbone.Model.extend({
+
+ url: function() {
+ return baseUrl + '/api/rules/show/?key=' + this.get('key');
+ },
+
+
+ parse: function(r) {
+ return r.rule ? r.rule : r;
+ }
+ });
+
+
+
+ var ActionPlans = Backbone.Collection.extend({
+
+ url: function() {
+ return baseUrl + '/api/action_plans/search';
+ },
+
+
+ parse: function(r) {
+ return r.actionPlans;
+ }
+
+ });
+
+
+
+ var IssueView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-template').html() || ''),
+ tagName: 'li',
+
+
+ ui: {
+ component: '.component'
+ },
+
+
+ events: {
+ 'click': 'showDetails'
+ },
+
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+
+ showDetails: function() {
+ this.$el.parent().children().removeClass('active');
+ this.$el.addClass('active');
+
+ var that = this,
+ app = this.options.app,
+ detailView = new window.SS.IssueDetailView({
+ model: this.model
+ }),
+ showCallback = function() {
+ jQuery('.navigator-details').removeClass('navigator-fetching');
+ app.detailsRegion.show(detailView);
+ };
+
+ jQuery('.navigator-details').empty().addClass('navigator-fetching');
+ jQuery.when(detailView.model.fetch()).done(function() {
+ if (that.model.get('status') !== 'CLOSED') {
+ that.fetchSource(detailView, showCallback);
+ } else {
+ showCallback();
+ }
+
+ });
+ },
+
+
+ fetchSource: function (view, callback) {
+ var line = this.model.get('line') || 0,
+ from = line >= 10 ? line - 10 : 0,
+ to = line + 30;
+
+ return jQuery
+ .ajax({
+ type: 'GET',
+ url: baseUrl + '/api/sources/show',
+ data: {
+ key: this.model.get('component'),
+ from: from,
+ to: to,
+ format: 'json'
+ }
+ })
+ .done(function (r) {
+ if (_.isObject(r) && r.source) {
+ view.source = r.source;
+ }
+ if (_.isObject(r) && r.scm) {
+ view.scm = r.scm;
+ }
+ })
+ .always(callback);
+ },
+
+
+ serializeData: function() {
+ var projectFilter = this.options.app.filters.findWhere({ property: 'componentRoots' }),
+ singleProject = _.isArray(projectFilter.get('value')) && projectFilter.get('value').length === 1;
+
+ return _.extend({
+ singleProject: singleProject
+ }, this.model.toJSON());
+ }
+ });
+
+
+
+ var NoIssuesView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#no-issues-template').html() || '')
+ });
+
+
+
+ var IssuesView = Backbone.Marionette.CollectionView.extend({
+ tagName: 'ol',
+ className: 'navigator-results-list',
+ itemView: IssueView,
+ emptyView: NoIssuesView,
+
+
+ itemViewOptions: function() {
+ return {
+ issuesView: this,
+ app: this.options.app
+ };
+ },
+
+
+ onRender: function() {
+ var $scrollEl = jQuery('.navigator-results'),
+ scrollEl = $scrollEl.get(0),
+ onScroll = function() {
+ if (scrollEl.offsetHeight + scrollEl.scrollTop >= scrollEl.scrollHeight) {
+ window.SS.IssuesNavigatorApp.fetchNextPage();
+ }
+ },
+ throttledScroll = _.throttle(onScroll, 300);
+ $scrollEl.off('scroll').on('scroll', throttledScroll);
+ },
+
+
+ onAfterItemAdded: function() {
+ var showLimitNotes = this.collection.maxResultsReached != null && this.collection.maxResultsReached;
+ jQuery('.navigator').toggleClass('navigator-with-notes', showLimitNotes);
+ jQuery('.navigator-notes').toggle(showLimitNotes);
+ },
+
+
+ close: function() {
+ var scrollEl = jQuery('.navigator-results');
+ scrollEl.off('scroll');
+ Backbone.Marionette.CollectionView.prototype.close.call(this);
+ }
+
+ });
+
+
+
+ var IssuesActionsView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issues-actions-template').html() || ''),
+
+
+ collectionEvents: {
+ 'sync': 'render'
+ },
+
+
+ events: {
+ 'click .navigator-actions-order': 'toggleOrderChoices',
+ 'click .navigator-actions-order-choices': 'sort'
+ },
+
+
+ ui: {
+ orderChoices: '.navigator-actions-order-choices'
+ },
+
+
+ onRender: function() {
+ if (!this.collection.sorting.sortText) {
+ this.collection.sorting.sortText = this.$('[data-sort=' + this.collection.sorting.sort + ']:first').text();
+ this.render();
+ return;
+ }
+
+ this.$('.open-modal').modal();
+ },
+
+
+ toggleOrderChoices: function(e) {
+ e.stopPropagation();
+ this.ui.orderChoices.toggleClass('open');
+ if (this.ui.orderChoices.is('.open')) {
+ var that = this;
+ jQuery('body').on('click.issues_actions', function() {
+ that.ui.orderChoices.removeClass('open');
+ });
+ }
+ },
+
+
+ sort: function(e) {
+ e.stopPropagation();
+ this.ui.orderChoices.removeClass('open');
+ jQuery('body').off('click.issues_actions');
+ var el = jQuery(e.target),
+ sort = el.data('sort'),
+ asc = el.data('asc');
+
+ if (sort != null && asc != null) {
+ this.collection.sorting = {
+ sort: sort,
+ sortText: el.text(),
+ asc: asc
+ };
+ this.options.app.fetchFirstPage();
+ }
+ },
+
+
+ serializeData: function() {
+ var data = Backbone.Marionette.ItemView.prototype.serializeData.apply(this, arguments);
+ return _.extend(data || {}, {
+ paging: this.collection.paging,
+ sorting: this.collection.sorting,
+ maxResultsReached: this.collection.maxResultsReached,
+ appState: window.SS.appState.toJSON(),
+ query: (Backbone.history.fragment || '').replace(/\|/g, '&')
+ });
+ }
+ });
+
+
+
+ var IssuesFilterBarView = window.SS.FilterBarView.extend({
+
+ collectionEvents: {
+ 'change:enabled': 'changeEnabled'
+ },
+
+
+ events: {
+ 'click .navigator-filter-submit': 'search'
+ },
+
+
+ getQuery: function() {
+ var query = {};
+ this.collection.each(function(filter) {
+ _.extend(query, filter.view.formatValue());
+ });
+ return query;
+ },
+
+
+ onAfterItemAdded: function(itemView) {
+ if (itemView.model.get('type') === window.SS.FavoriteFilterView ||
+ itemView.model.get('type') === window.SS.IssuesFavoriteFilterView) {
+ jQuery('.navigator-header').addClass('navigator-header-favorite');
+ }
+ },
+
+
+ search: function() {
+ this.options.app.state.set({
+ query: this.options.app.getQuery(),
+ search: true
+ });
+ this.options.app.fetchFirstPage();
+ },
+
+
+ fetchNextPage: function() {
+ this.options.app.fetchNextPage();
+ }
+
+ });
+
+
+
+ var IssuesHeaderView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issues-header-template').html() || ''),
+
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+
+ events: {
+ 'click #issues-new-search': 'newSearch',
+ 'click #issues-filter-save-as': 'saveAs',
+ 'click #issues-filter-save': 'save',
+ 'click #issues-filter-copy': 'copy',
+ 'click #issues-filter-edit': 'edit'
+ },
+
+
+ initialize: function(options) {
+ Backbone.Marionette.ItemView.prototype.initialize.apply(this, arguments);
+ this.listenTo(options.app.state, 'change', this.render);
+ },
+
+
+ newSearch: function() {
+ this.model.clear();
+ this.options.app.router.navigate('statuses=OPEN,REOPENED', { trigger: true, replace: true });
+ },
+
+
+ saveAs: function() {
+ var url = baseUrl + '/issues/save_as_form?' + (Backbone.history.fragment || '').replace(/\|/g, '&');
+ openModalWindow(url, {});
+ },
+
+
+ save: function() {
+ var that = this;
+ url = baseUrl + '/issues/save/' + this.model.id + '?' + (Backbone.history.fragment || '').replace(/\|/g, '&');
+ jQuery.ajax({
+ type: 'POST',
+ url: url
+ }).done(function() {
+ that.options.app.state.set('search', false);
+ });
+ },
+
+
+ copy: function() {
+ var url = baseUrl + '/issues/copy_form/' + this.model.id;
+ openModalWindow(url, {});
+ },
+
+
+ edit: function() {
+ var url = baseUrl + '/issues/edit_form/' + this.model.id;
+ openModalWindow(url, {});
+ },
+
+
+ serializeData: function() {
+ return _.extend({
+ canSave: this.model.id && this.options.app.state.get('search'),
+ appState: window.SS.appState.toJSON()
+ }, this.model.toJSON());
+ }
+
+ });
+
+
+
+ var IssueDetailCommentFormView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-comment-form-template').html() || ''),
+
+
+ ui: {
+ textarea: '#issue-comment-text',
+ cancelButton: '#issue-comment-cancel',
+ submitButton: '#issue-comment-submit'
+ },
+
+
+ events: {
+ 'keyup #issue-comment-text': 'toggleSubmit',
+ 'click #issue-comment-cancel': 'cancel',
+ 'click #issue-comment-submit': 'submit'
+ },
+
+
+ onDomRefresh: function() {
+ this.ui.textarea.focus();
+ },
+
+
+ toggleSubmit: function() {
+ this.ui.submitButton.prop('disabled', this.ui.textarea.val().length === 0);
+ },
+
+
+ cancel: function() {
+ this.options.detailView.updateAfterAction(false);
+ },
+
+
+ submit: function() {
+ var that = this,
+ text = this.ui.textarea.val(),
+ update = this.model && this.model.has('key'),
+ url = baseUrl + '/api/issues/' + (update ? 'edit_comment' : 'add_comment'),
+ data = { text: text };
+
+ if (update) {
+ data.key = this.model.get('key');
+ } else {
+ data.issue = this.options.issue.get('key');
+ }
+
+ this.options.detailView.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: url,
+ data: data
+ })
+ .done(function() {
+ that.options.detailView.updateAfterAction(true);
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.options.detailView.hideActionSpinner();
+ });
+ }
+ });
+
+
+
+ var IssueDetailSetSeverityFormView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-set-severity-form-template').html() || ''),
+
+
+ ui: {
+ select: '#issue-set-severity-select'
+ },
+
+
+ events: {
+ 'click #issue-set-severity-cancel': 'cancel',
+ 'click #issue-set-severity-submit': 'submit'
+ },
+
+
+ onRender: function() {
+ this.ui.select.select2({
+ minimumResultsForSearch: 100
+ });
+ },
+
+
+ cancel: function() {
+ this.options.detailView.updateAfterAction(false);
+ },
+
+
+ submit: function() {
+ var that = this;
+
+ this.options.detailView.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/set_severity',
+ data: {
+ issue: this.options.issue.get('key'),
+ severity: this.ui.select.val()
+ }
+ })
+ .done(function() {
+ that.options.detailView.updateAfterAction(true);
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.options.detailView.hideActionSpinner();
+ });
+ }
+ });
+
+
+
+ var IssueDetailAssignFormView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-assign-form-template').html() || ''),
+
+
+ ui: {
+ select: '#issue-assignee-select'
+ },
+
+
+ events: {
+ 'click #issue-assign-cancel': 'cancel',
+ 'click #issue-assign-submit': 'submit'
+ },
+
+
+ onRender: function() {
+ var currentUser = window.SS.currentUser,
+ assignee = this.options.issue.get('assignee'),
+ additionalChoices = [];
+
+ if (!assignee || currentUser !== assignee) {
+ additionalChoices.push({
+ id: currentUser,
+ text: window.SS.phrases.assignedToMe
+ });
+ }
+
+ if (!!assignee) {
+ additionalChoices.push({
+ id: '',
+ text: window.SS.phrases.unassigned
+ });
+ }
+
+ var select2Options = {
+ allowClear: false,
+ width: '250px',
+ formatNoMatches: function() { return window.SS.phrases.select2.noMatches; },
+ formatSearching: function() { return window.SS.phrases.select2.searching; },
+ formatInputTooShort: function() { return window.SS.phrases.select2.tooShort; }
+ };
+
+ if (additionalChoices.length > 0) {
+ select2Options.minimumInputLength = 0;
+ select2Options.query = function(query) {
+ if (query.term.length == 0) {
+ query.callback({ results: additionalChoices });
+ } else if (query.term.length >= 2) {
+ jQuery.ajax({
+ url: baseUrl + '/api/users/search?f=s2',
+ data: { s: query.term },
+ dataType: 'jsonp'
+ }).done(function(data) {
+ query.callback(data);
+ });
+ }
+ }
+ } else {
+ select2Options.minimumInputLength = 2;
+ select2Options.ajax = {
+ quietMillis: 300,
+ url: baseUrl + '/api/users/search?f=s2',
+ data: function (term, page) {
+ return {s: term, p: page}
+ },
+ results: function (data) {
+ return { more: data.more, results: data.results }
+ }
+ };
+ }
+
+ this.ui.select.select2(select2Options).select2('open');
+ },
+
+
+ cancel: function() {
+ this.options.detailView.updateAfterAction(false);
+ },
+
+
+ submit: function() {
+ var that = this;
+
+ this.options.detailView.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/assign',
+ data: {
+ issue: this.options.issue.get('key'),
+ assignee: this.ui.select.val()
+ }
+ })
+ .done(function() {
+ that.options.detailView.updateAfterAction(true);
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.options.detailView.hideActionSpinner();
+ });
+ }
+ });
+
+
+
+ var IssueDetailPlanFormView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-plan-form-template').html() || ''),
+
+
+ collectionEvents: {
+ 'reset': 'render'
+ },
+
+
+ ui: {
+ select: '#issue-detail-plan-select'
+ },
+
+
+ events: {
+ 'click #issue-plan-cancel': 'cancel',
+ 'click #issue-plan-submit': 'submit'
+ },
+
+
+ onRender: function() {
+ this.ui.select.select2({
+ width: '250px',
+ minimumResultsForSearch: 100
+ });
+
+ this.$('.error a')
+ .prop('href', baseUrl + '/action_plans/index/' + this.options.issue.get('project'));
+ },
+
+
+ cancel: function() {
+ this.options.detailView.updateAfterAction(false);
+ },
+
+
+ submit: function() {
+ var that = this,
+ plan = this.ui.select.val();
+
+ this.options.detailView.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/plan',
+ data: {
+ issue: this.options.issue.get('key'),
+ plan: plan === '#unplan' ? '' : plan
+ }
+ })
+ .done(function() {
+ that.options.detailView.updateAfterAction(true);
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.options.detailView.hideActionSpinner();
+ });
+ },
+
+
+ serializeData: function() {
+ return {
+ items: this.collection.toJSON(),
+ issue: this.options.issue.toJSON()
+ }
+ }
+ });
+
+
+
+ var IssueDetailRuleView = Backbone.Marionette.ItemView.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-rule-template').html() || ''),
+ className: 'rule-desc',
+ modelEvents: { 'change': 'render' },
+
+
+ serializeData: function() {
+ return _.extend({
+ characteristic: this.options.issue.get('characteristic'),
+ subCharacteristic: this.options.issue.get('subCharacteristic')
+ }, this.model.toJSON());
+ }
+ });
+
+
+
+ var IssueDetailView = Backbone.Marionette.Layout.extend({
+ template: Handlebars.compile(jQuery('#issue-detail-template').html() || ''),
+
+
+ regions: {
+ formRegion: '.code-issue-form',
+ ruleRegion: '#tab-issue-rule'
+ },
+
+
+ events: {
+ 'click .code-issue-toggle': 'toggleCollapsed',
+
+ 'click [href=#tab-issue-rule]': 'fetchRule',
+
+ 'click #issue-comment': 'comment',
+ 'click .issue-comment-edit': 'editComment',
+ 'click .issue-comment-delete': 'deleteComment',
+ 'click .issue-transition': 'transition',
+ 'click #issue-set-severity': 'setSeverity',
+ 'click #issue-assign': 'assign',
+ 'click #issue-assign-to-me': 'assignToMe',
+ 'click #issue-plan': 'plan',
+ 'click .issue-action': 'action'
+ },
+
+
+ modelEvents: {
+ 'change': 'render'
+ },
+
+
+ onRender: function() {
+ this.$('.code-issue-details').tabs();
+ this.$('.code-issue-form').hide();
+ this.rule = new Rule({ key: this.model.get('rule') });
+ this.ruleRegion.show(new IssueDetailRuleView({
+ model: this.rule,
+ issue: this.model
+ }));
+ this.initReferenceLinks();
+ },
+
+
+ initReferenceLinks: function() {
+ var sourcesId = 'sources_' + this.model.get('key');
+ this.$('#' + sourcesId).on('click', 'span.sym', { id: sourcesId }, highlight_usages);
+ },
+
+
+ onDomRefresh: function() {
+ var sourceTitleHeight = this.$('.source_title').outerHeight();
+ jQuery('.navigator-details').css('padding-top', (sourceTitleHeight + 10) + 'px');
+ },
+
+
+ onClose: function() {
+ if (this.ruleRegion) {
+ this.ruleRegion.reset();
+ }
+ },
+
+
+ resetIssue: function(options) {
+ var key = this.model.get('key');
+ this.model.clear({ silent: true });
+ this.model.set({ key: key }, { silent: true });
+ return this.model.fetch(options);
+ },
+
+
+ toggleCollapsed: function() {
+ this.$('.code-issue').toggleClass('code-issue-collapsed');
+ this.fetchRule();
+ },
+
+
+ fetchRule: function() {
+ var that = this;
+ if (!this.rule.has('name')) {
+ this.$('#tab-issue-rule').addClass('navigator-fetching');
+ this.rule.fetch({
+ success: function() {
+ that.$('#tab-issue-rule').removeClass('navigator-fetching');
+ }
+ });
+ }
+ },
+
+
+ showActionView: function(view) {
+ this.$('.code-issue-actions').hide();
+ this.$('.code-issue-form').show();
+ this.formRegion.show(view);
+ },
+
+
+ showActionSpinner: function() {
+ this.$('.code-issue-actions').addClass('navigator-fetching');
+ },
+
+
+ hideActionSpinner: function() {
+ this.$('.code-issue-actions').removeClass('navigator-fetching');
+ },
+
+
+ updateAfterAction: function(fetch) {
+ var that = this;
+
+ that.formRegion.reset();
+ that.$('.code-issue-actions').show();
+ that.$('.code-issue-form').hide();
+ that.$('[data-comment-key]').show();
+
+ if (fetch) {
+ jQuery.when(this.resetIssue()).done(function() {
+ that.hideActionSpinner();
+ });
+ }
+ },
+
+
+ comment: function() {
+ var commentFormView = new IssueDetailCommentFormView({
+ issue: this.model,
+ detailView: this
+ });
+ this.showActionView(commentFormView);
+ },
+
+
+ editComment: function(e) {
+ var commentEl = jQuery(e.target).closest('[data-comment-key]'),
+ commentKey = commentEl.data('comment-key'),
+ comment = _.findWhere(this.model.get('comments'), { key: commentKey });
+
+ commentEl.hide();
+
+ var commentFormView = new IssueDetailCommentFormView({
+ model: new Backbone.Model(comment),
+ issue: this.model,
+ detailView: this
+ });
+ this.showActionView(commentFormView);
+ },
+
+
+ deleteComment: function(e) {
+ var that = this,
+ commentKey = jQuery(e.target).closest('[data-comment-key]').data('comment-key'),
+ confirmMsg = jQuery(e.target).data('confirm-msg');
+
+ if (confirm(confirmMsg)) {
+ this.showActionSpinner();
+
+ jQuery.ajax({
+ type: "POST",
+ url: baseUrl + "/issue/delete_comment?id=" + commentKey
+ })
+ .done(function() {
+ that.updateAfterAction(true);
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.hideActionSpinner();
+ });
+ }
+ },
+
+
+ transition: function(e) {
+ var that = this;
+
+ this.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/do_transition',
+ data: {
+ issue: this.model.get('key'),
+ transition: jQuery(e.target).data('transition')
+ }
+ })
+ .done(function() {
+ that.resetIssue();
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.hideActionSpinner();
+ });
+ },
+
+
+ setSeverity: function() {
+ var setSeverityFormView = new IssueDetailSetSeverityFormView({
+ issue: this.model,
+ detailView: this
+ });
+ this.showActionView(setSeverityFormView);
+ },
+
+
+ assign: function() {
+ var assignFormView = new IssueDetailAssignFormView({
+ issue: this.model,
+ detailView: this
+ });
+ this.showActionView(assignFormView);
+ },
+
+
+ assignToMe: function() {
+ var that = this;
+
+ this.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/assign',
+ data: {
+ issue: this.model.get('key'),
+ assignee: window.SS.currentUser
+ }
+ })
+ .done(function() {
+ that.resetIssue();
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.hideActionSpinner();
+ });
+ },
+
+
+ plan: function() {
+ var that = this,
+ actionPlans = new ActionPlans(),
+ planFormView = new IssueDetailPlanFormView({
+ collection: actionPlans,
+ issue: this.model,
+ detailView: this
+ });
+
+ this.showActionSpinner();
+
+ actionPlans.fetch({
+ reset: true,
+ data: { project: this.model.get('project') },
+ success: function() {
+ that.hideActionSpinner();
+ that.showActionView(planFormView);
+ }
+ });
+ },
+
+ action: function(e) {
+ var that = this,
+ actionKey = jQuery(e.target).data('action');
+
+ this.showActionSpinner();
+
+ jQuery.ajax({
+ type: 'POST',
+ url: baseUrl + '/api/issues/do_action',
+ data: {
+ issue: this.model.get('key'),
+ actionKey: actionKey
+ }
+ })
+ .done(function() {
+ that.resetIssue();
+ })
+ .fail(function(r) {
+ alert(r.responseJSON.errors ? _.pluck(r.responseJSON.errors, 'msg').join(' ') : r);
+ that.hideActionSpinner();
+ });
+ },
+
+
+ serializeData: function() {
+ return _.extend({
+ source: this.source,
+ scm: this.scm
+ }, this.model.toJSON());
+ }
+
+ });
+
+
+
+ var IssuesDetailsFavoriteFilterView = window.SS.DetailsFavoriteFilterView.extend({
+ template: Handlebars.compile(jQuery('#issues-details-favorite-filter-template').html() || ''),
+
+
+ applyFavorite: function(e) {
+ var id = $j(e.target).data('id'),
+ filter = new window.SS.FavoriteFilter({ id: id }),
+ app = this.options.filterView.options.app;
+
+ filter.fetch({
+ success: function() {
+ app.state.set('search', false);
+ app.favoriteFilter.clear({ silent: true });
+ app.favoriteFilter.set(filter.toJSON());
+ }
+ });
+
+ this.options.filterView.hideDetails();
+ },
+
+
+ serializeData: function() {
+ return _.extend({}, this.model.toJSON(), {
+ items: this.model.get('choices')
+ });
+ }
+ });
+
+
+
+ var IssuesFavoriteFilterView = window.SS.FavoriteFilterView.extend({
+
+ initialize: function() {
+ window.SS.BaseFilterView.prototype.initialize.call(this, {
+ detailsView: IssuesDetailsFavoriteFilterView
+ });
+
+ this.listenTo(window.SS.appState, 'change:favorites', this.updateFavorites);
+ },
+
+
+ updateFavorites: function() {
+ this.model.set('choices', window.SS.appState.get('favorites'));
+ this.render();
+ }
+ });
+
+
+
+ var IssuesRouter = Backbone.Router.extend({
+
+ routes: {
+ '': 'emptyQuery',
+ ':query': 'index'
+ },
+
+
+ initialize: function(options) {
+ this.app = options.app;
+ },
+
+
+ parseQuery: function(query, separator) {
+ return (query || '').split(separator || '|').map(function(t) {
+ var tokens = t.split('=');
+ return {
+ key: tokens[0],
+ value: decodeURIComponent(tokens[1])
+ }
+ });
+ },
+
+
+ emptyQuery: function() {
+ this.navigate('statuses=OPEN,REOPENED', { trigger: true, replace: true });
+ },
+
+
+ index: function(query) {
+ var params = this.parseQuery(query);
+
+ var idObj = _.findWhere(params, { key: 'id' });
+ if (idObj) {
+ var that = this,
+ f = this.app.favoriteFilter;
+ this.app.canSave = false;
+ f.set('id', idObj.value);
+ f.fetch({
+ success: function() {
+ params = _.extend({}, that.parseQuery(f.get('query')), params);
+ that.loadResults(params);
+ }
+ });
+ } else {
+ this.loadResults(params);
+ }
+ },
+
+
+ loadResults: function(params) {
+ this.app.filterBarView.restoreFromQuery(params);
+ this.app.restoreSorting(params);
+ this.app.fetchFirstPage();
+ }
+
+ });
+
+
+
+ /*
+ * Export public classes
+ */
+
+ _.extend(window.SS, {
+ AppState: AppState,
+ Issue: Issue,
+ Issues: Issues,
+ FavoriteFilter: FavoriteFilter,
+ FavoriteFilters: FavoriteFilters,
+ IssueView: IssueView,
+ IssuesView: IssuesView,
+ IssuesActionsView: IssuesActionsView,
+ IssuesFilterBarView: IssuesFilterBarView,
+ IssuesHeaderView: IssuesHeaderView,
+ IssuesFavoriteFilterView: IssuesFavoriteFilterView,
+ IssueDetailView: IssueDetailView,
+ IssuesRouter: IssuesRouter
+ });
+
+});
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/measures-app.js b/sonar-server/src/main/webapp/javascripts/navigator/measures-app.js
new file mode 100644
index 00000000000..72919806e0c
--- /dev/null
+++ b/sonar-server/src/main/webapp/javascripts/navigator/measures-app.js
@@ -0,0 +1,170 @@
+/* global _:false, Backbone:false */
+
+window.SS = typeof window.SS === 'object' ? window.SS : {};
+
+(function() {
+
+ var NavigatorApp = new Backbone.Marionette.Application();
+ window.SS.MeasuresNavigatorApp = NavigatorApp;
+
+
+
+ NavigatorApp.addRegions({
+ filtersRegion: '.navigator-filters'
+ });
+
+
+ NavigatorApp.addInitializer(function() {
+ this.filters = new window.SS.Filters();
+
+ if (_.isObject(window.SS.favorites)) {
+ this.filters.add([
+ new window.SS.Filter({
+ type: window.SS.FavoriteFilterView,
+ enabled: true,
+ optional: false,
+ choices: window.SS.favorites,
+ favoriteUrl: '/measures/filter',
+ manageUrl: '/measures/manage'
+ })]);
+ }
+
+ this.filters.add([
+ new window.SS.Filter({
+ name: window.SS.phrases.components,
+ property: 'qualifiers[]',
+ type: window.SS.SelectFilterView,
+ enabled: true,
+ optional: false,
+ choices: window.SS.qualifiers,
+ defaultValue: window.SS.phrases.any
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.alert,
+ property: 'alertLevels[]',
+ type: window.SS.SelectFilterView,
+ enabled: false,
+ optional: true,
+ choices: {
+ 'error': window.SS.phrases.error,
+ 'warn': window.SS.phrases.warning,
+ 'ok': window.SS.phrases.ok
+ }
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.componentsOf,
+ property: 'base',
+ type: window.SS.ComponentFilterView,
+ multiple: false,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.favoritesOnly,
+ property: 'onFavourites',
+ type: window.SS.CheckboxFilterView,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.date,
+ propertyFrom: 'fromDate',
+ propertyTo: 'toDate',
+ type: window.SS.DateRangeFilterView,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.keyContains,
+ property: 'keySearch',
+ type: window.SS.StringFilterView,
+ enabled: false,
+ optional: true
+ })
+ ]);
+
+ if (_.isObject(window.SS.languages) && _.size(window.SS.languages) > 1) {
+ this.filters.add([
+ new window.SS.Filter({
+ name: window.SS.phrases.language,
+ property: 'languages[]',
+ type: window.SS.SelectFilterView,
+ enabled: false,
+ optional: true,
+ choices: window.SS.languages
+ })
+ ]);
+ }
+
+ this.filters.add([
+ new window.SS.Filter({
+ name: window.SS.phrases.lastAnalysis,
+ propertyFrom: 'ageMinDays',
+ propertyTo: 'ageMaxDays',
+ type: window.SS.RangeFilterView,
+ placeholder: window.SS.phrases.days,
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.metric,
+ property: 'c3',
+ type: window.SS.MetricFilterView,
+ metrics: window.SS.metrics,
+ periods: window.SS.metricPeriods,
+ operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' },
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.metric,
+ property: 'c2',
+ type: window.SS.MetricFilterView,
+ metrics: window.SS.metrics,
+ periods: window.SS.metricPeriods,
+ operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' },
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.metric,
+ property: 'c1',
+ type: window.SS.MetricFilterView,
+ metrics: window.SS.metrics,
+ periods: window.SS.metricPeriods,
+ operations: { 'eq': '=', 'lt': '<', 'lte': '≤', 'gt': '>', 'gte': '≥' },
+ enabled: false,
+ optional: true
+ }),
+
+ new window.SS.Filter({
+ name: window.SS.phrases.nameContains,
+ property: 'nameSearch',
+ type: window.SS.StringFilterView,
+ enabled: false,
+ optional: true
+ })
+ ]);
+
+
+ this.filterBarView = new window.SS.FilterBarView({
+ collection: this.filters,
+ extra: {
+ sort: '',
+ asc: false
+ }
+ });
+
+
+ this.filtersRegion.show(this.filterBarView);
+ });
+
+})();
diff --git a/sonar-server/src/main/webapp/javascripts/select-list.js b/sonar-server/src/main/webapp/javascripts/select-list.js
index 0a3bfef0507..05ae748a438 100644
--- a/sonar-server/src/main/webapp/javascripts/select-list.js
+++ b/sonar-server/src/main/webapp/javascripts/select-list.js
@@ -1,401 +1,381 @@
-requirejs.config({
+/* global Backbone:false, jQuery:false */
+/* jshint eqnull:true */
- paths: {
- 'backbone': 'third-party/backbone'
- },
+(function ($) {
- shim: {
- 'backbone': {
- exports: 'Backbone'
- }
- }
+ var showError = null;
-});
+ /*
+ * SelectList Collection
+ */
-requirejs(['backbone'], function (Backbone) {
+ var SelectListCollection = Backbone.Collection.extend({
- (function ($) {
+ parse: function(r) {
+ this.more = r.more;
+ return r.results;
+ },
- var showError = null;
+ fetch: function(options) {
+ var data = $.extend({
+ page: 1,
+ pageSize: 100
+ }, options.data || {}),
+ settings = $.extend({}, options, { data: data });
- /*
- * SelectList Collection
- */
+ this.settings = {
+ url: settings.url,
+ data: data
+ };
- var SelectListCollection = Backbone.Collection.extend({
+ Backbone.Collection.prototype.fetch.call(this, settings);
+ },
- parse: function (r) {
- this.more = r.more;
- return r.results;
- },
+ fetchNextPage: function(options) {
+ if (this.more) {
+ var nextPage = this.settings.data.page + 1,
+ settings = $.extend(this.settings, options);
- fetch: function (options) {
- var data = $.extend({
- page: 1,
- pageSize: 100
- }, options.data || {}),
- settings = $.extend({}, options, { data: data });
+ settings.data.page = nextPage;
- this.settings = {
- url: settings.url,
- data: data
- };
+ this.fetch(settings);
+ }
+ }
- Backbone.Collection.prototype.fetch.call(this, settings);
- },
+ });
- fetchNextPage: function (options) {
- if (this.more) {
- var nextPage = this.settings.data.page + 1,
- settings = $.extend(this.settings, options);
- settings.data.page = nextPage;
- this.fetch(settings);
- }
- }
+ /*
+ * SelectList Item View
+ */
- });
+ var SelectListItemView = Backbone.View.extend({
+ tagName: 'li',
+ template: function(d) {
+ return '<input class="select-list-list-checkbox" type="checkbox">' +
+ '<div class="select-list-list-item">' + d + '</div>';
+ },
- /*
- * SelectList Item View
- */
-
- var SelectListItemView = Backbone.View.extend({
- tagName: 'li',
-
- template: function (d) {
- return '<input class="select-list-list-checkbox" type="checkbox">' +
- '<div class="select-list-list-item">' + d + '</div>';
- },
-
- events: {
- 'change .select-list-list-checkbox': 'toggle'
- },
-
- initialize: function (options) {
- this.listenTo(this.model, 'change', this.render);
- this.settings = options.settings;
- },
-
- render: function () {
- this.$el.html(this.template(this.settings.format(this.model.toJSON())));
- this.$('input').prop('name', this.model.get('name'));
- this.$el.toggleClass('selected', this.model.get('selected'));
- this.$('.select-list-list-checkbox')
- .prop('title',
- this.model.get('selected') ?
- this.settings.tooltips.deselect :
- this.settings.tooltips.select)
- .prop('checked', this.model.get('selected'));
- },
-
- remove: function (postpone) {
- if (postpone) {
- var that = this;
+ events: {
+ 'change .select-list-list-checkbox': 'toggle'
+ },
+
+ initialize: function(options) {
+ this.listenTo(this.model, 'change', this.render);
+ this.settings = options.settings;
+ },
+
+ render: function() {
+ this.$el.html(this.template(this.settings.format(this.model.toJSON())));
+ this.$('input').prop('name', this.model.get('name'));
+ this.$el.toggleClass('selected', this.model.get('selected'));
+ this.$('.select-list-list-checkbox')
+ .prop('title',
+ this.model.get('selected') ?
+ this.settings.tooltips.deselect :
+ this.settings.tooltips.select)
+ .prop('checked', this.model.get('selected'));
+ },
+
+ remove: function(postpone) {
+ if (postpone) {
+ var that = this;
that.$el.addClass(this.model.get('selected') ? 'added' : 'removed');
- setTimeout(function () {
+ setTimeout(function() {
Backbone.View.prototype.remove.call(that, arguments);
}, 500);
- } else {
- Backbone.View.prototype.remove.call(this, arguments);
- }
- },
+ } else {
+ Backbone.View.prototype.remove.call(this, arguments);
+ }
+ },
- toggle: function () {
- var selected = this.model.get('selected'),
- that = this,
- url = selected ? this.settings.deselectUrl : this.settings.selectUrl,
- data = $.extend({}, this.settings.extra || {});
+ toggle: function() {
+ var selected = this.model.get('selected'),
+ that = this,
+ url = selected ? this.settings.deselectUrl : this.settings.selectUrl,
+ data = $.extend({}, this.settings.extra || {});
- data[this.settings.selectParameter] = this.model.get(this.settings.selectParameterValue);
+ data[this.settings.selectParameter] = this.model.get(this.settings.selectParameterValue);
- that.$el.addClass('progress');
- $.ajax({
+ that.$el.addClass('progress');
+ $.ajax({
url: url,
type: 'POST',
data: data
- })
- .done(function () {
- that.model.set('selected', !selected);
- })
- .fail(showError)
- .always(function () {
- that.$el.removeClass('progress');
- });
- }
- });
+ })
+ .done(function() {
+ that.model.set('selected', !selected);
+ })
+ .fail(showError)
+ .always(function() {
+ that.$el.removeClass('progress');
+ });
+ }
+ });
+
- /*
- * SelectList View
- */
+ /*
+ * SelectList View
+ */
- var SelectListView = Backbone.View.extend({
- template: function (l) {
- return '<div class="select-list-container">' +
- '<div class="select-list-control">' +
+ var SelectListView = Backbone.View.extend({
+ template: function(l) {
+ return '<div class="select-list-container">' +
+ '<div class="select-list-control">' +
'<div class="select-list-check-control">' +
- '<a class="select-list-control-button" name="selected">' + l.selected + '</a>' +
- '<a class="select-list-control-button" name="deselected">' + l.deselected + '</a>' +
- '<a class="select-list-control-button" name="all">' + l.all + '</a>' +
+ '<a class="select-list-control-button" name="selected">' + l.selected + '</a>' +
+ '<a class="select-list-control-button" name="deselected">' + l.deselected + '</a>' +
+ '<a class="select-list-control-button" name="all">' + l.all + '</a>' +
'</div>' +
'<div class="select-list-search-control">' +
- '<input type="text" placeholder="Search">' +
- '<a class="select-list-search-control-clear">&times;</a>' +
+ '<input type="text" placeholder="Search">' +
+ '<a class="select-list-search-control-clear">&times;</a>' +
'</div>' +
- '</div>' +
- '<div class="select-list-list-container">' +
+ '</div>' +
+ '<div class="select-list-list-container">' +
'<ul class="select-list-list"></ul>' +
- '</div>' +
- '</div>';
- },
-
- events: {
- 'click .select-list-control-button[name=selected]': 'showSelected',
- 'click .select-list-control-button[name=deselected]': 'showDeselected',
- 'click .select-list-control-button[name=all]': 'showAll',
-
- 'click .select-list-search-control-clear': 'clearSearch'
- },
-
- initialize: function (options) {
- this.listenTo(this.collection, 'add', this.renderListItem);
- this.listenTo(this.collection, 'reset', this.renderList);
- this.listenTo(this.collection, 'remove', this.removeModel);
- this.listenTo(this.collection, 'change:selected', this.confirmFilter);
- this.settings = options.settings;
- },
-
- render: function () {
- var that = this,
- keyup = function () {
- that.search();
- };
-
- this.$el.html(this.template(this.settings.labels))
- .width(this.settings.width);
-
- this.$listContainer = this.$('.select-list-list-container')
- .height(this.settings.height)
- .css('overflow', 'auto')
- .on('scroll', function () {
- that.scroll();
- });
-
- this.$list = this.$('.select-list-list');
-
- var searchInput = this.$('.select-list-search-control input')
- .on('keyup', $.debounce(250, keyup));
-
- setTimeout(function () {
- searchInput.focus();
- }, 250);
-
- this.listItemViews = [];
-
- showError = function () {
- $('<div>')
- .addClass('error').text(that.settings.errorMessage)
- .insertBefore(that.$el);
- };
- },
-
- renderList: function () {
- this.listItemViews.forEach(function (view) {
- view.remove();
+ '</div>' +
+ '</div>';
+ },
+
+ events: {
+ 'click .select-list-control-button[name=selected]': 'showSelected',
+ 'click .select-list-control-button[name=deselected]': 'showDeselected',
+ 'click .select-list-control-button[name=all]': 'showAll',
+
+ 'click .select-list-search-control-clear': 'clearSearch'
+ },
+
+ initialize: function(options) {
+ this.listenTo(this.collection, 'add', this.renderListItem);
+ this.listenTo(this.collection, 'reset', this.renderList);
+ this.listenTo(this.collection, 'remove', this.removeModel);
+ this.listenTo(this.collection, 'change:selected', this.confirmFilter);
+ this.settings = options.settings;
+ },
+
+ render: function() {
+ var that = this,
+ keyup = function() { that.search(); };
+
+ this.$el.html(this.template(this.settings.labels))
+ .width(this.settings.width);
+
+ this.$listContainer = this.$('.select-list-list-container')
+ .height(this.settings.height)
+ .css('overflow', 'auto')
+ .on('scroll', function() { that.scroll(); });
+
+ this.$list = this.$('.select-list-list');
+
+ var searchInput = this.$('.select-list-search-control input')
+ .on('keyup', $.debounce(250, keyup));
+
+ setTimeout(function() {
+ searchInput.focus();
+ }, 250);
+
+ this.listItemViews = [];
+
+ showError = function() {
+ $('<div>')
+ .addClass('error').text(that.settings.errorMessage)
+ .insertBefore(that.$el);
+ };
+ },
+
+ renderList: function() {
+ this.listItemViews.forEach(function(view) { view.remove(); });
+ this.listItemViews = [];
+ this.collection.each(this.renderListItem, this);
+ this.$listContainer.scrollTop(0);
+ },
+
+ renderListItem: function(item) {
+ var itemView = new SelectListItemView({
+ model: item,
+ settings: this.settings
+ });
+ this.listItemViews.push(itemView);
+ this.$list.append(itemView.el);
+ itemView.render();
+ },
+
+ confirmFilter: function(model) {
+ if (this.currentFilter !== 'all') {
+ this.collection.remove(model);
+ }
+ },
+
+ removeModel: function(model, collection, options) {
+ this.listItemViews[options.index].remove(true);
+ this.listItemViews.splice(options.index, 1);
+ },
+
+ filterBySelection: function(filter) {
+ var that = this;
+ filter = this.currentFilter = filter || this.currentFilter;
+
+ if (filter != null) {
+ this.$('.select-list-check-control').toggleClass('disabled', false);
+ this.$('.select-list-search-control').toggleClass('disabled', true);
+ this.$('.select-list-search-control input').val('');
+
+ this.$('.select-list-control-button').removeClass('active')
+ .filter('[name=' + filter + ']').addClass('active');
+
+ this.showFetchSpinner();
+
+ this.collection.fetch({
+ url: this.settings.searchUrl,
+ reset: true,
+ data: { selected: filter },
+ success: function() {
+ that.hideFetchSpinner();
+ },
+ error: showError
});
- this.listItemViews = [];
- this.collection.each(this.renderListItem, this);
- this.$listContainer.scrollTop(0);
- },
-
- renderListItem: function (item) {
- var itemView = new SelectListItemView({
- model: item,
- settings: this.settings
+ }
+ },
+
+ showSelected: function() {
+ this.filterBySelection('selected');
+ },
+
+ showDeselected: function() {
+ this.filterBySelection('deselected');
+ },
+
+ showAll: function() {
+ this.filterBySelection('all');
+ },
+
+ search: function() {
+ var query = this.$('.select-list-search-control input').val(),
+ hasQuery = query.length > 0,
+ that = this;
+
+ this.$('.select-list-check-control').toggleClass('disabled', hasQuery);
+ this.$('.select-list-search-control').toggleClass('disabled', !hasQuery);
+
+ if (hasQuery) {
+ this.showFetchSpinner();
+ this.currentFilter = 'all';
+
+ this.collection.fetch({
+ url: this.settings.searchUrl,
+ reset: true,
+ data: { query: query },
+ success: function() {
+ that.hideFetchSpinner();
+ },
+ error: showError
});
- this.listItemViews.push(itemView);
- this.$list.append(itemView.el);
- itemView.render();
- },
-
- confirmFilter: function (model) {
- if (this.currentFilter !== 'all') {
- this.collection.remove(model);
- }
- },
-
- removeModel: function (model, collection, options) {
- this.listItemViews[options.index].remove(true);
- this.listItemViews.splice(options.index, 1);
- },
-
- filterBySelection: function (filter) {
- var that = this;
- filter = this.currentFilter = filter || this.currentFilter;
-
- if (filter != null) {
- this.$('.select-list-check-control').toggleClass('disabled', false);
- this.$('.select-list-search-control').toggleClass('disabled', true);
- this.$('.select-list-search-control input').val('');
-
- this.$('.select-list-control-button').removeClass('active')
- .filter('[name=' + filter + ']').addClass('active');
-
- this.showFetchSpinner();
-
- this.collection.fetch({
- url: this.settings.searchUrl,
- reset: true,
- data: { selected: filter },
- success: function () {
- that.hideFetchSpinner();
- },
- error: showError
- });
- }
- },
-
- showSelected: function () {
- this.filterBySelection('selected');
- },
-
- showDeselected: function () {
- this.filterBySelection('deselected');
- },
-
- showAll: function () {
- this.filterBySelection('all');
- },
-
- search: function () {
- var query = this.$('.select-list-search-control input').val(),
- hasQuery = query.length > 0,
- that = this;
-
- this.$('.select-list-check-control').toggleClass('disabled', hasQuery);
- this.$('.select-list-search-control').toggleClass('disabled', !hasQuery);
-
- if (hasQuery) {
- this.showFetchSpinner();
- this.currentFilter = 'all';
-
- this.collection.fetch({
- url: this.settings.searchUrl,
- reset: true,
- data: { query: query },
- success: function () {
- that.hideFetchSpinner();
- },
- error: showError
- });
- } else {
- this.filterBySelection();
- }
- },
+ } else {
+ this.filterBySelection();
+ }
+ },
- searchByQuery: function (query) {
- this.$('.select-list-search-control input').val(query);
- this.search();
- },
+ searchByQuery: function(query) {
+ this.$('.select-list-search-control input').val(query);
+ this.search();
+ },
- clearSearch: function () {
- this.filterBySelection();
- },
+ clearSearch: function() {
+ this.filterBySelection();
+ },
- showFetchSpinner: function () {
- this.$listContainer.addClass('loading');
- },
+ showFetchSpinner: function() {
+ this.$listContainer.addClass('loading');
+ },
- hideFetchSpinner: function () {
- this.$listContainer.removeClass('loading');
- },
+ hideFetchSpinner: function() {
+ this.$listContainer.removeClass('loading');
+ },
- scroll: function () {
- var scrollBottom = this.$listContainer.scrollTop() >=
- this.$list[0].scrollHeight - this.$listContainer.outerHeight(),
- that = this;
+ scroll: function() {
+ var scrollBottom = this.$listContainer.scrollTop() >=
+ this.$list[0].scrollHeight - this.$listContainer.outerHeight(),
+ that = this;
- if (scrollBottom && this.collection.more) {
- $.throttle(250, function () {
+ if (scrollBottom && this.collection.more) {
+ $.throttle(250, function() {
that.showFetchSpinner();
that.collection.fetchNextPage({
- success: function () {
- that.hideFetchSpinner();
- }
+ success: function() { that.hideFetchSpinner(); }
});
- })();
- }
+ })();
}
+ }
- });
+ });
- /*
- * SelectList Entry Point
- */
- window.SelectList = function (options) {
- this.settings = $.extend(window.SelectList.defaults, options);
+ /*
+ * SelectList Entry Point
+ */
- this.collection = new SelectListCollection();
+ window.SelectList = function(options) {
+ this.settings = $.extend(window.SelectList.defaults, options);
- this.view = new SelectListView({
- el: this.settings.el,
- collection: this.collection,
- settings: this.settings
- });
+ this.collection = new SelectListCollection();
+
+ this.view = new SelectListView({
+ el: this.settings.el,
+ collection: this.collection,
+ settings: this.settings
+ });
+
+ this.view.render();
+ this.filter('selected');
+ return this;
+ };
- this.view.render();
- this.filter('selected');
- return this;
- };
- /*
- * SelectList API Methods
- */
+ /*
+ * SelectList API Methods
+ */
- window.SelectList.prototype.filter = function (filter) {
- this.view.filterBySelection(filter);
- return this;
- };
+ window.SelectList.prototype.filter = function(filter) {
+ this.view.filterBySelection(filter);
+ return this;
+ };
- window.SelectList.prototype.search = function (query) {
- this.view.searchByQuery(query);
- return this;
- };
+ window.SelectList.prototype.search = function(query) {
+ this.view.searchByQuery(query);
+ return this;
+ };
- /*
- * SelectList Defaults
- */
- window.SelectList.defaults = {
- width: '50%',
- height: 400,
+ /*
+ * SelectList Defaults
+ */
- format: function (item) {
- return item.value;
- },
+ window.SelectList.defaults = {
+ width: '50%',
+ height: 400,
- labels: {
- selected: 'Selected',
- deselected: 'Deselected',
- all: 'All'
- },
+ format: function (item) { return item.value; },
- tooltips: {
- select: 'Click this to select item',
- deselect: 'Click this to deselect item'
- },
+ labels: {
+ selected: 'Selected',
+ deselected: 'Deselected',
+ all: 'All'
+ },
- errorMessage: 'Something gone wrong, try to reload the page and try again.'
- };
+ tooltips: {
+ select: 'Click this to select item',
+ deselect: 'Click this to deselect item'
+ },
- })(jQuery);
+ errorMessage: 'Something gone wrong, try to reload the page and try again.'
+ };
-});
+})(jQuery);
diff --git a/sonar-server/src/main/webapp/javascripts/third-party/backbone.js b/sonar-server/src/main/webapp/javascripts/third-party/backbone-min.js
index c1ceabc4a57..c1ceabc4a57 100644
--- a/sonar-server/src/main/webapp/javascripts/third-party/backbone.js
+++ b/sonar-server/src/main/webapp/javascripts/third-party/backbone-min.js
diff --git a/sonar-server/src/main/webapp/javascripts/third-party/backbone.marionette.js b/sonar-server/src/main/webapp/javascripts/third-party/backbone.marionette.min.js
index 58ac9a82c71..58ac9a82c71 100644
--- a/sonar-server/src/main/webapp/javascripts/third-party/backbone.marionette.js
+++ b/sonar-server/src/main/webapp/javascripts/third-party/backbone.marionette.min.js
diff --git a/sonar-server/src/main/webapp/javascripts/third-party/require.js b/sonar-server/src/main/webapp/javascripts/third-party/require.js
deleted file mode 100644
index 84d1d678cf4..00000000000
--- a/sonar-server/src/main/webapp/javascripts/third-party/require.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- RequireJS 2.1.10 Copyright (c) 2010-2014, The Dojo Foundation All Rights Reserved.
- Available via the MIT or new BSD license.
- see: http://github.com/jrburke/requirejs for details
-*/
-var requirejs,require,define;
-(function(ca){function G(b){return"[object Function]"===N.call(b)}function H(b){return"[object Array]"===N.call(b)}function v(b,c){if(b){var d;for(d=0;d<b.length&&(!b[d]||!c(b[d],d,b));d+=1);}}function U(b,c){if(b){var d;for(d=b.length-1;-1<d&&(!b[d]||!c(b[d],d,b));d-=1);}}function s(b,c){return ga.call(b,c)}function j(b,c){return s(b,c)&&b[c]}function B(b,c){for(var d in b)if(s(b,d)&&c(b[d],d))break}function V(b,c,d,g){c&&B(c,function(c,h){if(d||!s(b,h))g&&"object"===typeof c&&c&&!H(c)&&!G(c)&&!(c instanceof
-RegExp)?(b[h]||(b[h]={}),V(b[h],c,d,g)):b[h]=c});return b}function t(b,c){return function(){return c.apply(b,arguments)}}function da(b){throw b;}function ea(b){if(!b)return b;var c=ca;v(b.split("."),function(b){c=c[b]});return c}function C(b,c,d,g){c=Error(c+"\nhttp://requirejs.org/docs/errors.html#"+b);c.requireType=b;c.requireModules=g;d&&(c.originalError=d);return c}function ha(b){function c(a,e,b){var f,n,c,d,g,h,i,I=e&&e.split("/");n=I;var m=l.map,k=m&&m["*"];if(a&&"."===a.charAt(0))if(e){n=
-I.slice(0,I.length-1);a=a.split("/");e=a.length-1;l.nodeIdCompat&&R.test(a[e])&&(a[e]=a[e].replace(R,""));n=a=n.concat(a);d=n.length;for(e=0;e<d;e++)if(c=n[e],"."===c)n.splice(e,1),e-=1;else if(".."===c)if(1===e&&(".."===n[2]||".."===n[0]))break;else 0<e&&(n.splice(e-1,2),e-=2);a=a.join("/")}else 0===a.indexOf("./")&&(a=a.substring(2));if(b&&m&&(I||k)){n=a.split("/");e=n.length;a:for(;0<e;e-=1){d=n.slice(0,e).join("/");if(I)for(c=I.length;0<c;c-=1)if(b=j(m,I.slice(0,c).join("/")))if(b=j(b,d)){f=b;
-g=e;break a}!h&&(k&&j(k,d))&&(h=j(k,d),i=e)}!f&&h&&(f=h,g=i);f&&(n.splice(0,g,f),a=n.join("/"))}return(f=j(l.pkgs,a))?f:a}function d(a){z&&v(document.getElementsByTagName("script"),function(e){if(e.getAttribute("data-requiremodule")===a&&e.getAttribute("data-requirecontext")===i.contextName)return e.parentNode.removeChild(e),!0})}function g(a){var e=j(l.paths,a);if(e&&H(e)&&1<e.length)return e.shift(),i.require.undef(a),i.require([a]),!0}function u(a){var e,b=a?a.indexOf("!"):-1;-1<b&&(e=a.substring(0,
-b),a=a.substring(b+1,a.length));return[e,a]}function m(a,e,b,f){var n,d,g=null,h=e?e.name:null,l=a,m=!0,k="";a||(m=!1,a="_@r"+(N+=1));a=u(a);g=a[0];a=a[1];g&&(g=c(g,h,f),d=j(p,g));a&&(g?k=d&&d.normalize?d.normalize(a,function(a){return c(a,h,f)}):c(a,h,f):(k=c(a,h,f),a=u(k),g=a[0],k=a[1],b=!0,n=i.nameToUrl(k)));b=g&&!d&&!b?"_unnormalized"+(Q+=1):"";return{prefix:g,name:k,parentMap:e,unnormalized:!!b,url:n,originalName:l,isDefine:m,id:(g?g+"!"+k:k)+b}}function q(a){var e=a.id,b=j(k,e);b||(b=k[e]=new i.Module(a));
-return b}function r(a,e,b){var f=a.id,n=j(k,f);if(s(p,f)&&(!n||n.defineEmitComplete))"defined"===e&&b(p[f]);else if(n=q(a),n.error&&"error"===e)b(n.error);else n.on(e,b)}function w(a,e){var b=a.requireModules,f=!1;if(e)e(a);else if(v(b,function(e){if(e=j(k,e))e.error=a,e.events.error&&(f=!0,e.emit("error",a))}),!f)h.onError(a)}function x(){S.length&&(ia.apply(A,[A.length,0].concat(S)),S=[])}function y(a){delete k[a];delete W[a]}function F(a,e,b){var f=a.map.id;a.error?a.emit("error",a.error):(e[f]=
-!0,v(a.depMaps,function(f,c){var d=f.id,g=j(k,d);g&&(!a.depMatched[c]&&!b[d])&&(j(e,d)?(a.defineDep(c,p[d]),a.check()):F(g,e,b))}),b[f]=!0)}function D(){var a,e,b=(a=1E3*l.waitSeconds)&&i.startTime+a<(new Date).getTime(),f=[],c=[],h=!1,k=!0;if(!X){X=!0;B(W,function(a){var i=a.map,m=i.id;if(a.enabled&&(i.isDefine||c.push(a),!a.error))if(!a.inited&&b)g(m)?h=e=!0:(f.push(m),d(m));else if(!a.inited&&(a.fetched&&i.isDefine)&&(h=!0,!i.prefix))return k=!1});if(b&&f.length)return a=C("timeout","Load timeout for modules: "+
-f,null,f),a.contextName=i.contextName,w(a);k&&v(c,function(a){F(a,{},{})});if((!b||e)&&h)if((z||fa)&&!Y)Y=setTimeout(function(){Y=0;D()},50);X=!1}}function E(a){s(p,a[0])||q(m(a[0],null,!0)).init(a[1],a[2])}function L(a){var a=a.currentTarget||a.srcElement,e=i.onScriptLoad;a.detachEvent&&!Z?a.detachEvent("onreadystatechange",e):a.removeEventListener("load",e,!1);e=i.onScriptError;(!a.detachEvent||Z)&&a.removeEventListener("error",e,!1);return{node:a,id:a&&a.getAttribute("data-requiremodule")}}function M(){var a;
-for(x();A.length;){a=A.shift();if(null===a[0])return w(C("mismatch","Mismatched anonymous define() module: "+a[a.length-1]));E(a)}}var X,$,i,K,Y,l={waitSeconds:7,baseUrl:"./",paths:{},bundles:{},pkgs:{},shim:{},config:{}},k={},W={},aa={},A=[],p={},T={},ba={},N=1,Q=1;K={require:function(a){return a.require?a.require:a.require=i.makeRequire(a.map)},exports:function(a){a.usingExports=!0;if(a.map.isDefine)return a.exports?a.exports:a.exports=p[a.map.id]={}},module:function(a){return a.module?a.module:
-a.module={id:a.map.id,uri:a.map.url,config:function(){return j(l.config,a.map.id)||{}},exports:K.exports(a)}}};$=function(a){this.events=j(aa,a.id)||{};this.map=a;this.shim=j(l.shim,a.id);this.depExports=[];this.depMaps=[];this.depMatched=[];this.pluginMaps={};this.depCount=0};$.prototype={init:function(a,e,b,f){f=f||{};if(!this.inited){this.factory=e;if(b)this.on("error",b);else this.events.error&&(b=t(this,function(a){this.emit("error",a)}));this.depMaps=a&&a.slice(0);this.errback=b;this.inited=
-!0;this.ignore=f.ignore;f.enabled||this.enabled?this.enable():this.check()}},defineDep:function(a,e){this.depMatched[a]||(this.depMatched[a]=!0,this.depCount-=1,this.depExports[a]=e)},fetch:function(){if(!this.fetched){this.fetched=!0;i.startTime=(new Date).getTime();var a=this.map;if(this.shim)i.makeRequire(this.map,{enableBuildCallback:!0})(this.shim.deps||[],t(this,function(){return a.prefix?this.callPlugin():this.load()}));else return a.prefix?this.callPlugin():this.load()}},load:function(){var a=
-this.map.url;T[a]||(T[a]=!0,i.load(this.map.id,a))},check:function(){if(this.enabled&&!this.enabling){var a,e,b=this.map.id;e=this.depExports;var f=this.exports,c=this.factory;if(this.inited)if(this.error)this.emit("error",this.error);else{if(!this.defining){this.defining=!0;if(1>this.depCount&&!this.defined){if(G(c)){if(this.events.error&&this.map.isDefine||h.onError!==da)try{f=i.execCb(b,c,e,f)}catch(d){a=d}else f=i.execCb(b,c,e,f);this.map.isDefine&&void 0===f&&((e=this.module)?f=e.exports:this.usingExports&&
-(f=this.exports));if(a)return a.requireMap=this.map,a.requireModules=this.map.isDefine?[this.map.id]:null,a.requireType=this.map.isDefine?"define":"require",w(this.error=a)}else f=c;this.exports=f;if(this.map.isDefine&&!this.ignore&&(p[b]=f,h.onResourceLoad))h.onResourceLoad(i,this.map,this.depMaps);y(b);this.defined=!0}this.defining=!1;this.defined&&!this.defineEmitted&&(this.defineEmitted=!0,this.emit("defined",this.exports),this.defineEmitComplete=!0)}}else this.fetch()}},callPlugin:function(){var a=
-this.map,b=a.id,d=m(a.prefix);this.depMaps.push(d);r(d,"defined",t(this,function(f){var d,g;g=j(ba,this.map.id);var J=this.map.name,u=this.map.parentMap?this.map.parentMap.name:null,p=i.makeRequire(a.parentMap,{enableBuildCallback:!0});if(this.map.unnormalized){if(f.normalize&&(J=f.normalize(J,function(a){return c(a,u,!0)})||""),f=m(a.prefix+"!"+J,this.map.parentMap),r(f,"defined",t(this,function(a){this.init([],function(){return a},null,{enabled:!0,ignore:!0})})),g=j(k,f.id)){this.depMaps.push(f);
-if(this.events.error)g.on("error",t(this,function(a){this.emit("error",a)}));g.enable()}}else g?(this.map.url=i.nameToUrl(g),this.load()):(d=t(this,function(a){this.init([],function(){return a},null,{enabled:!0})}),d.error=t(this,function(a){this.inited=!0;this.error=a;a.requireModules=[b];B(k,function(a){0===a.map.id.indexOf(b+"_unnormalized")&&y(a.map.id)});w(a)}),d.fromText=t(this,function(f,c){var g=a.name,J=m(g),k=O;c&&(f=c);k&&(O=!1);q(J);s(l.config,b)&&(l.config[g]=l.config[b]);try{h.exec(f)}catch(j){return w(C("fromtexteval",
-"fromText eval for "+b+" failed: "+j,j,[b]))}k&&(O=!0);this.depMaps.push(J);i.completeLoad(g);p([g],d)}),f.load(a.name,p,d,l))}));i.enable(d,this);this.pluginMaps[d.id]=d},enable:function(){W[this.map.id]=this;this.enabling=this.enabled=!0;v(this.depMaps,t(this,function(a,b){var c,f;if("string"===typeof a){a=m(a,this.map.isDefine?this.map:this.map.parentMap,!1,!this.skipMap);this.depMaps[b]=a;if(c=j(K,a.id)){this.depExports[b]=c(this);return}this.depCount+=1;r(a,"defined",t(this,function(a){this.defineDep(b,
-a);this.check()}));this.errback&&r(a,"error",t(this,this.errback))}c=a.id;f=k[c];!s(K,c)&&(f&&!f.enabled)&&i.enable(a,this)}));B(this.pluginMaps,t(this,function(a){var b=j(k,a.id);b&&!b.enabled&&i.enable(a,this)}));this.enabling=!1;this.check()},on:function(a,b){var c=this.events[a];c||(c=this.events[a]=[]);c.push(b)},emit:function(a,b){v(this.events[a],function(a){a(b)});"error"===a&&delete this.events[a]}};i={config:l,contextName:b,registry:k,defined:p,urlFetched:T,defQueue:A,Module:$,makeModuleMap:m,
-nextTick:h.nextTick,onError:w,configure:function(a){a.baseUrl&&"/"!==a.baseUrl.charAt(a.baseUrl.length-1)&&(a.baseUrl+="/");var b=l.shim,c={paths:!0,bundles:!0,config:!0,map:!0};B(a,function(a,b){c[b]?(l[b]||(l[b]={}),V(l[b],a,!0,!0)):l[b]=a});a.bundles&&B(a.bundles,function(a,b){v(a,function(a){a!==b&&(ba[a]=b)})});a.shim&&(B(a.shim,function(a,c){H(a)&&(a={deps:a});if((a.exports||a.init)&&!a.exportsFn)a.exportsFn=i.makeShimExports(a);b[c]=a}),l.shim=b);a.packages&&v(a.packages,function(a){var b,
-a="string"===typeof a?{name:a}:a;b=a.name;a.location&&(l.paths[b]=a.location);l.pkgs[b]=a.name+"/"+(a.main||"main").replace(ja,"").replace(R,"")});B(k,function(a,b){!a.inited&&!a.map.unnormalized&&(a.map=m(b))});if(a.deps||a.callback)i.require(a.deps||[],a.callback)},makeShimExports:function(a){return function(){var b;a.init&&(b=a.init.apply(ca,arguments));return b||a.exports&&ea(a.exports)}},makeRequire:function(a,e){function g(f,c,d){var j,l;e.enableBuildCallback&&(c&&G(c))&&(c.__requireJsBuild=
-!0);if("string"===typeof f){if(G(c))return w(C("requireargs","Invalid require call"),d);if(a&&s(K,f))return K[f](k[a.id]);if(h.get)return h.get(i,f,a,g);j=m(f,a,!1,!0);j=j.id;return!s(p,j)?w(C("notloaded",'Module name "'+j+'" has not been loaded yet for context: '+b+(a?"":". Use require([])"))):p[j]}M();i.nextTick(function(){M();l=q(m(null,a));l.skipMap=e.skipMap;l.init(f,c,d,{enabled:!0});D()});return g}e=e||{};V(g,{isBrowser:z,toUrl:function(b){var e,d=b.lastIndexOf("."),g=b.split("/")[0];if(-1!==
-d&&(!("."===g||".."===g)||1<d))e=b.substring(d,b.length),b=b.substring(0,d);return i.nameToUrl(c(b,a&&a.id,!0),e,!0)},defined:function(b){return s(p,m(b,a,!1,!0).id)},specified:function(b){b=m(b,a,!1,!0).id;return s(p,b)||s(k,b)}});a||(g.undef=function(b){x();var c=m(b,a,!0),e=j(k,b);d(b);delete p[b];delete T[c.url];delete aa[b];U(A,function(a,c){a[0]===b&&A.splice(c,1)});e&&(e.events.defined&&(aa[b]=e.events),y(b))});return g},enable:function(a){j(k,a.id)&&q(a).enable()},completeLoad:function(a){var b,
-c,f=j(l.shim,a)||{},d=f.exports;for(x();A.length;){c=A.shift();if(null===c[0]){c[0]=a;if(b)break;b=!0}else c[0]===a&&(b=!0);E(c)}c=j(k,a);if(!b&&!s(p,a)&&c&&!c.inited){if(l.enforceDefine&&(!d||!ea(d)))return g(a)?void 0:w(C("nodefine","No define call for "+a,null,[a]));E([a,f.deps||[],f.exportsFn])}D()},nameToUrl:function(a,b,c){var f,d,g;(f=j(l.pkgs,a))&&(a=f);if(f=j(ba,a))return i.nameToUrl(f,b,c);if(h.jsExtRegExp.test(a))f=a+(b||"");else{f=l.paths;a=a.split("/");for(d=a.length;0<d;d-=1)if(g=a.slice(0,
-d).join("/"),g=j(f,g)){H(g)&&(g=g[0]);a.splice(0,d,g);break}f=a.join("/");f+=b||(/^data\:|\?/.test(f)||c?"":".js");f=("/"===f.charAt(0)||f.match(/^[\w\+\.\-]+:/)?"":l.baseUrl)+f}return l.urlArgs?f+((-1===f.indexOf("?")?"?":"&")+l.urlArgs):f},load:function(a,b){h.load(i,a,b)},execCb:function(a,b,c,d){return b.apply(d,c)},onScriptLoad:function(a){if("load"===a.type||ka.test((a.currentTarget||a.srcElement).readyState))P=null,a=L(a),i.completeLoad(a.id)},onScriptError:function(a){var b=L(a);if(!g(b.id))return w(C("scripterror",
-"Script error for: "+b.id,a,[b.id]))}};i.require=i.makeRequire();return i}var h,x,y,D,L,E,P,M,q,Q,la=/(\/\*([\s\S]*?)\*\/|([^:]|^)\/\/(.*)$)/mg,ma=/[^.]\s*require\s*\(\s*["']([^'"\s]+)["']\s*\)/g,R=/\.js$/,ja=/^\.\//;x=Object.prototype;var N=x.toString,ga=x.hasOwnProperty,ia=Array.prototype.splice,z=!!("undefined"!==typeof window&&"undefined"!==typeof navigator&&window.document),fa=!z&&"undefined"!==typeof importScripts,ka=z&&"PLAYSTATION 3"===navigator.platform?/^complete$/:/^(complete|loaded)$/,
-Z="undefined"!==typeof opera&&"[object Opera]"===opera.toString(),F={},r={},S=[],O=!1;if("undefined"===typeof define){if("undefined"!==typeof requirejs){if(G(requirejs))return;r=requirejs;requirejs=void 0}"undefined"!==typeof require&&!G(require)&&(r=require,require=void 0);h=requirejs=function(b,c,d,g){var u,m="_";!H(b)&&"string"!==typeof b&&(u=b,H(c)?(b=c,c=d,d=g):b=[]);u&&u.context&&(m=u.context);(g=j(F,m))||(g=F[m]=h.s.newContext(m));u&&g.configure(u);return g.require(b,c,d)};h.config=function(b){return h(b)};
-h.nextTick="undefined"!==typeof setTimeout?function(b){setTimeout(b,4)}:function(b){b()};require||(require=h);h.version="2.1.10";h.jsExtRegExp=/^\/|:|\?|\.js$/;h.isBrowser=z;x=h.s={contexts:F,newContext:ha};h({});v(["toUrl","undef","defined","specified"],function(b){h[b]=function(){var c=F._;return c.require[b].apply(c,arguments)}});if(z&&(y=x.head=document.getElementsByTagName("head")[0],D=document.getElementsByTagName("base")[0]))y=x.head=D.parentNode;h.onError=da;h.createNode=function(b){var c=
-b.xhtml?document.createElementNS("http://www.w3.org/1999/xhtml","html:script"):document.createElement("script");c.type=b.scriptType||"text/javascript";c.charset="utf-8";c.async=!0;return c};h.load=function(b,c,d){var g=b&&b.config||{};if(z)return g=h.createNode(g,c,d),g.setAttribute("data-requirecontext",b.contextName),g.setAttribute("data-requiremodule",c),g.attachEvent&&!(g.attachEvent.toString&&0>g.attachEvent.toString().indexOf("[native code"))&&!Z?(O=!0,g.attachEvent("onreadystatechange",b.onScriptLoad)):
-(g.addEventListener("load",b.onScriptLoad,!1),g.addEventListener("error",b.onScriptError,!1)),g.src=d,M=g,D?y.insertBefore(g,D):y.appendChild(g),M=null,g;if(fa)try{importScripts(d),b.completeLoad(c)}catch(j){b.onError(C("importscripts","importScripts failed for "+c+" at "+d,j,[c]))}};z&&!r.skipDataMain&&U(document.getElementsByTagName("script"),function(b){y||(y=b.parentNode);if(L=b.getAttribute("data-main"))return q=L,r.baseUrl||(E=q.split("/"),q=E.pop(),Q=E.length?E.join("/")+"/":"./",r.baseUrl=
-Q),q=q.replace(R,""),h.jsExtRegExp.test(q)&&(q=L),r.deps=r.deps?r.deps.concat(q):[q],!0});define=function(b,c,d){var g,h;"string"!==typeof b&&(d=c,c=b,b=null);H(c)||(d=c,c=null);!c&&G(d)&&(c=[],d.length&&(d.toString().replace(la,"").replace(ma,function(b,d){c.push(d)}),c=(1===d.length?["require"]:["require","exports","module"]).concat(c)));if(O){if(!(g=M))P&&"interactive"===P.readyState||U(document.getElementsByTagName("script"),function(b){if("interactive"===b.readyState)return P=b}),g=P;g&&(b||
-(b=g.getAttribute("data-requiremodule")),h=F[g.getAttribute("data-requirecontext")])}(h?h.defQueue:S).push([b,c,d])};define.amd={jQuery:!0};h.exec=function(b){return eval(b)};h(r)}})(this);
diff --git a/sonar-server/src/main/webapp/javascripts/third-party/underscore.js b/sonar-server/src/main/webapp/javascripts/third-party/underscore-min.js
index f8728b3f26e..f8728b3f26e 100644
--- a/sonar-server/src/main/webapp/javascripts/third-party/underscore.js
+++ b/sonar-server/src/main/webapp/javascripts/third-party/underscore-min.js
diff --git a/sonar-server/wro.xml b/sonar-server/wro.xml
index 3395f9a23f0..ee181e082ca 100644
--- a/sonar-server/wro.xml
+++ b/sonar-server/wro.xml
@@ -23,7 +23,10 @@
<js>/javascripts/third-party/jquery-ui.min.js</js>
<js>/javascripts/third-party/jquery-ui.tabs.js</js>
<js>/javascripts/third-party/d3.v3.min.js</js>
- <js>/javascripts/third-party/underscore.js</js>
+ <js>/javascripts/third-party/underscore-min.js</js>
+ <js>/javascripts/third-party/backbone-min.js</js>
+ <js>/javascripts/third-party/backbone.marionette.min.js</js>
+ <js>/javascripts/third-party/handlebars.js</js>
<js>/javascripts/third-party/jquery.ba-throttle-debounce.min.js</js>
<js>/javascripts/third-party/select2.min.js</js>
@@ -34,9 +37,28 @@
<js>/javascripts/widgets/pie-chart.js</js>
<js>/javascripts/widgets/histogram.js</js>
+ <js>/javascripts/select-list.js</js>
<js>/javascripts/top-search.js</js>
<js>/javascripts/sortable.js</js>
+ <js>/javascripts/navigator/handlebars-extensions.js</js>
+
+ <js>/javascripts/navigator/filters/base-filters.js</js>
+ <js>/javascripts/navigator/filters/select-filters.js</js>
+ <js>/javascripts/navigator/filters/ajax-select-filters.js</js>
+ <js>/javascripts/navigator/filters/range-filters.js</js>
+ <js>/javascripts/navigator/filters/checkbox-filters.js</js>
+ <js>/javascripts/navigator/filters/string-filters.js</js>
+ <js>/javascripts/navigator/filters/metric-filters.js</js>
+ <js>/javascripts/navigator/filters/favorite-filters.js</js>
+ <js>/javascripts/navigator/filters/more-criteria-filters.js</js>
+ <js>/javascripts/navigator/filters/context-filters.js</js>
+
+ <js>/javascripts/navigator/issues.js</js>
+ <js>/javascripts/navigator/issues-app.js</js>
+ <js>/javascripts/navigator/issues-app-old.js</js>
+ <js>/javascripts/navigator/measures-app.js</js>
+
<js>/javascripts/application.js</js>
<js>/javascripts/dashboard.js</js>
<js>/javascripts/duplication.js</js>