Skip to content
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

Custom views #1705

Merged
merged 25 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
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
5 changes: 0 additions & 5 deletions frontend/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ declare module '@vue/runtime-core' {
ElButton: typeof import('element-plus/es')['ElButton']
ElButtonGroup: typeof import('element-plus/es')['ElButtonGroup']
ElCard: typeof import('element-plus/es')['ElCard']
ElCarousel: typeof import('element-plus/es')['ElCarousel']
ElCarouselItem: typeof import('element-plus/es')['ElCarouselItem']
ElCheckbox: typeof import('element-plus/es')['ElCheckbox']
ElCol: typeof import('element-plus/es')['ElCol']
ElCollapse: typeof import('element-plus/es')['ElCollapse']
ElCollapseItem: typeof import('element-plus/es')['ElCollapseItem']
ElContainer: typeof import('element-plus/es')['ElContainer']
Expand Down Expand Up @@ -49,12 +46,10 @@ declare module '@vue/runtime-core' {
ElTabPane: typeof import('element-plus/es')['ElTabPane']
ElTabs: typeof import('element-plus/es')['ElTabs']
ElTag: typeof import('element-plus/es')['ElTag']
ElTextarea: typeof import('element-plus/es')['ElTextarea']
ElTimeline: typeof import('element-plus/es')['ElTimeline']
ElTimelineItem: typeof import('element-plus/es')['ElTimelineItem']
ElTimeSelect: typeof import('element-plus/es')['ElTimeSelect']
ElTooltip: typeof import('element-plus/es')['ElTooltip']
ElUpload: typeof import('element-plus/es')['ElUpload']
RouterLink: typeof import('vue-router')['RouterLink']
RouterView: typeof import('vue-router')['RouterView']
}
Expand Down
4 changes: 2 additions & 2 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
if (!segmentKey || segmentKey.startsWith('%VUE_APP_SEGMENT_KEY')) {
segmentKey = 'CROWD_VUE_APP_SEGMENT_KEY'
}

!(function() {
var analytics = (window.analytics =
window.analytics || [])
Expand Down Expand Up @@ -136,7 +136,7 @@
analytics.load(segmentKey)
}
})()


let pendoKey = '%VUE_APP_PENDO_KEY%'

Expand Down
16 changes: 16 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"vite": "^4.4.7",
"vue": "^3.3.1",
"vue-3-sanitize": "^0.1.4",
"vue-draggable-next": "^2.2.1",
"vue-grid-layout": "3.0.0-beta1",
"vue-json-pretty": "^2.2.4",
"vue-router": "^4.1.6",
Expand Down
12 changes: 5 additions & 7 deletions frontend/src/modules/dashboard/components/dashboard-members.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:total="members.total"
:route="{
name: 'member',
query: filterQueryService().setQuery(allMembers.filter),
query: filterQueryService().setQuery(allContacts.config),
}"
button-title="All contacts"
report-name="Members report"
Expand Down Expand Up @@ -92,7 +92,7 @@
:to="{
name: 'member',
query: filterQueryService().setQuery({
...allMembers.filter,
...allContacts.config,
joinedDate: {
value: periodRange,
operator: 'between',
Expand Down Expand Up @@ -180,7 +180,7 @@
:to="{
name: 'member',
query: filterQueryService().setQuery({
...allMembers.filter,
...allContacts.config,
lastActivityDate: {
value: periodRange,
operator: 'between',
Expand Down Expand Up @@ -217,8 +217,7 @@ import { DAILY_GRANULARITY_FILTER } from '@/modules/widget/widget-constants';
import AppDashboardMemberItem from '@/modules/dashboard/components/member/dashboard-member-item.vue';
import AppDashboardCount from '@/modules/dashboard/components/dashboard-count.vue';
import { filterQueryService } from '@/shared/modules/filters/services/filter-query.service';
import newAndActive from '@/modules/member/config/saved-views/views/new-and-active';
import allMembers from '@/modules/member/config/saved-views/views/all-members';
import allContacts from '@/modules/member/config/saved-views/views/all-contacts';

export default {
name: 'AppDashboardMember',
Expand All @@ -237,8 +236,7 @@ export default {
activeMembersCount,
formatDateToTimeAgo,
filterQueryService,
newAndActive,
allMembers,
allContacts,
};
},
computed: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:total="organizations.total"
:route="{
name: 'organization',
query: filterQueryService().setQuery(allOrganizations.filter),
query: filterQueryService().setQuery(allOrganizations.config),
}"
button-title="All organizations"
report-name="Organizations report"
Expand Down Expand Up @@ -79,7 +79,7 @@
:to="{
name: 'organization',
query: filterQueryService().setQuery({
...allOrganizations.filter,
...allOrganizations.config,
joinedDate: {
value: periodRange,
operator: 'between',
Expand Down Expand Up @@ -159,7 +159,7 @@
:to="{
name: 'organization',
query: filterQueryService().setQuery({
...allOrganizations.filter,
...allOrganizations.config,
lastActivityDate: {
value: periodRange,
operator: 'between',
Expand Down
21 changes: 14 additions & 7 deletions frontend/src/modules/member/config/saved-views/main.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,32 @@
import { SavedView, SavedViewsConfig } from '@/shared/modules/saved-views/types/SavedViewsConfig';
import allMembers from './views/all-members';
import allContacts from './views/all-contacts';
import newAndActive from './views/new-and-active';
import slippingAway from './views/slipping-away';
import mostEngaged from './views/most-engaged';
import influential from './views/influential';
import teamMembers from './views/team-members';

import bot from './settings/bot';
import teamMember from './settings/teamMember';
import organization from './settings/organization';
import bot from './settings/bot/config';
import teamMember from './settings/teamMember/config';
import organization from './settings/organization/config';

export const memberSavedViews: SavedViewsConfig = {
defaultView: allMembers,
defaultView: allContacts,
settings: {
bot,
teamMember,
bot,
organization,
},
sorting: {
displayName: 'Member',
gaspergrom marked this conversation as resolved.
Show resolved Hide resolved
activityCount: '# of activities',
score: 'Engagement level',
lastActive: 'Last activity',
joinedAt: 'Joined date',
numberOfOpenSourceContributions: '# of OSS contributions',
},
};

// Hardcoded views until we have backend done for it
export const memberViews: SavedView[] = [
newAndActive,
slippingAway,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<template>
<article>
<p class="text-xs font-semibold leading-5 mb-3">
Bot members visibility
</p>
<el-radio-group v-model="value">
<el-radio :label="IncludeEnum.EXCLUDE" class="!h-5">
<span class="text-xs">Exclude bot members</span>
</el-radio>
<el-radio :label="IncludeEnum.INCLUDE" class="!h-5">
<span class="text-xs">Include bot members</span>
gaspergrom marked this conversation as resolved.
Show resolved Hide resolved
</el-radio>
</el-radio-group>
</article>
</template>

<script setup lang="ts">
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/common/types/IncludeEnum';
import { computed } from 'vue';

const props = defineProps<{
modelValue: IncludeEnum,
}>();

const emit = defineEmits<{(e: 'update:modelValue', value: IncludeEnum): any }>();

const value = computed<IncludeEnum>({
get() {
return props.modelValue;
},
set(val: IncludeEnum) {
emit('update:modelValue', val);
},
});
</script>

<script lang="ts">
export default {
name: 'CrMemberTeamMemberSetting',
};
</script>

<style lang="scss" scoped>
.tabs {
width: calc(100% - 72px);

&.is-shrink{
width: calc(100% - 262px);
}
}
gaspergrom marked this conversation as resolved.
Show resolved Hide resolved
</style>
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { SavedViewsSetting } from '@/shared/modules/saved-views/types/SavedViewsConfig';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/types/IncludeEnum';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/common/types/IncludeEnum';
import { includeFilterRenderer } from '@/modules/member/config/saved-views/settings/common/includeFilterRenderer';
import MemberBotSetting from './MemberBotSetting.vue';

const bot: SavedViewsSetting<IncludeEnum> = {
inSettings: true,
settingsComponent: MemberBotSetting,
defaultValue: IncludeEnum.EXCLUDE,
queryUrlParser(value: string): IncludeEnum {
return value as IncludeEnum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/types/IncludeEnum';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/common/types/IncludeEnum';

export const includeFilterRenderer = (property: string, value: IncludeEnum) => {
if (value === IncludeEnum.FILTER) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { SavedViewsSetting } from '@/shared/modules/saved-views/types/SavedViewsConfig';
import { includeFilterRenderer } from '@/modules/member/config/saved-views/settings/common/includeFilterRenderer';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/types/IncludeEnum';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/common/types/IncludeEnum';

const organization: SavedViewsSetting<IncludeEnum> = {
inSettings: false,
defaultValue: IncludeEnum.EXCLUDE,
queryUrlParser(value: string): IncludeEnum {
return value as IncludeEnum;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<template>
<article>
<p class="text-xs font-semibold leading-5 mb-3">
Team members visibility
</p>
<el-radio-group v-model="value">
<el-radio :label="IncludeEnum.EXCLUDE" class="!h-5">
<span class="text-xs">Exclude team members</span>
</el-radio>
<el-radio :label="IncludeEnum.INCLUDE" class="!h-5">
<span class="text-xs">Include team members</span>
</el-radio>
<el-radio :label="IncludeEnum.FILTER" class="!h-5">
<span class="text-xs">Team members only</span>
</el-radio>
gaspergrom marked this conversation as resolved.
Show resolved Hide resolved
</el-radio-group>
</article>
</template>

<script setup lang="ts">
import { computed } from 'vue';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/common/types/IncludeEnum';

const props = defineProps<{
modelValue: IncludeEnum,
}>();

const emit = defineEmits<{(e: 'update:modelValue', value: IncludeEnum): any }>();

const value = computed<IncludeEnum>({
get() {
return props.modelValue;
},
set(val: IncludeEnum) {
emit('update:modelValue', val);
},
});
</script>

<script lang="ts">
export default {
name: 'CrMemberTeamMemberSetting',
};
</script>

<style lang="scss" scoped>
.tabs {
width: calc(100% - 72px);

&.is-shrink{
width: calc(100% - 262px);
}
}
gaspergrom marked this conversation as resolved.
Show resolved Hide resolved
</style>
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import { SavedViewsSetting } from '@/shared/modules/saved-views/types/SavedViewsConfig';
import { includeFilterRenderer } from '@/modules/member/config/saved-views/settings/common/includeFilterRenderer';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/types/IncludeEnum';
import { IncludeEnum } from '@/modules/member/config/saved-views/settings/common/types/IncludeEnum';
import MemberTeamMemberSetting from './MemberTeamMemberSetting.vue';

const teamMember: SavedViewsSetting<IncludeEnum> = {
inSettings: true,
settingsComponent: MemberTeamMemberSetting,
defaultValue: IncludeEnum.EXCLUDE,
queryUrlParser(value: string): IncludeEnum {
return value as IncludeEnum;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { SavedView } from '@/shared/modules/saved-views/types/SavedViewsConfig';

const allMembers: SavedView = {
const allContacts: SavedView = {
id: 'all-contacts',
label: 'All contacts',
filter: {
name: 'All contacts',
placement: 'member',
gaspergrom marked this conversation as resolved.
Show resolved Hide resolved
visibility: 'tenant',
config: {
search: '',
relation: 'and',
order: {
Expand All @@ -18,4 +20,4 @@ const allMembers: SavedView = {
},
};

export default allMembers;
export default allContacts;
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@ import { SavedView } from '@/shared/modules/saved-views/types/SavedViewsConfig';

const influential: SavedView = {
id: 'influential',
label: 'Influential',
filter: {
name: 'Influential',
placement: 'member',
visibility: 'tenant',
config: {
search: '',
relation: 'and',
order: {
Expand All @@ -15,7 +17,6 @@ const influential: SavedView = {
teamMember: 'exclude',
organization: 'exclude',
},

reach: {
operator: 'gte',
value: 500,
Expand Down
Loading
Loading