A reusable feature across multiple applications on the Fiori Launchpad. There can be various use cases, but I will demonstrate a use case of displaying a pop-up whenever there is a downtime of selected applications on the FLP.
Steps
Create a plugin project and deploy the application to the SCP Cloud Platform:
Enable
SAP Fiori Launchpad Extensibility in the settings of WebIde.
Click on
Save. WebIde will restart. Enabling this extension helps in creating a
SAP Fiori Launchpad Plugin.
Create a
Project from Template
Select
SAP Fiori Launchpad Plugin and proceed.
Fill in details of the launchpad plugin
Click on
Finish.
All the code needs to be written in
component.js.
- Create a Popup.fragment.xml under folder 'fragment'
This is how the structure of the launchpad plugin app would look like:
Enable plugin only for specific set of applications:
This concept can be implemented if one can listen to events which are published by the Shell Application. There is an event named
'appOpened' that is already being publish. All we have to do is subscribe to it. The way to do it is below:
Write the below code in the component.js to subscribe to the required event:
appMeta.applicationDependencies.html5AppName gives you the unique 'html5AppName', which was used to deploy the application on SCP. Using the name of the application, one can perform any suitable action. Here, I will trigger a pop-up based on some conditions (the conditions, such as service calls, etc that are not mentioned here). In a nutshell, based on the combination of the unique application name and other user defined conditions, the downtime popup can be displayed to the logged in user to notify that the application will be / is under maintenance.
Once this is done, simply deploy the application to SCP Cloud Platform in the usual way.
Post the deployment of the application, add the app in SCP cockpit using the portal services being provided there. In addition to these steps, a final step is required to enable the code to be triggered by specific set of apps:
Add the catalogs to this Shell Plugin app in the portal, i.e., in this case add the catalogs of the app named
abc and
xyz to the
downtimedemo app. This will ensure that the component.js code will be triggered for only those specific apps whose catalogs have been added to this plugin app.
PS: Make sure to change the
App Type from SAPUI5 to
Shell Plugin while adding the plugin application in the portal:
Hope this blog is informative and might help incorporate the above methodology as a reusable component for your product or service.