V8-archive: Allow admins to see soft-deleted items

Created on 23 Apr 2019  ยท  25Comments  ยท  Source: directus/v8-archive

Bug Report

I can't see soft-deleted items as the admin user.

Steps to Reproduce

  1. Be an admin
  2. Create a item and set status to deleted
  3. Item should not be visible in the list.

Expected Behavior

See item after soft-delete.

Actual Behavior

Item is not visible in the list view.

Technical Details

  • Device: Macbook
  • OS: macOs
  • Browser: Chrome
  • Directus App: 7.1.0
  • Directus API: 2.0.20
enhancement

Most helpful comment

Something like this, where the "more" dots on the right of each collection have an option to "Empty Trash Permanently" or "View Items in Trash" which would take you to the Item Browse page filtered by deleted status (only can be seen by admins).

Directus 8 โ€“ Settings Trash

All 25 comments

Can also confirm this in the latest demo.

Also, the status dots aren't shown:
grafik

Hey @mimamuh โ€” I believe that this should be a Feature Request instead of a bug report. The original idea behind soft-delete was that it was truly gone but that it could be resurrected from the database if needed. That said, seeing as how some users might not have direct database access, I think this would be a good change to have.

@Nitwel โ€” status dots not showing up seems like an unrelated issue (and much more pressing). I am still seeing the dots locally so I wonder if someone just messed up the demo settings. We can check again after it resets (on the hour). If it _is_ still a problem, would you mind opening a new ticket for that one?

@benhaynes Okay, sorry for that. I was not sure because of https://github.com/directus/app/issues/174, it seemed to me it was already a feature? Thx for your help!

Oh, you are 100% right. Maybe @rijkvanzanten was incorrect... but either way we should look into this. Maybe it is an option (and broken) or it's not and should be! Either way, we'll check it out!

The thing is, especialy for newcomers, its not really clear that they "soft delete" the item when changing it to deleted. Even I thought it would just display in the database as deleted and not being removed. To make this more clear, we could add a delete prompt when soft deleting it so the user understands what he is doing.

Hmm, do you not get this alert when deleting an item?

Screen Shot 2019-04-23 at 1 18 20 PM

The idea was that the App/API treats soft and hard delete the same (other than deleting from the database). Still, I do agree that Admins should probably have access to see soft-deleted items.

Nope, I'm not getting any popup when soft deleting, only when deleting normaly:

GIF

Hm, I think I would rather change both delete options to a soft-delete per default for both 'buttons'.
From a UX perspective it is confusing to me having the delete-button doing something different than the soft-delete radio option ... that is an issue to me too. Because it is hard for a non techy person to understand the difference.

From a UX perspective I would solve it like that:

  1. Both buttons are soft-deletes per default.
  2. When a item is in deleted state there is a new button shown instead of the trash bin button: delete permanently

As an alternative I would rename the deleted status to deactivated and keep the current behaviour of the buttons, then it would be clearer to to me.

Ahhh, @Nitwel โ€” I always use the delete button in the Item Detail header (which maps to soft-delete if one exists)! You're absolutely right, we need to enforce that check on the status interface too! Would you mind opening a ticket for that?

@mimamuh โ€” both are doing the same thing... and we need to treat the UX the same (eg: show the same confirmation on the status interface).

I think we would want to separate any "delete permanently" function into the Settings (only Admins have access to Settings) so that there's a clear distinction. We would have a "Cleanup" Settings page that lets you empty the trash on a per-collection basis. Also, Admin's would be able to view soft-deleted items through the normal Browse page and resurrect them individually.

Do we all agree with this approach?

I also really like the idea that when somebody softdeletes an item, the item doesn't get 100% disconnected from directus but maybe is still accessable in a section of the admin panel. So if somebody non admin deletes something, admins could recover it easily. And in the new view there could be a clear trashbin button, which deletes all items in the trashbin completly.

Aaah, okay. :) I'm too new to directus. I really thought using the 'delete' icon button would remove it permanently and the status is a soft-delete.

I see two things and they are somehow independent from each other:

  1. Who can resurrect item?
    Here I would definitely love that non-admin users can change a soft-deleted item back again too. It is a common concept like the trash bin on desktop. And it is a good UX principle to always allow users to revert their changes in case they do something on mistake without asking an admin. So it would be cool if they are able to recover stuff.

  2. Who can delete permanently?
    Actually I think it is also a technical question how directus manages the data behind all of that and things like relations, ... so I don't know what a good idea is here, I'm not familiar enough with directus and the implication it could bring. So maybe it should just be an admin thing, ... but which admin likes to go every X weeks/month and permanently delete stuff? I don't know. Maybe also editor should be able to do so when I allow them by permissions for specific tables? I think it is highly based on the use case but also the philosophy of directus.

In my use case I wouldn't have a problem if editors can permanently delete some of the data if the warnings are made right from a UX perspective. It depends. But I think it is more of an admin task in general.

@Nitwel โ€” Whether a table hard or soft deletes an item is solely based on if it has a status field and if that status mapping has a soft-delete option. That way the admin can decide if items are precious enough to keep around (articles) or not (keywords) on a per-collection basis.

@mimamuh โ€” the only issue I see here is that choosing the status's soft-delete option should act the exact same as clicking the trash-can in the header. I think that soft-delete should be "transparent" to the user so that they treat them equally โ€” it's up to the admin what action they want to be performed when deleting.

  1. Right now, only someone with direct database access can resurrect soft-deleted items. But this ticket is for an enhancement to allow the admin role to do this within the App (or API) too. If you want a non-admin to be able to resurrect deleted items you can just create a new status mapping called "Deleted" and _don't_ mark it as soft-delete... this is essentially what you're looking for.

  2. Right now, if a collection has a soft-delete status option then no one can truly delete an item from the App/API. If the collection does not have a soft-delete status, then all items are permanently deleted. This gives the admin control over how data is deleted (soft/hard) and was intended. However once this ticket is implemented, admins will be able to "empty trash", as it were, from within the App.

I'll design a Settings pane called "Trash" and then we can continue the discussion. :)

Something like this, where the "more" dots on the right of each collection have an option to "Empty Trash Permanently" or "View Items in Trash" which would take you to the Item Browse page filtered by deleted status (only can be seen by admins).

Directus 8 โ€“ Settings Trash

Okay, now I start to realize how the implementation works, nice. :D
Maybe it would be cool to document this case in the docs. But probably it is already the case?

From a technical point of view I'm totally on your page:
For some collections I can enable soft-delete, for others hard-delete - makes sense especially when I think about directus as a data management tool.

I was more thinking from a UX point of view for editors when I approached directus and was wondering, why the status deleted isn't visible in the list anymore and was not aware of the Status Mapping setting, but it makes sense.

Because when I read the options default of status: draft - published - deleted; I thought the editor is able to see soft-deleted items on default too and can change the status to published again, ... but it is configured to be more of an admin thing on default ..., so deleted is deleted.

So you're design makes sense to me from the technical side for admins. Of course, admins have to know how it works and it is not easy to understand it without explanation first. I think the implementation and your design makes sense now.

Just one question: When I set the Status Mapping for one of the options to soft_delete: true, only then it is part of your list in the design?
So if I add another options to the status field, say "permanently deleted" and add the Status Mapping option to soft_delete: true for that, it will be part of the bin too, right?

So if I add another options to the status field, say "permanently deleted" and add the Status Mapping option to soft_delete: true for that, it will be part of the bin too, right?

The one question I have to add to this is what should the app do if you have two or more statuses that are marked soft delete? If you hit the delete button, to what status should the app set the item?

@rijkvanzanten No, I just would have one status for the soft-delete of course. I wanted to know how the implementation works and if it still works when change the option which is responsible for the soft-delete.

I finally just tried it and it works. And I assume it will also work with the Bin page.

The whole concept makes sense for me now. I just would give it a section in the docs, maybe under Guides -> Soft Deletes and how you can use it to give kind of a "soft-delete" to editors too. I just added a 'disabled' option but with soft_delete: false. Quite nice! But not obvious out of the box to at least me who had to implement it. :)

@rijkvanzanten โ€” adding more than one soft-delete option would be a misconfiguration... but we could always just use the first one if we needed a fallback.

@mimamuh โ€” I've added a ticket to the Docs repo. We're pretty busy right now, but hopefully someone (internal or external) will find time to add this soon! :)

@benhaynes @rijkvanzanten How about using a status archive instead of a delete ๐Ÿค” That would give a clear perception of what it does. And we can add an option in info pane to show archived items in the listing.

@theharshin โ€” the status mapping is completely open, so admins can name the soft-delete option whatever they want.

Since users can't un-delete/un-archive items, I think it's important to make this _seem_ like a permanent action โ€” so I prefer delete instead of archive... but again, the admin can name it whatever they'd like.

One important thing we can do is to _not_ show the soft-delete option in the status interface. That removes the confusion around having this in two places... and keeps the "delete" button in the header consistent.

I do kinda like the idea of a "Trash" section in the Collection sidebar (admins only). That might be a better place for emptying the trash, instead of putting that in the Settings where it might be missed.

One important thing we can do is to _not_ show the soft-delete option in the status interface. That removes the confusion around having this in two places... and keeps the "delete" button in the header consistent

I think this is the best way as it is not a good idea to mix up system-generated status and user-generated status and confuse the users. Right now, for me, the status field is a shady thing which does something in the background and I'm not aware of it ๐Ÿ˜„

to mix up system-generated status and user-generated status and confuse the users

There's no system generated status. I think you're confused with the default value of the status interface.

@rijkvanzanten Hmm, I totally missed this soft_delete key thing. I've used the default statues while creating a collection, so I thought those status are system generated ๐Ÿ˜…

I know this status thing is too complex to explain to general users but I found a great UI for this in ClickUp app. I'm attaching a screenshot of UI here just for a reference.

image

Love this! I've created an App Feature Request to add it for managing the status mapping: https://github.com/directus/app/issues/1570

Having a solid interface to setup the statuses instead of relying on a JSON object would be a great interface to have ๐Ÿ˜„

To achieve better clarity/visibility, we are now tracking feature requests within the Feature Request project board.

This issue being closed does not mean it's not being considered.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gitlabisbetterthangithub picture gitlabisbetterthangithub  ยท  3Comments

binary-koan picture binary-koan  ยท  3Comments

magikstm picture magikstm  ยท  3Comments

andgar2010 picture andgar2010  ยท  3Comments

Nitwel picture Nitwel  ยท  3Comments