From fdbc62894a37c32393dbf0fdcb8e3f7f89ad8882 Mon Sep 17 00:00:00 2001 From: Enjeck C Date: Wed, 22 Oct 2025 06:50:57 +0100 Subject: [PATCH 1/3] fix: Add key to pre-existing usergroup items Signed-off-by: Enjeck C --- .../rowTypePartials/UsergroupForm.vue | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue b/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue index ac303469e4..db9a184b05 100644 --- a/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue +++ b/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue @@ -44,12 +44,13 @@ export default { return { selectUsers: this.column.usergroupSelectUsers, selectGroups: this.column.usergroupSelectGroups, + internalLocalValue: [], } }, computed: { localValue: { get() { - return this.value + return this.internalLocalValue }, set(v) { let formattedValue = null @@ -58,6 +59,7 @@ export default { } else { formattedValue = [v] } + this.internalLocalValue = formattedValue this.$emit('update:value', formattedValue) }, }, @@ -67,6 +69,13 @@ export default { // Doing this in data() doesn't work due to timing issues, // since the data() function runs before the capabilities are fully initialized this.selectCircles = this.isCirclesEnabled ? this.column.usergroupSelectTeams : false + const formatted = (Array.isArray(this.value) ? this.value : []).map(item => ({ + ...(item ?? {}), + // Adding a unique key such that removing items works correctly + key: this.getKeyPrefix(item?.type) + (item?.id ?? ''), + })) + this.internalLocalValue = formatted + this.$emit('update:value', formatted) }, methods: { addItem(selectedItem) { @@ -77,6 +86,15 @@ export default { } }, + getKeyPrefix(type) { + switch (type) { + case 0: return 'users-' + case 1: return 'groups-' + case 2: return 'circles-' + default: return 'unknown-' + } + }, + filterOutUnwantedItems(list) { return list }, From 1d3b86038245381e6c147fa5dadc321a3f1cc456 Mon Sep 17 00:00:00 2001 From: Enjeck C Date: Tue, 11 Nov 2025 19:20:45 +0000 Subject: [PATCH 2/3] fix: Set default value for usergroup selection if none provided Signed-off-by: Enjeck C --- .../partials/rowTypePartials/UsergroupForm.vue | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue b/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue index db9a184b05..d622bd8091 100644 --- a/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue +++ b/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue @@ -69,13 +69,22 @@ export default { // Doing this in data() doesn't work due to timing issues, // since the data() function runs before the capabilities are fully initialized this.selectCircles = this.isCirclesEnabled ? this.column.usergroupSelectTeams : false - const formatted = (Array.isArray(this.value) ? this.value : []).map(item => ({ + + let initialValue = this.value + if (!initialValue || (Array.isArray(initialValue) && initialValue.length === 0)) { + initialValue = this.column.usergroupDefault || [] + } + + const formatted = (Array.isArray(initialValue) ? initialValue : []).map(item => ({ ...(item ?? {}), // Adding a unique key such that removing items works correctly key: this.getKeyPrefix(item?.type) + (item?.id ?? ''), })) this.internalLocalValue = formatted - this.$emit('update:value', formatted) + + if (formatted.length > 0) { + this.$emit('update:value', formatted) + } }, methods: { addItem(selectedItem) { From 05b087f97427b1de4dbfd867717fe537ec903985 Mon Sep 17 00:00:00 2001 From: Enjeck C Date: Tue, 11 Nov 2025 19:25:53 +0000 Subject: [PATCH 3/3] fix: Clear usergroup selection before editing rows Signed-off-by: Enjeck C --- cypress/e2e/column-usergroup.cy.js | 1 + .../ncTable/partials/rowTypePartials/UsergroupForm.vue | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cypress/e2e/column-usergroup.cy.js b/cypress/e2e/column-usergroup.cy.js index 18282aa3c2..475ba719ed 100644 --- a/cypress/e2e/column-usergroup.cy.js +++ b/cypress/e2e/column-usergroup.cy.js @@ -59,6 +59,7 @@ describe('Test column ' + columnTitle, () => { cy.get('[data-cy="ncTable"] table tr td .user-bubble__name').contains(localUser.userId).should('be.visible') cy.get('[data-cy="ncTable"] [data-cy="editRowBtn"]').click() + cy.get('[data-cy="usergroupRowSelect"] .vs__deselect').click({ multiple: true }) cy.get('[data-cy="usergroupRowSelect"] input').clear().type(nonLocalUser.userId) cy.get(`.vs__dropdown-menu [id="${nonLocalUser.userId}"]`).click() cy.get('[data-cy="editRowSaveButton"]').click() diff --git a/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue b/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue index d622bd8091..2f6dfd3edb 100644 --- a/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue +++ b/src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue @@ -69,19 +69,19 @@ export default { // Doing this in data() doesn't work due to timing issues, // since the data() function runs before the capabilities are fully initialized this.selectCircles = this.isCirclesEnabled ? this.column.usergroupSelectTeams : false - + let initialValue = this.value if (!initialValue || (Array.isArray(initialValue) && initialValue.length === 0)) { initialValue = this.column.usergroupDefault || [] } - + const formatted = (Array.isArray(initialValue) ? initialValue : []).map(item => ({ ...(item ?? {}), // Adding a unique key such that removing items works correctly key: this.getKeyPrefix(item?.type) + (item?.id ?? ''), })) this.internalLocalValue = formatted - + if (formatted.length > 0) { this.$emit('update:value', formatted) }