Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add troubleshooting script button to dashboard #844

Closed
16 of 20 tasks
Tracked by #903
jillpe opened this issue Oct 6, 2023 · 4 comments
Closed
16 of 20 tasks
Tracked by #903

Add troubleshooting script button to dashboard #844

jillpe opened this issue Oct 6, 2023 · 4 comments

Comments

@jillpe
Copy link

jillpe commented Oct 6, 2023

Summary

https://assaydepot.slack.com/archives/C0313NKC08L/p1678912353694389?thread_ts=1678804802.634039&cid=C0313NKC08L

Pals would like to add a few buttons in the UI that would trigger commands that allow tenant admins to run 'data repair' tasks. They would like a paragraph near each button explaining what it does and when you'd need to us it.

Scripts to include:

  • Generate missing Workflow Roles
    • fix problems related to approving works
  • Grant groups appropriate access to all records
    • fixes issues related to users not having abilities they should for certain records

Tasks

  • Each of the following RoleService methods should be extracted to an ApplicationJob#perform method; these jobs should be an inner class within the existing RoleService (e.g. RoleService::CreateAdminSetAccessesJob). The existing methods (e.g. RolesService.grant_workflow_roles_for_all_admin_sets!) should call #perform_now on their corresponding job (this is to preserve existing method interfaces).
    • RolesService.grant_workflow_roles_for_all_admin_sets!
    • RolesService.create_collection_accesses!
    • RolesService.create_admin_set_accesses!
    • RolesService.create_collection_type_participants!
  • Create a controller end-point for these administrative functions:
    • Authorize the action via authorize! :update, RoleService
    • The job name could be a parameter in the URL (e.g. /admin/role_services/:job_name_key); thus requiring only one controller action.
    • The action should require a POST request.
    • The action should handle HTML and JSON requests; HTML should flash a notice of the job submitted.
  • Create a view for submitting these jobs
    • Each button/link will need a paragraph of descriptive text.
  • Create a link on the Admin menu to show the above view
    • The link should be wrapped by can :update, RoleService
  • Create an ability entry for can! :update, RoleService
    • Question: Is this a new role that we want to expose? Is it adequate to say that you must be an admin to be able to :update RoleService?

Consideration; the rake tasks loop through each tenant and for each tenant call the corresponding RoleService method. Put another way, these administrative actions may need to consider per tenant basis and/or proprietor.

Acceptance Criteria

  • Buttons for the following are included as a new menu option off of the admin menu.
    • Grant groups appropriate access to all records
    • Generate missing Workflow Roles
    • Create collection access records
    • Create admin set access records

Caveats

Given that there is a request for a "paragraph of text explaining each button"; we want to consider that a drop down menu option might not be ideal. This might mean a full page for administrative tasks.

Testing

Navigate to dashboard and select Data Repair menu.
Click button
Verify that appropriate job was submitted to job queue

@jillpe
Copy link
Author

jillpe commented Oct 6, 2023

Can you provide more details on this?

@ndroark
Copy link
Collaborator

ndroark commented Oct 6, 2023

This is something Kiah had suggested in Slack: "It would be possible to add a few buttons in the UI that would trigger these commands, which would make it possible for tenant admins to run these 'data repair' tasks. We’d probably want to add a paragraph near each button explaining what it does and when you’d need to use it, but actually hooking the button up to the code would be very simple."

@bkiahstroud
Copy link
Contributor

bkiahstroud commented Dec 1, 2023

Existing "scripts" that I believe would be good candidates for this ticket:

I don't think this is relevant for this task, but for visibility, these all have corresponding rake tasks here (which is why I originally called them "scripts")

@laritakr laritakr self-assigned this Dec 6, 2023
laritakr added a commit that referenced this issue Dec 8, 2023
Adds a new menu, `Data Repair` which contains buttons to submit
RolesService repair tasks as jobs.

Jobs included are:
* CreateCollectionAccessesJob,
* CreateAdminSetAccessesJob,
* CreateCollectionTypeParticipantsJob,
* GrantWorkflowRolesForAllAdminSetsJob

Refs: #844
laritakr added a commit that referenced this issue Dec 8, 2023
laritakr added a commit that referenced this issue Dec 8, 2023
Adds a new menu, `Data Repair` which contains buttons to submit
RolesService repair tasks as jobs.

Jobs included are:
* CreateCollectionAccessesJob,
* CreateAdminSetAccessesJob,
* CreateCollectionTypeParticipantsJob,
* GrantWorkflowRolesForAllAdminSetsJob

Refs: #844
laritakr added a commit that referenced this issue Dec 8, 2023
@ShanaLMoore
Copy link
Contributor

ShanaLMoore commented Dec 8, 2023

QA Results: Pass ✅

@ndroark This is ready for your review

Tested on: Staging

Testing

Navigate to dashboard and select Data Repair menu.
Click button

  • Verify that appropriate job was submitted to job queue

Acceptance Criteria

  • Buttons for the following are included as a new menu option off of the admin menu.
    • Grant groups appropriate access to all records
    • Generate missing Workflow Roles
    • Create collection access records
    • Create admin set access records

Screenshots

Create Collection Accesses ✅

image
image

Create Admin Set Accesses ✅

image

image

Creation Collection Type Participants ✅

image

image

Admin Set Workflow Roles

image

NOTE:

⚠️ Translations will be run after client QA is approved. The client should review and approve the help text of the different options as running translations costs $$. Currently only English is supported.

@jeremyf jeremyf closed this as completed Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

6 participants