getsentry / sentry-jira

A Plugin for sentry that lets you create JIRA issues
Other
95 stars 32 forks source link

Bug: Cannot specify Label when creating an issue #48

Open seraphimalia opened 11 years ago

seraphimalia commented 11 years ago

Specifying a label (either a New Label or an Existing Label) results in the following error on submit: "string expected at index 0"

Error is shown Below the "Label" form field.

thurloat commented 11 years ago

Is there data missing from this bug report? I'm not seeing anything "shown below"

seraphimalia commented 11 years ago

Sorry, I was referring to the Add Issue Screen. The error message is shown below the field. The error is: "string expected at index 0". I am attaching a screenshot this time. sentry_labels_error_2013-06-28_20-10-52

thurloat commented 11 years ago

Great thanks, that should give me some direction.

Geekfish commented 10 years ago

I'm also having the exact same issue.

michaelhelmick commented 7 years ago

With select2 being updated, multiple tags should be able to be added.

I have some code, locally, to get tags from their old API:

As far as I know, there is no new API to get label suggestions. Hope this helps this enhancement come to fruition.

def handle_label_autocomplete(self, request, group, **kwargs):
        """
        Auto-complete JSON handler, Tries to handle multiple different types of
        response from JIRA as only some of their backend is moved over to use
        the JSON REST API, some of the responses come back in XML format and
        pre-rendered HTML.
        """
        #?query=stream
        url = urllib.unquote_plus(request.GET.get("label_autocomplete"))
        parsed = list(urlparse.urlsplit(url))
        query = urlparse.parse_qs(parsed[3])
        q = request.GET.get('q')

        jira_client = self.get_jira_client(group.project)

        url = '/rest/api/1.0/labels/suggest'
        query["query"] = q
        if query.get('fieldName'):
            query["fieldName"] = query["fieldName"][0]  # for some reason its a list.

        parsed[3] = urllib.urlencode(query)
        final_url = urlparse.urlunsplit(parsed)

        autocomplete_response = jira_client.get_cached(final_url)
        labels = []

        for label_xml in autocomplete_response.xml.findAll('suggestions'):
            labels.append({
                'value': label_xml.find('name').text,
                'display': label_xml.find('html').text,
                'needsRender': False,
                'q': q,
            })

        return JSONResponse({'labels': labels})