Skip to content

Commit

Permalink
fix: update usergroup column elements
Browse files Browse the repository at this point in the history
Signed-off-by: Cleopatra Enjeck M <patrathewhiz@gmail.com>
  • Loading branch information
enjeck committed Jun 3, 2024
1 parent 59c01b0 commit 3fa59e8
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ export default class UsergroupColumn extends AbstractUsergroupColumn {
this.usergroupSelectGroups = data.usergroupSelectGroups
}

// TODO consider if we want to sort, and how
// sort(mode) {
// }

Check failure on line 19 in src/shared/components/ncTable/mixins/columnsTypes/usergroup.js

View workflow job for this annotation

GitHub Actions / NPM lint

Trailing spaces not allowed
getValueString(valueObject) {
valueObject = valueObject || this.value || null

Expand All @@ -22,7 +26,7 @@ export default class UsergroupColumn extends AbstractUsergroupColumn {
if (ret === '') {
ret = obj.id
} else {
ret += ', ' + obj.display
ret += ', ' + obj.id
}
})
return ret
Expand Down
6 changes: 3 additions & 3 deletions src/shared/components/ncTable/mixins/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Filters = {
Contains: new Filter({
id: FilterIds.Contains,
label: t('tables', 'Contains'),
goodFor: [ColumnTypes.TextLine, ColumnTypes.TextLong, ColumnTypes.TextLink, ColumnTypes.TextRich, ColumnTypes.SelectionMulti, ColumnTypes.Usergroup],
goodFor: [ColumnTypes.TextLine, ColumnTypes.TextLong, ColumnTypes.TextLink, ColumnTypes.TextRich, ColumnTypes.SelectionMulti],
incompatibleWith: [FilterIds.IsEmpty, FilterIds.IsEqual],
}),
BeginsWith: new Filter({
Expand All @@ -68,7 +68,7 @@ export const Filters = {
id: FilterIds.IsEqual,
label: t('tables', 'Is equal'),
shortLabel: '=',
goodFor: [ColumnTypes.TextLine, ColumnTypes.Number, ColumnTypes.SelectionCheck, ColumnTypes.TextLink, ColumnTypes.NumberStars, ColumnTypes.NumberProgress, ColumnTypes.DatetimeDate, ColumnTypes.DatetimeTime, ColumnTypes.Datetime, ColumnTypes.Selection, ColumnTypes.SelectionMulti, ColumnTypes.Usergroup],
goodFor: [ColumnTypes.TextLine, ColumnTypes.Number, ColumnTypes.SelectionCheck, ColumnTypes.TextLink, ColumnTypes.NumberStars, ColumnTypes.NumberProgress, ColumnTypes.DatetimeDate, ColumnTypes.DatetimeTime, ColumnTypes.Datetime, ColumnTypes.Selection, ColumnTypes.SelectionMulti],
incompatibleWith: [FilterIds.IsEmpty, FilterIds.IsEqual, FilterIds.BeginsWith, FilterIds.EndsWith, FilterIds.Contains, FilterIds.IsGreaterThan, FilterIds.IsGreaterThanOrEqual, FilterIds.IsLowerThan, FilterIds.IsLowerThanOrEqual],
}),
IsGreaterThan: new Filter({
Expand Down Expand Up @@ -102,7 +102,7 @@ export const Filters = {
IsEmpty: new Filter({
id: FilterIds.IsEmpty,
label: t('tables', 'Is empty'),
goodFor: [ColumnTypes.TextLine, ColumnTypes.TextRich, ColumnTypes.Number, ColumnTypes.TextLink, ColumnTypes.NumberProgress, ColumnTypes.DatetimeDate, ColumnTypes.DatetimeTime, ColumnTypes.Datetime, ColumnTypes.SelectionCheck, ColumnTypes.Usergroup],
goodFor: [ColumnTypes.TextLine, ColumnTypes.TextRich, ColumnTypes.Number, ColumnTypes.TextLink, ColumnTypes.NumberProgress, ColumnTypes.DatetimeDate, ColumnTypes.DatetimeTime, ColumnTypes.Datetime, ColumnTypes.SelectionCheck],
incompatibleWith: [FilterIds.Contains, FilterIds.BeginsWith, FilterIds.EndsWith, FilterIds.IsEqual, FilterIds.IsGreaterThan, FilterIds.IsGreaterThanOrEqual, FilterIds.IsLowerThan, FilterIds.IsLowerThanOrEqual, FilterIds.IsEmpty],
noSearchValue: true,
}),
Expand Down
4 changes: 2 additions & 2 deletions src/shared/components/ncTable/mixins/magicFields.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,14 @@ export const MagicFields = {
id: 'me',
label: t('tables', 'Me (user ID)'),
icon: 'icon-user',
goodFor: [ColumnTypes.TextLine, ColumnTypes.Selection, ColumnTypes.SelectionMulti, ColumnTypes.TextRich, ColumnTypes.TextLink, ColumnTypes.Usergroup],
goodFor: [ColumnTypes.TextLine, ColumnTypes.Selection, ColumnTypes.SelectionMulti, ColumnTypes.TextRich, ColumnTypes.TextLink],
replace: getCurrentUser()?.uid,
}),
MyName: new MagicField({
id: 'my-name',
label: t('tables', 'Me (name)'),
icon: 'icon-user',
goodFor: [ColumnTypes.TextLine, ColumnTypes.Selection, ColumnTypes.SelectionMulti, ColumnTypes.TextRich, ColumnTypes.TextLink, ColumnTypes.Usergroup],
goodFor: [ColumnTypes.TextLine, ColumnTypes.Selection, ColumnTypes.SelectionMulti, ColumnTypes.TextRich, ColumnTypes.TextLink],
replace: getCurrentUser()?.displayName,
}),
Checked: new MagicField({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
{{ item.id }}
</span> -->
<NcUserBubble :display-name="item.id" :show-user-status="column.showUserStatus" :user="item.type === 0 ? item.id: ''">
<h3> User </h3>
@{{ item.id }}
</NcUserBubble>
</div>
Expand Down Expand Up @@ -37,7 +38,7 @@ export default {
},
},
mounted() {
console.log(value)
console.log(this.value)

Check failure on line 41 in src/shared/components/ncTable/partials/TableCellUsergroup.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
}

Check warning on line 42 in src/shared/components/ncTable/partials/TableCellUsergroup.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Missing trailing comma
}
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- TODO: Add prop for single or multiple -->
<NcSelect v-model="value" style="width: 100%;" :loading="loading" :options="options"
:placeholder="getPlaceholder()" :searchable="true" :get-option-key="(option) => option.key"
label="displayName" :aria-label-combobox="getPlaceholder()"
label="id" :aria-label-combobox="getPlaceholder()"
:user-select="mutableColumn.usergroupSelectUsers"
:group-select="mutableColumn.usergroupSelectGroups" :close-on-select="false"
:multiple="mutableColumn.usergroupMultipleItems" @search="asyncFind" @input="addItem">
Expand Down Expand Up @@ -83,7 +83,7 @@ export default {
data() {
return {
mutableColumn: this.column,
value: [],
value: this.column.usergroupDefault,
}
},
computed: {
Expand All @@ -95,10 +95,10 @@ export default {
// TODO update to get groups too
if (Array.isArray(v)) {
this.column.usergroupDefault = v.map(o => {

Check failure on line 97 in src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected mutation of "column" prop
return {type: o.isUser ? 0 : 1, id: o.user }
return o
})
} else {
this.column.usergroupDefault = [{ type: v.isUser ? 0 : 1, id: v.user }]
this.column.usergroupDefault = [v]

Check failure on line 101 in src/shared/components/ncTable/partials/columnTypePartials/forms/UsergroupForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected mutation of "column" prop
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<RowFormWrapper :title="column.title" :mandatory="column.mandatory" :description="column.description" :width="2">
<NcSelect v-model="localValue" style="width: 100%;" :loading="loading" :options="options"
:placeholder="getPlaceholder()" :searchable="true" :get-option-key="(option) => option.key"
label="displayName" :aria-label-combobox="getPlaceholder()"
label="id" :aria-label-combobox="getPlaceholder()"
:user-select="column.usergroupSelectUsers" :group-select="column.usergroupSelectGroups"
:close-on-select="false" :multiple="column.usergroupMultipleItems" @search="asyncFind"
@input="addItem">
Expand Down Expand Up @@ -48,13 +48,14 @@ export default {
},
set(v) {
// TODO update to get groups too
let formattedValue = []
console.log('v', v)

Check failure on line 51 in src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
let formattedValue = null
if (Array.isArray(v)) {
formattedValue = v.map(o => {
return {displayName: o.displayName, type: o.isUser ? 0 : 1, id: o.user }
return o
})
} else {
formattedValue = [{ displayName: v.displayName, type: v.isUser ? 0 : 1, id: v.user }]
formattedValue = [v]
}
console.log(formattedValue)

Check failure on line 60 in src/shared/components/ncTable/partials/rowTypePartials/UsergroupForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

Unexpected console statement
this.$emit('update:value', formattedValue)
Expand Down
8 changes: 3 additions & 5 deletions src/shared/mixins/searchUserGroup.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,11 +80,9 @@ export default {
const res = await axios.get(url)
const rawSuggestions = res.data.ocs.data.map(autocompleteResult => {
return {
user: autocompleteResult.id,
displayName: autocompleteResult.label,
icon: autocompleteResult.icon,
isUser: autocompleteResult.source.startsWith('users'),
key: autocompleteResult.source + '-' + autocompleteResult.id,
id: autocompleteResult.id,
type: autocompleteResult.source.startsWith('users') ? 0 : 1,
key: autocompleteResult.id,
}
})
this.suggestions = this.filterOutUnwantedItems(rawSuggestions)
Expand Down

0 comments on commit 3fa59e8

Please sign in to comment.