Class SupersetDashboard

java.lang.Object
com.vaadin.flow.component.Component
io.jmix.supersetflowui.kit.component.JmixSupersetDashboard
io.jmix.supersetflowui.component.SupersetDashboard
All Implemented Interfaces:
com.vaadin.flow.component.AttachNotifier, com.vaadin.flow.component.DetachNotifier, com.vaadin.flow.component.HasElement, com.vaadin.flow.component.HasSize, com.vaadin.flow.component.HasStyle, Serializable, org.springframework.beans.factory.Aware, org.springframework.beans.factory.InitializingBean, org.springframework.context.ApplicationContextAware

public class SupersetDashboard extends JmixSupersetDashboard implements org.springframework.context.ApplicationContextAware, org.springframework.beans.factory.InitializingBean
The component for showing embedded dashboards from Superset. It uses the embedded-sdk library on the client-side to embed a dashboard into an IFrame.

To work with the component correctly, you should provide the embedded ID from a configured dashboard in Superset and set it to the component.

By default, the component manages guest token acquisition and refresh requests. It configures the request according to the Superset API and contains the following information: dataset constraints, the embedded ID, and the current username. The client-side of the component handles token expiration time. Before expiration, the component requests fetching a new token in a non-blocking manner.

The example of component in a view descriptor:

 xmlns:superset="http://jmix.io/schema/superset/ui"

 <superset:dashboard id="dashboard"
                     height="100%"
                     width="100%"
                     embeddedId="d8bb6f86-dfef-4049-a39a-fd73da1a601d"/>
 
See Also:
  • Field Details

  • Constructor Details

    • SupersetDashboard

      public SupersetDashboard()
  • Method Details

    • setApplicationContext

      public void setApplicationContext(org.springframework.context.ApplicationContext applicationContext) throws org.springframework.beans.BeansException
      Specified by:
      setApplicationContext in interface org.springframework.context.ApplicationContextAware
      Throws:
      org.springframework.beans.BeansException
    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • getDatasetConstraintsProvider

      @Nullable public DatasetConstraintsProvider getDatasetConstraintsProvider()
      Returns:
      dataset constraints provider or null if not set
    • setDatasetConstraintsProvider

      public void setDatasetConstraintsProvider(@Nullable DatasetConstraintsProvider datasetConstraintsProvider)
      Sets dataset constraints provider. These constraints are applied to datasets that are used in an embedded dashboard JmixSupersetDashboard.getEmbeddedId().
      Parameters:
      datasetConstraintsProvider - dataset constraints providers
    • fetchGuestToken

      protected void fetchGuestToken()
      Overrides:
      fetchGuestToken in class JmixSupersetDashboard
    • buildGuestTokenBody

      protected GuestTokenBody buildGuestTokenBody(String embeddedID, @Nullable DatasetConstraintsProvider constraintsProvider)
    • convertToSupersetRls

      protected List<GuestTokenBody.RowLevelRole> convertToSupersetRls(List<DatasetConstraint> datasetConstraints)
    • createFetchGuestTokenTask

      protected SupersetDashboard.FetchGuestTokenTask createFetchGuestTokenTask(long timeout, GuestTokenBody body, String accessToken, @Nullable String csrfToken)