You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by "erdemcer (via GitHub)" <gi...@apache.org> on 2024/11/04 07:45:50 UTC

[I] iframe refresh [superset]

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

   I have a simple application which has iframe contains Superset dashboard. I would like to refresh dashboard from custom button in main page but everytime when refresh button is called full whole iframe is reloading. Is there any way to refresh dashboard in iframe without reloading whole iframe.
   
   Thanks


-- 
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


Re: [I] iframe refresh [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30826:
URL: https://github.com/apache/superset/issues/30826#issuecomment-2454388792

   <!-- Answer -->
   To resolve the "Uncaught ReferenceError: Switchboard is not defined" error, ensure that the `Switchboard` class is properly imported or included in your script. The `Switchboard` class is exported as a default instance, so you need to import it correctly in your parent window script. Here's how you can do it:
   
   1. **Import the Switchboard**: Make sure you have the correct import statement in your parent window script.
   
      ```javascript
      import Switchboard from 'path-to-switchboard-file';
      ```
   
      Replace `'path-to-switchboard-file'` with the actual path to the file where the `Switchboard` class is defined.
   
   2. **Ensure Script Order**: If you are not using a module system, ensure that the script containing the `Switchboard` class is loaded before any script that tries to use it.
   
   By following these steps, you should be able to initialize the `Switchboard` without encountering the reference error <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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] iframe refresh [superset]

Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #30826:
URL: https://github.com/apache/superset/issues/30826#issuecomment-2454018731

   <!-- Greeting -->
   Merhaba @erdemcer! I'm here to help you with any bugs or questions you have while waiting for a human maintainer. Let's solve this together!
   
   <!-- Answer -->
   To refresh the Superset dashboard in an iframe without reloading the entire iframe, you can use the `postMessage` API to communicate with the iframe and trigger a refresh. Superset provides a way to handle custom events or messages using the `Switchboard` class, which facilitates communication between the parent window and the iframe.
   
   Here's a basic outline of how you can achieve this:
   
   1. **Set up a MessageChannel**: Establish a communication channel between the parent window and the iframe.
   
   2. **Define a refresh method in the iframe**: Use the `Switchboard` class to define a method in the iframe that handles the refresh logic.
   
   3. **Emit a refresh message from the parent**: Use the `emit` method to send a message to the iframe to trigger the refresh.
   
   Example code snippet:
   
   ```javascript
   // In the parent window
   const switchboard = new Switchboard({ port: yourMessagePort });
   
   // Emit a message to trigger the refresh
   switchboard.emit('refresh');
   ```
   
   ```javascript
   // In the iframe
   switchboard.defineMethod('refresh', () => {
     // Logic to refresh the dashboard content
   });
   ```
   
   This setup allows you to refresh the dashboard content without reloading the entire iframe <sup>[[1]](https://github.com/apache/superset/blob/master/superset-frontend/packages/superset-ui-switchboard/src/switchboard.ts)</sup>.
   
   
   <!-- Dosu Comment Footer -->
   *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
   


-- 
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] iframe refresh [superset]

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

   Hi @dosu
   
   Thanks for reply . But i have following error while initialize Switchboard in the parent window.
   
   Uncaught ReferenceError: Switchboard is not defined
   
   Could you please give detail about your outline ?
   
   Thanks.
   


-- 
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] iframe refresh [superset]

Posted by "geido (via GitHub)" <gi...@apache.org>.
geido closed issue #30826: iframe refresh
URL: https://github.com/apache/superset/issues/30826


-- 
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] iframe refresh [superset]

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

   Hi,
   I am not using module system. I am trying to import it from supersetEmbeddedSdk with "onst switchboard = new supersetEmbeddedSdk.Switchboard({ port: channel.port1 });" But gives another error ;
   Uncaught TypeError: supersetEmbeddedSdk.Switchboard is not a constructor
   
   Thanks.


-- 
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] iframe refresh [superset]

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

   Hello @erdemcer I am closing this issue as this is not supported at the moment, but feel free to open up a PR to make this possible. Thank you!


-- 
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