Adding a new view and portlet
You can add a new view to the application menu and create the corresponding portlet.
About this task
The following views are available, by default, in Sterling Store Engagement:
- Order Fulfillment(
Order_Fulfillment
) - Inventory Management (
Inv_Management
) - Customer Service (
Customer_Service
)
However, you can define a new view and create corresponding portlets to suit your business needs. For more information about adding a new view in Sterling Business Center, see Configuring store hub rules.
Procedure
-
Create the following folder structure under SCREEN_EXTENSIONS_HOME, if not
already
present.
SCREEN_EXTENSIONS_HOME/features/home/portlet-setNote:The folder structure provided in this step contains the application-provided portlets. It is a good practice to create new portlets in the same path.
- Go to the SCREEN_EXTENSIONS_HOME/features/home/portlet-set folder.
- Copy portlet-set-extension.module.ts from
<WORKSPACE>/store-frontend/src/app/features/home/portlet-set to
<WORKSPACE>/store-frontend/store-extensions-src/app/features/home/portlet-set
folder.
If portlet-set-extension.module.ts is already present then do not copy the file. Custom portlet components and providers are declared in this file. - To create a new portlet, perform the following steps:
- Run the command: ng g c <componentName> --project=store-extensions
--skip-import Note: It is mandatory to pass the argument --project=store-extensions. Failing to do so will create the component in the application-provided src folder (<WORKSPACE>/store-frontend/src). The files created here are ignored and not rendered on browser.
- Update the portlet component class name in declarations
@NgModule
decorator in portlet-set-extension.module.ts.Note:- Ensure that you import the corresponding portlet component classes into portlet-set-extension.module.ts.
- Ensure that you are importing from store-extensions-src and not from the store-app-build folder.
- Run the command: ng g c <componentName> --project=store-extensions
--skip-import
- To create a service or provider for the new portlet component, perform the following
steps:
- Run the command: ng g s <serviceName>
--project=store-extensions Note: It is mandatory to pass the argument --project=store-extensions. Failing to do so will create the component in the application-provided src folder (<WORKSPACE>/store-frontend/src). The files created here are ignored and not rendered on browser.
- Update the service or provider name in providers of
@NgModule
decorator in portlet-set-extension.module.ts.
- Run the command: ng g s <serviceName>
--project=store-extensions
- Read View-Portlet registration. Register the portlet to a view
in one of the following ways:
- Register the portlet to a new view specification. For example, if you want to add a custom portlet to the ‘
User_Management
’ view, the JSON specification will look like:{ personaName: ‘User_Management', personaIconClass: 'app-icon-user_mgmt_20', portlets: [ { portletTitleBundleKey: ‘userPortlet.TITLE_UserPortlet', portletSequenceNumber: 4, portletComponent: UserPortletComponent, portletTID: ‘userPortlet', resourceId: 'ISF000004’ } ] }
- Register the portlet to an existing view specification.
- If you want to add a custom portlet to an existing view, say
Inv_Management
, the JSON specification will look like:{ personaName: ‘Inv_Management', portlets: [ { portletTitleBundleKey: ‘userPortlet.TITLE_UserPortlet', portletSequenceNumber: 4, portletComponent: UserPortletComponent, portletTID: ‘userPortlet', resourceId: 'ISF000004’ } ] }
- In the store-customization-impl.ts file, update the
extensionPersonaConfigList
property in the portlet-view JSON specification as follows:static extensionPersonaConfigList: IPersonaConfig[] = [ { personaName: ‘Inv_Management', personaIconClass: ‘app-icon-inventory_mgmt_20’, portlets: [ { portletTitleBundleKey: ‘userPortlet.TITLE_UserPortlet', portletSequenceNumber: 4, portletComponent: UserPortletComponent, portletTID: ‘userPortlet', resourceId: 'ISF000004’ } ] } ];
- If you want to add a custom portlet to an existing view, say
Note: Views are defined at hub level and are not permission-controlled. However, if you do not have permission for any portlet for a view, then that view is not displayed in the side navigation panel of the application. - Register the portlet to a new view specification.