mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-12 04:37:44 +02:00
Move services to public (#6156)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -0,0 +1,90 @@
|
||||
//
|
||||
// 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 } 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 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: ''
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
},
|
||||
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
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user