Adding Functionality to Administration Console
You can add your own functionality to SAP Commerce Cloud Administration Console based on the yhacext template. Use the extgen generator to create a new extension from the template. Then implement the logic for your new extension in this template.
During the Platform build process, your new extension adds its controllers, jsp pages, css and javascripts to the hac extension - all packed into a jar package located in <HYBRIS_BIN_DIR>/platform/ext/hac/web/webroot/WEB-INF/lib. On starting up, Administration Console registers these controllers and provides the jsp pages, css and javascript resources for use.
Your new extension enables you to create your own tabs with subtabs that display in Administration Console. In subtabs, you can configure url addresses to correspond with the mapping of your controllers.
New Extension Directory Structure
The Enhanced1 extension has the following directory structure:
| Directory | Description |
|---|---|
| /hac/src/de/hybris/platform/hac/controller/ | Custom controllers provided by extension |
| /hac/resources/jsp/ | Custom jsp views |
| /hac/resources/static/css | Custom css resources |
| /hac/resources/static/js | Custom javascript files |
| /resources/enhanced1-tab-config.json | Default-extension tab configuration (defined as bean in /resources/yhacext-spring.xml) |
| /resources/ | Extension items, beans, and spring configuration files |
| /hac/testsrc/de/hybris/platform/hac/controller | Unit tests for custom controllers |
Adding Your Functionalities to Administration Console
To add new functionalities to Administration Console follow the procedure.
Procedure
Adding New Tabs to Administration Console
You can create tabs in your new extension thanks to a spring bean defined in the Enhanced1-spring.xml file.
Context
<bean id="Enhanced1HacTabsConfig" class="de.hybris.platform.hac.custom.JsonHacConfiguration"> <property name="resource" value="classpath:Enhanced1-tab-config.json"/> </bean>
New tabs are displayed just like all other tabs in Administration Console. The tabs that you create can only perform the logic that you implement in your new extension. You cannot change the tabs that are defined for the original Administration Console.
To add a new tab to Administration Console follow the procedure.
Procedure
Enhanced1-tab-config.json Configuration
The configuration is a json array of objects that configure each tab and subtabs.
|
Tab definition |
Description |
|---|---|
| mainTabLabel |
Tab label displayed by Administration Console |
| basePath |
Url prefix shared by all subtabs |
| subtabs |
Array of subtabs |
|
Subtab definition |
Description |
|---|---|
| path |
The url a subtab points to. It is appended to mainTabLabel. |
| label |
Subtab label displayed by Administration Console |
| skipPrefix |
Decides if a path should be appended to basePath or just path should be used. |