mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-20 11:22:25 +02:00
* UBERF-11414: Use common integration kind Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Allow multiple gmail Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Merge with develop Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Refactor integration kinds Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Add integrations package Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Integrations Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Integration state and config Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Add integration events Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Refresh integration states Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Rename to integration-client Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Add filter button Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Add translations for filters Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Synced channels count Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Actions Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Add isLoading for connect Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Create connection and integration Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Use social id from hulygram Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Remove old integrations Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Gmail state Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Gmail state and disconnect all handler Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Add tests Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Formatting Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Gmail sync state Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix rush check Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix gmail tests Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix calendar actions and config Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Calendar state Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Access config Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Github integration state Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix svelte errors Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix formatting Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix typos Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix validate Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Fix translations Signed-off-by: Artem Savchenko <armisav@gmail.com> * UBERF-11414: Retry on network issues Signed-off-by: Artem Savchenko <armisav@gmail.com> --------- Signed-off-by: Artem Savchenko <armisav@gmail.com>
118 lines
4.5 KiB
TypeScript
118 lines
4.5 KiB
TypeScript
//
|
|
// Copyright © 2023 Hardcore Engineering Inc.
|
|
//
|
|
|
|
import { type Data, type Ref, type Space, type TxOperations } from '@hcengineering/core'
|
|
import { type Resources } from '@hcengineering/platform'
|
|
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'
|
|
import GithubIssueHeader from './components/GithubIssueHeader.svelte'
|
|
import Configure from './components/Configure.svelte'
|
|
import Connect from './components/Connect.svelte'
|
|
import ConnectApp from './components/ConnectApp.svelte'
|
|
import EditPullRequest from './components/EditPullRequest.svelte'
|
|
import GithubIcon from './components/GithubIcon.svelte'
|
|
import GithubIssueInfo from './components/GithubIssueInfo.svelte'
|
|
import GithubIssueInfoHeader from './components/GithubIssueInfoHeader.svelte'
|
|
import PullRequestMergeState from './components/PullRequestMergeState.svelte'
|
|
import PullRequests from './components/PullRequests.svelte'
|
|
import RepositoryPresenterRef from './components/RepositoryPresenterRef.svelte'
|
|
import RepositoryPresenterRefEditor from './components/RepositoryPresenterRefEditor.svelte'
|
|
import GithubReviewPresenter from './components/presenters/GithubReviewPresenter.svelte'
|
|
import GithubReviewThreadPresenter from './components/presenters/GithubReviewThreadPresenter.svelte'
|
|
import MergeableValuePresenter from './components/presenters/MergeableValuePresenter.svelte'
|
|
import PullRequestNotificationPresenter from './components/presenters/PullRequestNotificationPresenter.svelte'
|
|
import PullRequestPresenter from './components/presenters/PullRequestPresenter.svelte'
|
|
import PullRequestReviewDecisionValuePresenter from './components/presenters/PullRequestReviewDecisionValuePresenter.svelte'
|
|
import PullRequestStateValuePresenter from './components/presenters/PullRequestStateValuePresenter.svelte'
|
|
import RepositoryPresenter from './components/presenters/RepositoryPresenter.svelte'
|
|
import TitlePresenter from './components/presenters/TitlePresenter.svelte'
|
|
import GithubIssuePresenter from './components/presenters/GithubIssuePresenter.svelte'
|
|
import IntegrationState from './components/IntegrationState.svelte'
|
|
import github from './plugin'
|
|
|
|
async function updateIssue (
|
|
client: TxOperations,
|
|
id: Ref<Issue>,
|
|
space: Space,
|
|
issue: Data<Issue>,
|
|
settings: Record<string, any>,
|
|
phase: DocCreatePhase
|
|
): Promise<void> {
|
|
// We should add mixin only in post phase.
|
|
if (client.getHierarchy().hasMixin(space, github.mixin.GithubProject) && phase === 'post') {
|
|
// No actions required for now.
|
|
await client.createMixin(id, tracker.class.Issue, space._id, github.mixin.GithubIssue, {
|
|
githubNumber: 0,
|
|
repository: settings.repository as Ref<GithubIntegrationRepository>,
|
|
url: ''
|
|
})
|
|
}
|
|
}
|
|
|
|
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,
|
|
Configure,
|
|
GithubIcon,
|
|
ConnectApp,
|
|
PullRequestPresenter,
|
|
PullRequestNotificationPresenter,
|
|
PullRequests,
|
|
EditPullRequest,
|
|
GithubReviewPresenter,
|
|
GithubReviewThreadPresenter,
|
|
TitlePresenter,
|
|
RepositoryPresenter,
|
|
RepositoryPresenterRef,
|
|
RepositoryPresenterRefEditor,
|
|
AuthenticationCheck,
|
|
GithubIssueHeader,
|
|
GithubIssueInfo,
|
|
GithubIssueInfoHeader,
|
|
MergeableValuePresenter,
|
|
PullRequestReviewDecisionValuePresenter,
|
|
PullRequestStateValuePresenter,
|
|
PullRequestMergeState,
|
|
GithubIssuePresenter,
|
|
IntegrationState
|
|
},
|
|
handler: {
|
|
DisconnectHandler: async () => {}
|
|
},
|
|
functions: {
|
|
ShowForRepositoryOnly: async (spaces: Space[]) => {
|
|
const client = getClient()
|
|
return spaces.some((it) => client.getHierarchy().hasMixin(it, github.mixin.GithubProject))
|
|
},
|
|
UpdateIssue: updateIssue as DocCreateFunction,
|
|
GetCreateIssueAnalyticsProps: getCreateIssueAnalyticsProps as DocCreateAnalyticsPropsFunction
|
|
}
|
|
})
|