Skip to content

Instantly share code, notes, and snippets.

@ahanmal
Last active June 23, 2016 14:21
Show Gist options
  • Save ahanmal/3186a5869684bb514ad3 to your computer and use it in GitHub Desktop.
Save ahanmal/3186a5869684bb514ad3 to your computer and use it in GitHub Desktop.
Dashing JIRA Issues Open Widget

##JIRA Open Issues Widget For Dashing Simple widget that fetches current issues from JIRA by using a JQL Search. Data is displayed using th e included Numbers widget in Dashing.

##Usage

  1. Install Widget By Adding jira.rb to the jobs directory, or install by calling dashing install 3186a5869684bb514ad3

  2. Add gem 'jira-ruby', :require => 'jira' to your Gemfile

  3. Change to match your needs:

host = "HOST GOES HERE" username = "USERNAME GOES HERE" password = "PASSWORD GOES HERE" project = "PROJECT NAME GOES HERE" status = "OPEN STATUS GOES HERE" ```

  1. Add to dashboard.erb file:

    <li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
      <div data-id="jira" data-view="Number" data-title="Open Issues"></div>
    </li>
    
require 'jira'
host = "HOST GOES HERE"
username = "USERNAME GOES HERE"
password = "PASSWORD GOES HERE"
project = "PROJECT NAME GOES HERE"
status = "OPEN STATUS GOES HERE"
options = {
:username => username,
:password => password,
:context_path => '',
:site => host,
:auth_type => :basic
}
SCHEDULER.every '5m', :first_in => 0 do |job|
client = JIRA::Client.new(options)
num = 0;
client.Issue.jql("PROJECT = \"#{project}\" AND STATUS = \"#{status}\"").each do |issue|
num+=1
end
send_event('jira', { current: num})
end
@craig
Copy link

craig commented Jul 13, 2014

For some reason, this seems to fail if there is a larger number of tickets, it always shows 50, then. I couldn't get it to work properly.
EDIT: JIRA Limits queries to maxResults=50 by default.

@odinfox
Copy link

odinfox commented Oct 30, 2014

How can I apply a multiply status? Like "In Progress", Reopened, "Need Info"

@caval0rn
Copy link

Try this:
change "... AND STATUS = "#{status}"" ..." to "... AND STATUS in ("#{status}")" ..."
and "... status = "In Progress, Reopened, Need Info" ..."

@jackdinh10
Copy link

You should also note that maxResults can be modified in the JIRA config settings.

@Epiclemonaid
Copy link

it keeps throwing me an jira::HTTPerror anyone got a fix for that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment