DashboardStoreAccessorRepository
This singleton class serves the selector and the dispatcher properties for given dashboard.
export declare class DashboardStoreAccessorRepository
Remarks
The Dashboard() component has an optional property through which you can handle setting of the values for DashboardDispatch and DashboardSelectorEvaluator.
In your component using Dashboard() you can create an onStateChange callback for your dashboard using and pass it to mentioned Dashboard component property.
Example
const dashboardStoreAccessors = DashboardStoreAccessorRepository.getInstance();
// in the code where needed
dashboardStoreAccessors.getAccessorsForDashboard(<DASHBOARD_ID>).getDispatch()(
changeDateFilterSelection("relative", "GDC.time.month", "-3", "0"),
);
// or with check if accessor is initialized already
if (dashboardStoreAccessors.isAccessorInitializedForDashboard(DASHBOARD_ID)) {
setSelectResult(
dashboardStoreAccessors.getAccessorsForDashboard(DASHBOARD_ID).getSelector()(
selectEffectiveDateFilterOptions,
),
);
}
return (
<Dashboard dashboard={"<dashboardId>"} onStateChange={dashboardStoreAccessors.getOnChangeHandlerForDashboard(DASHBOARD_REF)}/>
)
To get latest properties, use static member function . If there is already an instance created, it will return this instance and will return new instance of the DashboardStoreAccessor otherwise.
Methods
Method | Modifiers | Description |
|---|---|---|
| Removes dashboard accessors from for the given dashboard ObjRef. | |
| Clears all accessors saved in accessors map. | |
| Gets the correct DashboardStoreAccessor for given dashboard from the accessors map. | |
| Gets the correct DashboardDispatch for given dashboard from the accessors map. | |
| Gets the correct DashboardSelectorEvaluator for given dashboard from the accessors map. | |
| Creates a callback for given dashboard. | |
| Checks if accessors is initialized for given dashboard ObjRef. |
Method details
DashboardStoreAccessorRepository.clearAccessorForDashboard()method
Removes dashboard accessors from for the given dashboard ObjRef.
static clearAccessorForDashboard(dashboard: ObjRef | string): void;
Parameters
Parameter | Type | Description |
|---|---|---|
dashboard | ObjRef | string | an ObjRef of the dashboard, or its id as a string |
Returns
void
DashboardStoreAccessorRepository.clearAllAccessors()method
Clears all accessors saved in accessors map.
static clearAllAccessors(): void;
Returns
void
DashboardStoreAccessorRepository.getAccessorsForDashboard()method
Gets the correct DashboardStoreAccessor for given dashboard from the accessors map.
static getAccessorsForDashboard(dashboard: ObjRef | string): DashboardStoreAccessor;
Parameters
Parameter | Type | Description |
|---|---|---|
dashboard | ObjRef | string | an ObjRef of the dashboard, or its id as a string |
Returns
DashboardStoreAccessorRepository.getDashboardDispatchForDashboard()method
Gets the correct DashboardDispatch for given dashboard from the accessors map.
static getDashboardDispatchForDashboard(dashboard: ObjRef | string): DashboardDispatch;
Parameters
Parameter | Type | Description |
|---|---|---|
dashboard | ObjRef | string | an ObjRef of the dashboard, or its id as a string |
Returns
DashboardStoreAccessorRepository.getDashboardSelectForDashboard()method
Gets the correct DashboardSelectorEvaluator for given dashboard from the accessors map.
static getDashboardSelectForDashboard(dashboard: ObjRef | string): DashboardSelectorEvaluator;
Parameters
Parameter | Type | Description |
|---|---|---|
dashboard | ObjRef | string | an ObjRef of the dashboard, or its id as a string |
Returns
DashboardStoreAccessorRepository.getOnChangeHandlerForDashboard()method
Creates a callback for given dashboard.
static getOnChangeHandlerForDashboard(dashboard: ObjRef | string): (state: DashboardState, dispatch: DashboardDispatch) => void;
Parameters
Parameter | Type | Description |
|---|---|---|
dashboard | ObjRef | string | an ObjRef of the dashboard, or its id as a string |
Returns
(state: DashboardState, dispatch: DashboardDispatch) => void
DashboardStoreAccessorRepository.isAccessorInitializedForDashboard()method
Checks if accessors is initialized for given dashboard ObjRef.
static isAccessorInitializedForDashboard(dashboard: ObjRef | string): boolean;
Parameters
Parameter | Type | Description |
|---|---|---|
dashboard | ObjRef | string | an ObjRef of the dashboard, or its id as a string |
Returns
boolean