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
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.ApplicationContextprotected BackgroundWorkerprotected CurrentUserSubstitutionprotected DatasetConstraintsProviderprotected SupersetClientprotected SupersetUiPropertiesprotected SupersetTokenManager -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidprotected GuestTokenBodybuildGuestTokenBody(String embeddedID, DatasetConstraintsProvider constraintsProvider) protected List<GuestTokenBody.RowLevelRole>convertToSupersetRls(List<DatasetConstraint> datasetConstraints) protected SupersetDashboard.FetchGuestTokenTaskcreateFetchGuestTokenTask(long timeout, GuestTokenBody body, String accessToken, String csrfToken) protected voidvoidsetApplicationContext(org.springframework.context.ApplicationContext applicationContext) voidsetDatasetConstraintsProvider(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, setUrlInternalMethods 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, setVisibleMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.vaadin.flow.component.AttachNotifier
addAttachListenerMethods inherited from interface com.vaadin.flow.component.DetachNotifier
addDetachListenerMethods inherited from interface com.vaadin.flow.component.HasElement
getElementMethods 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, setWidthFullMethods 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:
setApplicationContextin interfaceorg.springframework.context.ApplicationContextAware- Throws:
org.springframework.beans.BeansException
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
getDatasetConstraintsProvider
- Returns:
- dataset constraints provider or
nullif 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:
fetchGuestTokenin 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)
-