OneIdentity / IdentityManager.Imx

HTML5 source code for Identity Manager web apps
Other
26 stars 107 forks source link

Metadata 'Description' fields missing from entityschema endpoint #148

Closed NielsDeGroot closed 3 weeks ago

NielsDeGroot commented 4 weeks ago

I want to display the metadata description but it seems to be missing from the entityschema endpoint

projects\qer\src\lib\identities\identity-sidesheet\identity-sidesheet.component.ts console.log(this.data.selectedIdentity.GetEntity().GetColumn('FirstName').GetMetadata().GetDescription()) This returns: undefined

If you look in the schema end-point: https://.../apiserverdev/imx/entityschema There you will find that most columns do not contain the metadata 'Description' field = Commentary@DialogColumn

There are columns that contain the metadata field 'Description' these seem to be hard-coded inside the API-server. So maybe this was done to optimize the size of the schema json? Looked in the Admin portal to see if there was an option to enable this per column/table. Also checked if there was a property on the DialogColumn or DialogTable to enable this.

Examples from json response /imx/entityschema

Missing the metadata Description: "portal/admin/person": { "TypeName": "Person", ... "Properties": { ... "FirstName": { "ColumnName": "FirstName", "Type": 6, "Display": "First name", "MinLen": 1, "MaxLen": 64 },

Contains the metadata Description: "portal/attestation/approve": { "TypeName": "AttestationCase", ... "Properties": { ... "SupportsAssignmentAnalysis": { "ColumnName": "SupportsAssignmentAnalysis", "Type": 0, "IsReadOnly": true, "Display": "Assignment analysis supported", "Description": "Indicates whether assignment analysis is supported for the type of the attested object." },

My question: why is the metadata description field missing from the entityschema and how can it be inserted?

Thank you and regards, Niels

hannoquest commented 3 weeks ago

Hi @NielsDeGroot

This is intentional. The reason is the way that Commentary@DialogColumn is being used in the data model. It is a technicla description of the property's role, and not primarily designed to help the user understand what information needs to be entered for the property (if any).

It was determined in UX testing that, in the general case, mapping the Commentary@DialogColumn to the entityschema's description would result in a lot of less-than-helpful info popups/tooltips.

We still have descriptions for some fields, and it is possible (through an API plugin) to enable the description mapping for specific properties. If you want to try that, I can put together some code that you can use in an API plugin.

NielsDeGroot commented 3 weeks ago

Hello @hannoquest

Thank you for the quick reply and clarifying this. If you could provide some code examples, that would be great!

hannoquest commented 3 weeks ago
using QBM.CompositionApi.Definition;
using QBM.CompositionApi.Dto;
using QER.CompositionApi.Portal;
using VI.DB.MetaData;
using VI.DB.Sync;

namespace CCC.CompositionApi
{

    public class EnableDescriptionPlugin : IApiProviderFor<PortalApiProject>
    {
        public void Build(IApiBuilder builder)
        {
            var modsvc = builder.Resolver.Resolve<IModifierService>();
            var personTable = builder.Resolver.Resolve<IMetaData>().GetTable("Person");

            // Set the description for all person columns. You could use different tables
            // and columns here.
            foreach (var col in personTable.Columns)
            {
                modsvc.GetPropertyModifiers(col.Table.Tablename, col.Columnname)
                    .Add(new PropertyModifier
                    {
                        Description = MultiLanguageStringData.FromColumnDescription(col)
                    });
            }
        }
    }
}