From 30d946c4b4ccca4d9e3995abddf4d6b5f7bd00d1 Mon Sep 17 00:00:00 2001 From: Cleopatra Enjeck M Date: Mon, 8 Jul 2024 05:37:43 +0100 Subject: [PATCH] enh: update usergroup column elements Signed-off-by: Cleopatra Enjeck M --- .../main/partials/ColumnFormComponent.vue | 1 - src/modules/modals/CreateColumn.vue | 2 +- src/modules/sidebar/partials/ShareForm.vue | 2 +- .../ncTable/mixins/columnsTypes/usergroup.js | 17 ------ .../ncTable/partials/TableCellUsergroup.vue | 40 +++++++++----- .../columnTypePartials/forms/MainForm.vue | 2 +- .../forms/UsergroupForm.vue | 55 +++++++++++-------- .../rowTypePartials/UsergroupForm.vue | 37 +++++++------ src/shared/mixins/searchUserGroup.js | 4 +- src/shared/mixins/shareTypesMixin.js | 39 +++++++++++++ 10 files changed, 122 insertions(+), 77 deletions(-) create mode 100644 src/shared/mixins/shareTypesMixin.js diff --git a/src/modules/main/partials/ColumnFormComponent.vue b/src/modules/main/partials/ColumnFormComponent.vue index 7a2a1c6e4..de6b94e30 100644 --- a/src/modules/main/partials/ColumnFormComponent.vue +++ b/src/modules/main/partials/ColumnFormComponent.vue @@ -18,7 +18,6 @@ import DatetimeDateForm from '../../../shared/components/ncTable/partials/rowTyp import DatetimeTimeForm from '../../../shared/components/ncTable/partials/rowTypePartials/DatetimeTimeForm.vue' import TextRichForm from '../../../shared/components/ncTable/partials/rowTypePartials/TextRichForm.vue' import UsergroupForm from '../../../shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue' -import { AbstractColumn } from '../../../shared/components/ncTable/mixins/columnClass.js' export default { name: 'ColumnFormComponent', diff --git a/src/modules/modals/CreateColumn.vue b/src/modules/modals/CreateColumn.vue index 258712dfb..cb5dca63a 100644 --- a/src/modules/modals/CreateColumn.vue +++ b/src/modules/modals/CreateColumn.vue @@ -78,7 +78,7 @@ {{ t('tables', 'Add more') }} - diff --git a/src/modules/sidebar/partials/ShareForm.vue b/src/modules/sidebar/partials/ShareForm.vue index 33fc0b754..5ff28f5d7 100644 --- a/src/modules/sidebar/partials/ShareForm.vue +++ b/src/modules/sidebar/partials/ShareForm.vue @@ -154,7 +154,7 @@ export default { shareWith: result.value.shareWith, shareType: result.value.shareType, user: result.uuid || result.value.shareWith, - isNoUser: result.value.shareType !== SHARE_TYPES.SHARE_TYPE_USER, + isNoUser: result.value.shareType !== this.SHARE_TYPES.SHARE_TYPE_USER, displayName: result.name || result.label, icon: result.value.shareType === this.SHARE_TYPES.SHARE_TYPE_USER ? 'icon-user' : 'icon-group', // Vue unique binding to render within Multiselect's AvatarSelectOption diff --git a/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js b/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js index e02917102..654704009 100644 --- a/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js +++ b/src/shared/components/ncTable/mixins/columnsTypes/usergroup.js @@ -1,6 +1,5 @@ import { AbstractUsergroupColumn } from '../columnClass.js' import { ColumnTypes } from '../columnHandler.js' -import { FilterIds } from '../filter.js' export default class UsergroupColumn extends AbstractUsergroupColumn { @@ -13,10 +12,6 @@ export default class UsergroupColumn extends AbstractUsergroupColumn { this.usergroupSelectGroups = data.usergroupSelectGroups } - // TODO consider if we want to sort, and how - // sort(mode) { - // } - getValueString(valueObject) { valueObject = valueObject || this.value || null @@ -44,16 +39,4 @@ export default class UsergroupColumn extends AbstractUsergroupColumn { return super.isSearchStringFound(this.getValueString(cell), cell, searchString) } - isFilterFound(cell, filter) { - const filterValue = filter.magicValuesEnriched ? filter.magicValuesEnriched : filter.value - const valueString = this.getValueString(cell) - - const filterMethod = { - [FilterIds.Contains]() { return valueString?.includes(filterValue) }, - [FilterIds.IsEqual]() { return valueString === filterValue }, - [FilterIds.IsEmpty]() { return !valueString }, - }[filter.operator.id] - return super.isFilterFound(filterMethod, cell) - } - } diff --git a/src/shared/components/ncTable/partials/TableCellUsergroup.vue b/src/shared/components/ncTable/partials/TableCellUsergroup.vue index 3d2495179..263ef5560 100644 --- a/src/shared/components/ncTable/partials/TableCellUsergroup.vue +++ b/src/shared/components/ncTable/partials/TableCellUsergroup.vue @@ -2,26 +2,27 @@
- - -

User

- @{{ item.id }} -
+
+
+ +
+
+
+ {{ item.id }} +
+
+
+ + diff --git a/src/shared/components/ncTable/partials/columnTypePartials/forms/MainForm.vue b/src/shared/components/ncTable/partials/columnTypePartials/forms/MainForm.vue index 64ca16c14..b746b995c 100644 --- a/src/shared/components/ncTable/partials/columnTypePartials/forms/MainForm.vue +++ b/src/shared/components/ncTable/partials/columnTypePartials/forms/MainForm.vue @@ -5,7 +5,7 @@ {{ t('tables', 'Title') }}
- +
diff --git a/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue b/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue index 584de2ee5..0d5ab9c1f 100644 --- a/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue +++ b/src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue @@ -3,15 +3,15 @@
+ type="radio" data-cy="userSwitch"> {{ t('tables', 'Users') }} + name="usergroupTypeSelection" type="radio" data-cy="groupSwitch"> {{ t('tables', 'Groups') }} + type="radio" data-cy="userAndGroupSwitch"> {{ t('tables', 'Users and groups') }}
@@ -21,13 +21,11 @@ {{ t('tables', 'Default') }}
- + :user-select="true" :close-on-select="false" + :multiple="mutableColumn.usergroupMultipleItems" data-cy="usergroupDefaultSelect" @search="asyncFind" @input="addItem"> @@ -38,12 +36,11 @@ {{ t('tables', 'Select multiple items') }}
- +
- -
+
{{ t('tables', 'Show user status') }}
@@ -56,8 +53,6 @@ diff --git a/src/shared/mixins/searchUserGroup.js b/src/shared/mixins/searchUserGroup.js index 27fe7e53a..5bd51d1a9 100644 --- a/src/shared/mixins/searchUserGroup.js +++ b/src/shared/mixins/searchUserGroup.js @@ -42,10 +42,10 @@ export default { getShareTypes() { const types = [] if (this.selectUsers) { - types.push(SHARE_TYPES.SHARE_TYPE_USER) + types.push(this.SHARE_TYPES.SHARE_TYPE_USER) } if (this.selectGroups) { - types.push(SHARE_TYPES.SHARE_TYPE_GROUP) + types.push(this.SHARE_TYPES.SHARE_TYPE_GROUP) } return types }, diff --git a/src/shared/mixins/shareTypesMixin.js b/src/shared/mixins/shareTypesMixin.js new file mode 100644 index 000000000..18b793f54 --- /dev/null +++ b/src/shared/mixins/shareTypesMixin.js @@ -0,0 +1,39 @@ +/** + * @copyright Copyright (c) 2019 John Molakvoæ + * + * @author John Molakvoæ + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +export default { + data() { + return { + SHARE_TYPES: { + SHARE_TYPE_USER: OC.Share.SHARE_TYPE_USER, + SHARE_TYPE_GROUP: OC.Share.SHARE_TYPE_GROUP, + SHARE_TYPE_LINK: OC.Share.SHARE_TYPE_LINK, + SHARE_TYPE_EMAIL: OC.Share.SHARE_TYPE_EMAIL, + SHARE_TYPE_REMOTE: OC.Share.SHARE_TYPE_REMOTE, + SHARE_TYPE_CIRCLE: OC.Share.SHARE_TYPE_CIRCLE, + SHARE_TYPE_GUEST: OC.Share.SHARE_TYPE_GUEST, + SHARE_TYPE_REMOTE_GROUP: OC.Share.SHARE_TYPE_REMOTE_GROUP, + SHARE_TYPE_ROOM: OC.Share.SHARE_TYPE_ROOM, + }, + } + }, +}