Small improvements in jira widget

This commit is contained in:
Pavel Makhov 2019-11-23 21:05:16 -05:00
parent 7478043604
commit 70867f69ff
2 changed files with 36 additions and 13 deletions

35
jira-widget/README.md Normal file
View file

@ -0,0 +1,35 @@
# Jira widget
The widget shows the number of assigned tickets to the user and when clicked shows them in the list with some additional information. When item in the list is clicked - it opens the issue in browser
2![screenshot](cpu.gif)
## How it works
Widget users cURL to query JIRA's REST API. In order to be authenticated, widget uses netrc feature of the cURL, which is basically to store basic auth credentials in a .netrc file in home folder.
## 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 |
## Installation
Clone/download repo and use widget in **rc.lua**:
```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'}),
...
```

View file

@ -86,19 +86,8 @@ local function worker(args)
current_number_of_reviews = rawlen(result.issues)
--if current_number_of_reviews > previous_number_of_reviews then
-- widget:set_unseen_review(true)
-- naughty.notify{
-- icon = HOME_DIR ..'/.config/awesome/awesome-wm-widgets/gerrit-widget/gerrit_icon.svg',
-- title = 'New Incoming Review',
-- text = reviews[1].project .. '\n' .. get_name_by_id(reviews[1].owner._account_id) .. reviews[1].subject .. '\n',
-- run = function() spawn.with_shell("google-chrome https://" .. host .. '/' .. reviews[1]._number) end
-- }
----end
--
--previous_number_of_reviews = current_number_of_reviews
widget:set_text(current_number_of_reviews)
--
for i = 0, #rows do rows[i]=nil end
for _, issue in ipairs(result.issues) do
local path_to_avatar = os.getenv("HOME") ..'/.cache/awmw/jira-widget/avatars/' .. issue.fields.assignee.key
@ -179,7 +168,6 @@ local function worker(args)
jira_widget:buttons(
awful.util.table.join(
awful.button({}, 1, function()
--jira_widget:set_unseen_review(false)
if popup.visible then
popup.visible = not popup.visible
else