summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorstreetturtle <streetturtle@gmail.com>2020-12-17 20:25:36 -0500
committerstreetturtle <streetturtle@gmail.com>2020-12-17 20:25:36 -0500
commit1626886e51c2f2c0bf2730abb4d69c07df448d3e (patch)
tree4de38b5673fbbfa448677e43ef4212aa583c242e
parent8ad4d0228dfb686309ae7a7235940dea2e5bf211 (diff)
fix #228 - add gitlab readme
-rw-r--r--gitlab-widget/README.md48
-rw-r--r--gitlab-widget/gitlab.lua7
-rw-r--r--gitlab-widget/screenshot.pngbin0 -> 50469 bytes
3 files changed, 52 insertions, 3 deletions
diff --git a/gitlab-widget/README.md b/gitlab-widget/README.md
new file mode 100644
index 0000000..e2bbeb6
--- /dev/null
+++ b/gitlab-widget/README.md
@@ -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'
+ },
+ ...
+```
diff --git a/gitlab-widget/gitlab.lua b/gitlab-widget/gitlab.lua
index 2ab65b6..5d771b9 100644
--- a/gitlab-widget/gitlab.lua
+++ b/gitlab-widget/gitlab.lua
@@ -1,6 +1,7 @@
-------------------------------------------------
-- 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:
-- 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 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 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),
timeout, update_widget, gitlab_widget)
return gitlab_widget
diff --git a/gitlab-widget/screenshot.png b/gitlab-widget/screenshot.png
new file mode 100644
index 0000000..8ab6590
--- /dev/null
+++ b/gitlab-widget/screenshot.png
Binary files differ