summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--server/sonar-web/src/main/js/components/issue/issue-view.js13
-rw-r--r--server/sonar-web/src/main/js/components/issue/models/issue.js15
-rw-r--r--server/sonar-web/src/main/js/components/issue/templates/issue-set-type-form.hbs11
-rw-r--r--server/sonar-web/src/main/js/components/issue/templates/issue.hbs8
-rw-r--r--server/sonar-web/src/main/js/components/issue/views/set-type-form-view.js53
-rw-r--r--server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb18
-rw-r--r--sonar-core/src/main/resources/org/sonar/l10n/core.properties1
7 files changed, 118 insertions, 1 deletions
diff --git a/server/sonar-web/src/main/js/components/issue/issue-view.js b/server/sonar-web/src/main/js/components/issue/issue-view.js
index 1d41d63b46d..081e80699f5 100644
--- a/server/sonar-web/src/main/js/components/issue/issue-view.js
+++ b/server/sonar-web/src/main/js/components/issue/issue-view.js
@@ -29,6 +29,7 @@ import AssignFormView from './views/assign-form-view';
import CommentFormView from './views/comment-form-view';
import PlanFormView from './views/plan-form-view';
import SetSeverityFormView from './views/set-severity-form-view';
+import SetTypeFormView from './views/set-type-form-view';
import MoreActionsView from './views/more-actions-view';
import TagsFormView from './views/tags-form-view';
import Workspace from '../workspace/main';
@@ -50,6 +51,7 @@ export default Marionette.ItemView.extend({
'click .js-issue-comment-delete': 'deleteComment',
'click .js-issue-transition': 'transition',
'click .js-issue-set-severity': 'setSeverity',
+ 'click .js-issue-set-type': 'setType',
'click .js-issue-assign': 'assign',
'click .js-issue-assign-to-me': 'assignToMe',
'click .js-issue-plan': 'plan',
@@ -183,6 +185,17 @@ export default Marionette.ItemView.extend({
this.popup.render();
},
+ setType (e) {
+ e.stopPropagation();
+ $('body').click();
+ this.popup = new SetTypeFormView({
+ triggerEl: $(e.currentTarget),
+ bottom: true,
+ model: this.model
+ });
+ this.popup.render();
+ },
+
assign (e) {
e.stopPropagation();
$('body').click();
diff --git a/server/sonar-web/src/main/js/components/issue/models/issue.js b/server/sonar-web/src/main/js/components/issue/models/issue.js
index 84337c0c50d..637c78b49c0 100644
--- a/server/sonar-web/src/main/js/components/issue/models/issue.js
+++ b/server/sonar-web/src/main/js/components/issue/models/issue.js
@@ -235,6 +235,21 @@ export default Backbone.Model.extend({
/**
+ * Set type of issue
+ * @param {String|null} issueType Issue type
+ * @param {Object|null} options Options for jQuery ajax
+ * @returns {jqXHR}
+ */
+ setType (issueType, options) {
+ const opts = _.extend({
+ url: this.urlRoot() + '/set_type',
+ data: { issue: this.id, type: issueType }
+ }, options);
+ return this._action(opts);
+ },
+
+
+ /**
* Do a custom (plugin) action
* @param {String} actionKey Action Key
* @param {Object|null} options Options for jQuery ajax
diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue-set-type-form.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue-set-type-form.hbs
new file mode 100644
index 00000000000..3f42921aba2
--- /dev/null
+++ b/server/sonar-web/src/main/js/components/issue/templates/issue-set-type-form.hbs
@@ -0,0 +1,11 @@
+<ul class="menu">
+ {{#each items}}
+ <li>
+ <a href="#" class="js-issue-type" data-value="{{this}}">
+ {{issueType this}}
+ </a>
+ </li>
+ {{/each}}
+</ul>
+
+<div class="bubble-popup-arrow"></div>
diff --git a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
index e24a7960d3b..37a11c86c5c 100644
--- a/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
+++ b/server/sonar-web/src/main/js/components/issue/templates/issue.hbs
@@ -44,7 +44,13 @@
<td>
<ul class="list-inline issue-meta-list">
<li class="issue-meta">
- {{issueType this.type}}
+ {{#inArray actions "set_severity"}}
+ <button class="button-link issue-action issue-action-with-options js-issue-set-type">
+ {{issueType this.type}}&nbsp;<i class="icon-dropdown"></i>
+ </button>
+ {{else}}
+ {{issueType this.type}}
+ {{/inArray}}
</li>
<li class="issue-meta">
diff --git a/server/sonar-web/src/main/js/components/issue/views/set-type-form-view.js b/server/sonar-web/src/main/js/components/issue/views/set-type-form-view.js
new file mode 100644
index 00000000000..22a1d7e8bda
--- /dev/null
+++ b/server/sonar-web/src/main/js/components/issue/views/set-type-form-view.js
@@ -0,0 +1,53 @@
+/*
+ * SonarQube
+ * Copyright (C) 2009-2016 SonarSource SA
+ * mailto:contact AT sonarsource DOT com
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+import $ from 'jquery';
+import _ from 'underscore';
+import ActionOptionsView from '../../common/action-options-view';
+import Template from '../templates/issue-set-type-form.hbs';
+
+export default ActionOptionsView.extend({
+ template: Template,
+
+ getType () {
+ return this.model.get('type');
+ },
+
+ selectInitialOption () {
+ return this.makeActive(this.getOptions().filter(`[data-value="${this.getType()}"]`));
+ },
+
+ selectOption (e) {
+ const issueType = $(e.currentTarget).data('value');
+ this.submit(issueType);
+ return ActionOptionsView.prototype.selectOption.apply(this, arguments);
+ },
+
+ submit (issueType) {
+ return this.model.setType(issueType);
+ },
+
+ serializeData () {
+ return _.extend(ActionOptionsView.prototype.serializeData.apply(this, arguments), {
+ items: ['BUG', 'VULNERABILITY', 'CODE_SMELL']
+ });
+ }
+});
+
+
diff --git a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
index 1685b1e3f8a..bc9ed4193bb 100644
--- a/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
+++ b/server/sonar-web/src/main/webapp/WEB-INF/app/views/issues/_bulk_change_form.html.erb
@@ -81,6 +81,23 @@
<% end %>
<% end %>
+ <%
+ type_options = [
+ [message('issue.type.BUG'), 'BUG'],
+ [message('issue.type.VULNERABILITY'), 'VULNERABILITY'],
+ [message('issue.type.CODE_SMELL'), 'CODE_SMELL']
+ ]
+ type_options = options_for_select(type_options, 'BUG')
+ %>
+ <div class="modal-field">
+ <label for="type">
+ <%= message('issue.set_type') -%>
+ </label>
+ <input id="set-type-action" name="actions[]" type="checkbox" value="set_type"/>
+ <%= dropdown_tag('set_type.type', type_options, {:show_search_box => false}, {:id => 'type'}) -%>
+ <span style="float:right" class="note">(<%= message('issue_bulk_change.x_issues', :params => unresolved_issues_user_can_admin.to_s) -%>)</span>
+ </div>
+
<div class="modal-field">
<label for="severity">
<%= message('issue.set_severity') -%>
@@ -180,6 +197,7 @@
$j('#assignee').click(function() { check('assign-action'); });
$j('#plan').click(function() { check('plan-action'); });
$j('#severity').click(function() { check('set-severity-action'); });
+ $j('#type').click(function() { check('set-type-action'); });
$j('#add_tags').select2({tags: [ '<%= @tags.join("', '") -%>' ], width: '250px' });
$j('#add_tags').click(function() { check('add-tags-action'); });
$j('#remove_tags').select2({tags: [ '<%= @tags.join("', '") -%>' ], width: '250px' });
diff --git a/sonar-core/src/main/resources/org/sonar/l10n/core.properties b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
index 3e51375ddd6..6558306bb9f 100644
--- a/sonar-core/src/main/resources/org/sonar/l10n/core.properties
+++ b/sonar-core/src/main/resources/org/sonar/l10n/core.properties
@@ -688,6 +688,7 @@ issue.transition.wontfix=Resolve as won't fix
issue.transition.wontfix.description=This issue can be ignored because the rule is irrelevant in this context. Its technical debt won't be counted.
issue.set_severity=Change Severity
issue.set_severity.submit=Change Severity
+issue.set_type=Change Type
issue.do_plan=Plan
issue.plan.submit=Plan
issue.unplanned=Not planned