Class DashboardController
- All Implemented Interfaces:
Serializable,AppPages,Portlet,ComplexCalculationResult
The buttons can trigger UI actions (e.g. opening a page) or backend actions (calling a backend URL). It's also possible to display plain HTML links instead of buttons, with the exact same functionality.
Create the controller with api.newController(), add the items, and return the controller from a logic
element. The items are stacked on top of each other. A controller can be displayed in a dashboard and in most other
places that show logic results, for example Quote line items, Custom Forms or Action Items, where it usually opens
with the Show button.
The class implements AppPages, so the page constants are available on the controller, for example
controller.QC_DETAILS_PAGE.
Example:
def controller = api.newController()
controller.addHTML("<h2>Quotes</h2>")
controller.addButton("Open Quotes", controller.QC_DETAILS_PAGE)
return controller
- See Also:
-
Field Summary
Fields inherited from class AbstractPortletDto
dragDropEnabled, layout, messages, resizingEnabledFields inherited from interface AppPages
AIN_AGENTS, CM_MAIN_PAGE, CM_RECORDS_PAGE, CM_TYPES_PAGE, CONFIG_WIZARDS_PAGE, CUSTOM_FORMS_NEW, CUSTOM_FORMS_PAGE, CUSTOM_FORMS_TYPE_PAGE, DB_DASHBOARDS_PAGE, DP_PAGE, DP_TYPES_PAGE, ENABLE_ANALYSIS, ENABLE_APPROVALS, ENABLE_CUSTOMERS, ENABLE_EARNINGS, ENABLE_FORECASTING, ENABLE_PROGRAM_LINE, ENABLE_PROGRAM_LINES, ENABLE_SETTINGS, ENABLE_TERMS, MD_BOM_PAGE, MD_COMPETITION_PAGE, MD_CUSTOMERS_PAGE, MD_CX_PAGE, MD_DCR_PAGE, MD_PP_PAGE, MD_PRODUCTS_PAGE, MD_PX_PAGE, MD_SELLER_EXTENSIONS_PAGE, MD_SELLERS_PAGE, MD_WIZARD_PAGE, PA_CHART_BARLINE_PAGE, PA_CHART_BOXPLOT_PAGE, PA_CHART_BUBBLE_PAGE, PA_CHART_COMPARISONWF_PAGE, PA_CHART_DATATABLE_PAGE, PA_CHART_DETAILEDTIME_PAGE, PA_CHART_HEATMAP_PAGE, PA_CHART_HISTOGRAM_PAGE, PA_CHART_PAGE, PA_CHART_PIE_PAGE, PA_CHART_SCATTER_PAGE, PA_CHART_TIMESCATTER_PAGE, PA_CHART_TIMESERIES_PAGE, PA_CHART_WATERFALL_PAGE, PA_DATASOURCES_PAGE, PA_ROLLUPS_PAGE, PB_LPG_PAGE, PB_MPL_PAGE, PB_PL_ADD_SKU_PAGE, PB_PL_PAGE, PB_SIMULATION_PAGE, PM_CONTRACTS_PAGE, PM_NEW_CONTRACT, PO_NEW_MODEL, QC_DETAILS_PAGE, QC_NEW_QUOTE, QC_TYPES_PAGE, RM_DETAILS_PAGE, RM_MAIN_PAGE, RM_NEW_REBATE_AGREEMENT, RM_RECORDS_PAGE, RM_TEMPLATES_PAGE, SC_ACCRUAL_RECORDS_PAGE, SC_CALCULATIONS_PAGE, SC_COMPENSATION_RECORDS_PAGE, SC_COMPENSATION_TYPES_PAGE, SC_CONDITION_TYPES_PAGE, SC_NEW_PLAN, SC_PLANS_PAGE, SELLER_EXTENSIONS_PAGE, SELLERS_PAGE, USER_ACTIONS_PAGE, USER_NEW_ACTION_PAGE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddBackendCall(String label, String apiUrl) Performs a backend call in the user's context (i.e. from the browser).voidaddBackendCall(String label, String apiUrl, String payload) Performs a backend call in the user's context (i.e. from the browser).voidaddBackendCall(String label, String apiUrl, String payload, String successMessage, String failMessage) Performs a backend call in the user's context (i.e. from the browser).voidAdds a button to the controller.voidAdds a button to the controller.voidAdds a button to the controller.voidaddCollapsibleHTML(boolean isCollapsed, String sectionLabel, String html) Adds an HTML snippet into the controller as a collapsible section.voidaddDownloadButton(String label, String url) Adds a button that downloads a file, for example an Excel or PDF file.voidaddDownloadButton(String label, String url, String payload) Adds a button that downloads a file, for example an Excel or PDF file.voidAdds an HTML snippet into the controller.voidAdds a link (simple <A> tag) to the controller.voidAdds a link (simple <A> tag) to the controller.voidAdds a link (simple <A> tag) to the controller.List<DashboardController.ControllerItem> getItems()Not intended for public use.Returns the result type of this calculation result.Methods inherited from class AbstractPortletDto
getLabelOverride, layout, setLabelOverride, setLayout, value, withDragDrop, withError, withHeight, withHeight, withInfo, withLabelOverride, withLayout, withLayout, withLayout, withResizing, withTab, withWarning, withWidth, withWidth
-
Constructor Details
-
DashboardController
public DashboardController()Not intended for public use. Useapi.newController()to create a controller.- See Also:
-
-
Method Details
-
getResultType
Returns the result type of this calculation result.- Specified by:
getResultTypein interfaceComplexCalculationResult- Returns:
- always
"DASHBOARDCONTROLLER"
-
getItems
Not intended for public use. Returns the items added to the controller. The server sends them to the user interface, which renders them.- Returns:
- the items of the controller
-
addButton
Adds a button to the controller. When the user clicks the button, the target page opens.Example:
def controller = api.newController() controller.addButton("1. STEP: Go to Live Price Grids", controller.PB_LPG_PAGE)- Parameters:
label- The label of the buttontargetPage- The name of the target page. See predefined constants inAppPagesinterface.- See Also:
-
addButton
Adds a button to the controller.Example:
def controller = api.newController() controller.addButton("2. STEP: Go to LPG ABC", controller.PB_LPG_PAGE, "45.PG")- Parameters:
label- The label of the buttontargetPage- The name of the target page. See predefined constants inAppPagesinterface.targetPageState- An extra parameter that is used for deep links. E.g. a typed id to open a specific page- See Also:
-
addButton
Adds a button to the controller.Example:
def controller = api.newController() controller.addButton("Open Dashboard", controller.DB_DASHBOARDS_PAGE, null, "FirstDash")- Parameters:
label- The label of the buttontargetPage- The name of the target page. See predefined constants inAppPagesinterface.targetPageState- An extra parameter that is used for deep links. E.g. a typed id to open a specific pagecomponentId- Some UI actions require a parameter in this field (e.g. opening a specific dashboard)- See Also:
-
addLink
Adds a link (simple <A> tag) to the controller.Note: This is available in Unity UI only. No backporting planned for the Classic UI.
Example:
def controller = api.newController() controller.addLink("1. STEP: Go to Live Price Grids", controller.PB_LPG_PAGE)- Parameters:
label- The label of the linktargetPage- The name of the target page. See predefined constants inAppPagesinterface.- Since:
- 7.0 Bijou
-
addLink
Adds a link (simple <A> tag) to the controller.Note: This is available in Unity UI only. No backporting planned for the Classic UI.
Example:
def controller = api.newController() controller.addLink("2. STEP: Go to LPG ABC", controller.PB_LPG_PAGE, "45.PG")- Parameters:
label- The label of the linktargetPage- The name of the target page. See predefined constants inAppPagesinterface.targetPageState- An extra parameter that is used for deep links. E.g. a typed id to open a specific page- Since:
- 7.0 Bijou
-
addLink
Adds a link (simple <A> tag) to the controller.Note: This is available in Unity UI only. No backporting planned for the Classic UI.
Example:
def controller = api.newController() controller.addLink("Open Dashboard", controller.DB_DASHBOARDS_PAGE, null, "FirstDash")- Parameters:
label- The label of the linktargetPage- The name of the target page. See predefined constants inAppPagesinterface.targetPageState- An extra parameter that is used for deep links. E.g. a typed id to open a specific pagecomponentId- Some UI actions require a parameter in this field (e.g. opening a specific dashboard)- Since:
- 7.0 Bijou
-
addBackendCall
Performs a backend call in the user's context (i.e. from the browser).The controller shows a button with the specified label. When the user clicks the button, the browser sends a POST request to the URL. The user gets no message about the result. To show one, use
addBackendCall(String, String, String, String, String).Example:
def controller = api.newController() controller.addBackendCall("Calculate LPG", "/pricegridmanager.calculate/45")- Parameters:
label- The label of the buttonapiUrl- The URL to call- See Also:
-
addBackendCall
Performs a backend call in the user's context (i.e. from the browser).The controller shows a button with the specified label. When the user clicks the button, the browser sends a POST request with the payload to the URL. The user gets no message about the result. To show one, use
addBackendCall(String, String, String, String, String).- Parameters:
label- The label of the buttonapiUrl- The URL to callpayload- The POST data to send along with the request, as a JSON string. If the value is not valid JSON, the request is not sent.- See Also:
-
addBackendCall
public void addBackendCall(String label, String apiUrl, String payload, String successMessage, String failMessage) Performs a backend call in the user's context (i.e. from the browser).The controller shows a button with the specified label. When the user clicks the button, the browser sends a POST request with the payload to the URL. Then it shows the success message or the fail message as a notification.
Example:
def controller = api.newController() controller.addBackendCall("Calculate LPG", "/pricegridmanager.calculate/45", null, "OK", "Not OK")- Parameters:
label- The label of the buttonapiUrl- The URL to callpayload- The POST data to send along with the request, as a JSON string. If the value is not valid JSON, the request is not sent and the fail message is shown.successMessage- A text that should be displayed in case of a successful response from the backendfailMessage- A text that should be displayed in case of an error response from the backend- See Also:
-
addHTML
Adds an HTML snippet into the controller.Example:
def controller = api.newController() controller.addHTML("<h2>Welcome to Pricefx</h2>")HTML sanitization (since 17.0): HTML added to a dashboard is sanitized by default to prevent the execution of potentially malicious scripts (XSS). Only a restricted subset of tags and attributes is rendered and anything else is sanitized. In particular, raw
<a>hyperlinks pointing to external URLs are displayed as HTML code (shown verbatim as text) instead of clickable links unless the URL targetspricefx.com/pricefx.euor starts with#. Where a business case requires non-standard HTML or scripts, an administrator can disable sanitization for a specific partition via a feature flag, though using standard platform features (such as controller buttons) is recommended instead. See the Allowed HTML Tags and Attributes page in the Pricefx Knowledge Base for the full list of supported tags, attributes and URL schemes.- Parameters:
html- The html snippet.- Since:
- 11.1 - Paper Plane
- See Also:
-
addCollapsibleHTML
Adds an HTML snippet into the controller as a collapsible section.In a dashboard, the collapsed or expanded state is saved when the user saves the dashboard preference. The saved state takes precedence over
isCollapsed. It is stored bysectionLabel, so renaming the section discards it.Example:
def controller = api.newController() controller.addCollapsibleHTML(false, "section 1", "<h2>Welcome to Pricefx</h2>")HTML sanitization (since 17.0): HTML added to a dashboard is sanitized by default to prevent the execution of potentially malicious scripts (XSS). Only a restricted subset of tags and attributes is rendered and anything else is sanitized. In particular, raw
<a>hyperlinks pointing to external URLs are displayed as HTML code (shown verbatim as text) instead of clickable links unless the URL targetspricefx.com/pricefx.euor starts with#. Where a business case requires non-standard HTML or scripts, an administrator can disable sanitization for a specific partition via a feature flag, though using standard platform features (such as controller buttons) is recommended instead. See the Allowed HTML Tags and Attributes page in the Pricefx Knowledge Base for the full list of supported tags, attributes and URL schemes.- Parameters:
isCollapsed- Set totrueto show the section collapsed when the controller is displayed.sectionLabel- label of the collapsible sectionhtml- The html snippet- Since:
- 11.1 - Paper Plane
- See Also:
-
addDownloadButton
Adds a button that downloads a file, for example an Excel or PDF file. When the user clicks the button, the browser sends a POST request to the URL in the user's context and downloads the response as a file.When the URL runs a logic (
/formulamanager.executeformula/<logic name>), URL parameters set the output format (output=xlsoroutput=pdf) and the name of the file (fileName). WithoutfileName, an Excel file, or a PDF converted from it, is named after the logic plus a time stamp.Example:
def controller = api.newController() controller.addDownloadButton("Download Excel", "/formulamanager.executeformula/dashboard_export_logic?output=xls&fileName=MyDownloadedFile")- Parameters:
label- The label of the buttonurl- The URL to call- Since:
- 3.4.3 - Cuba Libre
- See Also:
-
addDownloadButton
Adds a button that downloads a file, for example an Excel or PDF file. When the user clicks the button, the browser sends a POST request with the payload to the URL in the user's context and downloads the response as a file.When the URL runs a logic (
/formulamanager.executeformula/<logic name>), the payload supplies values for the parameters defined in the logic. The payload must be a JSON object. The logic reads the values withapi.stringUserEntry(), for exampleapi.stringUserEntry("region"). ThetargetDatekey sets the target date of the logic instead. SeeaddDownloadButton(String, String)for the URL parameters that set the output format and the file name.Example:
def controller = api.newController() controller.addDownloadButton("Download XLS", "/formulamanager.executeformula/DashboardExport?output=xls", '{"region": "EU"}')- Parameters:
label- The label of the buttonurl- The URL to callpayload- The POST data to send along with the request- Since:
- 3.4.3 - Cuba Libre
- See Also:
-