Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FR] Add human-readable handles as comments to project config #7584

Closed
FreekVR opened this issue Feb 17, 2021 · 11 comments
Closed

[FR] Add human-readable handles as comments to project config #7584

FreekVR opened this issue Feb 17, 2021 · 11 comments
Labels
enhancement improvements to existing features project config 🐫 features related to Project config

Comments

@FreekVR
Copy link

FreekVR commented Feb 17, 2021

Description

Hi! We've been using the project config feature for a while now, and with the changes to split out config to separated files we're seeing a lot of improvements in merge conflict resolutions etc.

However, as we work with multiple developers on a single project, sometimes someone will check out an upstream branch, and forget to properly apply all the upstream project config changes, or just flat-out rebuild the config from a divergent local DB before applying the newer changes.

Anyway, sometimes this leads to some mishaps in fields disappearing from entry types where they were just added for example. We use code reviews via pull requests, but it's really hard to read the associations between different entities.

A good example would be a diff for this entry type config file for example:

image

I can't really see what's been added / changes here unless I manually go into the config/fields folder and check for the UUID.

A simple change which would be REALLY helpful would be to add a YAML comment wheever a UUID is referenced for another config file.

For example;

fieldLayouts:
  a10f84d1-1f05-4616-9de0-c5e35e7be121:
    tabs:
      -
        elements:
          -
            autocapitalize: true
            autocomplete: false
            autocorrect: true
            class: null
            disabled: false
            id: null
            instructions: ''
            label: Bedrijfsnaam
            max: null
            min: null
            name: null
            orientation: null
            placeholder: null
            readonly: false
            requirable: false
            size: null
            step: null
            tip: null
            title: null
            type: craft\fieldlayoutelements\EntryTitleField
            warning: null
            width: 100
          -
            fieldUid: 74c655a8-9bd5-41db-9402-f58841eed0ff # descriptionField
            instructions: null
            label: null
            required: false
            tip: null
            type: craft\fieldlayoutelements\CustomField
            warning: null
            width: 100

Would perhaps also be helpful for other areas:

Graphql scopes

isPublic: false
name: Frontend
scope:
  - 'sections.b24278b3-77ef-490f-8d5e-10d2dc43a481:read' # sections.article.read

Section site settings

siteSettings:
  0aedc5e6-b00f-4a0c-816a-fd98100cf2da: # myPrimarySiteEN

I'm probably missing a few areas here but you get the idea :)

@andris-sevcenko
Copy link
Contributor

I agree it would be helpful, but it probably won't happen, as it's not possible to do with the Symfony Yaml component.

Related discussion here: symfony/symfony#22516

@brandonkelly
Copy link
Member

Oh I really like this idea as well.

What if instead of saving the handles as comments, we just prepend them to the UIDs, the same way we’ve done with the YAML file names?

The contents of my config/project/fields/ folder

@brandonkelly brandonkelly added enhancement improvements to existing features project config 🐫 features related to Project config and removed enhancement labels Feb 17, 2021
@FreekVR
Copy link
Author

FreekVR commented Feb 17, 2021 via email

@brandonkelly
Copy link
Member

brandonkelly commented Feb 17, 2021

Yeah – that’s what I’m suggesting. The field handles in those file names are completely ignored on read.

@FreekVR
Copy link
Author

FreekVR commented Feb 18, 2021

Yeah maybe I misunderstood, but I thought you meant changing the project config from this:

fieldUid: 74c655a8-9bd5-41db-9402-f58841eed0ff
to
fieldUid: descriptionField--74c655a8-9bd5-41db-9402-f58841eed0ff

While I meant

fieldHandle: descriptionField
fieldUid: 74c655a8-9bd5-41db-9402-f58841eed0ff

Anyway, its probably a minor difference ;)

@brandonkelly
Copy link
Member

Oh gotcha. Yes I’m suggesting the former.

@brandonkelly
Copy link
Member

We just talked this over and have an idea for how we could possibly get the original comments idea to work, despite the YAML library not supporting it.

@andris-sevcenko
Copy link
Contributor

Just added this for the next Craft 3.6 release!
Screen Shot 2021-02-26 at 15 35 16
Screen Shot 2021-02-26 at 15 35 23

@brandonkelly
Copy link
Member

Craft 3.6.8 is out now with this change. Thanks for the great suggestion, @FreekVR!

@gbowne-quickbase
Copy link

Any chance this was undone in the 3.6.11.x branches? I touched a field and 600 files were updated removing those yaml comments!
image

@brandonkelly
Copy link
Member

@gbowne-quickbase Take a look at #7709.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement improvements to existing features project config 🐫 features related to Project config
Projects
None yet
Development

No branches or pull requests

4 participants