To add a custom Menu, we will need to modify some javascript and xml configuration files. If you need help finding these files, please see: JasperReports Server WEB-INF Directory Locations
- Edit the file WEB-INF/actionModel-navigation.xml
Add a separator tag and an option tag for the menu item
<option labelKey="NAV_028_ACCOUNTS" action="primaryNavModule.navigationOption" actionArgs="accounts"/>
Note: NAV_028_ACCOUNTS is a label key which we will be referring to in the properties file and "accounts" is an action argument which we will refer to in a javascript file
Edit the file WEB-INF/bundles/pro_nav_messages.properties
Add the line for the NAV_028_ACCOUNTS property with an appropriate value, in this case, MyCompany Accounts
NAV_027_SEARCH=Search Results NAV_028_ACCOUNTS=MyCompany Accounts
Note: MyCompany Accounts is name of custom Menu which will appear in the User Interface.
Edit file scripts/bower_components/jrs-ui/src/actionModel.primaryNavigation.js, (the scripts directory is at the same level as the WEB-INF directory)
Add a URL and parameters to load the desired page in response to selecting the new accounts menu item. In the case of this example, the action is to perform a search for all reports with the word account in their name or description.
report : {url : "flow.html", params: "_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-reports&searchText=" }, accounts: {url : "flow.html", params: "_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-reports&searchText=account" }, olap : {url : "flow.html", params: "_flowId=searchFlow&mode=search&filterId=resourceTypeFilter&filterOption=resourceTypeFilter-view&searchText=" },
Note: accounts has a url, flow.html, and parameter associated with it. The tag says that it will open the search repository and will give the list of resources with account as a search keyword
Edit the file WEB-INF/js.config.properties
# Control default value of javascript optimization in runtime javascript.optimize=false
Note: By default the value is true , can make it to false, or, instead of editing this file you could directly use the url as below:
http://localhost:8080/jasperserver-pro/flow.html?_flowId=homeFlow&_opt=false
Save the modified files and reload the web app in the app server.
The result should be as shown below:
Recommended Comments
There are no comments to display.