Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify fields displayed by jira jql "custom_jql" #47

Open
rasivasu opened this issue Jan 26, 2021 · 6 comments
Open

Specify fields displayed by jira jql "custom_jql" #47

rasivasu opened this issue Jan 26, 2021 · 6 comments

Comments

@rasivasu
Copy link

Is it possible to add / remove fields displayed by jira jql "custom_jql"?

@palashkulsh
Copy link
Contributor

try adding following in options object inside config.json

"list_issues_columns": { "Key": { "jsPath": "key" }, "Summary": { "jsPath": "fields.summary", "truncate": 70 }, "assignee": { "jsPath": "fields.assignee.name", "truncate": 15 }, "Status": { "jsPath": "fields.status.name" } },

@rasivasu
Copy link
Author

Adding "list_issues_columns" didn't change the output of jira jql custom_jql. Would you also let me know how I can find other possible fieldnames?

    "custom_alasql": {
        "project": "select fields->project->name , count(1)  AS counter from ? group by fields->project->name",
        "priority": "select fields->priority->name , count(1)  AS counter from ? group by fields->priority->name",
        "status": "select fields->project->name,fields->status->name , count(1)  AS counter from ? group by fields->project->name,fields->status->name"
    },
    "list_issues_columns": {
        "Key": { "jsPath": "key" },
        "Summary": { "jsPath": "fields.summary", "truncate": 70 },
        "assignee": { "jsPath": "fields.assignee.name", "truncate": 15 },
        "Status": { "jsPath": "fields.status.name" }
    },

@palashkulsh
Copy link
Contributor

try jira jql customjql -j 1 | jq . | less
you must have jq installed otherwise you can just run jira jql customjql -j 1 it gives corresponding json output.

@danshumaker
Copy link
Owner

If you are really adventurous you could hit the api endpoint to see if there are any hard coded limits:

This line is how we hit the api with rest/api/2/search?jql=
https://github.com/danshumaker/jira-cli/blob/master/lib/jira/ls.js#L138

As documented here: https://developer.atlassian.com/server/jira/platform/jira-rest-api-examples/#searching-for-issues-examples
And then elaborated on here: https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-fields/

But I guess we should switch our issue search to eventually use: https://developer.atlassian.com/cloud/jira/platform/rest/v2/api-group-jql/#api-group-jql instead.

@rasivasu
Copy link
Author

@palashkulsh Thank you. I am able to see what field names to use from the json.

But defining "list_issues_columns" in config.json didn't change the fields in the output. I checked out the codebase for jira-cli. I don't see the codebase referring to "list_issues_columns". At the same time, I saw the following line in ls.js.

        that.table = new Table({
          head: ['Key', 'Priority', 'Summary', 'Status', 'FixVersions'],

Can you confirm if adding the below lines to config.json will really change the list of fields being displayed in the output?

    "list_issues_columns": {
        "Key": { "jsPath": "key" },
        "Summary": { "jsPath": "fields.summary", "truncate": 70 },
        "assignee": { "jsPath": "fields.assignee.name", "truncate": 15 },
        "Status": { "jsPath": "fields.status.name" }
    },

@bowdi
Copy link
Contributor

bowdi commented Apr 12, 2021

@rasivasu I also can't see any references to list_issues_columns in the ls.js file (the one responsible for handling the jira jql file) and specifically the getIssues method (the one responsible for creating the table).

As a temporary workaround you could use the --json flag, then, using your scripting language of choice, create something in your profile to parse this json, get the fields your want, then show the table as you wish.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants