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

Can't select many to one field in system filter UI #12161

Closed
3 tasks done
LasseRosenow opened this issue Mar 15, 2022 · 18 comments
Closed
3 tasks done

Can't select many to one field in system filter UI #12161

LasseRosenow opened this issue Mar 15, 2022 · 18 comments
Labels

Comments

@LasseRosenow
Copy link
Sponsor Contributor

Preflight Checklist

Describe the Bug

I have a recursive collection that has children of itself etc.

I have one special field that I only want to show, when the parent is null meaning on the root element. But its not working. I cannot select the parent field, because it only expands on click and shows its sub fields, but if I use a sub field and check for null of the sub field instead of the parent, it is not working either. Probably because it cannot check the sub field for null because the parent is null.

image

I want to select the marked field, but its not possible.

To Reproduce

Create a collection that has a o2m relation on itself and try to create a rule that hides some other field within the collection, if its parent is null.

Errors Shown

No response

What version of Directus are you using?

9.6.0

What version of Node.js are you using?

16

What database are you using?

MariaDB

What browser are you using?

Chrome, Firefox

What operating system are you using?

Windows

How are you deploying Directus?

On a remote Debian server

@abdonrd
Copy link
Contributor

abdonrd commented Mar 15, 2022

I think you should select the Parent > ID.

@LasseRosenow
Copy link
Sponsor Contributor Author

I think you should select the Parent > ID.

Yes I tried that but it did not work.

@abdonrd
Copy link
Contributor

abdonrd commented Mar 15, 2022

I have this one working:

Screenshot 2022-03-15 at 11 43 34

@abdonrd
Copy link
Contributor

abdonrd commented Mar 15, 2022

Oh! Your are doing this in the Interface or in the Conditions?

In Interfaces it works for me, but in Conditions it doesn't.

@LasseRosenow
Copy link
Sponsor Contributor Author

LasseRosenow commented Mar 15, 2022

oh I didn't know you could do it in the Interface :O

Yes I'm doing it in the Conditions ;)

@LasseRosenow
Copy link
Sponsor Contributor Author

But I can only use Conditions, because I want to hide certain fields that have nothing to do with the relation etc. meaning I have a Checkboxes field that I only want to show on the root element of my relational tree ;) I think that would only be possible with Conditions right?

@abdonrd
Copy link
Contributor

abdonrd commented Mar 15, 2022

Yeah, and it looks like a bug.

@rijkvanzanten
Copy link
Member

But its not working. I cannot select the parent field, because it only expands on click and shows its sub fields

This feels like the underlying issue to me. Could you do me a favor, and try to see if it works if you edit the Raw Value (through the field label dropdown menu), and set the rule set in JSON manually?

If I'm understanding the use case correctly, it should be

{
  "parent": {
    "_null": true
  }
}

@rijkvanzanten rijkvanzanten changed the title Rule check if relational field is null not working Can't select many to one field in system filter UI Mar 15, 2022
@LasseRosenow
Copy link
Sponsor Contributor Author

Yes this works

@rijkvanzanten
Copy link
Member

Yes this works

Thanks for confirming 👍🏻

@abdonrd
Copy link
Contributor

abdonrd commented Mar 15, 2022

With this:

Screenshot 2022-03-15 at 15 46 14

I have this in the raw value:

{
  "_and": [
    {
      "parent": {
        "id": {
          "_null": true
        }
      }
    }
  ]
}

And it works if I change it manually to:

{
  "parent": {
    "_null": true
  }
}

@rijkvanzanten
Copy link
Member

rijkvanzanten commented Mar 15, 2022

It should also still work with the wrapped _and group:

{
  "_and": [
    {
      "parent": {
        "_null": true
      }
    }
  ]
}

The previous example (where you filter against parent.id) will validate that parent is an object with { id: null }, which (correctly) doesn't trigger in this case.

@abdonrd
Copy link
Contributor

abdonrd commented Mar 15, 2022

Yeah, looks like a UI/UX bug, right?

@rijkvanzanten
Copy link
Member

Yeah, looks like a UI/UX bug, right?

Yeah! The "Parent" row in this case should be selectable as well, rather than just toggle its group open/closed.

@Nitwel
Copy link
Member

Nitwel commented Mar 16, 2022

Funnily enough, I remember that I fixed that issue already when I reworked the useFieldTree composable but someone must have set groups to be not selectable by mistake.

@rijkvanzanten
Copy link
Member

Funnily enough, I remember that I fixed that issue already when I reworked the useFieldTree composable but someone must have set groups to be not selectable by mistake.

@Nitwel It only happens in system-filter, as it uses a v-select rather than a v-list with groups like we use in the display-template component 🙂 I created a new field-list component to standardize its use across the platform (mandatory xkcd) in #12157. Adding that field-list to the system-filter should resolve this issue as well 👍🏻

@Nitwel
Copy link
Member

Nitwel commented Mar 16, 2022

Oh I see, awesome!

@azrikahar
Copy link
Contributor

Seems like this is the same as #12040, so closing this in favor of tracking it over there 👍

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants