umbraco / Umbraco.UIBuilder.Issues

Back office UI builder for Umbraco
3 stars 2 forks source link

extending an existing section has unexpected results... #37

Closed ribsdigital closed 2 years ago

ribsdigital commented 2 years ago

Describe the bug hey there matt,

we've hit an interesting one today related to extending an existing section... it might be a bug, it might how we're setting it up but we thought we'd run it by you 👍

Steps To Reproduce this is our code - we can't run both at the same time but we've left both uncommented :

namespace BCNAMyJourney.Web.Core.Components
{
    public class KonstruktConfigurator : IKonstruktConfigurator
    {
        public void Configure(KonstruktConfigBuilder builder)
        {
            builder.AddSectionAfter("media", "Search Tracking", sectionConfig => sectionConfig
                .Tree(treeConfig => treeConfig

                    .AddCollection<SearchTrackingPoco>(x => x.Id, "Entry", "Entries", "A search entity", "icon-document", "icon-documents", collectionConfig => collectionConfig
                        .SetConnectionString("umbracoDbDSN")
                        .SetNameProperty(p => p.Query)
                        .ListView(listViewConfig => listViewConfig
                            .AddField(p => p.Query)
                            .AddField(p => p.Frequency)
                            .AddField(p => p.LastSearched)
                        )
                        .Editor(editorConfig => editorConfig
                            .AddTab("Data", tabConfig => tabConfig
                                .AddFieldset("Content", fieldsetConfig => fieldsetConfig
                                    .AddField(p => p.Query)
                                    .AddField(p => p.Frequency)
                                    .AddField(p => p.LastSearched)
                                )
                            )
                        )
                    )
                )
            );

            builder.WithSection("siteAdmin").AddTree("Search Tracking", "icon-folder", treeConfig =>
            {
                treeConfig
                    .AddCollection<SearchTrackingPoco>(x => x.Id, "Entry", "Entries", "A search entity", "icon-document", "icon-documents", collectionConfig => collectionConfig
                        .SetConnectionString("umbracoDbDSN")
                        .SetNameProperty(p => p.Query)
                        .ListView(listViewConfig => listViewConfig
                            .AddField(p => p.Query)
                            .AddField(p => p.Frequency)
                            .AddField(p => p.LastSearched)
                        )
                        .Editor(editorConfig => editorConfig
                            .AddTab("Data", tabConfig => tabConfig
                                .AddFieldset("Content", fieldsetConfig => fieldsetConfig
                                    .AddField(p => p.Query)
                                    .AddField(p => p.Frequency)
                                    .AddField(p => p.LastSearched)
                                )
                            )
                        )
                    );
            });
        }
    }
}

Expected behavior the first chunk of code works as expected:

image

however the 2nd chunk of code where we're trying to add to our custom siteAdmin section is producing the following:

image

Additional context the main thing to highlight is that we're trying to add the tree to a existing custom section, not one of the umbraco core sections.

we're still playing with the code but thought we'd run this by you - do you think this is a bug, or have we messed out our code?!

mattbrailsford commented 2 years ago

hey @ribsdigital

When you say siteAdmin is a custom section, is this another Konstrukt section? or a section defined some other way? and is this the only konstrukt tree defined in that section?

ribsdigital commented 2 years ago

hey ya matt,

so siteAdmin is a section we've added ourselves to the site in question. it's not a konstrukt section.

we had another play this morning, changing the code to add it to the umbraco core 'media' section:

image

this looks more like the expected result (although i'm not sure about the '3rd party' grouping'?) so our suspicion is that it's got something to do with how we've set up the section...

we'll keep playing and report back 👍

mattbrailsford commented 2 years ago

Closing for now. Please let me know if you find any further details and I'll reopen this issue 👍