Generates SAPUI5 Routing and Fragment Setup
Mohammad Sohail Khan
SAP BTP Consultant | SAPUI5 & Fiori | CAP | Workflow | Cloud Foundry | MDK | S4HANA Cloud | Node.js | Build Apps | SAP Certified ?
Developing SAPUI5 applications often involves repetitive tasks, particularly when setting up routing and fragments. To simplify this process, I excited to introduce ui5-route-generator, a powerful Node.js utility designed to automate and streamline these tasks, enabling you to focus on building robust applications.
Key Features of ui5-route-generator
- Automated Routing Setup: Quickly configure routes in your SAPUI5 applications with minimal effort.
- Effortless Fragment Setup: Simplify the integration of fragments in your project.
- Prompt-Based Interaction: Intuitive command-line prompts guide you through the setup process, ensuring you get everything right without hassle.
Getting Started with ui5-route-generator
Open your terminal and run the following command to install ui5-route-generator
npm i ui5-route-generator -D
?? NOTE: The tool will work when you open the project terminal with the path set to the project root directory, or else it will not work! Example is below
package intalled successfully! Now you can see the project structure Views, controller and the project directory.
Now, Run the command on Terminal
npm run ui5-route-generator
User want to add new View in the project user select on 'create route'
user give the new view name called 'SecondView' user can also select the file type whether you want in (.ts or .js) user select .js file you can see it successfully Created huuryy!!
Don't worry ;) it will generate routing configuration in Manifest.json
领英推è
Generating Fragment
Now our user has successfully added 'Routing' in the project let's move to Generating Fragment user run the command 'npm run ui5-route-generator' user will select the second option Fragment Setup
It will give you the Controller list we know fragment is not having there on controller they will depend on actual controller where we are setuping them and keep an eye on project directory :) user will select 'View2 controller'
Boom!! Fragment added successfully! user can see a function name called onOpenFragment() in terminal user needs to just call the function from controller it will open the fragment
?? You need to import the Fragment Library then only it will work check below image
After Import the library I am doing for .js file in .ts also you need to do same thing
Now you are ready to go trigger the function from your View2 onOpenFragment()
Call for Community Contributions
We invite the SAPUI5 community #javscript #developers to join us in improving and expanding ui5-route-generator. Whether it's through feedback, feature requests, bug reports, or direct contributions to the codebase, your participation is invaluable. Together, we can create a tool that best serves the needs of SAPUI5 developers.
Get started today and experience the difference with ui5-route-generator!
Tagging: #SAPUI5 #SAP #UI5Development #JavaScript #NodeJS #OpenSource #DeveloperTools #SoftwareDevelopment #Community #Routing #FragmentSetup
For more information and to contribute, visit our GitHub repository.