Action not visible when canSee = true but canRun = false #5157
-
Description:I have a destructive action with canSee and canRun rules applied to it. Given that canSee resolves to "true" but canRun to "false", the action is nowhere visible - nor in the details view, neither on the index view. Detailed steps to reproduce the issue on a fresh Nova installation:(new DeactivateResourceAction())
->showInline()
->canSee(function ($request) {
if ($request instanceof ActionRequest) {
return true;
}
return $this->resource->exists && $this->resource->isActive(); // returns true;
})
->canRun(function ($request, $role) {
return $role->users_count === 0; // returns false;
}) |
Beta Was this translation helpful? Give feedback.
Replies: 5 comments 1 reply
-
This is expected behavior, almost all selection will check |
Beta Was this translation helpful? Give feedback.
-
|
Thanks @crynobone. |
Beta Was this translation helpful? Give feedback.
-
|
I don't understand either. According to the documentation it should work as salvisb says. From https://nova.laravel.com/docs/4.0/actions/registering-actions.html#action-visibility |
Beta Was this translation helpful? Give feedback.
-
|
@crynobone If I may reignite this discussion, it would be really neat if there was a way to show an actions exists, but "grey it out" to indicate the user cannot run it at this time. I have had several cases now where users were simply not aware some functionality exists because they haven't encountered it yet and just assumed it wasn't possible in the first place. |
Beta Was this translation helpful? Give feedback.
-
|
In the next release, we are pushing a change to Actions that will make it more consistent with the expectations for what |
Beta Was this translation helpful? Give feedback.

In the next release, we are pushing a change to Actions that will make it more consistent with the expectations for what
canSeeandcanRunshould do. In short, if you can see an action, but can't run it, it will be visible but disabled in the UI.