zaquestion / lab

Lab wraps Git or Hub, making it simple to clone, fork, and interact with repositories on GitLab
https://zaquestion.github.io/lab
Creative Commons Zero v1.0 Universal
1.1k stars 102 forks source link

Time tracking support for lab #191

Open nkprince007 opened 6 years ago

nkprince007 commented 6 years ago

I'm a freelancer and I generally track my time with issues and merge requests on GitLab. It'd be really awesome, if we could have something similar to https://github.com/kriskbx/gitlab-time-tracker baked into lab tool itself.

$ lab time start issue 21
Time tracking started on issue #21 at 10:30AM UTC

$ lab time start issue 32
Time tracking started on issue #21 at 10:32AM UTC

$ lab time stop
Time tracking stopped on issues #21, #32 at 10:40AM UTC

$ lab time sync
Pushing time records to GitLab...done

$ lab time stats --user nkprince007
Generating reports for "nkprince007"...
Report generated.

TIME STATS

ISSUES

iid title spent total estimate
90 Login, Signup endpoints modified 2m 38s
66 Profile view: Method post not allowed 10m 2s
60 Use django-rest-auth endpoints instead of creating new ones 24m
58 Pet Profile 1h 2m 8s
53 Register all models to the admin UI 54m 13s
49 Auto-Tagging Translation 1h 19m 35s
48 Add a README about python-dotenv 3m 53s
47 Confirm Email 3h 36m 22s
46 Implement caching 57m 5s
45 Missing authentication for docs endpoint 3m 3s
44 Local dev errors should not post to production Sentry 23m 14s
43 Current backend has users with unhashed passwords 12m 3s
41 Add unit-tests for cookie app 34m 24s 40m
40 Test the Redis backend 20m 30m
39 Tests 3h 28m 48s 1d 7h
34 Document API endpoints 30m 29s
26 Add non-auth default user for generic feed 3h 31s 3h
24 Backend has to ensure post objects do not contain malicious JS code 15m 5s 2h
21 Django Admin UI doesn't serve CSS 1h 34s

MERGE REQUESTS

iid title spent total estimate
80 Disable sentry during development
73 Migrate to Stream Framework AKA get rid of getstream.io 2h 52m 32s
72 Email confirmation during signup 48m 6s
56 Likes and Comments! 15m
53 Use python-dotenv to configure env variables 14m 2s
49 WIP: Refactor to use stream_framework 8m 15s

TIME RECORDS

user date type iid time
30.07.2018 00:00:00
nkprince007 27.07.2018 22:03:08 Issue 90 2m 38s
nkprince007 27.07.2018 00:00:00 Issue 60 24m
nkprince007 27.07.2018 00:00:00 Issue 58 1h 2m 8s
nkprince007 26.07.2018 02:58:55 Issue 39 17m 32s
nkprince007 26.07.2018 02:38:14 Issue 39 20m 6s
nkprince007 26.07.2018 01:42:11 Issue 39 5m 58s
nkprince007 26.07.2018 00:18:48 Issue 39 11m 25s
nkprince007 25.07.2018 00:00:00 MergeRequest 73 1h 15m 2s
nkprince007 25.07.2018 00:00:00 Issue 39 2h 20m 45s
nkprince007 25.07.2018 00:00:00 Issue 39 13m 2s
nkprince007 24.07.2018 17:24:28 MergeRequest 73 1h 27m 17s
nkprince007 24.07.2018 00:00:00 Issue 24 15m 5s
nkprince007 23.07.2018 00:00:00 MergeRequest 72 25m 5s
nkprince007 23.07.2018 00:00:00 MergeRequest 72 23m 1s
nkprince007 23.07.2018 00:00:00 MergeRequest 73 10m 13s
nkprince007 22.07.2018 17:25:51 Issue 47 1h
nkprince007 22.07.2018 16:51:58 Issue 47 58m 35s
nkprince007 22.07.2018 00:48:34 Issue 47 -10m
nkprince007 22.07.2018 00:48:10 Issue 47 40m 3s
nkprince007 22.07.2018 00:36:16 Issue 47 14m 52s
nkprince007 22.07.2018 00:36:16 Issue 47 52m 52s
nkprince007 18.07.2018 21:54:42 Issue 21 14m 7s
nkprince007 18.07.2018 21:54:42 Issue 26 3s
nkprince007 18.07.2018 21:03:13 Issue 53 54m 13s
nkprince007 18.07.2018 15:39:07 Issue 26 3h 28s
nkprince007 18.07.2018 00:00:00 Issue 21 15m 2s
nkprince007 18.07.2018 00:00:00 Issue 21 31m 25s
nkprince007 18.07.2018 00:00:00 Issue 43 12m 3s
nkprince007 17.07.2018 14:23:55 Issue 49 1m 50s
nkprince007 17.07.2018 14:04:48 Issue 49 18m 57s
nkprince007 17.07.2018 13:26:45 Issue 49 8m 48s
nkprince007 17.07.2018 00:58:21 Issue 48 3m 53s
nkprince007 17.07.2018 00:00:00 MergeRequest 56 15m
nkprince007 17.07.2018 00:00:00 Issue 49 50m
nkprince007 17.07.2018 00:00:00 Issue 66 10m 2s
nkprince007 16.07.2018 13:38:50 Issue 44 12m 12s
nkprince007 16.07.2018 00:00:00 Issue 44 11m 2s
nkprince007 16.07.2018 00:00:00 Issue 46 20m
nkprince007 16.07.2018 00:00:00 Issue 46 12m 2s
nkprince007 16.07.2018 00:00:00 MergeRequest 53 2m
nkprince007 16.07.2018 00:00:00 MergeRequest 53 12m 2s
nkprince007 16.07.2018 00:00:00 Issue 46 25m 3s
nkprince007 15.07.2018 18:34:38 MergeRequest 49 2m 16s
nkprince007 15.07.2018 18:27:25 MergeRequest 49 5m 59s
nkprince007 15.07.2018 18:11:54 Issue 45 3m 3s
nkprince007 15.07.2018 00:00:00 Issue 34 14m 2s
nkprince007 14.07.2018 10:32:58 Issue 34 16m 27s
nkprince007 13.07.2018 04:34:13 Issue 41 9m 49s
nkprince007 13.07.2018 04:34:13 Issue 41 20s
nkprince007 13.07.2018 00:00:00 Issue 41 5m 5s
nkprince007 13.07.2018 00:00:00 Issue 41 14m 8s
nkprince007 12.07.2018 00:00:00 Issue 41 5m 2s
nkprince007 12.07.2018 00:00:00 Issue 40 10m
nkprince007 12.07.2018 00:00:00 Issue 40 10m
nkprince007 commented 6 years ago

The reason I want this integrated with lab and not use the cited tool is because that adds a huge dependency of node.js into my workflow and has several minor issues with little to no support for debugging. Plus, the cited tool uses phantomjs which is another huge dependency.

zaquestion commented 6 years ago

@nkprince Sounds good to me. Some immediate thoughts

nkprince007 commented 6 years ago

If issue, mr, etc is part of the command structure, commands should likely be lab issue time start

That is a clever suggestion.

storing state between commands would be new territory, not against, just not sure best way to approach

gtt stores the data to an autogenerated file in JSON format. We could do the same thing.

would want some way to explicitly log an amount of time

gtt also provides a way to manually edit data using gtt edit <tracker-id>. We could implement something similar and use the $EDITOR variable to open up the file for edits. However, we'd need some validation and backup procedure to protect the files, like opening up the process in a temporary file and then using atomic save or something like that.

curious if gitlab jira integration allows us to plug into loging time in an external issue tracker.

I'm not sure about this.

zaquestion commented 6 years ago

Quick note, in internal/git we have git.Edit which is what we use for creating an MR or issue. Regarding explicit time tracking I'm just thinking something like lab issue time log 21 1h, verbose but just having some should be enough. Editing the time tracking info seems good as well for cleaning up any over/under tracked time.

zaquestion commented 6 years ago

For self signed certs we talked about storing files in ~/.config/lab/certs, which makes sense. Given this would be state and not config tho, we might take the approach nvim and other programs seems to use and make a ~/.share/lab/time -- I'm not sure what the appropriate uses are for .share or what that looks like cross platform.

mmngreco commented 4 years ago

Hi guys, this feature looks awesome! I will be very happy to see it in the following releases. I would like to give you another point of view in order to show you my using case. I'd like to use something like:

lab issue 21 time spent 1d              # today by defult
lab issue 21 time spent -1d             # ups I make a mistake
lab issue 21 time spent 1d 01-01-2020   # specify the day

lab issue 21 time estimate 1w

lab issue 21 time reset spent     # I'm not sure about this
lab issue 21 time reset estimate  # I'm not sure about this

lab issue 21 time pull
lab issue 21 time push

and It will be great the possibility of edit a file with vim.

nkprince007 commented 4 years ago

@zaquestion are you working on this or do you mind if I start sometime next week?