private Set<String> parseTags(Map<String, Object> properties) {
Set<String> result = Sets.newHashSet();
- String tagsString = (String) properties.get("add_tags.tags");
+ String tagsString = (String) properties.get("tags");
if (!Strings.isNullOrEmpty(tagsString)) {
for(String tag: TAGS_SPLITTER.split(tagsString)) {
RuleTagFormat.validate(tag);
return context;
}
+ public Collection<String> listTags() {
+ return issueService.listTags(null, 0);
+ }
+
}
package org.sonar.server.issue;
-import org.mockito.Matchers;
import com.google.common.collect.ImmutableSet;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
+import org.mockito.Matchers;
import org.sonar.api.issue.internal.DefaultIssue;
import org.sonar.api.issue.internal.IssueChangeContext;
import org.sonar.core.issue.IssueUpdater;
@SuppressWarnings("unchecked")
public void should_execute() {
Map<String, Object> properties = newHashMap();
- properties.put("add_tags.tags", "tag2,tag3");
+ properties.put("tags", "tag2,tag3");
DefaultIssue issue = mock(DefaultIssue.class);
when(issue.tags()).thenReturn(ImmutableSet.of("tag1", "tag3"));
throwable.expectMessage("Tag 'th ag' is invalid. Rule tags accept only the characters: a-z, 0-9, '+', '-', '#', '.'");
Map<String, Object> properties = newHashMap();
- properties.put("add_tags.tags", "th ag");
+ properties.put("tags", "th ag");
DefaultIssue issue = mock(DefaultIssue.class);
when(issue.tags()).thenReturn(ImmutableSet.of("tag1", "tag3"));
package org.sonar.server.issue;
import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Maps;
import org.junit.Before;
import org.junit.Test;
import static org.mockito.Matchers.any;
import static org.mockito.Matchers.anyString;
import static org.mockito.Matchers.eq;
-import static org.mockito.Mockito.*;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
@RunWith(MockitoJUnitRunner.class)
public class InternalRubyIssueServiceTest {
assertThat(context.getPage()).isEqualTo(1);
}
+ @Test
+ public void list_tags() throws Exception {
+ ImmutableSet<String> tags = ImmutableSet.of("tag1", "tag2", "tag3");
+ when(issueService.listTags(null, 0)).thenReturn(tags);
+ assertThat(service.listTags()).isEqualTo(tags);
+ }
+
private void checkBadRequestException(Exception e, String key, Object... params) {
BadRequestException exception = (BadRequestException) e;
Message msg = exception.errors().messages().get(0);
end
@projectUuids = Set.new(@issues.map {|issue| issue.projectUuid()})
+ @tags = Internal.issues.listTags()
render :partial => 'issues/bulk_change_form'
end
</label>
<input id="add-tags-action" name="actions[]" type="checkbox" value="add_tags"/>
- <%# TODO Here, select2 box with tags to add %>
- <span style="float:right" class="note">(<%= message('issue_bulk_change.x_issues', :params => unresolved_issues_user_can_admin.to_s) -%>)</span>
+ <input id="add_tags" name="add_tags.tags" type="text"/>
+ <span style="float:right" class="note">(<%= message('issue_bulk_change.x_issues', :params => unresolved_issues.to_s) -%>)</span>
</div>
<% end %>
$j('#assignee').click(function() { check('assign-action'); });
$j('#plan').click(function() { check('plan-action'); });
$j('#severity').click(function() { check('set-severity-action'); });
+ $j('#add_tags').select2({tags: [ '<%= @tags.join("', '") -%>' ], width: '250px' });
+ $j('#add_tags').click(function() { check('add-tags-action'); });
</script>