Problem/Motivation

The current Project Browser calls the unofficial Drupal.org endpoint for project data. The more-supported and future-proof way is to make an API call to the Drupal 9 site that has been built and to which project data from Drupal.org has been migrated.

Proposed resolution

Make the API endpoint semi-configurable (i.e. leverage config without a UI), and point it at the Drupal 9 site. Rewrite all the API layer to use JSON:API from the data coming back from that site.

Remaining tasks

  1. change the endpoint
  2. rewrite the API-digesting code
  3. ensure Drupal 9 site is ready
  4. ensure Drupal 9 migrations are ongoing

API changes

Lots. :)

Data model changes

???

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

chrisfromredfin created an issue. See original summary.

fjgarlin’s picture

Title: Switch to using temporary Acquia site - Drupal 9 JSON:API endpoint » Switch to using (the future) Drupal 9 JSON:API endpoint
Assigned: Unassigned » fjgarlin
Related issues: +#3278352: Scaffolding and refactoring to use source plugins consistently

Adjusted title slightly as this issue is exactly what I am working on. Assigning to me. I will create an issue fork so we can see the progress.

Note that it is built from the changes introduced here: https://www.drupal.org/project/project_browser/issues/3278352

fjgarlin’s picture

The referenced issues changes are added to this MR as they're useful/needed.

fjgarlin’s picture

Waiting for related issues to go through as this one relies on those.

fjgarlin’s picture

Include the correct namespace for composer as separate property here too.

bnjmnm made their first commit to this issue’s fork.

tim.plunkett made their first commit to this issue’s fork.

narendraR made their first commit to this issue’s fork.

narendraR’s picture

I have moved the plugin in project_browser_test module in MR#308. May be some other work needs to be done here hence not changing assignee/Status.

fjgarlin’s picture

Assigned: fjgarlin » Unassigned

Added some more feedback, really small.

Actually, the only reason why I was assigned to it was to make sure I was able to keep up with the rest of PB changes on this issue, but as we're now making ready to be in the module, there is no need to have me as assignee.

Other than the small feedback I added, I think we can start asking for reviews. @narendraR, @bnjmnm and myself have worked on it, so maybe a further review from @tim.plunkett would be great.

MR#308 is the one to review.

narendraR’s picture

Status: Needs work » Needs review

Addressed feedback and marking as needs review.

tim.plunkett’s picture

Priority: Normal » Major
Issue tags: +core-mvp
fjgarlin’s picture

Integrated the new logo field, which will be a separate field on projects on the new www.drupal.org D9/10 version.

This was a follow-up from #3334783: Integrate GitLab Logo png to Drupal.org D7 project pages and #3334807: Repository logo on projects pages styling as the repo gitlab avatar is now displayed on the project pages.

lostcarpark’s picture

This is fantastic progress.

I think we just need to be aware that when this is promoted to the D9 endpoint, it will have the effect that many projects that have logos in the first image will lose their logos in Project Browser.

fjgarlin’s picture

We can just define the policy here #3277464: [PLAN] Where to fetch image from? and then implement the logic in this issue.

We can just fetch from the new D9 logo_url field (this is what's done right now), or add a fallback if needed.

As for the "losing" logos, taking a first image as a logo doesn't make it a logo (there are some comments about it in the linked issue). Maintainers that do worry about their logo will quickly update, and as far as I know, all the logo suggestions that we will make to the top 100 will also be made with the recommendation of adding it as logo.png to the repo.

Once users start seeing their modules showing up in project browser, they'll change logos, descriptions, etc and the advantage of the live endpoint is that the changes will show up in real-time.

In any case, I'm happy to implement whatever is decided.

chrisfromredfin’s picture

@fjgarlin - Can you confirm that logo_url is only being used in the D9 version in this branch? Right now, those who have their logo as logo.png will _never_ see that appear for PB data generated from the fixture, because logo_url isn't available from the D7 API?

OR, is it and we could actually update the fixture generation code to use it? (I don't see it, say, here: https://www.drupal.org/api-d7/node.json?nid=640498 )

fjgarlin’s picture

Correct Chris. It's not part of the json output.
On D7, we check it (and cache it) on the fly from the gitlab avatar URL, no field required.
On D9, this is a field that checks the above URL, and populates it.

We could alter the fixture generation to check the gitlab avatar and set it as logo. That won't be a difficult one. I'm happy to address it (best on a separate issue).

bbrala’s picture

I think it might also need a rebase? :)

fjgarlin’s picture

Status: Needs review » Needs work

It seems that markup has changed and the CSS selectors in the tests are no longer up to date. I will try to work on them.

fjgarlin’s picture

Status: Needs work » Needs review

Ok, a lot of markup changed since the test was written.
All feedback that was given at DrupalCon was addressed and all the tests have been fixed.

Ready to review again.

bbrala’s picture

Reviewed the code for the JSON:API source. Seems there is an testing issue left though.

fjgarlin’s picture

Tests are green now. I forgot to propagate the change to another part of the file. I love having tests.

bbrala’s picture

Status: Needs review » Reviewed & tested by the community

Went through the last commits, changes look as expected. Only a small comment on a comment (lol), but that is probablly nothing.

RTBC if i may ;)

chrisfromredfin’s picture

Title: Switch to using (the future) Drupal 9 JSON:API endpoint » Prepare to switch to using (the future) Drupal 9 JSON:API endpoint - implement tests, etc.
Status: Reviewed & tested by the community » Fixed

Woohoo! This is a major milestone step forward, and I can confirm it's not breaking anything in the UI. Renaming issue and filing follow-up.

Status: Fixed » Closed (fixed)

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