The life cycle data type Transition UI is used to define an user interface to be displayed as a result of a life cycle action. On the other hand it can be described as a method to get user input at runtime, as a part of life cycle transition. For an instance if the user wants to give a version to a resource while it is being promoted to a different environment that specific needed UI component can be added to the life cycle configuration using Transition UI.
1. Transition UIs are registered for an action/event in a particular state. The registration happens through the lifecycle configuration as given below.
2. If the lifecycle configuration demands the same transition UI for multiple actions/events, it has to be separately defined for every action/event.
3. As shown in the above configuration parameters can be passed to transition UI JSP page. Since these parameters are defined in the lifecycle configuration they are considered as static parameters. Hence they can not be changed at runtime.
4. The input values that are given through the transition UI are passed to back end and they can be read using an executor.
5. WSO2 Governance Registry includes a default transition UI which is the
pre_invoke_ajaxprocessor.jsp (as displayed in above configurations samples). This transition UI is used by the default service lifecycle for its service version functionality.
6. The main functionality of
pre_invoke_ajaxprocessor.jsp is to take user input for the versions of services and their dependent resources, so that they can be passed to the service version executor. The UI defined by this jsp would only be displayed for services. It will ignore all other media types. It will list down all the dependencies of a service resource. These dependencies are gathered recursively. Hence all the dependencies of that service and its dependent resources, will be displayed in the UI.
pre_invoke_ajaxprocessor.jsp accepts five different parameters which are optional. And the parameters are as given below.
preserveOriginal - Setting this parameter will allow users to instruct the server to keep the old resource or whether to delete it. If this parameter is set to false, then the underlying implementation will delete the resource after a state transition. This parameter is set to true by default.
viewVersion - This parameter is to instruct the jsp page to avoid displaying the content of the page. If the viewVersions is set to false then the corresponding UI would not be displayed. This parameter would pass the value of the "preserveOriginal" parameter to the server without displaying any additional UI to the user when it is set to false. This is set to true by default.
displayMediaType - This parameter is used to override the default media type which is checked by the jsp page. By default, this UI checks whether the resource has a media type equal to application/vnd.wso2-service+xml.
showDependencies - uses to define whether to display dependent resources of the service or not. If this parameter is set to "false", the jsp file will only show an input field for the service resource in the custom UI (it will not give input fields for any dependent resources).
currentEnvironment - Defines what is the current environment of the service (or its dependencies). The value of this parameter should be a path in the registry. If this parameter is set, the jsp page will not show input fields for resources that are not in the given registry path.