middleware icon indicating copy to clipboard operation
middleware copied to clipboard

Added Settings Page with DefaultSyncDays settings

Open Kamlesh72 opened this issue 1 year ago • 20 comments

Linked Issue(s)

#500

Acceptance Criteria fulfillment

  • [x] Reducers for Getting and Updating DefaultSyncDaysSetting
  • [x] NextJs common setting API for Getting and Updating Org settings.
  • [x] NextJs API for Resetting Bookmark
  • [x] Added Required types
  • [x] Settings Page and SyncDaysSetting component

Kamlesh72 avatar Aug 10 '24 10:08 Kamlesh72

@samad-yar-khan @jayantbh Is this approach ok? The settings page still need changes to easily add further settings. We can discuss about it.

Kamlesh72 avatar Aug 10 '24 14:08 Kamlesh72

@Kamlesh72 Can you also add a screenshot for the UI changes that goes with this PR. Thanks :)

adnanhashmi09 avatar Aug 12 '24 06:08 adnanhashmi09

https://github.com/user-attachments/assets/05a15de4-cf9f-4ccd-bc36-714e8e851f07

Screenshot 2024-08-12 at 3 21 41 PM

Kamlesh72 avatar Aug 12 '24 10:08 Kamlesh72

I think the shifting input field feels unpleasant to the eye. Everything else is fine though.

A simple change would be to just add a save button to the bottom that shows up on value changes.

Also, did you handle the case where the user should not be able to set a value smaller than the current sync days value?

jayantbh avatar Aug 12 '24 11:08 jayantbh

@jayantbh I will add code to handle the less than currentSyncDays input case. What should be maximum sync days? 365,366?

I am thinking of some way to handle all settings collectively. Will share the approach soon.

Kamlesh72 avatar Aug 12 '24 14:08 Kamlesh72

I was thinking to not set a maximum... but, let's start by setting it to 366 days. @Kamlesh72

jayantbh avatar Aug 12 '24 17:08 jayantbh

@samad-yar-khan do I need to call syncReposForOrg() after updating Sync Days?

Kamlesh72 avatar Aug 13 '24 15:08 Kamlesh72

@samad-yar-khan do I need to call syncReposForOrg() after updating Sync Days?

@Kamlesh72 yes you should. You can also ask the customer if they want to backfill data as per current changes or let the system handle in next sync cycle.

samad-yar-khan avatar Aug 14 '24 14:08 samad-yar-khan

https://github.com/middlewarehq/middleware/pull/516#issuecomment-2288883466

samad-yar-khan avatar Aug 14 '24 14:08 samad-yar-khan

@samad-yar-khan In future we might have more settings and they gets updated together. So asking customer for change might not be a good choice. I think it will be better to just call the sync in background. Can this be considered as Forced Sync?

Kamlesh72 avatar Aug 14 '24 14:08 Kamlesh72

@Kamlesh72 I agree with @samad-yar-khan. Either the data fills itself in the next iteration, or the customer force syncs. calling it quietly in the background might not be very intuitive for the user. We could give this control to the user. If we were so start the sync as soon as the user sets the setting, it would be better to show some message to the user that the sync has started or something along those lines. @jayantbh What are your thoughts on this?

adnanhashmi09 avatar Aug 14 '24 14:08 adnanhashmi09

@Kamlesh72 how would we handle multiple setting updations leading to multiple sync calls. Do you think this might overload the sync server?

samad-yar-khan avatar Aug 14 '24 14:08 samad-yar-khan

@samad-yar-khan On every /sync request we are aquiring a lock on redis, so multiple sync calls need to wait till that. So I don't think this will overload the sync server.

If you are asking how we will manage multiple settings, then API call will only be made for settings which are updated by user. Once this PR gets merged, my Next PR will be to handle setting changes collectively. https://github.com/middlewarehq/middleware/pull/516#pullrequestreview-2232670225

Kamlesh72 avatar Aug 14 '24 18:08 Kamlesh72

@Kamlesh72 were the visual changes that I requested, made? Asking because a bunch of other discussion has happened, and I wonder if I missed it. :) No pressure, just ensuring that I didn't miss anything.

jayantbh avatar Aug 14 '24 20:08 jayantbh

@jayantbh

https://github.com/user-attachments/assets/2a71e659-ec1d-4e1f-ba38-f9b85cab152a

Kamlesh72 avatar Aug 14 '24 20:08 Kamlesh72

Just one tiny change. Make the confirmation action (Save) be on the right, and the rejection action (Discard) be on the left.

That's generally how accept/reject CTAs work everywhere. :)

Good going on this though! 👍🏽

jayantbh avatar Aug 14 '24 20:08 jayantbh

I've approved it, but I'd like @samad-yar-khan or @adnanhashmi09 to also cross check.

jayantbh avatar Aug 14 '24 21:08 jayantbh

image

You guys sure this PR can't use ~11 more comments? 😛

jayantbh avatar Aug 22 '24 11:08 jayantbh

The initial PR and the PR in its current state is significantly different. Great growth @Kamlesh72 👏🏽 This must have been something to persevere through, but great job sticking to it.

jayantbh avatar Aug 22 '24 11:08 jayantbh

Thanks a lot everyone! Your feedback and guidance have made all the difference. The learnings I got is invaluable.

Kamlesh72 avatar Aug 22 '24 11:08 Kamlesh72

LGTM @Kamlesh72 Great Work 🚀

samad-yar-khan avatar Aug 23 '24 11:08 samad-yar-khan

LGTM @Kamlesh72 , good stuff! Merging this 🎉 cc: @samad-yar-khan @adnanhashmi09 @jayantbh

e-for-eshaan avatar Aug 23 '24 11:08 e-for-eshaan

Aw shucks. 93 (94 with this) comments. We were 6 away from greatness. 😂

jayantbh avatar Aug 23 '24 12:08 jayantbh