stakwork / sphinx-tribes-frontend

Frontend for sphinx tribes and bounties. The bounty platform that pays out in bitcoin. Sign up with Sphinx Chat, complete a bounty, and earn bitcoin! Go to our website for available bounties.
https://community.sphinx.chat/bounties
12 stars 42 forks source link

Add provider filter to superadmin #341

Closed AbdulWahab3181 closed 8 months ago

AbdulWahab3181 commented 8 months ago

Describe your changes

https://www.loom.com/share/a5f1eaa0dfec44ed96f828cc0dd5852b

Issue ticket number and link

Closes https://github.com/stakwork/sphinx-tribes-frontend/issues/294

Type of change

Please delete options that are not relevant.

Checklist before requesting a review

ecurrencyhodler commented 8 months ago

Thanks for the video and also demonstrating scrolling.

I noticed that once a provider has been selected the other providers are hidden until clear is pressed.

Let's instead keep all providers visible. Just preserve the check marks if they've been selected.

AbdulWahab3181 commented 8 months ago

Thanks for the video and also demonstrating scrolling.

I noticed that once a provider has been selected the other providers are hidden until clear is pressed.

Let's instead keep all providers visible. Just preserve the check marks if they've been selected.

Done

https://www.loom.com/share/c13f3459d1914f0cb3a22d7e68cfae62

ecurrencyhodler commented 8 months ago

LGTM Thanks. Let's get a code review.

elraphty commented 8 months ago

Provider dropdown is not inline with the other dropdownsScreenshot

AbdulWahab3181 commented 8 months ago

@elraphty Addressed

image
kevkevinpal commented 8 months ago

@elraphty @ecurrencyhodler I think we might want to do the filtering by provider from the backend doing it from the frontend will lead to inaccurate results, I would rather us do it by backend first instead of creating a frontend change that we'll need to fix in the future. I think we may have not scoped this issue well enough

let me know what you think

AbdulWahab3181 commented 8 months ago

@kevkevinpal We are already doing filtering by provider from the backend as you can see here

elraphty commented 8 months ago

@kevkevinpal We are already doing filtering by provider from the backend as you can see here

Take a look at @AbdulWahab3181 https://www.loom.com/share/818e0e9267a84332baabc9949edd847f the provider list is inaccurate, I will go with @kevkevinpal suggestion the provider list should come from the backend.

AbdulWahab3181 commented 8 months ago

@elraphty, I understand why you're only seeing two providers. We're currently displaying unique providers sourced from the metrics/bounties endpoint. When you select a 90-day or custom date range, the metrics/bounties endpoint is called with a limit of 20. Consequently, we receive 20 bounties related to 2 providers. If you wish to view other providers, please navigate to the next pages, as demonstrated in the attached video.

You're correct that the provider list comes from the backend for greater accuracy, but this wasn't within the scope of our current task. Additionally, there isn't an endpoint available in the backend that provides the list of providers. I propose closing this task after merging and creating two new tasks: one for the backend to provide the list of providers and another for the frontend to display these providers.

https://www.loom.com/share/65cbad64dac84ebdbdaf9e0ebaee0c3b

kevkevinpal commented 8 months ago

@AbdulWahab3181 so we can bump your bounty amount up 200k sats and can you then implement a filter on the API instead to filter by providers? Right now we are filtering by the bounties we have on the frontend which will lead to poor results

@elraphty can work on the backend to create the new query param for the provider filter

kevkevinpal commented 8 months ago

For now we can keep this PR up

AbdulWahab3181 commented 8 months ago

@AbdulWahab3181 so we can bump your bounty amount up 200k sats and can you then implement a filter on the API instead to filter by providers? Right now we are filtering by the bounties we have on the frontend which will lead to poor results

@elraphty can work on the backend to create the new query param for the provider filter

@kevkevinpal Thanks for considering the increase in bounty. Sure, I would do that once the provider list endpoint is ready on the backend.

ecurrencyhodler commented 8 months ago

Updated bounty. I'll create a ticket for raph: https://community.sphinx.chat/bounty/1582

elraphty commented 8 months ago

@AbdulWahab3181 ${Host}/metrics/bounties/providers?page=1&Open=false&Assigned=true&Paid=true&direction=desc&limit=5, this will return the providers list

AbdulWahab3181 commented 8 months ago

@elraphty @ecurrencyhodler I am receiving an 'access denied' message when trying to access the admin page. Could you please investigate on the backend?

image image
AbdulWahab3181 commented 8 months ago

I'm also encountering a 404 error when calling the metrics/bounties/providers endpoint. It was functioning properly just a minute before the access denied issues occurred

image
elraphty commented 8 months ago

@AbdulWahab3181 This worked for me https://people-test.sphinx.chat/metrics/bounties/providers?page=1&Open=false&Assigned=true&Paid=true&direction=desc&limit=5

Just make sure you pass the x-jwt header and the request body should be

{
    "start_date": "1709209136", 
    "end_date": "1709813936"
}

Screenshot

AbdulWahab3181 commented 8 months ago

@elraphty Now, It's working for me as well

AbdulWahab3181 commented 8 months ago

@elraphty I have Implemented provider list endpoint. Could you please have a look, also review and merge the PR?

https://www.loom.com/share/f1367dabe7654d0bad2759777f373829