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

[BUG] Handle Reference fields as grid columns #808

Closed
herflis opened this issue Aug 26, 2020 · 0 comments
Closed

[BUG] Handle Reference fields as grid columns #808

herflis opened this issue Aug 26, 2020 · 0 comments
Assignees
Labels
admin-ui bug Something isn't working
Milestone

Comments

@herflis
Copy link
Contributor

herflis commented Aug 26, 2020

🐜 Bug Report

There's a hard-coded list of field names that are reference fields to handle them as grid columns

export const isReferenceField = (fieldName: string, repo: Repository, schema = 'GenericContent') => {
  const refWhiteList = ['AllowedChildTypes', 'AllRoles']
  const setting = repo.schemas.getSchemaByName(schema).FieldSettings.find((f) => f.Name === fieldName)
  return refWhiteList.indexOf(fieldName) !== -1 || (setting && setting.Type === 'ReferenceFieldSetting') || false
}

It is not okay when you want to work with other reference fields or use them as visible columns in custom drawer item grids

📦 Package / Application

@sensenet/sn-app

📃 Version

latest

🐜 Describe the bug

image

👉 Steps To Reproduce

  1. Login to snover-service.test.sensenet.com with admin
  2. Go to /Content/Tasks
  3. Add a new Task with Status: pending and Notified:false
  4. open personal-settings
  5. Add the following json
{
   "theme": "dark",
   "default": {
      "drawer": {
         "items": [
            {
               "itemType": "CustomContent",
               "settings": {
                  "icon": "AddAlert",
                  "title": "Notify",
                  "appPath": "notify",
                  "root": "/Root/Content/Smartfolders/Notify",
                  "columns": [
                     "RelatedRepository",
                     "TaskType",
                     "Status",
                     "Notified",
                     "Actions"
                  ],
                  "description": "List of accounts that should be notified"
               }
            }
         ]
      }
   }
}
  1. Open the newly created menu

😯 Current behavior

[Object, object] is displayed in the reference field's column in the grid

🤔 Expected behavior

A generic logic should be added that displays the referenced content as a link to the content itself. (Later we can discuss about a future feature that makes it possible to configure how this reference field values should be displayed for a specific field)

@herflis herflis added the bug Something isn't working label Aug 26, 2020
@herflis herflis added this to the Sprint 217 milestone Aug 26, 2020
@taki9 taki9 self-assigned this Aug 31, 2020
@herflis herflis modified the milestones: Sprint 217, Sprint 218 Sep 2, 2020
@herflis herflis modified the milestones: Sprint 218, Sprint 219 Sep 16, 2020
@herflis herflis closed this as completed Sep 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
admin-ui bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants