awesome-wm-widgets/jira-widget/README.md

60 lines
2.2 KiB
Markdown
Raw Normal View History

2019-11-24 03:05:16 +01:00
# Jira widget
2021-04-13 02:53:44 +02:00
The widget shows the number of tickets assigned to the user (or any other result of a JQL query, see customization section) and when clicked shows them in the list, grouped by the ticket status. Left-click on the item opens the issue in the default browser:
2019-11-24 03:05:16 +01:00
2021-04-13 02:53:44 +02:00
<p align="center">
<img alt="screenshot" src="https://raw.githubusercontent.com/streetturtle/awesome-wm-widgets/master/jira-widget/screenshot/screenshot.png"/>
</p>
2020-02-24 03:07:44 +01:00
2019-11-24 03:05:16 +01:00
## How it works
2020-02-02 19:55:49 +01:00
Widget uses cURL to query Jira's [REST API](https://developer.atlassian.com/server/jira/platform/rest-apis/). In order to be authenticated, widget uses a [netrc](https://ec.haxx.se/usingcurl/usingcurl-netrc) feature of the cURL, which is basically to store basic auth credentials in a .netrc file in home folder.
2020-01-29 03:00:30 +01:00
2020-02-02 19:55:49 +01:00
If you are on Atlassian Cloud, then instead of providing a password in netrc file you can set an [API token](https://confluence.atlassian.com/cloud/api-tokens-938839638.html) which is a safer option, as you can revoke/change the token at any time.
2019-11-24 03:05:16 +01:00
## Customization
It is possible to customize widget by providing a table with all or some of the following config parameters:
| Name | Default | Description |
|---|---|---|
| `host` | Required | Ex: _http://jira.tmnt.com_ |
| `query` | `jql=assignee=currentuser() AND resolution=Unresolved` | JQL query |
| `icon` | `~/.config/awesome/awesome-wm-widgets/jira-widget/jira-mark-gradient-blue.svg` | Path to the icon |
2021-04-13 02:53:44 +02:00
| `timeout` | 600 | How often in seconds the widget refreshes |
2019-11-24 03:05:16 +01:00
## Installation
2021-12-13 10:36:10 +01:00
Create a .netrc file in your home directory with following content:
2020-01-30 16:32:18 +01:00
```bash
machine turtlejira.com
login mikey@tmnt.com
password cowabunga
```
Then change file's permissions to 600 (so only you can read/write it):
```bash
chmod 600 ~/.netrc
```
2021-04-13 02:53:44 +02:00
And test if it works by calling the API (`-n` option is to use the .netrc file for authentication):
2020-01-30 16:39:01 +01:00
```bash
2021-04-13 02:53:44 +02:00
curl -n 'https://turtleninja.com/rest/api/2/search?jql=assignee=currentuser()+AND+resolution=Unresolved'
2020-01-30 16:39:01 +01:00
```
2020-01-30 16:32:18 +01:00
2021-04-13 02:53:44 +02:00
Clone/download repo and use the widget in **rc.lua**:
2019-11-24 03:05:16 +01:00
```lua
local jira_widget = require("awesome-wm-widgets.jira-widget.jira")
...
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
-- default
jira_widget({host = 'http://jira.tmnt.com'}),
...
```