-
Notifications
You must be signed in to change notification settings - Fork 727
Bugfix/lfx 1803 people tab org #2696
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
Changes from 6 commits
182face
b8f8c04
b84811e
0986738
4fc8261
ae2b0b8
0a872bc
82aabfd
4b8f758
9fb7d90
1178b9a
45c5ef2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,6 +6,7 @@ | |
| :search-config="memberSearchFilter" | ||
| :saved-views-config="memberSavedViews" | ||
| :custom-config="customAttributesFilter" | ||
| :exclude-filters="excludeFilters" | ||
| hash="people" | ||
| @fetch="onFilterChange($event)" | ||
| /> | ||
|
|
@@ -20,9 +21,7 @@ | |
| <template #trigger> | ||
| <div class="flex items-center gap-1 py-2"> | ||
| <p class="text-small"> | ||
| <span class="font-semibold"> | ||
| Sort: | ||
| </span> | ||
| <span class="font-semibold"> Sort: </span> | ||
| {{ sorters[sort] }} | ||
| </p> | ||
| <lf-icon-old name="arrow-down-s-line" :size="16" /> | ||
|
|
@@ -37,12 +36,7 @@ | |
| @click="onSortChange(key)" | ||
| > | ||
| <span>{{ label }}</span> | ||
| <lf-icon-old | ||
| v-if="sort === key" | ||
| name="check-line" | ||
| :size="16" | ||
| class="text-primary-500" | ||
| /> | ||
| <lf-icon-old v-if="sort === key" name="check-line" :size="16" class="text-primary-500" /> | ||
| </lf-dropdown-item> | ||
| </lf-dropdown> | ||
| </div> | ||
|
|
@@ -71,11 +65,7 @@ | |
| class="border-2 rounded-full p-0.5" | ||
| :class="isNew(contributor) ? 'border-primary-500' : 'border-transparent'" | ||
| > | ||
| <lf-avatar | ||
| :src="avatar(contributor)" | ||
| :name="contributor.displayName" | ||
| :size="32" | ||
| /> | ||
| <lf-avatar :src="avatar(contributor)" :name="contributor.displayName" :size="32" /> | ||
| </div> | ||
| <p class="text-medium font-semibold text-black group-hover:text-primary-500 transition"> | ||
| {{ contributor.displayName }} | ||
|
|
@@ -117,11 +107,7 @@ | |
| </div> | ||
| </template> | ||
| </app-identities-horizontal-list-members> | ||
| <lf-tooltip | ||
| v-else | ||
| placement="top-end" | ||
| content="This person's data is not shown because of the GDPR." | ||
| > | ||
| <lf-tooltip v-else placement="top-end" content="This person's data is not shown because of the GDPR."> | ||
| <div class="h-6 w-21 rounded-md bg-gray-200" /> | ||
| </lf-tooltip> | ||
| </div> | ||
|
|
@@ -131,26 +117,17 @@ | |
| <div class="flex justify-center pb-8"> | ||
| <lf-icon-old name="group-2-line" :size="80" class="text-gray-200" /> | ||
| </div> | ||
| <h5 class="text-center text-h5"> | ||
| No people found | ||
| </h5> | ||
| <h5 class="text-center text-h5">No people found</h5> | ||
| <p class="text-gray-600 text-small text-center mt-4"> | ||
| We couldn't find any results that match your search criteria, please try a different query | ||
| </p> | ||
| </div> | ||
| <div | ||
| v-if="pagination.total > (pagination.page * pagination.perPage)" | ||
| v-if="pagination.total > pagination.page * pagination.perPage" | ||
| class="pt-10 pb-6 gap-4 flex justify-center items-center" | ||
| > | ||
| <p class="text-small text-gray-400"> | ||
| {{ contributors.length }} of {{ totalContacts }} people | ||
| </p> | ||
| <lf-button | ||
| type="primary-ghost" | ||
| loading-text="Loading people..." | ||
| :loading="loading" | ||
| @click="loadMore" | ||
| > | ||
| <p class="text-small text-gray-400">{{ contributors.length }} of {{ totalContacts }} people</p> | ||
| <lf-button type="primary-ghost" loading-text="Loading people..." :loading="loading" @click="loadMore"> | ||
| Load more | ||
| </lf-button> | ||
| </div> | ||
|
|
@@ -176,16 +153,15 @@ import LfDropdown from '@/ui-kit/dropdown/Dropdown.vue'; | |
| import LfDropdownItem from '@/ui-kit/dropdown/DropdownItem.vue'; | ||
| import { useLfSegmentsStore } from '@/modules/lf/segments/store'; | ||
| import LfButton from '@/ui-kit/button/Button.vue'; | ||
| import AppIdentitiesHorizontalListMembers | ||
| from '@/shared/modules/identities/components/identities-horizontal-list-members.vue'; | ||
| import AppIdentitiesHorizontalListMembers from '@/shared/modules/identities/components/identities-horizontal-list-members.vue'; | ||
| import pluralize from 'pluralize'; | ||
| import LfTooltip from '@/ui-kit/tooltip/Tooltip.vue'; | ||
| import LfSpinner from '@/ui-kit/spinner/Spinner.vue'; | ||
| import LfContributorEngagementLevel from '@/modules/contributor/components/shared/contributor-engagement-level.vue'; | ||
| import useContributorHelpers from '@/modules/contributor/helpers/contributor.helpers'; | ||
|
|
||
| const props = defineProps<{ | ||
| organization: Organization, | ||
| organization: Organization; | ||
| }>(); | ||
|
|
||
| const filterConfig = { ...memberFilters }; | ||
|
|
@@ -202,11 +178,12 @@ const totalContacts = ref<number>(0); | |
| const loading = ref<boolean>(false); | ||
|
|
||
| const savedBody = ref<any>({}); | ||
| const searchStr = ref<string>(''); | ||
|
|
||
| const { | ||
| avatar, isNew, identities, isMasked, | ||
| } = useContributorHelpers(); | ||
| const { avatar, isNew, identities, isMasked } = useContributorHelpers(); | ||
|
|
||
| // TODO: need to revisit this. Understand why the filter.vue is parsing the segmentId for this component as a filter in that component | ||
| const excludeFilters = ['segmentId']; | ||
|
||
| const sorters = { | ||
| score_DESC: 'Most engaged', | ||
| activityCount_DESC: 'Most activities', | ||
|
|
@@ -245,22 +222,19 @@ const doGetMembersCount = () => { | |
| filter: orgFilter, | ||
| segments: selectedProjectGroup.value?.id ? [selectedProjectGroup.value?.id] : props.organization.segments, | ||
| }, | ||
| true, | ||
| ) | ||
| .then(({ count }) => { | ||
| totalContacts.value = count; | ||
| }); | ||
| true | ||
| ).then(({ count }) => { | ||
| totalContacts.value = count; | ||
| }); | ||
| }; | ||
|
|
||
| const fetch = () => { | ||
| loading.value = true; | ||
| MemberService.listMembers({ | ||
| filter: { | ||
| and: [ | ||
| orgFilter, | ||
| savedBody.value, | ||
| ], | ||
| and: [orgFilter, savedBody.value], | ||
| }, | ||
| search: searchStr.value, | ||
|
Comment on lines
237
to
+240
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🛠️ Refactor suggestion Improve error handling in fetch function The fetch function resets data on error but doesn't provide user feedback about the failure. Consider adding error handling: filter: {
and: [orgFilter, savedBody.value],
},
search: searchStr.value,
+}).catch((error) => {
+ contributors.value = [];
+ pagination.value.total = 0;
+ // Add error notification
+ console.error('Failed to fetch contributors:', error);
+ // If you have a notification system
+ // notify.error('Failed to load contributors. Please try again.');
|
||
| offset: (pagination.value.page - 1) * pagination.value.perPage, | ||
| limit: pagination.value.perPage, | ||
| orderBy: sort.value, | ||
|
|
@@ -284,15 +258,16 @@ const fetch = () => { | |
| }; | ||
|
|
||
| const loadMore = () => { | ||
| if (pagination.value.total <= (pagination.value.page * pagination.value.perPage)) { | ||
| if (pagination.value.total <= pagination.value.page * pagination.value.perPage) { | ||
| return; | ||
| } | ||
| pagination.value.page += 1; | ||
| fetch(); | ||
| }; | ||
|
|
||
| const onFilterChange = (filterQuery: FilterQuery) => { | ||
| savedBody.value = filterQuery.filter; | ||
| savedBody.value = filterQuery.body; | ||
| searchStr.value = filterQuery.search; | ||
| pagination.value.page = 1; | ||
| pagination.value.total = 0; | ||
| fetch(); | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.