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

Use static (uploaded) image as dashboard thumbnail #24373

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

dinesh-zemoso
Copy link

@dinesh-zemoso dinesh-zemoso commented Jun 13, 2023

SUMMARY

User can choose a static image as the dashboard thumbnail
Here is the discussion link : #18872

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

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

@dinesh-zemoso dinesh-zemoso requested a review from a team as a code owner June 13, 2023 06:01
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Congrats on making your first PR and thank you for contributing to Superset! 🎉 ❤️

We hope to see you in our Slack community too! Not signed up? Use our Slack App to self-register.

@dinesh-zemoso dinesh-zemoso changed the title Initial-commit Use static (uploaded) image as dashboard thumbnail #18872 Jun 13, 2023
@dinesh-zemoso dinesh-zemoso changed the title Use static (uploaded) image as dashboard thumbnail #18872 Use static (uploaded) image as dashboard thumbnail Jun 13, 2023
Copy link
Member

@john-bodley john-bodley left a comment

Choose a reason for hiding this comment

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

Thanks for the PR. I’ve added a few comments (regarding the Python logic) and enabled CI—which surfaced some issues.

@@ -436,13 +436,13 @@ class D3Format(TypedDict, total=False):
# and doesn't work with all nested types.
"PRESTO_EXPAND_DATA": False,
# Exposes API endpoint to compute thumbnails
"THUMBNAILS": False,
"THUMBNAILS": True,
Copy link
Member

Choose a reason for hiding this comment

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

@dinesh-zemoso you probably don't want to change the default configuration. You can refer to the documentation in CONTRIBUTING.md regarding how to provide local overrides.

# ### end Alembic commands ###

def downgrade():
pass
Copy link
Member

Choose a reason for hiding this comment

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

Please add a downgrade which restores the table to its previous state.

@rusackas
Copy link
Member

@dinesh-zemoso just checking in to see if you're able to follow through on this. Thanks in advance!

"CACHE_TYPE": "NullCache",
"CACHE_NO_NULL_WARNING": True,
'CACHE_TYPE': 'redis',
'CACHE_DEFAULT_TIMEOUT': 24*60*60*7,
Copy link
Member

Choose a reason for hiding this comment

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

Could you use the timedelta instead (example) to improve readability.

@@ -645,8 +645,10 @@ class D3Format(TypedDict, total=False):
THUMBNAIL_CHART_DIGEST_FUNC: Optional[Callable[[Slice, ExecutorType, str], str]] = None

THUMBNAIL_CACHE_CONFIG: CacheConfig = {
"CACHE_TYPE": "NullCache",
"CACHE_NO_NULL_WARNING": True,
'CACHE_TYPE': 'redis',
Copy link
Member

Choose a reason for hiding this comment

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

See my previous comment.

@@ -1296,7 +1298,7 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument
# chrome:
# Requires: headless chrome
# Limitations: unable to generate screenshots of elements
WEBDRIVER_TYPE = "firefox"
WEBDRIVER_TYPE = "chrome"
Copy link
Member

Choose a reason for hiding this comment

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

See my previous comment.

@@ -1317,7 +1319,7 @@ def EMAIL_HEADER_MUTATOR( # pylint: disable=invalid-name,unused-argument
WEBDRIVER_OPTION_ARGS = ["--headless"]

# The base URL to query for accessing the user interface
WEBDRIVER_BASEURL = "http://0.0.0.0:8080/"
WEBDRIVER_BASEURL = "http://localhost:8088/"
Copy link
Member

Choose a reason for hiding this comment

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

See my previous comment.

@@ -160,6 +160,7 @@ class Dashboard(Model, AuditMixinNullable, ImportExportMixin):
published = Column(Boolean, default=False)
is_managed_externally = Column(Boolean, nullable=False, default=False)
external_url = Column(Text, nullable=True)
static_image = Column(Text, nullable=True)
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't this be a BLOB (or similar) if we're storing a binary object. Additionally could you talk to any performance concerns this could have, i.e., the payload for fetching a record will likely increase significantly.

I'm not sure if having a separate table to house these images makes more sense.

cc @betodealmeida @michael-s-molina

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants