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

Script to lock Couch DB objects en-masse #7878

Closed
Tracked by #7877
akhenry opened this issue Oct 9, 2024 · 2 comments
Closed
Tracked by #7877

Script to lock Couch DB objects en-masse #7878

akhenry opened this issue Oct 9, 2024 · 2 comments
Labels
notable_change A change which should be noted in the changelog type:enhancement verified Tested or intentionally closed

Comments

@akhenry
Copy link
Contributor

akhenry commented Oct 9, 2024

Is your feature request related to a problem? Please describe.

See #7877 for description of broad problem being solved here.

Describe the solution you'd like

A script to lock Open MCT Domain objects in Couch DB en-masse. This can be achieved by setting the locked property on a domain object.

The scripting should take as input:

  1. The based URL for a couch server
  2. The name of the database to operate on
  3. The object to lock
  4. A user-name and password for authentication purposes

The script should set the locked property on the target object and all of its children.

The script should support integration with existing ground scripting infrastructure by defaulting to environment variables for all script inputs.

@akhenry akhenry added this to the Build 9 RC11 milestone Oct 9, 2024
@akhenry akhenry added the notable_change A change which should be noted in the changelog label Oct 9, 2024
@akhenry akhenry changed the title Develop script to lock Couch DB objects en-masse Script to lock Couch DB objects en-masse Oct 9, 2024
@akhenry
Copy link
Contributor Author

akhenry commented Oct 9, 2024

Testing Notes

Locking

  1. Identify a folder with a a large number of complex objects with many layers of composition (eg. "Discipline Displays").
  2. Note the identifier keystring for this object (eg. 086f5c1e-1935-4874-9b33-ab5629e9b80a)
  3. Execute the script to lock the identified object tree. The specifics of the test environment will be provided separately :
    node src/plugins/persistence/couch/scripts/lockObjects.mjs -d <database name> -l -o <object keystring> --user <admin user> --pass <admin password>
  4. The script should execute with no errors. Scroll through the results and confirm that they look like:
    {"ok":true,"id":"086f5c1e-1935-4874-9b33-ab5629e9b80a","rev":"5-086f5c1e-1935-4874-9b33-ab5629e9b80a"}
  5. Navigate to the target object in Open MCT. If already navigated you may need to refresh to reflect the new locked status
  6. Confirm that the target object now has a lock icon in the browse bar at the top of the object view:
    Screenshot 2024-10-10 at 11 55 19 AM
  7. Verify that the icon doesn't activate the 'pointer' (hand/finger) cursor, doesn't look like a button or have c-button CSS classing on it. Hover over the icon and verify that a tooltip is displayed that reads "Locked for editing, cannot be unlocked."
  8. Browse through various descendants of the target object and confirm that they too show the lock icon in the same way.

Unlocking

  1. Execute the script to lock the identified object tree using the same arguments used to lock the object tree, but using the -u modifier instead of -l in order to unlock objects:
    node src/plugins/persistence/couch/scripts/lockObjects.mjs -d <database name> -u -o <object keystring> --user <admin user> --pass <admin password>
  2. The script should execute with no errors. Scroll through the results and confirm that they look like:
    {"ok":true,"id":"086f5c1e-1935-4874-9b33-ab5629e9b80a","rev":"5-086f5c1e-1935-4874-9b33-ab5629e9b80a"}
  3. Navigate to the target object in Open MCT. If already navigated you may need to refresh to reflect the new locked status
  4. Confirm that the target object now has an unlock icon in the browse bar at the top of the object view:
    Screenshot 2024-10-09 at 4 28 27 PM
  5. Browse through various descendants of the target object. Displays should show the unlocked icon as they are user-lockable. Folders should not, they are not user-lockable.

@akhenry
Copy link
Contributor Author

akhenry commented Oct 10, 2024

@unlikelyzero to test

@akhenry akhenry added the verified Tested or intentionally closed label Oct 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
notable_change A change which should be noted in the changelog type:enhancement verified Tested or intentionally closed
Projects
None yet
Development

No branches or pull requests

1 participant