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

[explorer/nodewatch]: Added query params for get node list endpoint #1303

Open
wants to merge 2 commits into
base: nodewatch/add-node-api-status
Choose a base branch
from

Conversation

AnthonyLaw
Copy link
Member

Problem: The filter node is missing on the API node list endpoint.
Solution: Added query params only_ssl, limit, and order.

only_ssl: to filter out SSL enable node, it needs explorer and wallet.
limit: the number of numbers returned from the endpoint.
order: shuffle node list when required

@AnthonyLaw AnthonyLaw changed the title explorer/nodewatch]: Added query params for get node list endpoint [explorer/nodewatch]: Added query params for get node list endpoint Mar 12, 2025
@AnthonyLaw AnthonyLaw force-pushed the nodewatch/node-filter branch from e16e99b to 30afd3e Compare March 12, 2025 01:19
Copy link

codecov bot commented Mar 12, 2025

Codecov Report

Attention: Patch coverage is 96.42857% with 1 line in your changes missing coverage. Please review.

Project coverage is 98.24%. Comparing base (4ad67d2) to head (30afd3e).

Files with missing lines Patch % Lines
explorer/nodewatch/nodewatch/__init__.py 90.00% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@                        Coverage Diff                        @@
##           nodewatch/add-node-api-status    #1303      +/-   ##
=================================================================
- Coverage                          98.24%   98.24%   -0.01%     
=================================================================
  Files                                158      158              
  Lines                               6571     6592      +21     
  Branches                             143      143              
=================================================================
+ Hits                                6456     6476      +20     
- Misses                               115      116       +1     
Flag Coverage Δ
explorer-nodewatch 98.40% <96.42%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
explorer/nodewatch/nodewatch/RoutesFacade.py 96.80% <100.00%> (+0.40%) ⬆️
explorer/nodewatch/nodewatch/__init__.py 96.26% <90.00%> (-0.59%) ⬇️
🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@AnthonyLaw AnthonyLaw requested review from Wayonb and Jaguar0625 March 12, 2025 03:01
role_condition = True

if role is not None:
role_condition = role == descriptor.roles if exact_match else role == (role & descriptor.roles)
Copy link
Contributor

Choose a reason for hiding this comment

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

If the roles does not match, it seems you can return False

role_condition = role == descriptor.roles if exact_match else role == (role & descriptor.roles)

if only_ssl:
return role_condition and descriptor.is_ssl_enabled
Copy link
Contributor

Choose a reason for hiding this comment

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

Should be able to do this return descriptor.is_ssl_enabled if only_ssl else True

def _get_json_nodes(role, exact_match, request_args):
only_ssl = None
if 'only_ssl' in request_args:
only_ssl = True
Copy link
Contributor

Choose a reason for hiding this comment

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

only_ssl = True if 'only_ssl' in request_args else None

limit = int(request_args.get('limit', 0))

return jsonify(symbol_routes_facade.json_nodes(role=role, exact_match=exact_match, only_ssl=only_ssl, limit=limit, order=order))

Copy link
Contributor

Choose a reason for hiding this comment

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

It seems role is always a required arg?

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