Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: custom visualization support #83

Merged
merged 12 commits into from
Jan 20, 2022
Merged

feat: custom visualization support #83

merged 12 commits into from
Jan 20, 2022

Conversation

Alwinator
Copy link
Contributor

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Aug 31, 2021

This pull request fixes 1 alert when merging be8b628 into e429c54 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 1, 2021

This pull request introduces 1 alert and fixes 1 when merging 79d0f9a into e429c54 - view on LGTM.com

new alerts:

  • 1 for Reflected server-side cross-site scripting

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 1, 2021

This pull request fixes 1 alert when merging 54b551e into e429c54 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@Alwinator Alwinator changed the title WIP: Implementing custom visualization support Implementing custom visualization support Sep 1, 2021
@Alwinator Alwinator marked this pull request as ready for review September 1, 2021 18:48
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 4, 2021

This pull request fixes 1 alert when merging 35bca88 into def3e54 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

Copy link
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some comments

aw_server/config.py Outdated Show resolved Hide resolved
aw_server/custom_watcher_pages.py Outdated Show resolved Hide resolved
aw_server/main.py Outdated Show resolved Hide resolved
aw_server/custom_watcher_pages.py Outdated Show resolved Hide resolved
aw_server/custom_watcher_pages.py Outdated Show resolved Hide resolved
aw_server/custom_watcher_pages.py Outdated Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Sep 6, 2021

Codecov Report

Merging #83 (bd8b6b6) into master (7399920) will decrease coverage by 0.57%.
The diff coverage is 46.66%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #83      +/-   ##
==========================================
- Coverage   58.48%   57.90%   -0.58%     
==========================================
  Files          10       11       +1     
  Lines         554      582      +28     
==========================================
+ Hits          324      337      +13     
- Misses        230      245      +15     
Impacted Files Coverage Δ
aw_server/config.py 100.00% <ø> (ø)
aw_server/main.py 17.64% <7.69%> (-3.41%) ⬇️
aw_server/custom_static.py 71.42% <71.42%> (ø)
aw_server/server.py 82.45% <100.00%> (+2.09%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 7399920...bd8b6b6. Read the comment docs.

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 6, 2021

This pull request fixes 1 alert when merging 2846e7f into def3e54 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Sep 6, 2021

This pull request fixes 1 alert when merging cc961c1 into def3e54 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

Copy link
Member

@ErikBjare ErikBjare left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would like to merge this. I really like the idea of experimenting with new visualizations through this method.

Looks really good. The only thing is that I don't see the need for the get_data endpoint, as it's a bit redundant, so probably just drop that and we'll merge it? :)

aw_server/main.py Outdated Show resolved Hide resolved
aw_server/server.py Outdated Show resolved Hide resolved
aw_server/custom_static.py Outdated Show resolved Hide resolved
aw_server/custom_static.py Show resolved Hide resolved
aw_server/custom_static.py Outdated Show resolved Hide resolved
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Jan 19, 2022

This pull request fixes 1 alert when merging a4d962e into 7399920 - view on LGTM.com

fixed alerts:

  • 1 for Unreachable code

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Jan 19, 2022

This pull request introduces 1 alert and fixes 1 when merging bd8b6b6 into 7399920 - view on LGTM.com

new alerts:

  • 1 for Unused import

fixed alerts:

  • 1 for Unreachable code

@Alwinator
Copy link
Contributor Author

@ErikBjare I am glad that you want to merge the visualization. I implemented the changes according to your feedback in the aw-server. Since the get_data endpoint is gone, I also had to remove it from the aw-webui. There is only one missing: since the data does not get passed to the custom visualization now, the start/end date (that you can pick in the activity watch GUI) needs to be passed to the visualization. I am not sure where to get it from, so I think it would be better if you could implement this tiny last bit. Just replace my null values here.

Thanks for merging!

@ErikBjare ErikBjare changed the title Implementing custom visualization support feat: custom visualization support Jan 20, 2022
@ErikBjare ErikBjare merged commit dd97ecf into ActivityWatch:master Jan 20, 2022
@Alwinator
Copy link
Contributor Author

@ErikBjare Yay! Thanks for merging!

@ErikBjare
Copy link
Member

@Alwinator Thanks for contributing! (and sorry for the delay)

I'm working on an example for the aw-watcher-input watcher to demonstrate how to use the feature, so hopefully that'll be ready sometime next week :)

@Alwinator
Copy link
Contributor Author

@ErikBjare No problem! Sounds great!

@ErikBjare
Copy link
Member

Here's my super-basic initial example: ActivityWatch/aw-watcher-input#12

ErikBjare pushed a commit to ActivityWatch/aw-webui that referenced this pull request Mar 8, 2022
ErikBjare pushed a commit to ActivityWatch/aw-webui that referenced this pull request Mar 8, 2022
Finished custom visualization feature

Fix linting

Fix cannot parse JSON because of request failed bug

Do not call watcher view with undefined data

Remove the data endpoint according ActivityWatch/aw-server#83 (review)

style: formatted with prettier
ErikBjare pushed a commit to ActivityWatch/aw-webui that referenced this pull request Mar 8, 2022
Finished custom visualization feature

Fix linting

Fix cannot parse JSON because of request failed bug

Do not call watcher view with undefined data

Remove the data endpoint according ActivityWatch/aw-server#83 (review)

style: formatted with prettier
ErikBjare pushed a commit to ActivityWatch/aw-webui that referenced this pull request Mar 8, 2022
Finished custom visualization feature

Fix linting

Fix cannot parse JSON because of request failed bug

Do not call watcher view with undefined data

Remove the data endpoint according ActivityWatch/aw-server#83 (review)

style: formatted with prettier
ErikBjare pushed a commit to ActivityWatch/aw-webui that referenced this pull request Mar 8, 2022
Finished custom visualization feature

Fix linting

Fix cannot parse JSON because of request failed bug

Do not call watcher view with undefined data

Remove the data endpoint according ActivityWatch/aw-server#83 (review)

style: formatted with prettier
LockBlock-dev added a commit to LockBlock-dev/aw-server-rust that referenced this pull request Sep 3, 2022
I struggled a bit with this since it is my first time with Rust but here it is. I used the FileServer from Rocket because that is the easiest way I found to get custom HTML per watcher.

How to use:
Create a `visualizations` folder in your [data](https://docs.activitywatch.net/en/latest/directories.html#data) folder. Then create a folder for your custom watcher and put your index.html here. Example: `/home/USER/.local/share/activitywatch/aw-server-rust/visualizations/aw-watcher-test/index.html`
You can also load JavaScript from other files, just put them in the same directory.

I tested it with my custom watcher and it works with [custom visualization support](ActivityWatch/aw-server#83) of aw-server.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants