Environments page
This page will provide master -> detail -> detail -> detail functionality. The user will be able to add environments, the applications for the environments, the services for the environments and lastly the components for the services.
The only environments that can be entered are within the scope of the roles the user has admin privileges for.
The master (environments) is an interactive report. This is because I used the wizard to create the page, and it's a "Report with form on a table".
I've manually added to the region a select list that shows the roles for a user. When creating a select list based on a sql query, the query has to return two values, the display value and the item value. The first column returned by the query is the display, the second is the item value. In my example below I concatenated the role_id so I could visually see the item value.
select role_name||' - '||role_description||' - '||role_id, role_id from ui_roles
where role_id in (select role_id from ui_admin_users where email_address = lower(:APP_USER) and role_name != 'ui_role_admin')
order by role_name
Display null values is set to Yes and the Null display value is "-- select a role --"
For the sql query for the report, added where role_id = :P6_ROLES
Must remember to add P6_ROLES to page items to submit.
Change create button action to "submit page"
Then added branch in processing section to go to page after submit. and add the role_id to the set items in the editing of the page in the branch. Target it the column in the modal, source is the select list. also added clear cache of page 7. This was to make sure it's always creating new environment
Next is to have logic that disables the create button when no role has been selected.
Did this using dynamic action. on change, item p6_roles. condition item is null. true action disables create button, false action enables create button.
When the modal form closed, the underlying report did not refresh. To fix that created a dynamic action on the reports page.
da: Env DLOG Close
Event: Dialog Closed
Selection Type: JavaScript exp
JavaScript Expression:
this.data && this.data.dialogPageId === 7
on true action - refresh the environments region
changed the interactive report to interactive grid. had to get the ids populating again
to move roles select list to left, changed label column span to 1.
Display null values is set to Yes and the Null display value is "-- select a role --"
For the sql query for the report, added where role_id = :P6_ROLES
Must remember to add P6_ROLES to page items to submit.
Change create button action to "submit page"
Then added branch in processing section to go to page after submit. and add the role_id to the set items in the editing of the page in the branch. Target it the column in the modal, source is the select list. also added clear cache of page 7. This was to make sure it's always creating new environment
Next is to have logic that disables the create button when no role has been selected.
Did this using dynamic action. on change, item p6_roles. condition item is null. true action disables create button, false action enables create button.
When the modal form closed, the underlying report did not refresh. To fix that created a dynamic action on the reports page.
da: Env DLOG Close
Event: Dialog Closed
Selection Type: JavaScript exp
JavaScript Expression:
this.data && this.data.dialogPageId === 7
on true action - refresh the environments region
changed the interactive report to interactive grid. had to get the ids populating again
to move roles select list to left, changed label column span to 1.
Comments
Post a Comment