mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-21 03:42:24 +02:00
UBERF-10471: Fix Github miss status updates and allow to re-integrate existing repos (#8842)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -13,12 +13,18 @@
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import DropdownLabelsPopup from '@hcengineering/ui/src/components/DropdownLabelsPopup.svelte'
|
||||
import { GithubIntegration, GithubIntegrationRepository, githubPullRequestStates } from '@hcengineering/github'
|
||||
import {
|
||||
GithubIntegration,
|
||||
GithubIntegrationRepository,
|
||||
githubPullRequestStates,
|
||||
type GithubProject
|
||||
} from '@hcengineering/github'
|
||||
import github from '../plugin'
|
||||
|
||||
export let integration: WithLookup<GithubIntegration>
|
||||
export let repository: GithubIntegrationRepository
|
||||
export let projects: Project[] = []
|
||||
export let orphanProjects: GithubProject[] = []
|
||||
|
||||
/**
|
||||
* @public
|
||||
@@ -112,16 +118,23 @@
|
||||
|
||||
const githubProject = client.getHierarchy().as(projectInst, github.mixin.GithubProject)
|
||||
|
||||
void getClient().update(githubProject, {
|
||||
if (githubProject.integration !== integration._id) {
|
||||
await getClient().update(githubProject, {
|
||||
integration: integration._id
|
||||
})
|
||||
}
|
||||
await getClient().update(githubProject, {
|
||||
$push: { repositories: repository._id }
|
||||
})
|
||||
void getClient().update(repository, { githubProject: githubProject._id, enabled: true })
|
||||
await getClient().update(repository, { githubProject: githubProject._id, enabled: true })
|
||||
}
|
||||
|
||||
$: allowedProjects = projects.filter(
|
||||
(it) =>
|
||||
(client.getHierarchy().asIf(it, github.mixin.GithubProject)?.integration ?? integration._id) === integration._id
|
||||
)
|
||||
$: allowedProjects = projects
|
||||
.filter(
|
||||
(it) =>
|
||||
(client.getHierarchy().asIf(it, github.mixin.GithubProject)?.integration ?? integration._id) === integration._id
|
||||
)
|
||||
.concat(orphanProjects)
|
||||
async function selectProject (event: MouseEvent): Promise<void> {
|
||||
showPopup(
|
||||
DropdownLabelsPopup,
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
<script lang="ts">
|
||||
import GithubRepositories from './GithubRepositories.svelte'
|
||||
|
||||
import { WithLookup } from '@hcengineering/core'
|
||||
import { toIdMap, WithLookup } from '@hcengineering/core'
|
||||
import { GithubIntegration } from '@hcengineering/github'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import { Project } from '@hcengineering/tracker'
|
||||
import { Scroller } from '@hcengineering/ui'
|
||||
import { GithubIntegration } from '@hcengineering/github'
|
||||
import github from '../plugin'
|
||||
|
||||
export let integrations: WithLookup<GithubIntegration>[] = []
|
||||
@@ -14,6 +14,10 @@
|
||||
const client = getClient()
|
||||
|
||||
$: githubProjects = client.getHierarchy().asIfArray(projects, github.mixin.GithubProject)
|
||||
|
||||
$: integerationsMap = toIdMap(integrations)
|
||||
|
||||
$: orphanProjects = githubProjects.filter((it) => !integerationsMap.has(it.integration))
|
||||
</script>
|
||||
|
||||
{#if integrations.length > 0}
|
||||
@@ -23,7 +27,7 @@
|
||||
{@const giprj = githubProjects.filter((it) => it.integration === gi._id)}
|
||||
<div class="flex flex-col mb-4">
|
||||
<!-- svelte-ignore a11y-missing-attribute -->
|
||||
<GithubRepositories integration={gi} giProjects={giprj} {projects} />
|
||||
<GithubRepositories integration={gi} giProjects={giprj} {projects} {orphanProjects} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
import ConnectProject from './ConnectProject.svelte'
|
||||
import { githubLanguageColors } from './languageColors'
|
||||
import { sendGHServiceRequest } from './utils'
|
||||
import { BackgroundColor } from '@hcengineering/text'
|
||||
|
||||
export let integration: WithLookup<GithubIntegration>
|
||||
export let projects: Project[] = []
|
||||
export let giProjects: GithubProject[] = []
|
||||
export let orphanProjects: GithubProject[] = []
|
||||
|
||||
const client = getClient()
|
||||
|
||||
@@ -235,7 +235,7 @@
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
<ConnectProject {integration} {repository} {projects} />
|
||||
<ConnectProject {integration} {repository} {projects} {orphanProjects} />
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user