umbraco / Umbraco-CMS

Umbraco is a free and open source .NET content management system helping you deliver delightful digital experiences.
https://umbraco.com
MIT License
4.4k stars 2.66k forks source link

Angular entityResource does not return 'alias' for DocumentType #15023

Open chrden opened 10 months ago

chrden commented 10 months ago

Which Umbraco version are you using? (Please write the exact version, example: 10.1.0)

12.2.0

Bug summary

The angular entityResource does not return a value for the 'alias' property when "DocumentType" is passed to the type parameter

Specifics

When injecting the entityResource into an angular controller, and then calling the getAll(type, postFilter) method, the resulting array of Document Types always returns an empty string for the alias property.

It's not made clear from the below documentation what the result object should look like but both the contentTypeResource and elementTypeResource return the alias property correctly populated https://apidocs.umbraco.com/v12/ui/#/api/umbraco.resources.entityResource

I found this when upgrading to Umbraco v12.2.0 as we were previously using contentTypeResource but a change was made to restrict element types from being returned and we need to be able to retrieve a complete list of all Document Types, regardless of whether or not they are an element type: https://github.com/umbraco/Umbraco-CMS/commit/b2831dcd5efaf84c09bd2bfc7a2b4ce26a24b200

image

Steps to reproduce

  1. Inject entityResource into an angular controller
  2. Call getAll("DocumentType")
  3. Review returned object to find alias property is always empty

Expected result / actual result

alias property is correctly populated when calling entityResource.getAll("DocumentType")

github-actions[bot] commented 10 months ago

Hi there @chrden!

Firstly, a big thank you for raising this issue. Every piece of feedback we receive helps us to make Umbraco better.

We really appreciate your patience while we wait for our team to have a look at this but we wanted to let you know that we see this and share with you the plan for what comes next.

We wish we could work with everyone directly and assess your issue immediately but we're in the fortunate position of having lots of contributions to work with and only a few humans who are able to do it. We are making progress though and in the meantime, we will keep you in the loop and let you know when we have any questions.

Thanks, from your friendly Umbraco GitHub bot :robot: :slightly_smiling_face:

kjac commented 10 months ago

Hi @chrden,

Thank you for reaching out 😄 apologies for the belated response, and thanks for putting in the effort to make this issue report so detailed 💪

I can confirm that the alias is indeed empty when using entityResource.

The following code:

image

...produces this log message:

image

This applies to any entity type, it is not limited to document types. The screenshots above is from V10, so this has been around for a long time.

Unfortunately there is no easy fix to mend this. The document type Alias is simply not available when mapping entities to their response models. This has to do with how the EntityRepository is built.

Still, I'm going to put this up for grabs, if anyone out there would like to have a go at mending it. A fix should ensure that the alias property is fetched by the EntityRepository and mapped by the EntityMapDefinition, and should include both document, media and member types.

github-actions[bot] commented 10 months ago

Hi @chrden,

We're writing to let you know that we would love some help with this issue. We feel that this issue is ideal to flag for a community member to work on it. Once flagged here, folk looking for issues to work on will know to look at yours. Of course, please feel free work on this yourself ;-). If there are any changes to this status, we'll be sure to let you know.

For more information about issues and states, have a look at this blog post.

Thanks muchly, from your friendly Umbraco GitHub bot :-)