Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions frontend/src/modules/member/config/filters/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@ import joinedDate from './joinedDate/config';
import lastActivityDate from './lastActivityDate/config';
import reach from './reach/config';
import tags from './tags/config';
import memberName from './memberName/config';

export const memberFilters: Record<string, FilterConfig> = {
memberName,
Comment thread
joanagmaia marked this conversation as resolved.
noOfActivities,
noOfOSSContributions,
activeOn,
Expand Down
31 changes: 31 additions & 0 deletions frontend/src/modules/member/config/filters/memberName/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import { FilterConfigType } from '@/shared/modules/filters/types/FilterConfig';
import {
StringFilterConfig,
StringFilterOptions,
StringFilterValue,
} from '@/shared/modules/filters/types/filterTypes/StringFilterConfig';
import { itemLabelRendererByType } from '@/shared/modules/filters/config/itemLabelRendererByType';
import { apiFilterRendererByType } from '@/shared/modules/filters/config/apiFilterRendererByType';

const memberName: StringFilterConfig = {
id: 'memberName',
label: 'Member name',
iconClass: 'ri-account-circle-line',
type: FilterConfigType.STRING,
options: {},
itemLabelRenderer(
value: StringFilterValue,
options: StringFilterOptions,
): string {
return itemLabelRendererByType[FilterConfigType.STRING](
'Member name',
value,
options,
);
},
apiFilterRenderer(value: StringFilterValue): any[] {
return apiFilterRendererByType[FilterConfigType.STRING]('displayName', value);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also if you notice on string.label.renderer.ts file we do this:
const excludeText = !include ? ' (exclude)' : '';

And since we are not passing any include value, the filter is getting updated like this:
Screenshot 2023-09-06 at 13 56 40

Can you also update the following:

  1. On frontend/src/shared/modules/filters/types/filterTypes/StringFilterConfig.ts add include: boolean to StringFilterValue
  2. Then on frontend/src/shared/modules/filters/components/filterTypes/StringFilter.vue update defaultForm to
const defaultForm: StringFilterValue = {
  value: '',
  include: true,
  operator: FilterStringOperator.LIKE,
};

This won't render the Include Checkbox. It's just a fix to make sure that we don't render (exclude) when we are actually including.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

alright, changes made :)

},
};

export default memberName;