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

[0.10] Fix table performance & rework attribute(list) logic #504

Open
wants to merge 33 commits into
base: release-0.10
Choose a base branch
from

Conversation

v1r0x
Copy link
Member

@v1r0x v1r0x commented Jun 6, 2024

This branch started as a simple performance booster for table attributes. But the whole attribute handling was a huge code block with DRY code in the table component as well.
Thus, I reworked the attributelist and table component to be based on a new Attribute component (tables also has a new TabularRow component). This introduced a new problem with entity attributes (especially in tables), so I tried to move all logic that loads the data needed for the frontend to the serialize and unserialize in the AttributeType classes.

v1r0x added 14 commits June 4, 2024 13:55
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
…rformance

Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
@v1r0x v1r0x changed the title [0.10[ Fix table performance & rework attribute(list) logic [0.10] Fix table performance & rework attribute(list) logic Jun 19, 2024
Copy link

@Severino Severino left a comment

Choose a reason for hiding this comment

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

In current state the creation of a table attribute is not working.

disabled: computed(_ => data.value.isDisabled || disabled.value),
value: computed(_ => getValueOrDefault()),
// TODO check for selection need?
selection: computed(_ => getAttributeSelection(data.value.id) || {}),
Copy link

Choose a reason for hiding this comment

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

This is a problem, I think this should return an array as default => ... | [ ]
Throws error when creating table attribute.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah, selections should be Arrays 👍

Comment on lines 346 to 349
reactTo,
hideLinks,
preview,
previewData,
Copy link

Choose a reason for hiding this comment

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

Those are not used.

Copy link
Member Author

Choose a reason for hiding this comment

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

These are some remains from stuff I copy&wasted 😅 can be deleted 👍

@@ -620,8 +510,8 @@
initialValue: value.value,
});
const state = reactive({
isPreview: computed(_ => previewColumns.value && Object.keys(previewColumns.value).length > 0),
columns: computed(_ => state.isPreview ? previewColumns.value : getAttribute(attribute.value.id).columns),
isPreview: computed(_ => preview.value && previewData.value && Object.keys(previewData.value).length > 0),
Copy link

Choose a reason for hiding this comment

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

Why isn't preview.value check enough?
Maybe a different name if it does more than one thing?

Copy link
Member Author

Choose a reason for hiding this comment

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

I just did a double check to make sure that we enabled preview (preview.value) and have actual data to preview (previewData.value).

Copy link
Member Author

Choose a reason for hiding this comment

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

I think there was a mix up from the old structure. preview and previewData is part of Attribute.vue and Tabular.vue only receives previewColumns. Thus, checking for previewColumns existance and content is enough.

class="text-center"
v-if="row.hidden_info"
class="text-muted text-center fs-5 p-2 bg-primary-subtle"
:colspan="Object.keys(state.columns).length + 2"
Copy link

Choose a reason for hiding this comment

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

use computed at this and the next position? (redundancy)

Copy link
Member Author

Choose a reason for hiding this comment

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

👍

case 'string-sc':
case 'date':
case 'url':
return '';
Copy link

Choose a reason for hiding this comment

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

There are 3 positions where we return ' '. Combine the non-default cases that return ''?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, we can add this at the end right before default. Thought I already did that 🤔

Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
@v1r0x v1r0x force-pushed the 0.10-fix-performance-table branch from ecc6cc7 to 97b80f7 Compare August 1, 2024 09:20
v1r0x and others added 3 commits August 1, 2024 14:44
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
@v1r0x v1r0x force-pushed the 0.10-fix-performance-table branch from 255d304 to a177433 Compare August 1, 2024 13:02
@v1r0x
Copy link
Member Author

v1r0x commented Aug 1, 2024

I resolved merge conflicts and added our new si-unit-attribute, that was added to the pre-PR attribute handling logic. Can you also confirm it is still working @Severino ?

@Severino
Copy link

Severino commented Aug 2, 2024

I tried getting it to work, but when I create a new and empty table with an SiUnit Attribute, I cannot add a new line, as it creates an empty object, however the si attribute need a metadata object for the bast_unit and the default_unit

v1r0x and others added 3 commits August 5, 2024 11:22
Severino and others added 9 commits August 5, 2024 16:19
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Signed-off-by: Vinzenz Rosenkranz <vinzenz.rosenkranz@uni-tuebingen.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants