Followup of #2669974: Implement the CSV parser UI

Problem/Motivation

The UI provides no way to remove or edit a custom source.

Considerations

There are multiple use cases for using a custom source:

  • To define a CSV column.
  • To define a Xpath query (when using the XML Xpath parser).
  • To provide a value that is not coming from the main source: the value can either be filled programmatically (by subscribing to the parse event) or with a Feeds Tamper plugin like "Set default value", "Copy source value", "Calculate hash" or "Rewrite".

This how these custom sources currently arise:

  1. User selects a target. From the sources dropdown that appears it selects "New source..." and fills in a source.
  2. User clicks the "Save" button to save the mapping configuration.
  3. From the sources dropdown, user selects "New source..." again and fills in a source.
  4. User clicks the "Save" button to save the mapping configuration.

Now the previous created source is still available in the sources dropdown and cannot be edited or deleted.

Proposed resolution

@irinaz proposed to add a menu tab in the UI. #2 This tab will list all custom sources.

Label the new tab 'Custom sources'

Provide edit and delete operations for listed custom sources.

Implement custom source edit form.

@MegaChriz proposed automatically removing unused custom sources on access of the mapping tab. See comments #8 #10 #13

Completed tasks

  • Create a mockup/UI design of the page.
  • Implement the UI.
    • Feeds Extensible Parsers needs to have additional fields on this form: "Raw" and "Inner XML", see the image from #14.

      Introduce a new plugin type called FeedsCustomSource.

      There is a similar named FeedsSource plugin. FeedsSource and FeedsCustomSource will have a similar purpose: delivering sources.
      FeedsSource delivers predefined sources and FeedsCustomSource will deliver custom sources.

      Concurrent work in feeds_ex module: #3209655: Integration with feeds custom source UI

    • Make some custom source plugins only available in certain contexts. For example: the xml source should only be available when the XML Xpath parser (or a parser that extends that parser) is selected.

Remaining tasks

  • Test what happens in Feeds Tamper when deleting a custom source:
    1. Create a feed type using the CSV parser.
    2. Map a CSV source called "title" to node title and a CSV source called "body" to node body.
    3. Add a Tamper for the body > body mapping. Any Tamper plugin is okay.
    4. On the Custom Sources tab, delete the custom source "body".
    5. Export the configuration and check if the Tamper configuration for "body" is removed as well.
  • Test if the CSV parser ignores sources of type "Dummy".
    1. Create a feed type using the CSV parser.
    2. Map a CSV source called "title" to node title.
    3. Map a Dummy source called "body" to node body.
    4. Import a CSV file that has columns "title" and "body".
    5. Assert that the node only has a title and body is empty. The body should be empty because the CSV parser should ignore the Dummy source.
  • Test if the XML parser from Feeds Extensible Parsers ignores sources of type "Dummy".
    1. Apply the code from #3209655: Integration with feeds custom source UI to the Feeds Extensible Parsers module.
    2. Create a feed type using the XML parser.
    3. Map a XML source called "title" to node title.
    4. Map a Dummy source called "body" to node body.
    5. Import a XML file that has tags "title" and "body" for each item.
    6. Assert that the node only has a title and body is empty. The body should be empty because the XML parser should ignore the Dummy source.
  • Test updating existing configurations:
    1. Install Feeds 8.x-3.0-alpha11.
    2. Create a feed type using the CSV parser.
    3. Map "title" to node title and "body" to node body.
    4. Update to latest dev and apply the code from this issue.
    5. Import a CSV file that has columns "title" and "body".
    6. Assert that nodes were created with title and body.

Future ideas, potential new issues/features

Some ideas that were discussed but are not blockers to completing this issue.

  • Introduce an "Add custom source" button to custom sources tab.

User interface changes

A new tab 'Custom sources' will be added to the UI.

API changes

When an unused source gets automatically deleted, it would be interesting to see how that affects Feeds Tamper configuration.
Feeds Tamper may also need to be patched to clean up their configuration when a custom source gets deleted.

We need to test Feeds Tamper out to see what happens in this case.

See comment #11

Data model changes

None.

Description current as of comment #63

Issue fork feeds-2938505

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MegaChriz created an issue. See original summary.

irinaz’s picture

Here are three options for naming/location of the tab. Content of the page Tamper can be very similar to Tamper D7.

  • Manage Sources - most consistent name, where you can edit/tamper source, remove it, and maybe later add new source(?)
  • Tamper and Manage Sources - longer name that points out what you can do in this tab
  • Tamper Sources - old name so users of D7 know exactly where to go

https://www.drupal.org/files/issues/manage-sources.png

tamper and manage

tamper sources

mattshoaf’s picture

I vote for Manage Sources, it's the cleanest and most consistent name. Tamper can add a link(s) there, and I could see other contrib modules using it as well, so I think it would be better to be agnostic in that respect.

jwineichen’s picture

Manage sources makes sense to me, but should it have "custom" in there somewhere too? Or will that tab only show up if CSV parser is selected?

MegaChriz’s picture

@jwineichen
The tab would always show up. Custom sources can be added regardless of the parser. This is because there are multiple use cases for using a custom source:

  1. To define a CSV column.
  2. To define a Xpath query (when using the XML Xpath parser).
  3. To provide a value that is not coming from the main source: the value can either be filled programmatically (by subscribing to the parse event) or with a Feeds Tamper plugin like "Set default value", "Copy source value", "Calculate hash" or "Rewrite".
jwineichen’s picture

@megachriz Gotcha. Makes total sense.

vchen’s picture

FileSize
69.37 KB

I suggest something more simpler and more in line with the Drupal Manage Field interface.

When user clicks edit, the row would then turn the source column to a text box (allowing users to edit the name) and the Target would turn into a dropdown (allowing users to edit as well).

OR, when user clicks edit, it brings them to another screen with allowing users to edit Source and Target and save.

MegaChriz’s picture

@vchen
Thanks for your suggestion! That would be a nice solution indeed. I think that there is however one problem in this issue that it won't solve: previously created custom sources not used for any target cannot be edited/deleted this way.

This how these custom sources currently arise:

  1. User selects a target. From the sources dropdown that appears it selects "New source..." and fills in a source.
  2. User clicks the "Save" button to save the mapping configuration.
  3. From the sources dropdown, user selects "New source..." again and fills in a source.
  4. User clicks the "Save" button to save the mapping configuration.

Now the previous created source is still available in the sources dropdown and cannot be edited or deleted.

Maybe unmapped custom sources should be cleanedup automatically? I wonder if that would break a particular use case?

But anyway, I think your suggestion is great, @vchen.

MegaChriz’s picture

Issue tags: +beta blocker

Adding this as a beta blocker.

jamesdixon’s picture

Here's a summary of what we decided may be a good way to move forwards:

1) If there is a source that's not mapped (ie: a garbage source) when the user goes to the mapping screen we delete it
2) We move ahead with the UI that was proposed in #7 above
3) We should look into creating a new issue for temporary targets which existed in D7 but not in D8 in case someone needs to use a source that shouldn't be mapped anywhere

MegaChriz’s picture

@jamesdixon
When an unused source gets automatically deleted, it would be interesting to see how that affects Feeds Tamper configuration. Maybe Feeds Tamper needs to be patched as well to clean up their configuration when an unused source gets deleted.

jamesdixon’s picture

That's a good point. We should note that we need to test Feeds Tamper out to see what happens in this case.

irinaz’s picture

I think that automatically removing unused sources as proposed in https://www.drupal.org/project/feeds/issues/2938505#comment-13088514 will be best solution. I do not see any use case when it will be more efficient to find unused source than to add new one. There might be a way to check programmatically if a source is used in tamper.

In this case we do not need to make any change to UI and we can keep it clean.

MegaChriz’s picture

FileSize
36.67 KB

@irinaz
Feeds Extensible Parsers in D7 does provide options for sources, like if a XML source should be raw XML. The D8 version currently has no way to expose these options. I think we therefore need additional UI for managing sources - in order to be able to complete the Feeds Extensible Parsers port.

The UI of Feeds Extensible Parsers in D7:

MegaChriz’s picture

I've made the first step for adding the custom sources UI. It is now on separate tab:

Note that there is no button for adding a custom source. That is because if we are going to delete unused sources, then adding a new source would result into an instant delete - because it is not used in mapping. I think this could be confusing for users? Do they understand they need to add sources on the mapping page?

This is how the form for editing a custom source looks like:

Feeds Extensible Parsers needs to have additional fields on this form: "Raw" and "Inner XML", see the image from #14.

To achieve this, we could:

  1. Introduce a new plugin type called FeedsCustomSource. Downside of this is that there already is a similar named FeedsSource plugin. And they both would also kinda have the same purpose: delivering sources. Only FeedsSource would deliver predefined sources and FeedsCustomSource would deliver custom sources.
  2. Try if custom sources could be baked into the existing FeedsSource plugin type. The challenge here is that a single plugin now is expected to return multiple sources. So it would somehow need to be able to return custom sources too. But these custom sources are now stored in one big list on the feed type, they are not stored per source type.
thursday_bw’s picture

@MegaChriz

Do you have a patch file that can be applied so as to see those UI's in action and see how you implemented it?

thursday_bw’s picture

1. Introduce a new plugin type called FeedsCustomSource. Downside of this is that there already is a similar named FeedsSource plugin. And they both would also kinda have the same purpose: delivering sources. Only FeedsSource would deliver predefined sources and FeedsCustomSource would deliver custom sources.

This is a perfectly sound solution. The two plugins do do two different things, ableit very similar.

2. Try if custom sources could be baked into the existing FeedsSource plugin type. The challenge here is that a single plugin now is expected to return multiple sources. So it would somehow need to be able to return custom sources too. But these custom sources are now stored in one big list on the feed type, they are not stored per source type.

This is more complicated than necessary when option 1 does the job quite well.

thursday_bw’s picture

@MegaChriz

Do you have a patch file that can be applied so as to see those UI's in action and see how you implemented it?

Seems I was out of the loop too long and missed the move to merge requests.. and missed the merge request too.

haver’s picture

I can't find the UI for editing/removing soгrces in latest dev?

MegaChriz’s picture

Status: Active » Needs work

@haver
The code hasn't been added to the dev release yet. The work for this issue also hasn't completed yet. Changes are needed in order for the Feeds Extensible Parsers module to be able to add extra fields to a custom source. See #16.

To try this feature, either checkout the issue fork branch:
git clone git@git.drupal.org:issue/feeds-2938505.git
Or apply the diff as a patch:
curl https://git.drupalcode.org/project/feeds/-/merge_requests/10.diff | patch -p1

haver’s picture

Status: Needs work » Active

@megachriz
Thank you, I've found temporary solution - exporting feed type via /admin/config/development/configuration/single/export , manually edit text and than reimporting back. Stay on alfa release.

thursday_bw’s picture

Issue summary: View changes

Updated main description to better reflect current status.

thursday_bw’s picture

Issue summary: View changes
thursday_bw’s picture

Issue summary: View changes
thursday_bw’s picture

Issue summary: View changes
MegaChriz’s picture

@bevan.wishart
Thanks for your review and for updating the issue summary! I'm currently experimenting with introducing a new plugin type called FeedsCustomSource.

thursday_bw’s picture

Issue summary: View changes

Updating description to better reflect the work currently being done for FeedsCustomSource plugin by MegaChriz

thursday_bw’s picture

I agree that a new plugin for custom sources is better than adding custom sources to the existing FeedsSource plugin.

@MegaChriz, could you clarify "Feeds Extensible Parsers needs to have additional fields on custom sources tab form: "Raw" and "Inner XML". see #16"
Does that mean we need an issue on Feeds Extensible Parsers to implement that there. Or do you mean these fields need to exist so that Feeds extensible parsers can make use of them?
Feeds Extensible Parsers module

thursday_bw’s picture

One question, and some suggestions depending on the answer:

Do we need an "Add custom source" button on the custom sources tab?

It appears that we don't as these custom sources are being generated on the mapping page as per #8

This how these custom sources currently arise:

User selects a target. From the sources dropdown that appears it selects "New source..." and fills in a source.
User clicks the "Save" button to save the mapping configuration.
From the sources dropdown, user selects "New source..." again and fills in a source.
User clicks the "Save" button to save the mapping configuration.
Now the previous created source is still available in the sources dropdown and cannot be edited or deleted.

If we do need to implement an add custom source button I will remove the reference to it in this issue description.

If we do need/want to implement an Add custom sources button on the custom sources page, then I recemmend we do not do an automatic
clean up on access to the mapping page. But rather add a 'status' column to the Custom Sources tab with values of 'mapped' or 'unmapped', and leave it to the administrator to remove any unmapped sources via the operations on that source's row.

irinaz’s picture

I vote to NOT have button "add custom source" - current flow with adding new custom sources in "mapping" tab works well. The primary goal for this page is allow cleanup of unused custom sources. Editing custom sources is also important, but it is less of priority for users now.

thursday_bw’s picture

Issue summary: View changes

I agree with @irinaz.

"current flow with adding new custom sources in "mapping" tab works well." Yes

"The primary goal for this page is allow cleanup of unused custom sources." Yes

"Editing custom sources is also important, but it is less of priority for users now." Yes

That's enough for me to use some intiative and update that description to be concise.

thursday_bw’s picture

I've just pulled down the code for this issue fork. My eyes are drawn to comment #16 and this screenshot.

Screenshot of sample new tab with custom sources rows

There is no need for the type column, we only care about custom sources.

These rows should be limited to custom sources and remove the type column.

thursday_bw’s picture

Here's a new mock up with the raw and inner html columns, and the type column removed:

MegaChriz’s picture

You are making some good points, thanks!

Re #29

Does that mean we need an issue on Feeds Extensible Parsers to implement that there.

Yes, we do. My thought is to implement this simultaneously with the custom source UI, so I'm more confident that the implementation would cover feeds_ex's needs.

Re #31

Editing custom sources is also important, but it is less of priority for users now.

For Feeds itself it is indeed less important (or even not important at all). But for Feeds Extensible Parsers I think it is vital as that module has extra options for custom sources (see #14). So I think it is needed if we want to complete the port of Feeds Extensible Parsers from D7 to D8/D9. Do you agree?

Re #33

There is no need for the type column, we only care about custom sources.

My idea behind the "Type" column is to let it indicate whether it is a XML source or a "dumb" source (ignored by the parser). Anyway, it would tell of which FeedsCustomSource plugin the custom source is. But I can imagine that in practice all configured sources would be of the same type in most cases. So the "Type" information might only be useful in advanced use cases?

Re #34
Nice mockup! I think it provides a better UX than what I'm currently working on. I hope I can make it as in the mockup after I implemented the basics of the FeedsCustomSource plugin type.

MegaChriz’s picture

I've opened a new issue branch called "2938505-custom-source-plugin-type" where you can see where I'm going with the FeedsCustomSource plugin type. Keep in mind the code is still a bit messy (missing function docs, missing comments, commented out code, etc.) and that it doesn't work great yet.
https://git.drupalcode.org/issue/feeds-2938505/-/tree/2938505-custom-sou...

As of now, I’m trying to adjust the mapping page to display a list of FeedsCustomSource plugins there:

But I get the creation form for every FeedsCustomSource plugin displayed for every mapper:

So I'm probably not doing something right yet with #states or with using subforms.

thursday_bw’s picture

Issue summary: View changes
FileSize
45.85 KB

@MegaChriz Thanks for hands on work you've put in to move this forward, I'm starting to get my head around the plugin requirements.

I noticed the editing implementation already in the MR, so I've added that back in to the description.

I have marked the "Create a mockup/UI design of the page" to tidy up the description.

Paraphrase the summary: "implement the UI including allowances for feeds extensible parsers integration" is basically where it's at, plus details of that.

The type column can be added or not at this point I suppose, these things can often become more apparent as the implementation progresses.

Let's go ahead and open the issue on feeds extensible parsers and add reciprocal links to both. I feel inclined to leave that in your hands @MegaChriz at least until if or when dig I dig deeper into the code and get a better understand the interplay of the sources and plugins.

thursday_bw’s picture

Issue summary: View changes

Updated description to reflect that the effect on feeds tamper needs to be tested and considered.

thursday_bw’s picture

Issue summary: View changes

I pushed the code I used to generate the mockup to this branch: 2938505-custom-source-mock-ui

Comparison to 2938505-custom-sources-ui: 2938505-custom-sources-ui...2938505-custom-source-mock-ui

As you can see I just cheated by directly displaying a checkbox. Having this branch gives the option for someone to tweak the mockups.

thursday_bw’s picture

Here's a demo I whipped up to explain how I think you want these custom sources to appear in the sources drop down.

Demo screencast

I have pushed the code to make this work to it's own branch, but it's a super dirty hack, enough to demo the behaviour and that's all.
Dirty hack branch: 2938505-custom-source-plugin-parser-define-demo
Dirty hack diff (2938505-custom-source-plugin-type...2938505-custom-source-plugin-parser-define-demo)

thursday_bw’s picture

OK.. I pushed some more changes to that 2938505-custom-source-plugin-parser-define-demo branch

This time to move the form altering logic into the CustomSource plugins..

So the concept here is the processor plugin assigned to a feedtype dictates which custom source(s) can alter the form.

A one to one relationship between customSource type and processor seems logical to me.

The Default custom source type here has started to become the "CSV" custom source type.

This code is really quite quick and dirty.. hopefully demonstrates a workable solution.

thursday_bw’s picture

Issue summary: View changes

Added some more contextual information to the description

MegaChriz’s picture

Issue summary: View changes

Adding a custom source on the mapping form now "works" in the branch 2938505-custom-source-plugin-type.

I'm not completely satisfied with the implementation yet, as the mapping form is making assumptions about which fields are defined on the custom source plugin. The plugins don't have any influence either on how the custom sources get saved on the feed type.

An other thing that needs to happen: some custom source plugins should only be available for certain parsers. For example: the xml source should only be available when the XML Xpath parser (or a parser that extends that parser) is selected.

thursday_bw’s picture

Going to pop down some of the ideas that are in my head.

An other thing that needs to happen: some custom source plugins should only be available for certain parsers. For example: the xml source should only be available when the XML Xpath parser (or a parser that extends that parser) is selected.

@MegaChriz

This looks very doable. The mapping form is already calling out to parsers to alter the form.. that's even how the "CSV" label gets on to the custom source option in your branch.. the parser alters the form.

By adding a mechanism so that the custom source plugins can register to a parser, the parser can then appropriately alter the mapping form.

In this way people can add custom sources that work with certain parsers simply by creating a new custom source plugin. The custom source itself decides which parsers it works with by registering with them.

thursday_bw’s picture

In reference to the automatica delte of custom sources when accessing the mapping tab. This is making less and less sense as this issue develops.

There is a delete form inplemented in the existing branches on this issue. That provides a solution to deleting custom sources, and the manage of them is easy due to the custom sources tab.

An autodelete could be confusing for users. The example of not being able to add an 'add custom source' button is already raised. By not implementing the autodelete, we can implement an add source button.

I don't see the problem that the autodelete solves, I see a couple of problems that it creates.

thursday_bw’s picture

New branch, WIP but is well on the way.

https://git.drupalcode.org/issue/feeds-2938505/-/compare/2938505-custom-...

Moves the responsibily for generating the custom source options from the MappingForm to the Parsers (ParserBase speficially).

Each parser plugin can specify what type(s) it is in it's annotation, eg xml or csv.

Each custom source plugin can specify what type of parser it will work with in it's annotation. eg xml or csv.

So, a custom source can register as compatible with csv, or xml, or csv and xml.. Parsers who's types contains xml will display custom source options for custom sources that are compatible with 'xml' parsers.

This patch works for both XML and Sitemap parsers.

It adds a 'CSV' custom source which is registered with 'csv' parser types.

It registers the xml custom source with the xml parser types.

it retains the 'custom default source' and registers that with both xml and csv parsers.

FeedsEx's Parsers will need to have the additional annotation. FeedsEx's ParseBase will need to extend Feeds' ParserBase and call the parent::mappingFormAlter from it's implementation of that method.

Feed type showing it uses a SitemapXML Parser:

Feed type with SitemapXML Parser showing XML and Default custom source options:

Feed type show use of CSV parser:

Feed type with CSV parser showing csv and default custom source options:

Feed type using a feeds_ex supplied parser:

Feed type with a feeds_ex supplied parser, showing no custom sources because the feeds_ex parsers do not register any, or alter the form.

thursday_bw’s picture

Pushed some more changes to branch: 2938505-custom-source-plugin-type-bevan

The Default Custom Source will now appear on any parser, which means, at least for now, all parsers including feeds_ex parsers get at least the default custom source available.

Have refactored a little, including converting the ConfigurablePluginBase into a trait which allows for FeedsEx/ParserBase to extend ParserBase happily and inherit the custom source compatibility.

This should take care of

An other thing that needs to happen: some custom source plugins should only be available for certain parsers. For example: the xml source should only be available when the XML Xpath parser (or a parser that extends that parser) is selected.

I can start an issue on feeds_ex and push the changes I made there too. Will call it "Custom source compatibily" or something, and we
can do the feeds_ex work in there.

thursday_bw’s picture

Issue summary: View changes

Update the description with a link to the new feeds_ex issue: https://www.drupal.org/project/feeds_ex/issues/3209655

Hopefully this helps greese the wheels a bit so we can update the feeds_ex issue as we go while this one develops.

thursday_bw’s picture

Pushed a fix to 2938505-custom-source-plugin-type-bevan. The CustomSourceEditForm was not saving the custom source type. It does now.

thursday_bw’s picture

@MegaChriz

re:

I'm not completely satisfied with the implementation yet, as the mapping form is making assumptions about which fields are defined on the custom source plugin

Could you elaborate on that?

I'm not seeing which parts of those mapping forms are making assumptions like that.

thursday_bw’s picture

I'm not sure I comprehend you rregarding this either:

The plugins don't have any influence either on how the custom sources get saved on the feed type.

Maybe you mean something like the need to add a hook/event to:


 \Drupal\feeds\Entity\FeedType::addCustomSource

  /**
   * {@inheritdoc}
   */
  public function addCustomSource($name, array $source) {
    $this->custom_sources[$name] = $source;
    return $this;
  }

Though I'm not sure of the necessity of that as the custom source plugin is providing the configuration form that informs the contents of $source on the customSourceEditForm and MappingForm via `$plugin->buildConfigurationForm()`.

...

Oh and I just noticed what you might mean about the assuming fields of the custom source.
as in the mapping form assumes 'label', 'machine_name', and 'value' in `\Drupal\feeds\Form\MappingForm::processFormState`
Label and machine name both look like definite candidates for necessary fields on all custom types.

Value maybe not? That particular method has some readibility issues.

MegaChriz’s picture

@bevan.wishart

"supported_custom_source_types" and "parsers" properties

I'm slowly going through your changes and I'm trying to understand how the property "supported_custom_source_types" on parsers works and how the property "parsers" on custom sources works. This is what you write about it in #48:

Each parser plugin can specify what type(s) it is in it's annotation, eg xml or csv.

Each custom source plugin can specify what type of parser it will work with in it's annotation. eg xml or csv.

So, a custom source can register as compatible with csv, or xml, or csv and xml.. Parsers who's types contains xml will display custom source options for custom sources that are compatible with 'xml' parsers.

I've a hard time to understand why both the parser and the custom source plugin should state to which they are compatible. It seems to me that only the parser should say which custom source types it supports. After all, the parser's implementation should actually do something with these custom sources. Except for the "Dummy" source - which could be used with Feeds Tamper.

I'm not sure either if "supported_custom_source_types" should be in the parser's annotation as I think parsers extending an other parser should automatically support the same set of custom source types by default. With it being in the annotation, every parser extending an existing one would need to add the same value for "supported_custom_source_types".

XML source type is only for Feeds Extensible Parser's XML Parser

I see the Sitemap parser now supports the "xml" custom source type, though its implementation doesn't do any specific with this custom source type. So only the XML parser from Feeds Extensible Parsers should be using it. For your interest, I added the XML source type to the Feeds code base as a temporary thing, to see what kind of effect it had on the UI of Feeds.

Thanks for your work! Sorry that it took me a while to get back on this issue. I hope you're willing to continue to team up with me on this issue. Let me know if you want that.

MegaChriz’s picture

Status: Active » Needs work
MegaChriz’s picture

It isn't ready yet, but else tests don't run.

irinaz’s picture

Issue tags: +DCCO2021

irinaz’s picture

@megachriz, thanks for updates this weekend - should we also update issue summary with completed tasks?

MegaChriz’s picture

@irinaz, I'm still working on it. Just closed the branches that I think are no longer relevant. But I do can post what I currently have. I just expect that there will be some bugs in it.

For example: we now have more types of custom sources: dummy, csv and xml. What do the XML and CSV parsers do when you define sources of type 'dummy'? I think the parsers will try to use them, while they should be ignored. If you've time today, you could test that, else I hope to have time to test that somewhere this week.
Specifically, these are the steps to test for the CSV parser:

  1. Create a feed type using the CSV parser.
  2. Map a CSV source called "title" to node title.
  3. Map a Dummy source called "body" to node body.
  4. Import a CSV file that has columns "title" and "body".

The title from the CSV file should be imported, the body value should not because it was not defined as a CSV source.
Something similar should be tested for the XML parser from Feeds Extensible Parsers.

An other important thing to test is how these changes affect existing configurations. Are existing custom sources used for the CSV parser being treated as CSV sources or as Dummy sources?

Today, I've done some work on the Feeds Extensible Parsers side of things. Mostly some small UI tweaks. And adding a custom source type for the QueryPath parsers.

irinaz’s picture

I will try to do this testing before Thursday and report back.

MegaChriz’s picture

Issue summary: View changes

@irinaz
I've updated the remaining tasks in the issue summary. Let me know if there's something unclear. I see that there's also a test to be done that involves Feeds Tamper.

MegaChriz’s picture

Status: Needs work » Needs review

Recent changes:

  • Removed XML source plugin (because this has been moved to feeds_ex in #3209655: Integration with feeds custom source UI).
  • A post update to update custom source configuration.
  • Calling custom source validation handlers when adding/editing custom sources.
  • Make sure that the CSV parser ignores "dummy" sources and added test coverage for that.

Next steps are:

  • Go through the code, see if there is code that has become redundant because of all the changes.
  • Manual testing (+ bug fixing if needed)
irinaz’s picture

I completed manual testing for remaining tasks, all four cases work as expected. This is HUGE improvement of UI.

irinaz’s picture

Issue tags: +GlobalSprint2021
irinaz’s picture

Issue tags: -GlobalSprint2021 +GlobalSprint2022
irinaz’s picture

Issue tags: -GlobalSprint2022 +ContributionWeekend2022
irinaz’s picture

Issue tags: -GlobalSprint2022 +ContributionWeekend2022
MegaChriz’s picture

I've looked through the code once more and I found some small issues, most being aesthetic, like missing a word in a comment.

I fixed the most that I found today (see latest commit message for details), for the following remarks I need to take a closer look:

  • Annotation for FeedsCustomSource is empty. Is that correct?
  • Some classes require FeedsPluginManager in the constructor instead of an interface. MappingForm uses PluginManagerInterface. Classes should probably require that instead of FeedsPluginManager. CsvParserTest and other parser unit tests would need to be updated as well.
  • In MappingFormTest a test for testing uniqueness of a custom source is removed. Is that correct?
MegaChriz’s picture

Status: Needs review » Reviewed & tested by the community

I think this one is a good to go now. Now it is just waiting for #3209655: Integration with feeds custom source UI to be finalized (for which I just added a few remarks). Because else the dev release of feeds_ex would be broken.

  • MegaChriz committed e672615 on 8.x-3.x authored by thursday_bw
    Issue #2938505 by MegaChriz, thursday_bw, irinaz, vchen, jwineichen,...
MegaChriz’s picture

Status: Reviewed & tested by the community » Fixed

Code is merged!

irinaz’s picture

This is huge - last blocker to do beta release!!! Thanks you, thank you, thank you!

Status: Fixed » Closed (fixed)

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

loopy1492’s picture

We have our site set at 3x-dev which, admittedly not a great idea. When working on a feed after module updates, we noticed that, on the Mappings page, when selecting a source, there is no longer an option for "New Source" in the dropdown.

We are running 3x-dev on Drupal 9.3.4 with PHP 8. When I go to the "custom sources" tab, it tells me to add it through the drop-downs on the Mappings page.

Something happened that isn't being caught by updb.

Switching to Alpha 11 has fixed the issue. I just wanted you to know that it's possible this might be breaking existing feeds.