mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-31 20:29:55 +02:00
Add more github analytics (#6506)
Signed-off-by: Kristina Fefelova <kristin.fefelova@gmail.com>
This commit is contained in:
@@ -53,7 +53,7 @@
|
||||
return
|
||||
}
|
||||
|
||||
Analytics.handleEvent('Connect project to github')
|
||||
Analytics.handleEvent('github.project.connected', { project: projectInst.identifier, repository: repository._id })
|
||||
|
||||
if (!client.getHierarchy().hasMixin(projectInst, github.mixin.GithubProject)) {
|
||||
// We need to add GithubProject mixin
|
||||
|
||||
@@ -20,6 +20,8 @@
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import { ObjectPresenter } from '@hcengineering/view-resources'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
|
||||
import github from '../plugin'
|
||||
import ConnectProject from './ConnectProject.svelte'
|
||||
import { githubLanguageColors } from './languageColors'
|
||||
@@ -45,6 +47,10 @@
|
||||
await client.update(prj, {
|
||||
$pull: { repositories: repository._id }
|
||||
})
|
||||
Analytics.handleEvent('github.project.disconnected', {
|
||||
project: prj.identifier,
|
||||
repository: repository._id
|
||||
})
|
||||
// // We need to delete all issues related to repository
|
||||
// const ops = client.apply('cleanup:' + repository._id)
|
||||
// const issuesQuery = await client.findAll(
|
||||
|
||||
@@ -4,7 +4,12 @@
|
||||
|
||||
import { type Data, type Ref, type Space, type TxOperations } from '@hcengineering/core'
|
||||
import { type Resources } from '@hcengineering/platform'
|
||||
import { getClient, type DocCreateFunction, type DocCreatePhase } from '@hcengineering/presentation'
|
||||
import {
|
||||
getClient,
|
||||
type DocCreateFunction,
|
||||
type DocCreatePhase,
|
||||
type DocCreateAnalyticsPropsFunction
|
||||
} from '@hcengineering/presentation'
|
||||
import tracker, { type Issue } from '@hcengineering/tracker'
|
||||
import { type GithubIntegrationRepository } from '@hcengineering/github'
|
||||
import AuthenticationCheck from './components/AuthenticationCheck.svelte'
|
||||
@@ -51,6 +56,25 @@ async function updateIssue (
|
||||
}
|
||||
}
|
||||
|
||||
function getCreateIssueAnalyticsProps (
|
||||
space: Space,
|
||||
issue: Data<Issue>,
|
||||
settings: Record<string, any>
|
||||
): Record<string, any> {
|
||||
const hierarchy = getClient().getHierarchy()
|
||||
if (hierarchy.hasMixin(space, github.mixin.GithubProject)) {
|
||||
const repository = settings.repository as Ref<GithubIntegrationRepository>
|
||||
if (repository == null) return {}
|
||||
|
||||
return {
|
||||
github: true,
|
||||
githubRepository: repository
|
||||
}
|
||||
}
|
||||
|
||||
return {}
|
||||
}
|
||||
|
||||
export default async (): Promise<Resources> => ({
|
||||
component: {
|
||||
Connect,
|
||||
@@ -85,6 +109,7 @@ export default async (): Promise<Resources> => ({
|
||||
const client = getClient()
|
||||
return spaces.some((it) => client.getHierarchy().hasMixin(it, github.mixin.GithubProject))
|
||||
},
|
||||
UpdateIssue: updateIssue as DocCreateFunction
|
||||
UpdateIssue: updateIssue as DocCreateFunction,
|
||||
GetCreateIssueAnalyticsProps: getCreateIssueAnalyticsProps as DocCreateAnalyticsPropsFunction
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user