fix #228 - add gitlab readme

This commit is contained in:
streetturtle 2020-12-17 20:25:36 -05:00
parent 8ad4d0228d
commit 1626886e51
3 changed files with 52 additions and 3 deletions

48
gitlab-widget/README.md Normal file
View File

@ -0,0 +1,48 @@
# Gitlab widget
<p align="center">
<a href="https://github.com/streetturtle/awesome-wm-widgets/labels/gitlab" target="_blank"><img alt="GitHub issues by-label" src="https://img.shields.io/github/issues/streetturtle/awesome-wm-widgets/gitlab"></a>
</p>
The widget shows the number of merge requests assigned to the user and when clicked shows additional information, such as
- author's name and avatar (opens user profile page when clicked);
- MR name (opens MR when clicked);
- source and target branches;
- when was created;
- number of comments;
- number of approvals.
![screenshot](./screenshot.png)
## Customization
It is possible to customize widget by providing a table with all or some of the following config parameters:
| Name | Default | Description |
|---|---|---|
| `icon` | `./icons/gitlab-icon.svg` | Path to the icon |
| `host` | Required | e.g _https://gitlab.yourcomapny.com_ |
| `access_token` | Required | e.g _h2v531iYASDz6McxYk4A_ |
| `timeout` | 60 | How often in seconds the widget should be refreshed |
_Note:_
- to get the access token, go to **User Settings** -> **Access Tokens** and generate a token with **api** scope
## Installation
Clone/download repo and use widget in **rc.lua**:
```lua
local gitlab_widget = require("awesome-wm-widgets.gitlab-widget.gitlab")
...
s.mytasklist, -- Middle widget
{ -- Right widgets
layout = wibox.layout.fixed.horizontal,
...
-- default
gitlab_widget{
host = 'https://gitlab.yourcompany.com',
access_token = 'h2v531iYASDz6McxYk4A'
},
...
```

View File

@ -1,6 +1,7 @@
------------------------------------------------- -------------------------------------------------
-- Gitlab Widget for Awesome Window Manager -- Gitlab Widget for Awesome Window Manager
-- Shows the number of currently assigned pull requests -- Shows the number of currently assigned merge requests
-- and information about them
-- More details could be found here: -- More details could be found here:
-- https://github.com/streetturtle/awesome-wm-widgets/tree/master/gitlab-widget -- https://github.com/streetturtle/awesome-wm-widgets/tree/master/gitlab-widget
@ -140,7 +141,7 @@ local function worker(user_args)
local args = user_args or {} local args = user_args or {}
local icon = args.icon or WIDGET_DIR .. '/icons/gitlab-icon.svg' local icon = args.icon or WIDGET_DIR .. '/icons/gitlab-icon.svg'
local api_token = args.api_token or show_warning('API Token is not set') local access_token = args.access_token or show_warning('API Token is not set')
local host = args.host or show_warning('Gitlab host is not set') local host = args.host or show_warning('Gitlab host is not set')
local timeout = args.timeout or 60 local timeout = args.timeout or 60
@ -391,7 +392,7 @@ local function worker(user_args)
) )
) )
watch(string.format(GET_PRS_CMD, api_token, host), watch(string.format(GET_PRS_CMD, access_token, host),
-- string.format(GET_PRS_CMD, host, workspace, repo_slug, uuid, uuid), -- string.format(GET_PRS_CMD, host, workspace, repo_slug, uuid, uuid),
timeout, update_widget, gitlab_widget) timeout, update_widget, gitlab_widget)
return gitlab_widget return gitlab_widget

Binary file not shown.

After

Width:  |  Height:  |  Size: 49 KiB