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

unify commercial / premium fleet checking logic and add a param to diagnostics json #602

Closed
shawaj opened this issue Jun 8, 2023 · 0 comments · Fixed by #609
Closed

Comments

@shawaj
Copy link
Member

shawaj commented Jun 8, 2023

Currently we have commercial fleet checking logic in a few different places:

  • template_hyper.html
  • upgrade.html
  • device_info.html
  • auth.py

We should unify these into a single function and add a parameter to diagnostics JSON (maybe "premium":true or similar) so we can use something like:

{% if diagnostics.premium %}

instead of

{% if diagnostics and diagnostics.BA and diagnostics.BA.endswith('-c') %}

It also means we can make use of similar logic to what is in auth.py whereby we check for the -c at end of fleet name but we also check for the fleet ID as well.

Related to #601 #574 #581

shawaj added a commit that referenced this issue Jun 10, 2023
shawaj added a commit to NebraLtd/hm-pyhelper that referenced this issue Jun 10, 2023
- move commercial fleet check to hm-pyhelper from diag
- add bobcat px30 commercial fleet

Ref NebraLtd/hm-diag#602 and NebraLtd/hm-diag#606
shawaj added a commit to NebraLtd/hm-pyhelper that referenced this issue Jun 10, 2023
- move commercial fleet check to hm-pyhelper from diag
- add bobcat px30 commercial fleets

Ref NebraLtd/hm-diag#602 and NebraLtd/hm-diag#606
shawaj added a commit that referenced this issue Jun 10, 2023
shawaj added a commit that referenced this issue Jun 11, 2023
- move commercial check to pyhelper
- bump pyhelper
- add commercial check to before_request and pull into views
- fix tests
- add bobcat px30 to commercial fleets

Closes: #602
Closes: #606
shawaj added a commit that referenced this issue Jun 11, 2023
- move commercial check to pyhelper
- bump pyhelper version
- add commercial check to before_request and pull into views
- fix tests
- add bobcat px30 to commercial fleets
- pull diagnostics into views where necessary for sidebar dashboard link
- use timestamp query string on mysterium iframe load to force-refresh

Closes: #602
Closes: #606
Closes: #576
shawaj added a commit that referenced this issue Jun 11, 2023
- move commercial check to pyhelper
- bump pyhelper version
- add commercial check to before_request and pull into views (decided not to use before_request and g.commercial in the end as needed serial number from diagnostics dict anyway so was better to do it that way)
- fix tests
- add bobcat px30 to commercial fleets
- pull diagnostics into views where necessary for sidebar dashboard link
- use timestamp query string on mysterium iframe load to force-refresh

Closes: #602
Closes: #606
Closes: #576
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 a pull request may close this issue.

1 participant