Try our conversational search powered by Generative AI!

How to support drag & drop for IList<ContentReference>?

Vote:
 

Hello,

another issue we are currently facing is that the CMS (Azure environment) will restart if a CMS editor tries to use the category selector(geta optimizely categories) which is using the CategorySelectionTree.js that is loading all categories via /EPiServer/cms/Stores/contentstructure/6685 (6685  is the category-id). This is causing heavy load on the database and leads to sql timeouts after 40 seconds. We did not have this issue with Epi11. So maybe someone has an idea how to optimize the database here(we played around with Mars and connection pooling). This is an urgent production issue that needs to get fixed(we are silver partner). We also see performance issues on scheduled jobs recently causing sometimes sql timeouts so failed jobs.  

As a workaround i'm trying to support drag & drop for the categories, so that the user can assign them directly from the cms tree without needing to use the selector dialog. This does not seem to be supported. Is that a general issue or something that i should address to the geta plugin support? Has someone else the same issue and maybe a solution?

The AllowedTypes seems to be correct, isn't it?

[Display(Name = "Categories", 
	Description = "Add one or more Categories under which this Article will be tagged in, and can be filtered for.",
	GroupName = SystemTabNames.Content, Order = 30)]
[Categories] 
[AllowedTypes(AllowedTypes = new[] { typeof(CategoryData) })]
public virtual IList<ContentReference>? Categories { get; set; }

The CategoriesAttribute is the one from the plugin and added as shown in the documentation. For the sake of completeness, this is the code:

namespace Geta.Optimizely.Categories.DataAnnotations
{
  [AttributeUsage(AttributeTargets.Property)]
  public class CategoriesAttribute : Attribute, IDisplayMetadataProvider, IMetadataDetailsProvider
  {
    private readonly CategorySettings _categorySettings;
    private readonly IEnumerable<IContentRepositoryDescriptor> _contentRepositoryDescriptors;

    public CategoriesAttribute()
      : this(ServiceProviderExtensions.GetInstance<IEnumerable<IContentRepositoryDescriptor>>(ServiceLocator.Current), ServiceProviderExtensions.GetInstance<CategorySettings>(ServiceLocator.Current))
    {
    }

    public CategoriesAttribute(
      IEnumerable<IContentRepositoryDescriptor> contentRepositoryDescriptors,
      CategorySettings categorySettings)
    {
      this._contentRepositoryDescriptors = contentRepositoryDescriptors;
      this._categorySettings = categorySettings;
    }

    public void CreateDisplayMetadata(DisplayMetadataProviderContext context)
    {
      if (!(context.DisplayMetadata.AdditionalValues[(object) "epi:extendedmetadata"] is ExtendedMetadata additionalValue))
        return;
      Type[] typeArray = new Type[1]
      {
        typeof (CategoryData)
      };
      IContentRepositoryDescriptor repositoryDescriptor = this._contentRepositoryDescriptors.First<IContentRepositoryDescriptor>((Func<IContentRepositoryDescriptor, bool>) (x => x.Key == CategoryContentRepositoryDescriptor.RepositoryKey));
      additionalValue.ClientEditingClass = "geta-optimizely-categories/widget/CategorySelector";
      additionalValue.EditorConfiguration["AllowedTypes"] = (object) typeArray;
      additionalValue.EditorConfiguration["AllowedDndTypes"] = (object) typeArray;
      additionalValue.OverlayConfiguration["AllowedDndTypes"] = (object) typeArray;
      additionalValue.EditorConfiguration["categorySettings"] = (object) this._categorySettings;
      additionalValue.EditorConfiguration["repositoryKey"] = (object) CategoryContentRepositoryDescriptor.RepositoryKey;
      additionalValue.EditorConfiguration["settings"] = (object) repositoryDescriptor;
      additionalValue.EditorConfiguration["roots"] = (object) repositoryDescriptor.Roots;
    }
  }
}

Any advice is greatly appreciated.

#314454
Edited, Dec 20, 2023 13:35
Vote:
 

Have you tried reaching out to marisks Māris Krivtežs on the official GitHub page?  https://github.com/Geta/geta-optimizely-categories

#314461
Dec 20, 2023 16:25
Tim Schmelter - Dec 21, 2023 0:22
Thanks for the advice. Meanwhile i have stopped trying to use the plugin category selector since it has two major issues:
- massive db issues because it's loading all categories in parallel
- does not support drag & drop

I now select categories with the normal content selector which supports drag & drop and also does not have any issues with db performance. Since geta categories are normal content that works without a problem.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.