Package io.jmix.supersetflowui.component
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:
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContext
protected BackgroundWorker
protected CurrentUserSubstitution
protected DatasetConstraintsProvider
protected SupersetClient
protected SupersetUiProperties
protected SupersetTokenManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
protected GuestTokenBody
buildGuestTokenBody
(String embeddedID, DatasetConstraintsProvider constraintsProvider) protected List<GuestTokenBody.RowLevelRole>
convertToSupersetRls
(List<DatasetConstraint> datasetConstraints) protected SupersetDashboard.FetchGuestTokenTask
createFetchGuestTokenTask
(long timeout, GuestTokenBody body, String accessToken, String csrfToken) protected void
void
setApplicationContext
(org.springframework.context.ApplicationContext applicationContext) void
setDatasetConstraintsProvider
(DatasetConstraintsProvider datasetConstraintsProvider) Sets dataset constraints provider.Methods inherited from class io.jmix.supersetflowui.kit.component.JmixSupersetDashboard
getEmbeddedId, isChartControlsVisible, isFiltersExpanded, isTitleVisible, setChartControlsVisible, setEmbeddedId, setFiltersExpanded, setGuestTokenInternal, setTitleVisible, setUrlInternal
Methods inherited from class com.vaadin.flow.component.Component
addListener, findAncestor, fireEvent, from, get, getChildren, getElement, getEventBus, getId, getListeners, getLocale, getParent, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getTranslation, getUI, hasListener, isAttached, isTemplateMapped, isVisible, onAttach, onDetach, onEnabledStateChanged, removeFromParent, scrollIntoView, scrollIntoView, set, setElement, setId, setVisible
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListener
Methods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListener
Methods inherited from interface com.vaadin.flow.component.HasElement
getElement
Methods inherited from interface com.vaadin.flow.component.HasSize
getHeight, getHeightUnit, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getWidth, getWidthUnit, setHeight, setHeight, setHeightFull, setMaxHeight, setMaxHeight, setMaxWidth, setMaxWidth, setMinHeight, setMinHeight, setMinWidth, setMinWidth, setSizeFull, setSizeUndefined, setWidth, setWidth, setWidthFull
Methods inherited from interface com.vaadin.flow.component.HasStyle
addClassName, addClassNames, getClassName, getClassNames, getStyle, hasClassName, removeClassName, removeClassNames, setClassName, setClassName
-
Field Details
-
applicationContext
protected org.springframework.context.ApplicationContext applicationContext -
supersetClient
-
tokenManager
-
backgroundWorker
-
currentUserSubstitution
-
supersetUiProperties
-
datasetConstraintsProvider
-
-
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 interfaceorg.springframework.context.ApplicationContextAware
- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSet
in interfaceorg.springframework.beans.factory.InitializingBean
-
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 dashboardJmixSupersetDashboard.getEmbeddedId()
.- Parameters:
datasetConstraintsProvider
- dataset constraints providers
-
fetchGuestToken
protected void fetchGuestToken()- Overrides:
fetchGuestToken
in classJmixSupersetDashboard
-
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)
-