aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStas Vilchik <vilchiks@gmail.com>2014-01-22 19:02:52 +0600
committerStas Vilchik <vilchiks@gmail.com>2014-01-22 19:03:07 +0600
commitc3a99c9c255fc0bb178eb6053945eaf07039c3cf (patch)
tree053eb940fbb695c5deaeb0efa3c6def9f5b91647
parentc1f6bd2c61e96cff3bad2695a3fc995cfd0f9732 (diff)
downloadsonarqube-c3a99c9c255fc0bb178eb6053945eaf07039c3cf.tar.gz
sonarqube-c3a99c9c255fc0bb178eb6053945eaf07039c3cf.zip
New Issues Page: Some adjustments
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_header.hbs.erb19
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_actions.hbs.erb6
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_details_favorite_filter.hbs.erb14
-rw-r--r--sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_no_issues.hbs.erb1
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/base-filters.js11
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/range-filters.js6
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/select-filters.js7
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/filters/string-filters.js6
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/issues-app.js61
-rw-r--r--sonar-server/src/main/webapp/javascripts/navigator/issues.js42
-rw-r--r--sonar-server/src/main/webapp/stylesheets/navigator.css15
-rw-r--r--sonar-server/src/main/webapp/stylesheets/navigator/base.css15
-rw-r--r--sonar-server/src/main/webapp/stylesheets/navigator/base.less18
13 files changed, 145 insertions, 76 deletions
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_header.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_header.hbs.erb
index baba017f437..00d6d3a1e18 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_header.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_header.hbs.erb
@@ -1,13 +1,18 @@
<script id="issues-header-template" type="text/x-handlebars-template">
<h1 class="navigator-header-title">{{#if name}}{{name}}{{else}}<%= message ('issues') -%>{{/if}}</h1>
- <div class="navigator-header-actions">
- <button id="issues-new-search"><%= message ('issue_filter.new_search') -%></button>
- {{#if canSave}}<button id="issues-filter-save"><%= message('save') -%></button>{{/if}}
+ <div class="navigator-header-actions">
+ <button id="issues-new-search"><%= message ('issue_filter.new_search') -%></button>
- {{#unless id}}<button id="issues-filter-save-as"><%= message('save_as') -%></button>{{/unless}}
+ {{#if appState.canManageFilter}}
+ {{#if canSave}}<button id="issues-filter-save"><%= message('save') -%></button>{{/if}}
+ {{#unless id}}<button id="issues-filter-save-as"><%= message('save_as') -%></button>{{/unless}}
+ {{#if id}}<button id="issues-filter-copy"><%= message('copy') -%></button>{{/if}}
+ {{#if id}}<button id="issues-filter-edit"><%= message('edit') -%></button>{{/if}}
+ {{/if}}
+ </div>
- {{#if id}}<button id="issues-filter-copy"><%= message('copy') -%></button>{{/if}}
- {{#if id}}<button id="issues-filter-edit"><%= message('edit') -%></button>{{/if}}
- </div>
+ {{#if description}}
+ <div class="navigator-header-description">{{description}}</div>
+ {{/if}}
</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_actions.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_actions.hbs.erb
index 272b3c06c77..6ad281c955c 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_actions.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_actions.hbs.erb
@@ -16,6 +16,10 @@
</ul>
<div class="navigator-actions-total">
Found: {{paging.total}}
- <a href="<%= url_for params.merge({:action => 'bulk_change_form'}) -%>?{{query}}" class="navigator-actions-bulk open-modal" title="<%= message('bulk_change') -%>"><i class="icon-settings"></i></a>
+ {{#if appState.canBulkChange}}
+ <a href="<%= url_for params.merge({:action => 'bulk_change_form'}) -%>?{{query}}"
+ class="navigator-actions-bulk open-modal"
+ title="<%= message('bulk_change') -%>"><i class="icon-settings"></i></a>
+ {{/if}}
</div>
</script>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_details_favorite_filter.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_details_favorite_filter.hbs.erb
index 22d0b4af753..19019dd8eee 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_details_favorite_filter.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issues_details_favorite_filter.hbs.erb
@@ -1,11 +1,13 @@
<script id="issues-details-favorite-filter-template" type="text/x-handlebars-template">
<ul class="navigator-filter-select-list">
- {{#each items}}
- <li>
- <label data-id="{{id}}">{{{name}}}</label>
- </li>
- {{/each}}
- <li class="line"></li>
+ {{#if items}}
+ {{#each items}}
+ <li>
+ <label data-id="{{id}}">{{{name}}}</label>
+ </li>
+ {{/each}}
+ <li class="line"></li>
+ {{/if}}
<li class="manage">
<label id="manage-favorites"><%= message('manage') -%></label>
</li>
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_no_issues.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_no_issues.hbs.erb
index 1ff2e0ec3b5..f785e9a3df5 100644
--- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_no_issues.hbs.erb
+++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_no_issues.hbs.erb
@@ -1,6 +1,5 @@
<script id="no-issues-template" type="text/x-handlebars-template">
<div class="navigator-results-no-issues">
- <i class="icon-emoticon-sad"></i>
<p>No issues to display</p>
</div>
</script>
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 b7cf7201ea9..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
@@ -163,6 +163,7 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
restoreFromQuery: function(q) {
var param = _.findWhere(q, { key: this.model.get('property') });
if (param && param.value) {
+ this.model.set('enabled', true);
this.restore(param.value, param);
} else {
this.clear();
@@ -254,11 +255,9 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
},
- render: function() {
- Backbone.Marionette.CompositeView.prototype.render.apply(this, arguments);
-
- if (this.collection.where({ type: window.SS.FavoriteFilterView }).length > 0 ||
- this.collection.where({ type: window.SS.IssuesFavoriteFilterView }).length > 0) {
+ 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');
}
},
@@ -266,6 +265,8 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
restoreFromQuery: function(q) {
this.collection.each(function(item) {
+ item.set('enabled', !item.get('optional'));
+ item.view.clear();
item.view.restoreFromQuery(q);
});
},
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 34a9570e0af..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
@@ -154,6 +154,12 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
formatValue: function() {
return this.model.get('value');
+ },
+
+
+ clear: function() {
+ this.model.unset('value');
+ this.detailsView.render();
}
});
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 f14ca27f839..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
@@ -295,14 +295,17 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
clear: function() {
var that = this;
- this.model.unset('value');
if (this.selection && this.choices) {
this.selection.each(function(m) {
that.choices.add(m);
});
this.selection.reset([]);
}
- this.renderBase();
+ this.model.unset('value');
+ this.detailsView.render();
+ if (this.detailsView.updateCurrent) {
+ this.detailsView.updateCurrent(0);
+ }
},
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 7e9ef3722fe..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
@@ -68,6 +68,12 @@ window.SS = typeof window.SS === 'object' ? window.SS : {};
value: value,
enabled: true
});
+ },
+
+
+ clear: function() {
+ this.model.unset('value');
+ this.detailsView.render();
}
});
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js b/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js
index 43b40c2a886..3290043c8a8 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js
@@ -18,6 +18,9 @@ jQuery(function() {
NavigatorApp.addInitializer(function() {
+ this.appState = new window.SS.AppState();
+ window.SS.appState = this.appState;
+
this.state = new Backbone.Model({
query: ''
});
@@ -144,20 +147,6 @@ jQuery(function() {
]);
- this.favoriteFilters = new window.SS.FavoriteFilters();
- this.filters.unshift([
- new window.SS.Filter({
- type: window.SS.IssuesFavoriteFilterView,
- enabled: true,
- optional: false,
- choices: this.favoriteFilters,
- manageUrl: '/issues/manage'
- })]);
- this.favoriteFilters.fetch({
- reset: true
- });
-
-
this.filterBarView = new window.SS.IssuesFilterBarView({
app: this,
collection: this.filters,
@@ -172,14 +161,30 @@ jQuery(function() {
NavigatorApp.addInitializer(function() {
- this.router = new window.SS.IssuesRouter({
- app: this
- });
- Backbone.history.start();
+ var app = this;
- var router = this.router;
- this.favoriteFilter.on('change:query', function(model, query) {
- router.navigate(query, { trigger: true });
+ 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 });
+ });
});
});
@@ -193,9 +198,17 @@ jQuery(function() {
};
window.onSaveAs = window.onCopy = window.onEdit = function(id) {
- app.favoriteFilters.fetch({ reset: true });
- app.router.navigate('id=' + id, { trigger: true });
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();
+ }
+ });
};
});
@@ -277,6 +290,8 @@ jQuery(function() {
}
});
}
+
+ this.detailsRegion.reset();
};
diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues.js b/sonar-server/src/main/webapp/javascripts/navigator/issues.js
index c3773a61821..7d9cbc39278 100644
--- a/sonar-server/src/main/webapp/javascripts/navigator/issues.js
+++ b/sonar-server/src/main/webapp/javascripts/navigator/issues.js
@@ -4,6 +4,22 @@ 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({});
var Issues = Backbone.Collection.extend({
model: Issue,
@@ -195,6 +211,7 @@ jQuery(function() {
return _.extend(data || {}, {
paging: this.collection.paging,
sorting: this.collection.sorting,
+ appState: window.SS.appState.toJSON(),
query: (Backbone.history.fragment || '').replace(/\|/g, '&')
});
}
@@ -302,7 +319,8 @@ jQuery(function() {
serializeData: function() {
return _.extend({
- canSave: this.model.id && this.options.app.state.get('search')
+ canSave: this.model.id && this.options.app.state.get('search'),
+ appState: window.SS.appState.toJSON()
}, this.model.toJSON());
}
@@ -327,7 +345,7 @@ jQuery(function() {
applyFavorite: function(e) {
var id = $j(e.target).data('id'),
- filter = this.model.get('choices').get(id),
+ filter = new window.SS.FavoriteFilter({ id: id }),
app = this.options.filterView.options.app;
filter.fetch({
@@ -343,7 +361,7 @@ jQuery(function() {
serializeData: function() {
return _.extend({}, this.model.toJSON(), {
- items: this.model.get('choices').toJSON()
+ items: this.model.get('choices')
});
}
});
@@ -357,7 +375,13 @@ jQuery(function() {
detailsView: IssuesDetailsFavoriteFilterView
});
- this.listenTo(this.model.get('choices'), 'reset', this.render);
+ this.listenTo(window.SS.appState, 'change:favorites', this.updateFavorites);
+ },
+
+
+ updateFavorites: function() {
+ this.model.set('choices', window.SS.appState.get('favorites'));
+ this.render();
}
});
@@ -376,11 +400,12 @@ jQuery(function() {
},
- parseQuery: function(query) {
- return (query || '').split('|').map(function(t) {
+ parseQuery: function(query, separator) {
+ return (query || '').split(separator || '|').map(function(t) {
+ var tokens = t.split('=');
return {
- key: t.split('=')[0],
- value: decodeURIComponent(t.split('=')[1])
+ key: tokens[0],
+ value: decodeURIComponent(tokens[1])
}
});
},
@@ -422,6 +447,7 @@ jQuery(function() {
*/
_.extend(window.SS, {
+ AppState: AppState,
Issue: Issue,
Issues: Issues,
FavoriteFilter: FavoriteFilter,
diff --git a/sonar-server/src/main/webapp/stylesheets/navigator.css b/sonar-server/src/main/webapp/stylesheets/navigator.css
index 81fb802f974..7683e46516f 100644
--- a/sonar-server/src/main/webapp/stylesheets/navigator.css
+++ b/sonar-server/src/main/webapp/stylesheets/navigator.css
@@ -83,10 +83,17 @@
font-size: 20px;
line-height: 34px;
}
+.navigator-header-description {
+ display: inline-block;
+ vertical-align: middle;
+ margin-left: 16px;
+ font-size: 11px;
+ font-style: italic;
+}
.navigator-header-actions {
display: inline-block;
vertical-align: middle;
- margin-left: 24px;
+ margin-left: 16px;
}
.navigator-header-actions > button {
position: relative;
@@ -175,12 +182,6 @@
color: #999;
text-align: center;
}
-.navigator-results-no-issues i {
- font-size: 32px;
-}
-.navigator-results-no-issues p {
- margin-top: 10px;
-}
.navigator-details {
padding: 10px;
background-color: #ffffff;
diff --git a/sonar-server/src/main/webapp/stylesheets/navigator/base.css b/sonar-server/src/main/webapp/stylesheets/navigator/base.css
index 72febd6d17d..1b883eba782 100644
--- a/sonar-server/src/main/webapp/stylesheets/navigator/base.css
+++ b/sonar-server/src/main/webapp/stylesheets/navigator/base.css
@@ -83,10 +83,17 @@
font-size: 20px;
line-height: 34px;
}
+.navigator-header-description {
+ display: inline-block;
+ vertical-align: middle;
+ margin-left: 16px;
+ font-size: 11px;
+ font-style: italic;
+}
.navigator-header-actions {
display: inline-block;
vertical-align: middle;
- margin-left: 24px;
+ margin-left: 16px;
}
.navigator-header-actions > button {
position: relative;
@@ -175,12 +182,6 @@
color: #999;
text-align: center;
}
-.navigator-results-no-issues i {
- font-size: 32px;
-}
-.navigator-results-no-issues p {
- margin-top: 10px;
-}
.navigator-details {
padding: 10px;
background-color: #ffffff;
diff --git a/sonar-server/src/main/webapp/stylesheets/navigator/base.less b/sonar-server/src/main/webapp/stylesheets/navigator/base.less
index 94ce0f86e21..d168d9afa10 100644
--- a/sonar-server/src/main/webapp/stylesheets/navigator/base.less
+++ b/sonar-server/src/main/webapp/stylesheets/navigator/base.less
@@ -83,10 +83,18 @@
line-height: @navigatorHeaderHeight;
}
+.navigator-header-description {
+ display: inline-block;
+ vertical-align: middle;
+ margin-left: 16px;
+ font-size: @smallFontSize;
+ font-style: italic;
+}
+
.navigator-header-actions {
display: inline-block;
vertical-align: middle;
- margin-left: 24px;
+ margin-left: 16px;
& > button {
position: relative;
@@ -198,14 +206,6 @@
padding-top: 20%;
color: #999;
text-align: center;
-
- i {
- font-size: 32px;
- }
-
- p {
- margin-top: 10px;
- }
}