sentry-jira icon indicating copy to clipboard operation
sentry-jira copied to clipboard

Bug: Cannot specify Label when creating an issue

Open seraphimalia opened this issue 12 years ago • 5 comments

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.

seraphimalia avatar Jun 20 '13 08:06 seraphimalia

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

thurloat avatar Jun 26 '13 00:06 thurloat

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

seraphimalia avatar Jun 28 '13 18:06 seraphimalia

Great thanks, that should give me some direction.

thurloat avatar Jun 28 '13 18:06 thurloat

I'm also having the exact same issue.

Geekfish avatar Jan 13 '14 14:01 Geekfish

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})

michaelhelmick avatar Oct 06 '16 18:10 michaelhelmick