Skip to content

feat: add relation column type#2248

Open
Koc wants to merge 1 commit intomainfrom
feature/add-relations-column-type
Open

feat: add relation column type#2248
Koc wants to merge 1 commit intomainfrom
feature/add-relations-column-type

Conversation

@Koc
Copy link
Copy Markdown
Contributor

@Koc Koc commented Jan 9, 2026

This PR introduces a basic relation type. It allows to connect few tables together. We will store row id as a column value and display selected column as a label for this values. Closes #172.

✔️ Implemented

🔍 Column create/edit

image

🔍 Row create/edit via popup/inline

image

🔍 Row display in table/view + handle relation row removal

image image

🔍 Filter for view

image

🔍 Filter for rows

image image

🔍 Import/Export

image image

🚧 Pending (help welcomed):

  • Behat tests
  • Cypress tests?

❎ What is out of scope:

  • Lookup columns to add an extra columns from the related table to the current one. It will be handled separately in upcoming PR.

@Koc Koc force-pushed the feature/add-relations-column-type branch from c3f6a2d to fdd744e Compare January 15, 2026 17:44
@Koc Koc force-pushed the bugfix/fix-loading-of-large-tables branch from f792683 to f599f40 Compare January 15, 2026 19:21
@Koc Koc force-pushed the feature/add-relations-column-type branch 6 times, most recently from 92af03c to 0f9416b Compare January 16, 2026 00:28
@Aveyron-RetD Aveyron-RetD mentioned this pull request Jan 16, 2026
@Koc Koc force-pushed the feature/add-relations-column-type branch 3 times, most recently from 6a4e073 to 5209182 Compare January 16, 2026 18:06
@Koc Koc changed the base branch from bugfix/fix-loading-of-large-tables to main January 16, 2026 18:06
@Koc Koc force-pushed the feature/add-relations-column-type branch 4 times, most recently from fb98364 to 198afa1 Compare January 16, 2026 18:43
@Koc Koc marked this pull request as ready for review January 16, 2026 19:12
@Koc Koc requested review from blizzz and enjeck as code owners January 16, 2026 19:12
@Koc Koc force-pushed the feature/add-relations-column-type branch from 198afa1 to ddc1bd1 Compare January 16, 2026 20:45
@juliusknorr juliusknorr added the enhancement New feature or request label Jan 21, 2026
@juliusknorr juliusknorr requested a review from samin-z January 21, 2026 20:49
@Koc Koc force-pushed the feature/add-relations-column-type branch 2 times, most recently from f34f8f9 to d406233 Compare January 25, 2026 12:47
@Koc Koc force-pushed the feature/add-relations-column-type branch 4 times, most recently from f092bad to 502b69b Compare February 12, 2026 23:24
@Koc Koc force-pushed the feature/add-relations-column-type branch from 502b69b to 8093d63 Compare February 15, 2026 16:40
@Koc Koc force-pushed the feature/add-relations-column-type branch 7 times, most recently from d45b95c to cb637bd Compare February 28, 2026 18:32
@enjeck enjeck force-pushed the feature/add-relations-column-type branch from cb637bd to 9b36f43 Compare March 4, 2026 04:59
Copy link
Copy Markdown
Contributor

@enjeck enjeck left a comment

Choose a reason for hiding this comment

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

Thanks, it works quite well already. A few comments for now. I have only tested the creation of columns and rows so far

})
this.availableLabelColumns = columns
.filter(column =>
column instanceof NumberColumn || column instanceof TextLineColumn,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

why restrict to just these 2 column types?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

it seems like the relation should easily generalise to all column types

Copy link
Copy Markdown
Contributor Author

@Koc Koc Mar 19, 2026

Choose a reason for hiding this comment

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

In theory we can, but I'm not sure that this is good idea. This is the column which we will display in the relation dropdown. So, this column should be unique in order to properly select correct relation row (otherwise you will select wrong rows).

What sense to display select/multi-select/rating here? I doubt that those type of columns will be unique.

image image

Comment on lines +167 to +177
$targetColumn = $this->columnMapper->find($settings[Column::RELATION_LABEL_COLUMN]);
if ($isView) {
$view = $this->viewMapper->find($targetId);
$rows = $this->row2Mapper->findAll(
[$targetColumn->getId()],
$view->getTableId(),
null,
null,
$view->getFilterArray(),
$view->getSortArray(),
$this->userId
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we ever consider permissions such that the user must have access to the table/view before they can link to it?

Copy link
Copy Markdown
Contributor Author

@Koc Koc Mar 19, 2026

Choose a reason for hiding this comment

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

No, and this is a "feature by design". The main idea is that admin creates tables for dictionaries, e.g. users, departments, offices, etc, then creates table that references to this dictionaries, e.g. vacations. And he can share only vacations to the end users.

Otherwise he should to share all dictionary tables as well. And users will have tons of irrelevant tables in their shares. Or admin can forget to share dictionary tables and users will suffer because table with relations not displays all columns.

We can't share table partially per column right now. Let's preserve same approach for new column types as well.

@Koc Koc force-pushed the feature/add-relations-column-type branch 2 times, most recently from 7e22314 to b47617a Compare March 19, 2026 19:56
@Koc
Copy link
Copy Markdown
Contributor Author

Koc commented Mar 19, 2026

pipeline failures looks like are unrelated. Please re-review @enjeck @blizzz

Signed-off-by: Kostiantyn Miakshyn <molodchick@gmail.com>
@Koc Koc force-pushed the feature/add-relations-column-type branch from b47617a to 3240639 Compare March 25, 2026 23:07
@blizzz blizzz moved this to 🏗️ In progress in 📝 Productivity team Mar 26, 2026
@Aveyron-RetD
Copy link
Copy Markdown

Aveyron-RetD commented Mar 30, 2026

So I have user tested and this looks good. 👍 Could not get it to work at first because I did not get that only text field were working. This will create maybe some confusion on first use. Not all tables do have this text field. Perhaps a comment with a small tooltip with a little (i) in the screenshot below to explain that you can only link that kind of data
image

For my mention of #2035 this is not a good fit.
I was hoping that this would solve the one-to-many expansion I have been dreaming about, but no :-( .

@Koc
Copy link
Copy Markdown
Contributor Author

Koc commented Mar 31, 2026

I was hoping that this would solve the one-to-many expansion I have been dreaming about, but no :-( .

@Aveyron-RetD yeah, I'm aware about that case. But you need to understand me as well: feature is really huge, we should start from something simple and improve it in upcoming iterations 🤝

I will add tooltip soon. Hope that we can merge it soon 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: 🏗️ In progress

Development

Successfully merging this pull request may close these issues.

Relational properties

5 participants