diff --git a/backend/src/services/organizationService.ts b/backend/src/services/organizationService.ts index 7123d1aa4..492928cdf 100644 --- a/backend/src/services/organizationService.ts +++ b/backend/src/services/organizationService.ts @@ -1013,19 +1013,19 @@ export default class OrganizationService extends LoggerBase { } async findAllAutocomplete(data) { - const segmentId = data.segments && data.segments.length > 0 ? data.segments[0] : undefined - - const res = await OrganizationRepository.findAndCountAll( + const { filter, orderBy, limit, offset, segments } = data + return OrganizationRepository.findAndCountAll( { - ...data, - segmentId, - include: { - segments: true, - }, + filter, + orderBy, + limit, + offset, + segmentId: segments.length > 0 ? segments[0] : undefined, + fields: ['id', 'segmentId', 'displayName', 'memberCount', 'activityCount', 'logo'], + include: { aggregates: true, identities: false, lfxMemberships: true }, }, this.options, ) - return res } async findAndCountAll(args) { diff --git a/frontend/src/modules/member/member-service.js b/frontend/src/modules/member/member-service.js index ad466c9cc..2b40e1dec 100644 --- a/frontend/src/modules/member/member-service.js +++ b/frontend/src/modules/member/member-service.js @@ -140,7 +140,7 @@ export class MemberService { }, } : {}, offset: 0, - orderBy: 'displayName_ASC', + orderBy: 'activityCount_DESC', limit, ...(segments && { segments, diff --git a/frontend/src/modules/organization/components/shared/organization-select.vue b/frontend/src/modules/organization/components/shared/organization-select.vue index 8876f353b..9207cd48e 100644 --- a/frontend/src/modules/organization/components/shared/organization-select.vue +++ b/frontend/src/modules/organization/components/shared/organization-select.vue @@ -59,6 +59,8 @@ import LfAvatar from '@/ui-kit/avatar/Avatar.vue'; import LfIconOld from '@/ui-kit/icon/IconOld.vue'; import LfProjectGroupsTags from '@/shared/modules/project-groups/components/project-groups-tags.vue'; import AppAutocompleteOneInput from '@/shared/form/autocomplete-one-input.vue'; +import { storeToRefs } from 'pinia'; +import { useLfSegmentsStore } from '@/modules/lf/segments/store'; const props = defineProps<{ modelValue: Organization | null, @@ -66,6 +68,8 @@ const props = defineProps<{ const emit = defineEmits<{(e: 'update:modelValue', value: Organization | null): any}>(); +const { selectedProjectGroup } = storeToRefs(useLfSegmentsStore()); + const form = computed({ get() { return props.modelValue; @@ -81,8 +85,8 @@ const fetchOrganizations = async ({ query } : { query, limit: 40, excludeSegments: true, -}) - .then((options: Organization[]) => options.filter((m) => m.id !== form.value?.id)); + segments: [selectedProjectGroup.value?.id], +}); const createOrganization = (value: string) => OrganizationService.create({ name: value, diff --git a/frontend/src/modules/organization/organization-service.js b/frontend/src/modules/organization/organization-service.js index 1c04fea75..d8dff7f11 100644 --- a/frontend/src/modules/organization/organization-service.js +++ b/frontend/src/modules/organization/organization-service.js @@ -200,7 +200,7 @@ export class OrganizationService { ], }, offset: 0, - orderBy: 'displayName_ASC', + orderBy: 'activityCount_DESC', limit, ...(segments && { segments,