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

fix(nav): make doc and bug buttons customizable #22682

Merged
merged 2 commits into from
Jan 11, 2023

Conversation

villebro
Copy link
Member

@villebro villebro commented Jan 11, 2023

SUMMARY

Currently the documentation text and icon config parameters are not being respected in the RightMenu component. See the parameters here:

superset/superset/config.py

Lines 1307 to 1310 in c0aeb2a

# Send user to a link where they can read more about Superset
DOCUMENTATION_URL = None
DOCUMENTATION_TEXT = "Documentation"
DOCUMENTATION_ICON = None # Recommended size: 16x16

This fixes that + adds similar overrides for the bug links. In addition, the old right menu FAB template is no longer being used, and can hence be deleted.

AFTER

Here's the docs and buglinks with the new customizations (notice the top right hand corner next to "Settings"):
image

BEFORE

Previously the DOCUMENTATION_ICON and DOCUMENTATION_ICON params weren't being used, and the bug link was not customizable:
image

TESTING INSTRUCTIONS

ADDITIONAL INFORMATION

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@codecov
Copy link

codecov bot commented Jan 11, 2023

Codecov Report

Merging #22682 (73422a7) into master (159dcd7) will decrease coverage by 0.03%.
The diff coverage is 100.00%.

❗ Current head 73422a7 differs from pull request most recent head 2eacacf. Consider uploading reports for the commit 2eacacf to get more accurate results

@@            Coverage Diff             @@
##           master   #22682      +/-   ##
==========================================
- Coverage   67.14%   67.10%   -0.04%     
==========================================
  Files        1869     1869              
  Lines       71523    71586      +63     
  Branches     7814     7814              
==========================================
+ Hits        48022    48040      +18     
- Misses      21460    21505      +45     
  Partials     2041     2041              
Flag Coverage Δ
hive 52.60% <ø> (-0.04%) ⬇️
mysql 78.01% <ø> (-0.09%) ⬇️
postgres 78.07% <ø> (-0.10%) ⬇️
presto 52.50% <ø> (-0.04%) ⬇️
python 81.30% <ø> (-0.10%) ⬇️
sqlite 76.48% <ø> (-0.09%) ⬇️
unit 51.48% <ø> (-0.04%) ⬇️

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

Impacted Files Coverage Δ
superset-frontend/src/types/bootstrapTypes.ts 100.00% <ø> (ø)
superset/config.py 91.74% <ø> (+0.07%) ⬆️
superset/views/base.py 77.05% <ø> (+0.07%) ⬆️
...perset-frontend/src/views/components/RightMenu.tsx 78.23% <100.00%> (ø)
superset/db_engine_specs/impala.py 44.87% <0.00%> (-38.47%) ⬇️
superset/reports/commands/log_prune.py 85.71% <0.00%> (-3.58%) ⬇️
superset/commands/importers/v1/utils.py 92.20% <0.00%> (-1.30%) ⬇️
superset/common/query_object.py 93.84% <0.00%> (-0.52%) ⬇️
superset/reports/commands/execute.py 91.66% <0.00%> (-0.34%) ⬇️
... and 5 more

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

href={navbarRight.documentation_url}
target="_blank"
rel="noreferrer"
title={navbarRight.documentation_text || t('Documentation')}
Copy link
Member

@kgabryje kgabryje Jan 11, 2023

Choose a reason for hiding this comment

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

  1. Should we translate documentation_text? If not, we probably don't want to translate bug_report_text in line 564?
  2. Are you sure that t() will work correctly with dynamic expression like here (text depends on the result of || operator). Shouldn't we use t('%s', navbarRight.documentation_text || 'Documentation') instead? That's actually more of a question than suggestion, I'm not sure which style is preferred here

Copy link
Member Author

Choose a reason for hiding this comment

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

Oof, the bug_report_text translation was a complete mistake from me! Will fix

Copy link
Member Author

Choose a reason for hiding this comment

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

Regarding question 2, I think the pattern in documentation_text is correct, i.e. we want to use the string from the config as-is, and only fall back to the translated text if it's undefined.

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

LGTM!

@villebro villebro merged commit 7b15e6e into apache:master Jan 11, 2023
@villebro villebro deleted the villebro/docs-nav branch January 11, 2023 17:24
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.1.0 and removed 🚢 2.1.3 labels Mar 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 2.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants