diff --git a/frontend/app/components/modules/project/components/contributors/config/metrics.ts b/frontend/app/components/modules/project/components/contributors/config/metrics.ts index b55c3aada..aeae39424 100644 --- a/frontend/app/components/modules/project/components/contributors/config/metrics.ts +++ b/frontend/app/components/modules/project/components/contributors/config/metrics.ts @@ -1,4 +1,5 @@ import type { DropdownGroupOptions } from '~/components/uikit/dropdown/types/dropdown.types'; +import {ActivityTypes} from "~~/types/shared/activity-types"; export const metricsOptions: DropdownGroupOptions[] = [ { label: '', items: [{ label: 'All activities', value: 'all' }] }, @@ -6,52 +7,52 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Github', items: [ { - value: 'authored-commit', + value: ActivityTypes.AUTHORED_COMMIT.valueOf(), label: 'Authored a commit' }, { - value: 'pull_request-closed', + value: ActivityTypes.PULL_REQUEST_CLOSED.valueOf(), label: 'Closed a pull request' }, { - value: 'pull_request-opened', + value: ActivityTypes.PULL_REQUEST_OPENED.valueOf(), label: 'Opened a pull request' }, { - value: 'pull_request-comment', + value: ActivityTypes.PULL_REQUEST_COMMENT.valueOf(), label: 'Commented on a pull request' }, { - value: 'pull_request-merged', + value: ActivityTypes.PULL_REQUEST_MERGED.valueOf(), label: 'Merged a pull request' }, { - value: 'pull_request-review-requested', + value: ActivityTypes.PULL_REQUEST_REVIEW_REQUESTED.valueOf(), label: 'Requested a review for a pull request' }, { - value: 'pull_request-review-thread-comment', + value: ActivityTypes.PULL_REQUEST_REVIEW_THREAD_COMMENT.valueOf(), label: 'Commented on a pull request review thread' }, { - value: 'issue-closed', + value: ActivityTypes.ISSUE_CLOSED.valueOf(), label: 'Closed an issue' }, { - value: 'issue-opened', + value: ActivityTypes.ISSUE_OPENED.valueOf(), label: 'Opened an issue' }, { - value: 'issue-comment', + value: ActivityTypes.ISSUE_COMMENT.valueOf(), label: 'Commented on an issue' }, { - value: 'discussion-started', + value: ActivityTypes.DISCUSSION_STARTED.valueOf(), label: 'Started a discussion' }, { - value: 'discussion-comment', + value: ActivityTypes.DISCUSSION_COMMENT.valueOf(), label: 'Commented on a discussion' } ] @@ -60,47 +61,47 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Git', items: [ { - value: 'authored-commit', + value: ActivityTypes.AUTHORED_COMMIT.valueOf(), label: 'Authored a commit' }, { - value: 'reviewed-commit', + value: ActivityTypes.REVIEWED_COMMIT.valueOf(), label: 'Reviewed a commit' }, { - value: 'tested-commit', + value: ActivityTypes.TESTED_COMMIT.valueOf(), label: 'Tested a commit' }, { - value: 'co-authored-commit', + value: ActivityTypes.COAUTHORED_COMMIT.valueOf(), label: 'Co-authored a commit' }, { - value: 'informed-commit', + value: ActivityTypes.INFORMED_COMMIT.valueOf(), label: 'Informed a commit' }, { - value: 'influenced-commit', + value: ActivityTypes.INFLUENCED_COMMIT.valueOf(), label: 'Influenced a commit' }, { - value: 'approved-commit', + value: ActivityTypes.APPROVED_COMMIT.valueOf(), label: 'Approved a commit' }, { - value: 'committed-commit', + value: ActivityTypes.COMMITTED_COMMIT.valueOf(), label: 'Committed a commit' }, { - value: 'reported-commit', + value: ActivityTypes.REPORTED_COMMIT.valueOf(), label: 'Reported a commit' }, { - value: 'resolved-commit', + value: ActivityTypes.RESOLVED_COMMIT.valueOf(), label: 'Resolved a commit' }, { - value: 'signed-off-commit', + value: ActivityTypes.SIGNEDOFF_COMMIT.valueOf(), label: 'Signed off a commit' } ] @@ -109,39 +110,39 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Gerrit', items: [ { - value: 'changeset-new', + value: ActivityTypes.CHANGESET_NEW.valueOf(), label: 'Created a changeset' }, { - value: 'changeset-created', + value: ActivityTypes.CHANGESET_CREATED.valueOf(), label: 'Created a changeset' }, { - value: 'changeset-merged', + value: ActivityTypes.CHANGESET_MERGED.valueOf(), label: 'Merged a changeset' }, { - value: 'changeset-closed', + value: ActivityTypes.CHANGESET_CLOSED.valueOf(), label: 'Closed a changeset' }, { - value: 'changeset-abandoned', + value: ActivityTypes.CHANGESET_ABANDONED.valueOf(), label: 'Abandoned a changeset' }, { - value: 'changeset_comment-created', + value: ActivityTypes.CHANGESET_COMMENT_CREATED.valueOf(), label: 'Created a changeset comment' }, { - value: 'patchset-created', + value: ActivityTypes.PATCHSET_CREATED.valueOf(), label: 'Created a patchset' }, { - value: 'patchset_comment-created', + value: ActivityTypes.PATCHSET_COMMENT_CREATED.valueOf(), label: 'Created a patchset comment' }, { - value: 'patchset_approval-created', + value: ActivityTypes.PATCHSET_APPROVAL_CREATED.valueOf(), label: 'Created a patchset approval' } ] @@ -150,39 +151,39 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Gitlab', items: [ { - value: 'issue-opened', + value: ActivityTypes.ISSUE_OPENED.valueOf(), label: 'Opened an issue' }, { - value: 'issue-closed', + value: ActivityTypes.ISSUE_CLOSED.valueOf(), label: 'Closed an issue' }, { - value: 'merge_request-closed', + value: ActivityTypes.MERGE_REQUEST_CLOSED.valueOf(), label: 'Closed a merge request' }, { - value: 'merge_request-opened', + value: ActivityTypes.MERGE_REQUEST_OPENED.valueOf(), label: 'Opened a merge request' }, { - value: 'merge_request-review-thread-comment', + value: ActivityTypes.MERGE_REQUEST_REVIEW_THREAD_COMMENT.valueOf(), label: 'Commented on a merge request review thread' }, { - value: 'merge_request-merged', + value: ActivityTypes.MERGE_REQUEST_MERGED.valueOf(), label: 'Merged a merge request' }, { - value: 'merge_request-comment', + value: ActivityTypes.MERGE_REQUEST_COMMENT.valueOf(), label: 'Commented on a merge request' }, { - value: 'issue-comment', + value: ActivityTypes.ISSUE_COMMENT.valueOf(), label: 'Commented on an issue' }, { - value: 'authored-commit', + value: ActivityTypes.AUTHORED_COMMIT.valueOf(), label: 'Authored a commit' } ] @@ -191,7 +192,7 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'GroupsIO', items: [ { - value: 'message', + value: ActivityTypes.MESSAGE.valueOf(), label: 'Sent a message' } ] @@ -200,35 +201,35 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Confluence', items: [ { - value: 'page-created', + value: ActivityTypes.PAGE_CREATED.valueOf(), label: 'Created a page' }, { - value: 'page-updated', + value: ActivityTypes.PAGE_UPDATED.valueOf(), label: 'Updated a page' }, { - value: 'comment-created', + value: ActivityTypes.COMMENT_CREATED.valueOf(), label: 'Created a comment' }, { - value: 'attachment-created', + value: ActivityTypes.ATTACHMENT_CREATED.valueOf(), label: 'Created an attachment' }, { - value: 'blogpost-created', + value: ActivityTypes.BLOGPOST_CREATED.valueOf(), label: 'Created a blog post' }, { - value: 'blogpost-updated', + value: ActivityTypes.BLOGPOST_UPDATED.valueOf(), label: 'Updated a blog post' }, { - value: 'attachment', + value: ActivityTypes.ATTACHMENT.valueOf(), label: 'Attached a file' }, { - value: 'comment', + value: ActivityTypes.COMMENT.valueOf(), label: 'Commented on a page' } ] @@ -237,31 +238,31 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Jira', items: [ { - value: 'issue-created', + value: ActivityTypes.ISSUE_CREATED.valueOf(), label: 'Created an issue' }, { - value: 'issue-closed', + value: ActivityTypes.ISSUE_CLOSED.valueOf(), label: 'Closed an issue' }, { - value: 'issue-assigned', + value: ActivityTypes.ISSUE_ASSIGNED.valueOf(), label: 'Assigned an issue' }, { - value: 'issue-updated', + value: ActivityTypes.ISSUE_UPDATED.valueOf(), label: 'Updated an issue' }, { - value: 'issue-comment-created', + value: ActivityTypes.ISSUE_COMMENT_CREATED.valueOf(), label: 'Created an issue comment' }, { - value: 'issue-comment-updated', + value: ActivityTypes.ISSUE_COMMENT_UPDATED.valueOf(), label: 'Updated an issue comment' }, { - value: 'issue-attachment-added', + value: ActivityTypes.ISSUE_ATTACHMENT_ADDED.valueOf(), label: 'Added an attachment to an issue' } ] @@ -270,7 +271,7 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Devto', items: [ { - value: 'comment', + value: ActivityTypes.COMMENT.valueOf(), label: 'Commented on a post' } ] @@ -279,15 +280,15 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Discord', items: [ { - value: 'message', + value: ActivityTypes.MESSAGE.valueOf(), label: 'Sent a message' }, { - value: 'thread-started', + value: ActivityTypes.THREAD_STARTED.valueOf(), label: 'Started a thread' }, { - value: 'thread-message', + value: ActivityTypes.THREAD_MESSAGE.valueOf(), label: 'Sent a message in a thread' } ] @@ -296,11 +297,11 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Discourse', items: [ { - value: 'create-topic', + value: ActivityTypes.CREATE_TOPIC.valueOf(), label: 'Created a topic' }, { - value: 'message-in-topic', + value: ActivityTypes.MESSAGE_IN_TOPIC.valueOf(), label: 'Sent a message in a topic' } ] @@ -309,11 +310,11 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Hackernews', items: [ { - value: 'post', + value: ActivityTypes.POST.valueOf(), label: 'Posted a post' }, { - value: 'comment', + value: ActivityTypes.COMMENT.valueOf(), label: 'Commented on a post' } ] @@ -322,7 +323,7 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Linkedin', items: [ { - value: 'comment', + value: ActivityTypes.COMMENT.valueOf(), label: 'Commented on a post' } ] @@ -331,11 +332,11 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Reddit', items: [ { - value: 'post', + value: ActivityTypes.POST.valueOf(), label: 'Posted a post' }, { - value: 'comment', + value: ActivityTypes.COMMENT.valueOf(), label: 'Commented on a post' } ] @@ -344,7 +345,7 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Slack', items: [ { - value: 'message', + value: ActivityTypes.MESSAGE.valueOf(), label: 'Sent a message' } ] @@ -353,11 +354,11 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Stackoverflow', items: [ { - value: 'question', + value: ActivityTypes.QUESTION.valueOf(), label: 'Asked a question' }, { - value: 'answer', + value: ActivityTypes.ANSWER.valueOf(), label: 'Answered a question' } ] @@ -366,11 +367,11 @@ export const metricsOptions: DropdownGroupOptions[] = [ label: 'Twitter', items: [ { - value: 'hashtag', + value: ActivityTypes.HASHTAG.valueOf(), label: 'Used a hashtag' }, { - value: 'mention', + value: ActivityTypes.MENTION.valueOf(), label: 'Mentioned a user' } ] diff --git a/frontend/types/shared/activity-platforms.ts b/frontend/types/shared/activity-platforms.ts new file mode 100644 index 000000000..504e3da7b --- /dev/null +++ b/frontend/types/shared/activity-platforms.ts @@ -0,0 +1,19 @@ +export enum ActivityPlatforms { + ALL = 'all', + GITHUB = 'Github', + GIT = 'Git', + GERRIT = 'Gerrit', + GITLAB = 'Gitlab', + GROUPS_IO = 'GroupsIO', + CONFLUENCE = 'Confluence', + JIRA = 'Jira', + DEVTO = 'Devto', + DISCORD = 'Discord', + DISCOURSE = 'Discourse', + HACKERNEWS = 'Hackernews', + LINKEDIN = 'Linkedin', + REDDIT = 'Reddit', + SLACK = 'Slack', + STACKOVERFLOW = 'Stackoverflow', + TWITTER = 'Twitter' +} diff --git a/frontend/types/shared/activity-types.ts b/frontend/types/shared/activity-types.ts new file mode 100644 index 000000000..900f99ebe --- /dev/null +++ b/frontend/types/shared/activity-types.ts @@ -0,0 +1,87 @@ +export enum ActivityTypes { + ALL = 'all', + + // The ones below are for Github + AUTHORED_COMMIT = 'authored-commit', + PULL_REQUEST_CLOSED = 'pull_request-closed', + PULL_REQUEST_OPENED = 'pull_request-opened', + PULL_REQUEST_COMMENT = 'pull_request-comment', + PULL_REQUEST_MERGED = 'pull_request-merged', + PULL_REQUEST_REVIEW_REQUESTED = 'pull_request-review-requested', + PULL_REQUEST_REVIEW_THREAD_COMMENT = 'pull_request-review-thread-comment', + ISSUE_CLOSED = 'issue-closed', + ISSUE_OPENED = 'issue-opened', + ISSUE_COMMENT = 'issue-comment', + DISCUSSION_STARTED = 'discussion-started', + DISCUSSION_COMMENT = 'discussion-comment', + + // The ones below are for Git + REVIEWED_COMMIT = 'reviewed-commit', + TESTED_COMMIT = 'tested-commit', + COAUTHORED_COMMIT = 'co-authored-commit', + INFORMED_COMMIT = 'informed-commit', + INFLUENCED_COMMIT = 'influenced-commit', + APPROVED_COMMIT = 'approved-commit', + COMMITTED_COMMIT = 'committed-commit', + REPORTED_COMMIT = 'reported-commit', + RESOLVED_COMMIT = 'resolved-commit', + SIGNEDOFF_COMMIT = 'signed-off-commit', + + // The ones below are for Gerrit + CHANGESET_NEW = 'changeset-new', + CHANGESET_CREATED = 'changeset-created', + CHANGESET_MERGED = 'changeset-merged', + CHANGESET_CLOSED = 'changeset-closed', + CHANGESET_ABANDONED = 'changeset-abandoned', + CHANGESET_COMMENT_CREATED = 'changeset_comment-created', + PATCHSET_CREATED = 'patchset-created', + PATCHSET_COMMENT_CREATED = 'patchset_comment-created', + PATCHSET_APPROVAL_CREATED = 'patchset_approval-created', + + // The ones below are for Gitlab + MERGE_REQUEST_CLOSED = 'merge_request-closed', + MERGE_REQUEST_OPENED = 'merge_request-opened', + MERGE_REQUEST_REVIEW_THREAD_COMMENT = 'merge_request-review-thread-comment', + MERGE_REQUEST_MERGED = 'merge_request-merged', + MERGE_REQUEST_COMMENT = 'merge_request-comment', + + // The ones below are for GroupsIO + MESSAGE = 'message', + + // The ones below are for Confluence + PAGE_CREATED = 'page-created', + PAGE_UPDATED = 'page-updated', + COMMENT_CREATED = 'comment-created', + ATTACHMENT_CREATED = 'attachment-created', + BLOGPOST_CREATED = 'blogpost-created', + BLOGPOST_UPDATED = 'blogpost-updated', + ATTACHMENT = 'attachment', + COMMENT = 'comment', + + // The ones below are for Jira + ISSUE_CREATED = 'issue-created', + ISSUE_ASSIGNED = 'issue-assigned', + ISSUE_UPDATED = 'issue-updated', + ISSUE_COMMENT_CREATED = 'issue-comment-created', + ISSUE_COMMENT_UPDATED = 'issue-comment-updated', + ISSUE_ATTACHMENT_ADDED = 'issue-attachment-added', + + // The ones below are for Discord + THREAD_STARTED = 'thread-started', + THREAD_MESSAGE = 'thread-message', + + // The ones below are for Discourse + CREATE_TOPIC = 'create-topic', + MESSAGE_IN_TOPIC = 'message-in-topic', + + // The ones below are for Hackernews + POST = 'post', + + // The ones below are for Stackoverflow + QUESTION = 'question', + ANSWER = 'answer', + + // The ones below are for Twitter + HASHTAG = 'hashtag', + MENTION = 'mention' +}