From: Stas Vilchik Date: Mon, 27 Jan 2014 10:31:45 +0000 (+0600) Subject: New Issues Page: issue in the left bar is updated when an action is done in the issue... X-Git-Tag: 4.2~461 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=83c5fcd8ce7f09d88182df602fc0483aa357cd0b;p=sonarqube.git New Issues Page: issue in the left bar is updated when an action is done in the issue detail panel --- diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue.hbs.erb index c7101e02d09..f8840da272c 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue.hbs.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue.hbs.erb @@ -11,12 +11,12 @@ -
- {{rule.name}} +
+ {{ruleName}}
-
{{project.longName}}
- {{component.longName}} +
{{projectLongName}}
+ {{componentLongName}}
diff --git a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb index 658460581c6..d6b269925d8 100644 --- a/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb +++ b/sonar-server/src/main/webapp/WEB-INF/app/views/issues/templates/_issue_detail.hbs.erb @@ -56,10 +56,10 @@
{{actionPlanName}}
{{/if}} - {{#if technicalDebt}} + {{#if debt}}
  • <%= message('issue.technical_debt_clear') -%>
    -
    {{technicalDebt}}
    +
    {{debt}}
  • {{/if}} {{# if reporter}} 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 1f34d32428c..ccd18c0d58c 100644 --- a/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js +++ b/sonar-server/src/main/webapp/javascripts/navigator/issues-app.js @@ -52,10 +52,6 @@ jQuery(function() { collection: this.issues }); this.actionsRegion.show(this.issuesActionsView); - - this.issueDetailView = new window.SS.IssueDetailView({ - model: new window.SS.Issue() - }); }); @@ -250,15 +246,14 @@ jQuery(function() { NavigatorApp.storeQuery = function(query, sorting) { - var fullQuery = query; if (sorting) { - _.extend(fullQuery, { + _.extend(query, { sort: sorting.sort, asc: '' + sorting.asc }); } - var queryString = _.map(fullQuery, function(v, k) { + var queryString = _.map(query, function(v, k) { return [k, encodeURIComponent(v)].join('='); }).join('|'); this.router.navigate(queryString); diff --git a/sonar-server/src/main/webapp/javascripts/navigator/issues.js b/sonar-server/src/main/webapp/javascripts/navigator/issues.js index 6502cb843fc..299613f0c1b 100644 --- a/sonar-server/src/main/webapp/javascripts/navigator/issues.js +++ b/sonar-server/src/main/webapp/javascripts/navigator/issues.js @@ -56,17 +56,30 @@ jQuery(function() { this.maxResultsReached = r.maxResultsReached; return r.issues.map(function(issue) { - return _.extend({}, issue, { - component: find(r.components, issue.component), - project: find(r.projects, issue.project), - rule: find(r.rules, issue.rule), - author: find(r.users, issue.author, 'login'), - comments: (issue.comments || []).map(function(comment) { - return _.extend({}, comment, { - user: find(r.users, comment.login, 'login') - }); - }) - }); + 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; }); } @@ -120,21 +133,31 @@ jQuery(function() { var IssueView = Backbone.Marionette.ItemView.extend({ template: Handlebars.compile(jQuery('#issue-template').html() || ''), tagName: 'li', + + events: { 'click': 'showDetails' }, + modelEvents: { + 'change': 'render' + }, + + showDetails: function() { this.$el.parent().children().removeClass('active'); this.$el.addClass('active'); var app = this.options.app, - detailView = this.options.app.issueDetailView; + detailView = new window.SS.IssueDetailView({ + model: this.model + }); - detailView.model.set({ key: this.model.get('key') }, { silent: true}); - jQuery.when(detailView.model.fetch()).done(function() { - app.detailsRegion.show(detailView); + detailView.model.fetch({ + success: function() { + app.detailsRegion.show(detailView); + } }); } }); @@ -509,7 +532,9 @@ jQuery(function() { onClose: function() { - this.ruleRegion.close(); + if (this.ruleRegion) { + this.ruleRegion.reset(); + } },