Problem/Motivation
As there is more progress into the plugin system (so we can switch between mock data vs real data and endpoints), we need to make sure that new additions to Svelte files do NOT rely on IDs or labels only present in the mock data.
Things like this should be avoided at all costs. Instead, it should be an endpoint where you read that data, and then you iterate through the IDs and the labels.
Steps to reproduce
Get the latest version of 1.0.x and see code like this:
let developmentVocab = {
UNDER_ACTIVE_DEVELOPMENT: 9988,
MAINTENANCE_FIXES_ONLY: 13030,
NO_FURTHER_DEVELOPMENT: 16538,
OBSOLETE: 9994
};
let developmentLabel = {
9988: 'Active',
13030: 'Maintenance Only',
16538: 'No Further Development',
9994: 'Obsolete'
}
This is data from the mock fixtures and will never work with another plugin reading from actual endpoints.
Proposed resolution
Create new endpoints for data that can be needed and have Svelte read from the endpoints and then iterate through the results.
Remaining tasks
- ✅ File an issue about this project
- ☐ Addition/Change/Update/Fix to this project
- ☐ Testing to ensure no regression
- ☐ Automated unit/functional testing coverage
- ☐ Developer Documentation support on feature change/addition
- ☐ User Guide Documentation support on feature change/addition
- ☐ Code review from 1 Drupal core team member
- ☐ Full testing and approval
- ☐ Credit contributors
- ☐ Review with the product owner
- ☐ Release
User interface changes
Svelte files will need to be refactored.
API changes
A few. New endpoints will be needed.
Data model changes
Not really if we encapsulate data in the plugin. It can return a hardcoded array, as long as that's in the plugin and not the svelte files.
Release notes snippet
Decouple front-end from the source of data so we can exchange between mock and real endpoints.
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | After.png | 143.4 KB | tim.plunkett |
| #7 | Before.png | 140.31 KB | tim.plunkett |
Issue fork project_browser-3280176
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:
Comments
Comment #2
fjgarlin commentedComment #4
tim.plunkettComment #5
fjgarlin commentedTo test this:
* Launch drupalpod <3
* Test with the (default) mock data plugin. Everything should work.
* `ddev drush config:set project_browser.admin_settings enabled_source random_data -y` <===== PURE RANDOM DATA.
* `ddev drush cr`
* Navigate to "admin/modules/browse" and test again. All requests return random data but the front-end should remain functional, which is the purpose of this issue.
Comment #6
fjgarlin commentedComment #7
tim.plunkettThis is NW so not sure if this level of feedback is appreciated at this point, but one major concern is how this breaks things if you DON'T switch the enabled source plugin.
Before

After

The initial state of the active filters is broken, their labeling is broken, the security coverage changed input types, the checkboxes alignment is gone
Comment #8
fjgarlin commentedThis feedback is perfectly valid so far. That's exactly the area I still need to work on. I need to sort out "defaults" and appearance. Thanks so much!
The "Security coverage" filter, however, should not be a radio, as that field can actually have 3 possible values, and we might want to filter by any combination, the same as the "development" or "maintenance" status. Not sure why it was made into a radio but I'm planning to keep it a checkbox because radio inputs don't really match the data model and filters in this case. I am also happy to be told otherwise, maybe I just don't know the logic behind it.
The actual values for those fields can be (from d.org, but again, it could be any number of values):
Comment #9
fjgarlin commentedComment #10
fjgarlin commentedComment #11
srishtiiee commentedThe MR looks good from my point of view, both functionality and design wise. Everything is working as expected. Also, the tabs aren't a part of the figma designs, removing those is a good idea. Marking as RTBC.
Comment #16
tim.plunkettFran walked me, Chris, Tim, and Bob through this on Zoom and all of our feedback was addressed in real time. I have a follow-up to open, but I want to get this in now. Thanks @fjgarlin for the great work!