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

Relational Selection Panel for Insights Variable #15452

Merged
merged 39 commits into from
Sep 15, 2022
Merged

Conversation

br41nslug
Copy link
Member

@br41nslug br41nslug commented Sep 7, 2022

Description

Add relational selection panel to insights variables.

The panel has the following options implemented:

  • Selecting the related collection

  • Select single or multiple (m2o for single, o2m for multiple)

  • Set a display template

  • Set a filter to limit the selectable items (it throws an error on selecting more)

  • A soft limit when selecting multiple

  • The o2m like interface has an added "Clear Items" button

    firefox_ZSztWS292W

Type of Change

  • Bugfix
  • Improvement
  • New Feature
  • Refactor / codestyle updates
  • Other, please describe:

Requirements Checklist

  • New / updated tests are included
  • All tests are passing locally
  • Performed a self-review of the submitted code

If adding a new feature:

  • Documentation was added/updated — directus/docs#127

@br41nslug br41nslug marked this pull request as ready for review September 8, 2022 12:40
@rijkvanzanten rijkvanzanten self-assigned this Sep 8, 2022
@rijkvanzanten
Copy link
Member

@benhaynes any thoughts on the UX of that multi-select list style? I'd like the dropdown style to stay centered (as it's a single input), but think that the list style should be top-aligned. Also not entirely sure about using a "full" primary button in the panel there 🤔

@rijkvanzanten
Copy link
Member

Very excited for this! Great job @azrikahar & @br41nslug 👏🏻

@benhaynes
Copy link
Sponsor Member

@benhaynes any thoughts on the UX of that multi-select list style? I'd like the dropdown style to stay centered (as it's a single input), but think that the list style should be top-aligned. Also not entirely sure about using a "full" primary button in the panel there 🤔

If we're keeping with this standard interface design (which we are), then I agree that the multi-select list should be top-aligned (similar padding from the heading as other panels). If there's not enough vertical height, then the bottom should crop and the panel would scroll to view the rest.

For the horizontal layout, the rows should be 100% width down to a min-width (I think they are)... but ideally we have the two buttons be 50%/50% (with the standard gap between), until the panel width gets too small... and then they would snap to be 100%/100% stacked.

Icing on the cake, it'd be nice if the action buttons were sticky to the bottom (so they don't scroll off) when the rows pushed the data beyond the vertical height. Wondering if it makes sense to "pin" these buttons to the bottom even if the rows don't push them there. This also assumes these panels will scroll as I'm imagining. 😆

Not sure about making the primary buttons more subdued... could try outline, but there's no standard for that yet.

@rijkvanzanten
Copy link
Member

@azrikahar can you A/B between outline buttons and text only style? The full primary buttons are a little too much there

@azrikahar
Copy link
Contributor

can you A/B between outline buttons and text only style?

Sure!

Full Outline Text-only

but ideally we have the two buttons be 50%/50% (with the standard gap between)

Does the 50%/50% mean something like this? (the example uses outline for now)

It might be too full-width if the panel is wider I think, but I might also be misinterpreting here 😄

chrome_nbSNehjNrG

@br41nslug
Copy link
Member Author

firefox_wQ0XZImzbs

@rijkvanzanten
Copy link
Member

@azrikahar Lets go text only and top-align the list of items 🙂

@azrikahar
Copy link
Contributor

@azrikahar Lets go text only and top-align the list of items 🙂

Update:

chrome_qVAvfh5SdA

Copy link
Member

@licitdev licitdev left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works well for me! 🚀

@rijkvanzanten
Copy link
Member

Looks great, feels great, big fan

@rijkvanzanten rijkvanzanten merged commit f9c4422 into main Sep 15, 2022
@rijkvanzanten rijkvanzanten deleted the relational-variable branch September 15, 2022 16:18
@benhaynes
Copy link
Sponsor Member

Whoa, this turned out amazing!!

qborisb pushed a commit to qborisb/directus that referenced this pull request Sep 16, 2022
* init

* add field (variable key)

* panel index option

* remove custom component

* attempt at implementing virtual m2o logic

* adding o2m layout

* moved drawer and implementing display items for o2m

* removed o2m draggable, added limit for o2m and implemented diplay templates

* style fix for single relation

* fixed deselect for o2m

* enforce multi limit

* fixed adding items for o2m and clear all button

* abstracted away displayItem logic and cleaned up code

* add selection to drawer-collection

* fix graphql error on init

* only store an array for multiple relations

* udated var names

* use dense display for 5 items and up

* use full width for the limit option

* fixed deselect for single relation

* removed unused notices

* type fix

* clear the cache when switching collections
added required flags in options
updated label to be in line with the variable panel

* added multiple label

* fix time series options filter

it should attempt to JSON.parse() when possible, and skip parsing when there's undefined values

* remove unused styles

* prevent negative limit

* keep multiple-relation top-aligned

* fixed pronblem with deselecting/reselecting items

* keep action buttons sticky at the bottom

* text-only styling for multiple-relation buttons

* use <button> and remove unnecessary styles

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
qborisb pushed a commit to qborisb/directus that referenced this pull request Sep 16, 2022
* init

* add field (variable key)

* panel index option

* remove custom component

* attempt at implementing virtual m2o logic

* adding o2m layout

* moved drawer and implementing display items for o2m

* removed o2m draggable, added limit for o2m and implemented diplay templates

* style fix for single relation

* fixed deselect for o2m

* enforce multi limit

* fixed adding items for o2m and clear all button

* abstracted away displayItem logic and cleaned up code

* add selection to drawer-collection

* fix graphql error on init

* only store an array for multiple relations

* udated var names

* use dense display for 5 items and up

* use full width for the limit option

* fixed deselect for single relation

* removed unused notices

* type fix

* clear the cache when switching collections
added required flags in options
updated label to be in line with the variable panel

* added multiple label

* fix time series options filter

it should attempt to JSON.parse() when possible, and skip parsing when there's undefined values

* remove unused styles

* prevent negative limit

* keep multiple-relation top-aligned

* fixed pronblem with deselecting/reselecting items

* keep action buttons sticky at the bottom

* text-only styling for multiple-relation buttons

* use <button> and remove unnecessary styles

Co-authored-by: Azri Kahar <42867097+azrikahar@users.noreply.github.com>
Co-authored-by: ian <licitdev@gmail.com>
@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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants