You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2022/07/18 21:43:03 UTC

[GitHub] [superset] mennymendoza opened a new issue, #20756: Make an http request to the "Download as Image" button on the Dashboard page

mennymendoza opened a new issue, #20756:
URL: https://github.com/apache/superset/issues/20756

   Hello contributors C: is it currently possible to send an HTTP request to trigger the behavior that the "Download As Image" button has below? And if that feature is not currently available, could we possibly add that?
   
   ![Screenshot (40)_LI](https://user-images.githubusercontent.com/58401948/179618749-4772b754-eaae-45c5-a900-e589f75588f5.jpg)
   
   I've successfully downloaded chart screenshots using the [Superset API](https://superset.apache.org/docs/api/). However, for my use case, I would prefer to keep the layout of the dashboard in the exported image. I've also successfully downloaded dashboard thumbnails using the API (and setting up Celery/Redis) but the resolution on these images isn't great and it appears to cut off the bottom of the dashboard (unless I set it up wrong; feel free to let me know).
   
   ![dashboard_9](https://user-images.githubusercontent.com/58401948/179621857-eccc0f57-f656-4b34-a77e-ea2c537f4b72.png)
   
   On the other hand, the "Download As Image" button does exactly what I need! It seems to adapt to the length of the dashboard and the resolution is good. I can't seem to find a link to it anywhere though; I've even tried monitoring the traffic between my server and client but I still haven't found a way to trigger that button with a URL or a raw HTTP request C: Thank you guys so much for your help and time!


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Chamawix commented on issue #20756: Make an http request to the "Download as Image" button on the Dashboard page

Posted by GitBox <gi...@apache.org>.
Chamawix commented on issue #20756:
URL: https://github.com/apache/superset/issues/20756#issuecomment-1211782107

   @mennymendoza Thanks for your input and for sharing, I saw what I lacked in my previous conf, it was based on another issue information so was not sure what went wrong... 
   I succeeded retrieving thumbnail from an example dashboard.
   
   I just changed the WEBDRIVER_BASEURL = "http://172.17.0.1:8088" to -> WEBDRIVER_BASEURL = "http://superset:8088" for it to work. 
   
   Did I miss the information from the documentation ? Or you succeeded to do it by yourself ?


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Make an http request to the "Download as Image" button on the Dashboard page [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas closed issue #20756: Make an http request to the "Download as Image" button on the Dashboard page
URL: https://github.com/apache/superset/issues/20756


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] Chamawix commented on issue #20756: Make an http request to the "Download as Image" button on the Dashboard page

Posted by GitBox <gi...@apache.org>.
Chamawix commented on issue #20756:
URL: https://github.com/apache/superset/issues/20756#issuecomment-1204153924

   > Hello contributors C: is it currently possible to send an HTTP request to trigger the behavior that the "Download As Image" button has below? And if that feature is not currently available, could we possibly add that?
   > 
   > ![Screenshot (40)_LI](https://user-images.githubusercontent.com/58401948/179618749-4772b754-eaae-45c5-a900-e589f75588f5.jpg)
   > 
   > I've successfully downloaded chart screenshots using the [Superset API](https://superset.apache.org/docs/api/). However, for my use case, I would prefer to keep the layout of the dashboard in the exported image. I've also successfully downloaded dashboard thumbnails using the API (and setting up Celery/Redis) but the resolution on these images isn't great and it appears to cut off the bottom of the dashboard (unless I set it up wrong; feel free to let me know).
   > 
   > ![dashboard_9](https://user-images.githubusercontent.com/58401948/179621857-eccc0f57-f656-4b34-a77e-ea2c537f4b72.png)
   > 
   > On the other hand, the "Download As Image" button does exactly what I need! It seems to adapt to the length of the dashboard and the resolution is good. I can't seem to find a link to it anywhere though; I've even tried monitoring the traffic between my server and client but I still haven't found a way to trigger that button with a URL or a raw HTTP request C: Thank you guys so much for your help and time!
   
   Is it possible for you to share your configuration for setting up the cache and make the thumbnails and charts configuration works properly ? 
   I am struggling at this, and the documentation is not quite clear about how to do it. 
   
   I have the same UC of extracting the dashboard into an image, so if you are not satisfied with your solution, I'll end up creating specific tasks to take those screenshots too ...  Thanks for your input ! 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] mennymendoza commented on issue #20756: Make an http request to the "Download as Image" button on the Dashboard page

Posted by GitBox <gi...@apache.org>.
mennymendoza commented on issue #20756:
URL: https://github.com/apache/superset/issues/20756#issuecomment-1192650972

   In case anyone's wondering, I ended up just making my own custom Celery task and using [Puppeteer](https://developer.chrome.com/docs/puppeteer/) to navigate to all of my dashboards and take screenshots of them. Apparently, all Superset is really doing with this button is taking the DOM elements on the current webpage and using the dom-to-image-more node package (which itself uses browser functionality on the client side) to download the dashboard as an image.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] mennymendoza commented on issue #20756: Make an http request to the "Download as Image" button on the Dashboard page

Posted by GitBox <gi...@apache.org>.
mennymendoza commented on issue #20756:
URL: https://github.com/apache/superset/issues/20756#issuecomment-1212107346

   If you're talking about using docker, it recommends to use docker in the documentation [here](https://superset.apache.org/docs/installation/installing-superset-using-docker-compose).
   
   If you're talking about getting thumbnails to work, then no, I read the documentation thoroughly and was still confused, so I read through several issues and scoured the internet for answers. Basically, the web driver should specify the host machine (or the Docker gateway), and not superset_app. If you use "localhost", it specifies the container that the code is running in, which is superset_app.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


[GitHub] [superset] mennymendoza commented on issue #20756: Make an http request to the "Download as Image" button on the Dashboard page

Posted by GitBox <gi...@apache.org>.
mennymendoza commented on issue #20756:
URL: https://github.com/apache/superset/issues/20756#issuecomment-1211457084

   Sure! The only thing I needed to change to set up thumbnails and chart screenshots was the superset_config.py file. Here it is:
   ```python
   import logging
   import os
   from datetime import timedelta
   from typing import Optional
   
   from cachelib.file import FileSystemCache
   from celery.schedules import crontab
   from superset.superset_typing import CacheConfig
   
   logger = logging.getLogger()
   
   
   def get_env_variable(var_name: str, default: Optional[str] = None) -> str:
       """Get the environment variable or raise exception."""
       try:
           return os.environ[var_name]
       except KeyError:
           if default is not None:
               return default
           else:
               error_msg = "The environment variable {} was missing, abort...".format(
                   var_name
               )
               raise EnvironmentError(error_msg)
   
   
   DATABASE_DIALECT = get_env_variable("DATABASE_DIALECT")
   DATABASE_USER = get_env_variable("DATABASE_USER")
   DATABASE_PASSWORD = get_env_variable("DATABASE_PASSWORD")
   DATABASE_HOST = get_env_variable("DATABASE_HOST")
   DATABASE_PORT = get_env_variable("DATABASE_PORT")
   DATABASE_DB = get_env_variable("DATABASE_DB")
   
   # The SQLAlchemy connection string.
   SQLALCHEMY_DATABASE_URI = "%s://%s:%s@%s:%s/%s" % (
       DATABASE_DIALECT,
       DATABASE_USER,
       DATABASE_PASSWORD,
       DATABASE_HOST,
       DATABASE_PORT,
       DATABASE_DB,
   )
   
   REDIS_HOST = get_env_variable("REDIS_HOST")
   REDIS_PORT = get_env_variable("REDIS_PORT")
   REDIS_CELERY_DB = get_env_variable("REDIS_CELERY_DB", "0")
   REDIS_RESULTS_DB = get_env_variable("REDIS_RESULTS_DB", "1")
   
   CACHE_DEFAULT_TIMEOUT = int(timedelta(days=1).total_seconds())
   CACHE_CONFIG: CacheConfig = {
       'CACHE_TYPE': 'RedisCache',
       'CACHE_DEFAULT_TIMEOUT': CACHE_DEFAULT_TIMEOUT,
       'CACHE_KEY_PREFIX': 'meta_',
       'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/2'
   }
   DATA_CACHE_CONFIG: CacheConfig = {
       'CACHE_TYPE': 'RedisCache',
       'CACHE_DEFAULT_TIMEOUT': CACHE_DEFAULT_TIMEOUT,
       'CACHE_KEY_PREFIX': 'data_',
       'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/3'
   }
   # RESULTS_BACKEND = FileSyst  emCache("/app/superset_home/sqllab")
   RESULTS_BACKEND: CacheConfig = {
       'CACHE_TYPE': 'RedisCache',
       'CACHE_DEFAULT_TIMEOUT': CACHE_DEFAULT_TIMEOUT,
       'CACHE_KEY_PREFIX': 'results_',
       'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_RESULTS_DB}'
   }
   FILTER_STATE_CACHE_CONFIG: CacheConfig = {
       'CACHE_TYPE': 'RedisCache',
       'CACHE_DEFAULT_TIMEOUT': CACHE_DEFAULT_TIMEOUT,
       'CACHE_KEY_PREFIX': 'filter_',
       'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/4'
   }
   EXPLORE_FORM_DATA_CACHE_CONFIG: CacheConfig = {
       'CACHE_TYPE': 'RedisCache',
       'CACHE_DEFAULT_TIMEOUT': CACHE_DEFAULT_TIMEOUT,
       'CACHE_KEY_PREFIX': 'explore_',
       'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/5'
   }
   THUMBNAIL_SELENIUM_USER = "admin"
   THUMBNAIL_CACHE_CONFIG: CacheConfig = {
       'CACHE_TYPE': 'RedisCache',
       'CACHE_DEFAULT_TIMEOUT': CACHE_DEFAULT_TIMEOUT,
       'CACHE_KEY_PREFIX': 'thumbnail_',
       'CACHE_REDIS_URL': f'redis://{REDIS_HOST}:{REDIS_PORT}/6'
   }
   
   
   class CeleryConfig(object):
       BROKER_URL = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_CELERY_DB}"
       CELERY_IMPORTS = ("superset.sql_lab", "superset.tasks", 'superset.tasks.thumbnails')
       CELERY_RESULT_BACKEND = f"redis://{REDIS_HOST}:{REDIS_PORT}/{REDIS_RESULTS_DB}"
       CELERYD_LOG_LEVEL = "DEBUG"
       CELERYD_CONCURRENCY = 10
       CELERYD_PREFETCH_MULTIPLIER = 1
       CELERY_ACKS_LATE = False
       CELERYBEAT_SCHEDULE = {}
   
   
   CELERY_CONFIG = CeleryConfig
   
   FEATURE_FLAGS = {"THUMBNAILS": True, "THUMBNAILS_SQLA_LISTENERS": True, "ENABLE_TEMPLATE_PROCESSING": True, }
   ALERT_REPORTS_NOTIFICATION_DRY_RUN = True
   WEBDRIVER_BASEURL = "http://172.17.0.1:8088"
   # The base URL for the email report hyperlinks.
   WEBDRIVER_BASEURL_USER_FRIENDLY = WEBDRIVER_BASEURL
   SUPERSET_WEBSERVER_TIMEOUT = int(timedelta(minutes=5).total_seconds())
   
   SQLLAB_CTAS_NO_LIMIT = True
   
   #
   # Optionally import superset_config_docker.py (which will have been included on
   # the PYTHONPATH) in order to allow for local settings to be overridden
   #
   try:
       import superset_config_docker
       from superset_config_docker import *  # noqa
   
       logger.info(
           f"Loaded your Docker configuration at " f"[{superset_config_docker.__file__}]"
       )
   except ImportError:
       logger.info("Using default Docker config...")
   ```
   
   I cloned the GitHub repo and am running it with Docker Compose in production mode. So I'm using the command `docker compose -f docker-compose-non-dev.yml up` in the root directory. Let me know if you have any other questions.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org


Re: [I] Make an http request to the "Download as Image" button on the Dashboard page [superset]

Posted by "rusackas (via GitHub)" <gi...@apache.org>.
rusackas commented on issue #20756:
URL: https://github.com/apache/superset/issues/20756#issuecomment-1939368465

   Closing this as stale since it's been silent for so long, and we're trying to steer toward a more actionable Issues backlog. If people are still encountering this in current versions (currently 3.x) please open a new Issue or a PR to address the problem.  


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org