mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-11 12:17:44 +02:00
Merge staging-new and bump versions
Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@hcengineering/github-resources",
|
||||
"version": "0.7.382",
|
||||
"version": "0.7.411",
|
||||
"main": "src/index.ts",
|
||||
"author": "Hardcore Engineering Inc.",
|
||||
"scripts": {
|
||||
@@ -10,10 +10,12 @@
|
||||
"build:watch": "compile ui",
|
||||
"_phase:build": "compile ui",
|
||||
"_phase:format": "format src",
|
||||
"_phase:validate": "compile validate"
|
||||
"_phase:validate": "compile validate",
|
||||
"svelte-check": "do-svelte-check",
|
||||
"_phase:svelte-check": "do-svelte-check"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@hcengineering/platform-rig": "workspace:^0.7.382",
|
||||
"@hcengineering/platform-rig": "workspace:^0.7.411",
|
||||
"svelte-loader": "^3.2.0",
|
||||
"sass": "^1.80.0",
|
||||
"svelte-preprocess": "^5.1.4",
|
||||
@@ -36,37 +38,37 @@
|
||||
"svelte-eslint-parser": "^0.33.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@hcengineering/platform": "workspace:^0.7.382",
|
||||
"@hcengineering/platform": "workspace:^0.7.411",
|
||||
"svelte": "^4.2.20",
|
||||
"@hcengineering/github": "workspace:^0.7.382",
|
||||
"@hcengineering/ui": "workspace:^0.7.382",
|
||||
"@hcengineering/presentation": "workspace:^0.7.382",
|
||||
"@hcengineering/text": "workspace:^0.7.382",
|
||||
"@hcengineering/text-editor": "workspace:^0.7.382",
|
||||
"@hcengineering/text-editor-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/analytics": "workspace:^0.7.382",
|
||||
"@hcengineering/contact": "workspace:^0.7.382",
|
||||
"@hcengineering/contact-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/setting": "workspace:^0.7.382",
|
||||
"@hcengineering/login": "workspace:^0.7.382",
|
||||
"@hcengineering/core": "workspace:^0.7.382",
|
||||
"@hcengineering/view": "workspace:^0.7.382",
|
||||
"@hcengineering/view-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/setting-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/client": "workspace:^0.7.382",
|
||||
"@hcengineering/chunter": "workspace:^0.7.382",
|
||||
"@hcengineering/github": "workspace:^0.7.411",
|
||||
"@hcengineering/ui": "workspace:^0.7.411",
|
||||
"@hcengineering/presentation": "workspace:^0.7.411",
|
||||
"@hcengineering/text": "workspace:^0.7.411",
|
||||
"@hcengineering/text-editor": "workspace:^0.7.411",
|
||||
"@hcengineering/text-editor-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/analytics": "workspace:^0.7.411",
|
||||
"@hcengineering/contact": "workspace:^0.7.411",
|
||||
"@hcengineering/contact-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/setting": "workspace:^0.7.411",
|
||||
"@hcengineering/login": "workspace:^0.7.411",
|
||||
"@hcengineering/core": "workspace:^0.7.411",
|
||||
"@hcengineering/view": "workspace:^0.7.411",
|
||||
"@hcengineering/view-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/setting-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/client": "workspace:^0.7.411",
|
||||
"@hcengineering/chunter": "workspace:^0.7.411",
|
||||
"fast-equals": "^5.2.2",
|
||||
"@hcengineering/task": "workspace:^0.7.382",
|
||||
"@hcengineering/tracker": "workspace:^0.7.382",
|
||||
"@hcengineering/panel": "workspace:^0.7.382",
|
||||
"@hcengineering/attachment-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/chunter-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/notification": "workspace:^0.7.382",
|
||||
"@hcengineering/tracker-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/preference": "workspace:^0.7.382",
|
||||
"@hcengineering/diffview": "workspace:^0.7.382",
|
||||
"@hcengineering/activity": "workspace:^0.7.382",
|
||||
"@hcengineering/activity-resources": "workspace:^0.7.382",
|
||||
"@hcengineering/account-client": "workspace:^0.7.382"
|
||||
"@hcengineering/task": "workspace:^0.7.411",
|
||||
"@hcengineering/tracker": "workspace:^0.7.411",
|
||||
"@hcengineering/panel": "workspace:^0.7.411",
|
||||
"@hcengineering/attachment-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/chunter-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/notification": "workspace:^0.7.411",
|
||||
"@hcengineering/tracker-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/preference": "workspace:^0.7.411",
|
||||
"@hcengineering/diffview": "workspace:^0.7.411",
|
||||
"@hcengineering/activity": "workspace:^0.7.411",
|
||||
"@hcengineering/activity-resources": "workspace:^0.7.411",
|
||||
"@hcengineering/account-client": "workspace:^0.7.411"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<script lang="ts">
|
||||
import { Integration } from '@hcengineering/setting'
|
||||
import type { Integration as AccountIntegration } from '@hcengineering/account-client'
|
||||
import Connect from './Connect.svelte'
|
||||
|
||||
export let integration: Integration
|
||||
export let integration: AccountIntegration | undefined
|
||||
</script>
|
||||
|
||||
<Connect bind:integration on:close />
|
||||
|
||||
@@ -8,20 +8,19 @@
|
||||
|
||||
import GithubPersonProfile from './GithubPersonProfile.svelte'
|
||||
|
||||
import type { Integration as AccountIntegration } from '@hcengineering/account-client'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { WithLookup, getCurrentAccount } from '@hcengineering/core'
|
||||
import { GithubAuthentication, GithubIntegration } from '@hcengineering/github'
|
||||
import { getEmbeddedLabel, getMetadata, translate } from '@hcengineering/platform'
|
||||
import presentation, { Card, HTMLViewer, NavLink, createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { Integration } from '@hcengineering/setting'
|
||||
import presentation, { Card, HTMLViewer, NavLink, createQuery } from '@hcengineering/presentation'
|
||||
import tracker, { Project } from '@hcengineering/tracker'
|
||||
import ui, { Button, Label, Loading, TabItem, TabList, location, ticker } from '@hcengineering/ui'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
import github from '../plugin'
|
||||
import { onAuthorize } from './utils'
|
||||
import { clientId } from '@hcengineering/client'
|
||||
import { onAuthorize, updateGithubAccountIntegrationLogin } from './utils'
|
||||
|
||||
export let integration: Integration
|
||||
export let integration: AccountIntegration | undefined
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
@@ -59,10 +58,7 @@
|
||||
})
|
||||
|
||||
function save (): void {
|
||||
void getClient().diffUpdate(integration, {
|
||||
value: auth?.login ?? ''
|
||||
})
|
||||
dispatch('close', { value: auth?.login ?? '-' })
|
||||
void updateGithubAccountIntegrationLogin(auth?.login ?? '', integration)
|
||||
}
|
||||
function onConnect (): void {
|
||||
const state = btoa(
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import core, { ClassifierKind, Ref, WithLookup, generateId } from '@hcengineering/core'
|
||||
import { getEmbeddedLabel, getMetadata, translate } from '@hcengineering/platform'
|
||||
import core, { Ref, WithLookup, generateId } from '@hcengineering/core'
|
||||
import { getMetadata, translate } from '@hcengineering/platform'
|
||||
import { getClient } from '@hcengineering/presentation'
|
||||
import task, { TaskType, updateProjectType, type TaskStatusFactory } from '@hcengineering/task'
|
||||
import tracker, { Project, createStatesData } from '@hcengineering/tracker'
|
||||
@@ -63,13 +63,6 @@
|
||||
|
||||
if (!client.getHierarchy().hasMixin(projectInst, github.mixin.GithubProject)) {
|
||||
// We need to add GithubProject mixin
|
||||
const mixinId = await getClient().createDoc(core.class.Mixin, core.space.Model, {
|
||||
extends: github.mixin.GithubIssue,
|
||||
kind: ClassifierKind.MIXIN,
|
||||
label: getEmbeddedLabel(projectInst.name),
|
||||
hidden: false,
|
||||
icon: github.icon.Github
|
||||
})
|
||||
await getClient().createMixin(
|
||||
projectInst._id,
|
||||
tracker.class.Project,
|
||||
@@ -77,9 +70,7 @@
|
||||
github.mixin.GithubProject,
|
||||
{
|
||||
integration: integration._id,
|
||||
repositories: [],
|
||||
mixinClass: mixinId,
|
||||
mappings: []
|
||||
repositories: []
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
@@ -3,18 +3,17 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { PersonAccount } from '@hcengineering/contact'
|
||||
import { getCurrentAccount } from '@hcengineering/core'
|
||||
import { createQuery, getClient, getFileUrl } from '@hcengineering/presentation'
|
||||
import { Button, Chevron, Component, ExpandCollapse, Label } from '@hcengineering/ui'
|
||||
import diffview from '@hcengineering/diffview'
|
||||
import { GithubPatch, GithubPullRequest, GithubPullRequestReview } from '@hcengineering/github'
|
||||
|
||||
import github from '../plugin'
|
||||
import { getCurrentEmployee } from '@hcengineering/contact'
|
||||
|
||||
export let pullRequest: GithubPullRequest
|
||||
|
||||
const me = getCurrentAccount() as PersonAccount
|
||||
const me = getCurrentEmployee()
|
||||
|
||||
let isCollapsed = true
|
||||
|
||||
@@ -37,6 +36,7 @@
|
||||
}
|
||||
|
||||
$: hasPatch = patch !== undefined && patchText !== ''
|
||||
$: changedFilesCount = patchText === '' ? 0 : (patchText.match(/^diff --git /gm)?.length ?? 0)
|
||||
|
||||
let review: GithubPullRequestReview | undefined
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
github.class.GithubPullRequestReview,
|
||||
{
|
||||
attachedTo: pullRequest._id,
|
||||
author: me.person
|
||||
author: me
|
||||
},
|
||||
(res) => {
|
||||
;[review] = res
|
||||
@@ -60,7 +60,7 @@
|
||||
async function handleFileViewed (fileName: string, sha: string, viewed: boolean): Promise<void> {
|
||||
const current = await client.findOne(github.class.GithubPullRequestReview, {
|
||||
attachedTo: pullRequest._id,
|
||||
author: me.person
|
||||
author: me
|
||||
})
|
||||
|
||||
const files = current?.files ?? []
|
||||
@@ -73,7 +73,7 @@
|
||||
files.push({ fileName, sha })
|
||||
}
|
||||
|
||||
if (current) {
|
||||
if (current != null) {
|
||||
await client.update(current, { files })
|
||||
} else {
|
||||
await client.addCollection(
|
||||
@@ -82,7 +82,7 @@
|
||||
pullRequest._id,
|
||||
github.class.GithubPullRequest,
|
||||
'reviewsVisual',
|
||||
{ author: me.person, files }
|
||||
{ author: me, files }
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -106,7 +106,7 @@
|
||||
fill={'var(--caption-color)'}
|
||||
marginRight={'.375rem'}
|
||||
/>
|
||||
<Label label={github.string.ChangedFiles} params={{ files: pullRequest.files }} />
|
||||
<Label label={github.string.ChangedFiles} params={{ files: changedFilesCount }} />
|
||||
</svelte:fragment>
|
||||
</Button>
|
||||
</div>
|
||||
@@ -119,7 +119,7 @@
|
||||
props={{ patch: patchText, viewed: viewedFiles }}
|
||||
on:change={(evt) => {
|
||||
const { fileName, sha, viewed } = evt.detail
|
||||
handleFileViewed(fileName, sha, viewed)
|
||||
void handleFileViewed(fileName, sha, viewed)
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
</script>
|
||||
|
||||
<HyperlinkEditor
|
||||
value={repository?.repository?.html_url ?? repository?.htmlURL}
|
||||
value={repository?.htmlURL ?? ''}
|
||||
placeholder={getEmbeddedLabel(repository?.name ?? '')}
|
||||
title={repository?.name ?? ''}
|
||||
readonly
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
export let label: IntlString = github.string.AssignRepository
|
||||
export let showIcon: boolean = false
|
||||
|
||||
$: repository = $integrationRepositories.get(value)
|
||||
$: repository = value != null ? $integrationRepositories.get(value) : undefined
|
||||
|
||||
let selectedRepository: GithubIntegrationRepository | undefined
|
||||
|
||||
|
||||
+5
-6
@@ -3,7 +3,7 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import core, { PersonId, Ref, WithLookup, getCurrentAccount } from '@hcengineering/core'
|
||||
import core, { Ref, WithLookup, getCurrentAccount } from '@hcengineering/core'
|
||||
import { GithubPullRequest, GithubReviewComment, GithubReviewThread } from '@hcengineering/github'
|
||||
|
||||
import { ActivityMessageHeader, ActivityMessageTemplate } from '@hcengineering/activity-resources'
|
||||
@@ -82,8 +82,9 @@
|
||||
}
|
||||
}
|
||||
|
||||
const toRefPersonAccount = (account: PersonId): PersonId => account
|
||||
const toRefPerson = (account?: Ref<Person>): Ref<Person> => account as Ref<Person>
|
||||
function onDiffExpand (nextExpanded: boolean): void {
|
||||
expanded = nextExpanded
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
@@ -122,9 +123,7 @@
|
||||
fileName: value.path,
|
||||
expandable: value.isResolved,
|
||||
expanded,
|
||||
onExpand: (value) => {
|
||||
expanded = value
|
||||
}
|
||||
onExpand: onDiffExpand
|
||||
}}
|
||||
/>
|
||||
{/if}
|
||||
|
||||
@@ -1,11 +1,18 @@
|
||||
import {
|
||||
getClient as getAccountClientRaw,
|
||||
type AccountClient,
|
||||
type Integration as AccountIntegration
|
||||
} from '@hcengineering/account-client'
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { concatLink, getCurrentAccount, toIdMap, type IdMap } from '@hcengineering/core'
|
||||
import {
|
||||
githubIntegrationKind,
|
||||
makeQuery,
|
||||
type GithubAuthentication,
|
||||
type GithubIntegrationRepository,
|
||||
type GithubProject
|
||||
} from '@hcengineering/github'
|
||||
import login from '@hcengineering/login'
|
||||
import { PlatformError, getMetadata, unknownError } from '@hcengineering/platform'
|
||||
import presentation, { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { location } from '@hcengineering/ui'
|
||||
@@ -41,6 +48,41 @@ export async function onAuthorize (login?: string): Promise<void> {
|
||||
window.open(url)
|
||||
}
|
||||
|
||||
export function getAccountClient (): AccountClient | undefined {
|
||||
const accountsUrl = getMetadata(login.metadata.AccountsUrl)
|
||||
const token = getMetadata(presentation.metadata.Token)
|
||||
if (accountsUrl == null || token == null) {
|
||||
return undefined
|
||||
}
|
||||
return getAccountClientRaw(accountsUrl, token)
|
||||
}
|
||||
|
||||
export async function updateGithubAccountIntegrationLogin (
|
||||
loginVal: string,
|
||||
integration: AccountIntegration | undefined
|
||||
): Promise<void> {
|
||||
try {
|
||||
const accountClient = getAccountClient()
|
||||
if (accountClient === undefined) {
|
||||
throw new Error('Account client is not defined')
|
||||
}
|
||||
const socialId = integration?.socialId ?? getCurrentAccount().primarySocialId
|
||||
const workspaceUuid = integration?.workspaceUuid ?? null
|
||||
|
||||
const key = { socialId, kind: githubIntegrationKind, workspaceUuid }
|
||||
const existing = await accountClient.getIntegration(key)
|
||||
const mergedData = { ...(existing?.data ?? {}), login: loginVal }
|
||||
|
||||
if (existing == null) {
|
||||
throw new Error('Integration not found')
|
||||
}
|
||||
await accountClient.updateIntegration({ ...existing, data: mergedData })
|
||||
} catch (err: any) {
|
||||
console.error('Error updating github account integration login', err)
|
||||
Analytics.handleError(err)
|
||||
}
|
||||
}
|
||||
|
||||
const repositoryQuery = createQuery(true)
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user