Skip to content

Action class chunks target models to 200, thats makes hard to get the action details #1113

@tufankilicaslan

Description

@tufankilicaslan
  • Laravel Version: 5.7.16
  • Nova Version: 1.2.0
  • PHP Version: 7.2.10

Description:

When running a nova action, target models chunks into per 200 records, and we have no way to group action models nor understand total amount of the data from Action class. So if we want to do some operation after all actions completed, there is no way to understand this. And there is no way to get total models count in Action class before or after action run.

Steps To Reproduce:

  • Create a sample resource / model with above 200 records.
  • Create a simple action class (doesn't matter queued or sync action)
    /**
     * Perform the action on the given models.
     *
     * @param  \Laravel\Nova\Fields\ActionFields  $fields
     * @param  \Illuminate\Support\Collection  $models
     * @return mixed
     */
    public function handle(ActionFields $fields, Collection $models)
    {
        \Log::info("action called with batchId:".$this->batchId);
    }
  • Run the action, and check the log file.
  • You will see different batchIds creating for each 200 models and we have no way to find the relation between each batchId.

Possible solutions:

@davidhemphill we should access something like this: $this->modelCount , $this->totalChunks, $this->currentChunk similar to pagination module. So we can understand the operation details and total action models count.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions