Problem/Motivation

In the D7 version of Feeds, you could configure a feed to run in the background (during cron runs) instead of in the UI. This is useful if you have a large feed to import and don't want to keep the browser open until the import has finished.

Proposed resolution

Let's add a new operation called "Schedule import" that will live beside the 'Import' operation. Now an user can choose whether he/she wants to import directly or wait until cron has ran.

Remaining tasks

Review.

User interface changes

On the feed page a new button called "Schedule import" appears.
On the feed listing page an operation called "Schedule import" is added to the dropbutton.

API changes

None.

Data model changes

New permissions will be added for scheduling imports. You could configure this way whether your users are allowed to import directly or import in background.

Release notes snippet

Patch will follow.

Comments

MegaChriz created an issue. See original summary.

megachriz’s picture

Status: Active » Needs review
StatusFileSize
new10.82 KB
megachriz’s picture

This renames the button to "Import in background". Hopefully, this label makes it more clear for first time users what the button does compared to the default "Import" button.

I also added some help texts. I hope these are useful.

Dynamic label?

I received the suggestion to rename the default button to "Import now", but I think I will leave it to what it is: "Import". I had the idea to dynamically rename the button to "Import" if you only would see one of the two actions. For this, I started to follow the instructions on https://www.drupal.org/docs/8/api/menu-api/providing-module-defined-loca..., but then I wasn't sure how to properly reach the feed type in ::getTitle() and got worried about possible caching issues. So I decided to keep it simple.

Status: Needs review » Needs work

The last submitted patch, 3: feeds-schedule-import-3029133-3.patch, failed testing. View results

megachriz’s picture

Status: Needs work » Needs review
StatusFileSize
new12.17 KB
new652 bytes

The test failed because since the text for the action "Schedule import" was changed to "Import in background", the test found the text "Import" as well. It was asserted that that text should not be available.

Removing that line.

  • MegaChriz committed b802efc on 8.x-3.x
    Issue #3029133 by MegaChriz: Add a "Import in background" operation.
    
megachriz’s picture

Title: Add a "Schedule import" operation » Add a "Import in background" operation
Status: Needs review » Fixed

Committed #5.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.