[Workbench] Add lock button for collection display to enable rename & delete
Because renaming or deleting a file changes the portable data hash of a collection, we want to warn the user of the consequences before allowing them to do that.
The proposed mechanism is a lock icon which defaults to locked and when clicked to unlock pops up a warning dialog that the user needs to dismiss.
Text of warning dialog - "Changing the contents of the collection, including renaming files, will change its Portable Data Hash (PDH)"
OK = unlock and enable file delete & rename
Cancel = collection remains locked
#1 Updated by Radhika Chippada about 2 years ago
- Assigned To set to Radhika Chippada
The lock / unlock is at UI level only. For ex: if I unlock, and close the browser and reopen in a new browser, the collection will be in "locked" state again.
When the collection is "locked", the file trash and pencil icons, and Upload tab should be either hidden or disabled.
#4 Updated by Radhika Chippada about 2 years ago
Branch 11365-collection-lock-button implements:
- Add a "lock" button for collection#show page with confirmation dialog
- On collection page load, (since the collection is in locked state on page load), disable the Upload tab, the pencil icons on files (rename option) and trash icon on files
- On unlock, they are enabled and accessible
- When the collection is locked, the drop down button "Selection... "-> "Remove selected files" is disabled even when one or more files are selected using the checkbox(es). Only when the collection is "unlocked" this selection option is enabled (if one or more files are selected)
- One caveat here is that if the user clicks on the checkboxes and clicks on Selection... and then goes and unlocks the collection, this button event will not be fired and will need the user to toggle one or more checkboxes to re-fire the event
- Another caveat is with the Upload tab. If a user clicks on lock and unlocks the collection, transitions into the Upload tab and then goes and locks the collection again, the user can still work in the Upload tab (since he was already here). It doesn't seem like putting in effort to prevent this edge case is worth the while
#5 Updated by Lucas Di Pentima about 2 years ago
Some cosmetic questions:
- Seems to me that the lock/unlock icon is too small in comparison to the buttons on its side. It may be difficult to spot by the users, if we don’t have any bigger icon, maybe we can place it on the left side so it’s more visible?
- Can the lock icon have a tooltip explaining its purpose? Or maybe the disabled buttons to have an alternate tooltip to explain why they’re disabled?
- Typo on the user warning: ‘portalble'
apps/workbench/test/integration/collections_test.rb:377- Typo on the test name
- Can the unlock code on the tests be moved somewhere to be reused as a func?