clockify / browser-extension

Clockify Browser Extension
https://clockify.me/chrome-time-tracking
BSD 3-Clause "New" or "Revised" License
185 stars 172 forks source link

Time inputs as addition to the time button #85

Closed dpoetzsch closed 4 years ago

dpoetzsch commented 4 years ago

Hi,

besides #80 we actually implemented another extension to the plugin to make it more useful for our internal processes.

A demo says more than a thousand words: peek

Basically, we found that often we forget clicking the time buttons, but were quite satisfied with the simplicity of gitlabs minimalistic time tracking, where you can just add durations like 1h 30m. However, we cannot use gitblabs time tracking as it is always visible to everyone who has access to the issues and we did not have high hopes of changing that. So we implemented that feature into the clockify plugin.

This might be a feature specific to how we use time tracking. If this does not match your philosophy of time tracking, we'll just maintain our fork :)

However, if you are interested in this feature we might be able to put some more work into it to make it public-production-ready (styling, etc.).

aleksandar-olic commented 4 years ago

Oh, this is really great! Sure, we'd love to merge this.

I've tested this and I can see the input, but it won't submit time; I've entered 4h and pressed Enter and nothing happened, the input just froze.

dpoetzsch commented 4 years ago

Thanks for the feedback and the bug info. In this case I'll try to find some time to enhance this from "suffices-for-internal-developer-use" to "production-level" standards :)

dpoetzsch commented 4 years ago

I took the time to enhance styling of the input field.

I also tested it on chrome where everything worked just fine for me. On firefox, temporary loading does not work: I run npm run compile.dev.firefox and choose the manifest.json in about:debugging / load temporary addon. I get redirected to my clockify dashboard, but the extension icon does not show in the toolbar and nothing is injected on any website. Same applies for current master.

Concerning your bug: What you see is that the input is set to readonly and waits for a submission response that somehow gets lost. I cannot reproduce it but see three possibilities how this might happen:

  1. The code throws some kind of error. Can you spot something in the plugin inspector?
  2. The submitTime event handler in extension.js did not load correctly. Maybe the plugin was not completely reset?
  3. Uploading the time entry (or fetching the token) fails and the response is somehow lost. I figure this should also show up in the plugin inspector's console.

If nothing shows up, I can try to add some more debug code in order to catch the error.

aleksandar-olic commented 4 years ago

Ok, I''ve compiled your version and got it working. The trouble was "required filed" and it wouldn't save if the entry didn't have a project (I had Timeseet enabled whcih makes project required, but description, task, and tag can also be required fields).

Also, I've noticed that it didn't follow the Settings about whether it's allowed to create stuff. I'll test it some more next week.

Oh, and the message looks much better thanks to styling! :)

dpoetzsch commented 4 years ago

This is very good input :) I'll happily look into the problems next week :)

dpoetzsch commented 4 years ago

I found the settings bug and fixed it (forgot local storage returns strings not parsed values).

Concerning the required field problem: I found the option in the workspace settings but cannot test it as I don't own a plus account. According to your API docs I'd expect the endpoint to return status 400. So I did my testing by intentionally producing another 400 error.

I changed the code a bit so a 400 is now treated with an explanatory alert similar to the one found in the start/stop functions of the button.

aleksandar-olic commented 4 years ago

Great! I'll take a look and test it some more.

p.s. If you wish to test some stuff, you can activate a free trial and get access to all the features. It expires in 7 days, but after that you can just create a new workspace and activate another trial there.

dpoetzsch commented 4 years ago

Thanks for the tip, I tested it and it works fine for me with required fields (the alert ist shown both for the button and the input).

dpoetzsch commented 4 years ago

I just saw this PR had conflicts with the master branch; now everything should be fine again + I've updated the code a bit to reflect the changes of #88

aleksandar-olic commented 4 years ago

Great! I've tested it and everything seems to work fine as far as I can see. The only issue I've noticed is that the "Start timer" button started behaving oddly. For instance, when you click, it doesn't change it's state to "Stop timer" so it looks like it's not working, even though the timer has actually started.

dpoetzsch commented 4 years ago

To be honest, I noticed this behavior of the timer button already before this PR. But for me it wasn't consistent, when I clicked a couple of more times it worked fine.

When I find the time I'll try to look into this anyway :)

dpoetzsch commented 4 years ago

Hey, you were right, I introduced a bug there for the button :( Didn't notice that .json() returns a promise)

I fixed it in the last commit.

aleksandar-olic commented 4 years ago

Great it's working now. But, there is one very weird bug now: when I install extension, the start button won't start at all until I turn on "Integrations can create..." in Settings. After that, it can start and it continues working even when I turn off the setting (this happens in all integrations: Gitlab, Jira,, Asana...). It's very strange....

To reproduce:

  1. Remove extension
  2. Load extension
  3. Open issue and click "Start timer"

Result: nothing happens until you open settings and enable "Integrations can create..."

dpoetzsch commented 4 years ago

Thanks for all the thourough testing. I found the issue and fixed it.

aleksandar-olic commented 4 years ago

Thanks for all the fixes, really appreciate it! Everything seems to work fine now. 🎉