mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-29 09:09:15 +03:00
UBERF-7181: Fix GH PR statuses (#5749)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
6b74823cbb
commit
ba5b0749bc
@ -18,6 +18,7 @@ import {
|
|||||||
DOMAIN_STATUS,
|
DOMAIN_STATUS,
|
||||||
DOMAIN_TX,
|
DOMAIN_TX,
|
||||||
TxOperations,
|
TxOperations,
|
||||||
|
toIdMap,
|
||||||
type Attribute,
|
type Attribute,
|
||||||
type Class,
|
type Class,
|
||||||
type Doc,
|
type Doc,
|
||||||
@ -50,8 +51,8 @@ import {
|
|||||||
type TaskType
|
type TaskType
|
||||||
} from '@hcengineering/task'
|
} from '@hcengineering/task'
|
||||||
|
|
||||||
import task from './plugin'
|
|
||||||
import { DOMAIN_TASK } from '.'
|
import { DOMAIN_TASK } from '.'
|
||||||
|
import task from './plugin'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -566,7 +567,24 @@ function areSameArrays (arr1: any[] | undefined, arr2: any[] | undefined): boole
|
|||||||
|
|
||||||
export const taskOperation: MigrateOperation = {
|
export const taskOperation: MigrateOperation = {
|
||||||
async migrate (client: MigrationClient): Promise<void> {
|
async migrate (client: MigrationClient): Promise<void> {
|
||||||
await tryMigrate(client, taskId, [])
|
await tryMigrate(client, taskId, [
|
||||||
|
{
|
||||||
|
state: 'migrate-tt-model-states',
|
||||||
|
func: async (client) => {
|
||||||
|
const prTaskTypes = client.model.findAllSync(task.class.TaskType, {})
|
||||||
|
|
||||||
|
const allModelStatuses = toIdMap(client.model.findAllSync(core.class.Status, {}))
|
||||||
|
for (const tt of prTaskTypes) {
|
||||||
|
const missing = tt.statuses.filter((it) => !allModelStatuses.has(it))
|
||||||
|
await client.update(
|
||||||
|
DOMAIN_TX,
|
||||||
|
{ objectId: { $in: missing }, objectSpace: 'task:space:Statuses' },
|
||||||
|
{ $set: { objectSpace: core.space.Model } }
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
])
|
||||||
},
|
},
|
||||||
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
async upgrade (client: MigrationUpgradeClient): Promise<void> {
|
||||||
await tryUpgrade(client, taskId, [
|
await tryUpgrade(client, taskId, [
|
||||||
|
@ -197,6 +197,7 @@
|
|||||||
<Button
|
<Button
|
||||||
loading={okProcessing}
|
loading={okProcessing}
|
||||||
focusIndex={10001}
|
focusIndex={10001}
|
||||||
|
minWidth={'5rem'}
|
||||||
disabled={!canSave}
|
disabled={!canSave}
|
||||||
label={okLabel}
|
label={okLabel}
|
||||||
kind={'primary'}
|
kind={'primary'}
|
||||||
|
@ -45,6 +45,7 @@
|
|||||||
export let disabled: boolean = false
|
export let disabled: boolean = false
|
||||||
export let loading: boolean = false
|
export let loading: boolean = false
|
||||||
export let width: string | undefined = undefined
|
export let width: string | undefined = undefined
|
||||||
|
export let minWidth: string | undefined = undefined
|
||||||
export let height: string | undefined = undefined
|
export let height: string | undefined = undefined
|
||||||
export let resetIconSize: 'none' | 'icon' | 'full' = 'none'
|
export let resetIconSize: 'none' | 'icon' | 'full' = 'none'
|
||||||
export let highlight: boolean = false
|
export let highlight: boolean = false
|
||||||
@ -137,6 +138,7 @@
|
|||||||
disabled={disabled || loading}
|
disabled={disabled || loading}
|
||||||
class:short
|
class:short
|
||||||
class:resetIconSize={resetIconSize === 'full'}
|
class:resetIconSize={resetIconSize === 'full'}
|
||||||
|
style:min-width={minWidth}
|
||||||
style:width
|
style:width
|
||||||
style:height
|
style:height
|
||||||
style:flex-shrink={shrink}
|
style:flex-shrink={shrink}
|
||||||
|
@ -204,7 +204,8 @@ export async function getWorkspaces (): Promise<Workspace[]> {
|
|||||||
return [
|
return [
|
||||||
{
|
{
|
||||||
workspace: DEV_WORKSPACE,
|
workspace: DEV_WORKSPACE,
|
||||||
workspaceId: DEV_WORKSPACE
|
workspaceId: DEV_WORKSPACE,
|
||||||
|
lastVisit: 0
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,8 @@ export interface Workspace {
|
|||||||
|
|
||||||
creating?: boolean
|
creating?: boolean
|
||||||
createProgress?: number
|
createProgress?: number
|
||||||
|
|
||||||
|
lastVisit: number
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -102,20 +102,22 @@
|
|||||||
{#if (integration?.value ?? '') === ''}
|
{#if (integration?.value ?? '') === ''}
|
||||||
{#if integrationType.createComponent}
|
{#if integrationType.createComponent}
|
||||||
<Button
|
<Button
|
||||||
|
minWidth={'5rem'}
|
||||||
label={setting.string.Add}
|
label={setting.string.Add}
|
||||||
kind={'primary'}
|
kind={'primary'}
|
||||||
on:click={(ev) => handleConfigure(integrationType.createComponent)}
|
on:click={(ev) => handleConfigure(integrationType.createComponent)}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
{:else if (integration?.disabled ?? false) && integrationType.reconnectComponent}
|
{:else if (integration?.disabled ?? false) && integrationType.reconnectComponent}
|
||||||
<Button label={setting.string.Reconnect} kind={'primary'} on:click={handleReconnect} />
|
<Button label={setting.string.Reconnect} minWidth={'5rem'} kind={'primary'} on:click={handleReconnect} />
|
||||||
{:else if integration?.value !== ''}
|
{:else if integration?.value !== ''}
|
||||||
{#if integrationType.onDisconnect}
|
{#if integrationType.onDisconnect}
|
||||||
<Button label={setting.string.Disconnect} on:click={disconnect} />
|
<Button label={setting.string.Disconnect} minWidth={'5rem'} on:click={disconnect} />
|
||||||
{/if}
|
{/if}
|
||||||
{#if integrationType.configureComponent !== undefined}
|
{#if integrationType.configureComponent !== undefined}
|
||||||
<Button
|
<Button
|
||||||
label={setting.string.Configure}
|
label={setting.string.Configure}
|
||||||
|
minWidth={'5rem'}
|
||||||
kind={'primary'}
|
kind={'primary'}
|
||||||
on:click={(ev) => handleConfigure(integrationType.configureComponent)}
|
on:click={(ev) => handleConfigure(integrationType.configureComponent)}
|
||||||
/>
|
/>
|
||||||
|
@ -13,9 +13,10 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import contact from '@hcengineering/contact'
|
||||||
import login, { Workspace } from '@hcengineering/login'
|
import login, { Workspace } from '@hcengineering/login'
|
||||||
import { getMetadata, getResource } from '@hcengineering/platform'
|
import { getMetadata, getResource } from '@hcengineering/platform'
|
||||||
import contact from '@hcengineering/contact'
|
import presentation, { decodeTokenPayload, isAdminUser } from '@hcengineering/presentation'
|
||||||
import {
|
import {
|
||||||
Icon,
|
Icon,
|
||||||
IconCheck,
|
IconCheck,
|
||||||
@ -34,7 +35,6 @@
|
|||||||
import { workbenchId } from '@hcengineering/workbench'
|
import { workbenchId } from '@hcengineering/workbench'
|
||||||
import { onDestroy, onMount } from 'svelte'
|
import { onDestroy, onMount } from 'svelte'
|
||||||
import { workspacesStore } from '../utils'
|
import { workspacesStore } from '../utils'
|
||||||
import presentation, { isAdminUser } from '@hcengineering/presentation'
|
|
||||||
// import Drag from './icons/Drag.svelte'
|
// import Drag from './icons/Drag.svelte'
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
@ -134,20 +134,29 @@
|
|||||||
<div class="antiPopup" on:keydown={keyDown}>
|
<div class="antiPopup" on:keydown={keyDown}>
|
||||||
<div class="ap-space x2" />
|
<div class="ap-space x2" />
|
||||||
{#if isAdmin}
|
{#if isAdmin}
|
||||||
<div class="ml-2 mr-2 mb-2 flex-grow flex-row-center">
|
<div class="p-2 ml-2 mr-2 mb-2 flex-grow flex-row-center">
|
||||||
<SearchEdit bind:value={search} width={'100%'} />
|
<SearchEdit bind:value={search} width={'100%'} />
|
||||||
{#if isAdminUser()}
|
{#if isAdminUser()}
|
||||||
<div class="p-1">
|
<div class="p-1">
|
||||||
|
{#if $workspacesStore.length > 500}
|
||||||
|
500 /
|
||||||
|
{/if}
|
||||||
{$workspacesStore.length}
|
{$workspacesStore.length}
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="p-2 ml-2 mb-4 select-text flex-col bordered">
|
||||||
|
{decodeTokenPayload(getMetadata(presentation.metadata.Token) ?? '').workspace}
|
||||||
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
<div class="ap-scroll">
|
<div class="ap-scroll">
|
||||||
<div class="ap-box">
|
<div class="ap-box">
|
||||||
{#each $workspacesStore.filter((it) => search === '' || (it.workspaceName?.includes(search) ?? false) || it.workspace.includes(search)) as ws, i}
|
{#each $workspacesStore
|
||||||
|
.filter((it) => search === '' || (it.workspaceName?.includes(search) ?? false) || it.workspace.includes(search))
|
||||||
|
.slice(0, 500) as ws, i}
|
||||||
{@const wsName = ws.workspaceName ?? ws.workspace}
|
{@const wsName = ws.workspaceName ?? ws.workspace}
|
||||||
{@const _activeSession = activeSessions[ws.workspaceId]}
|
{@const _activeSession = activeSessions[ws.workspaceId]}
|
||||||
|
{@const lastUsageDays = Math.round((Date.now() - ws.lastVisit) / (1000 * 3600 * 24))}
|
||||||
<a
|
<a
|
||||||
class="stealth"
|
class="stealth"
|
||||||
href={getWorkspaceLink(ws)}
|
href={getWorkspaceLink(ws)}
|
||||||
@ -168,8 +177,13 @@
|
|||||||
<!-- <div class="logo empty" /> -->
|
<!-- <div class="logo empty" /> -->
|
||||||
<!-- <div class="flex-col flex-grow"> -->
|
<!-- <div class="flex-col flex-grow"> -->
|
||||||
<div class="flex-col flex-grow">
|
<div class="flex-col flex-grow">
|
||||||
<span class="label overflow-label flex-grow">
|
<span class="label overflow-label flex flex-grow flex-between">
|
||||||
{wsName}
|
{wsName}
|
||||||
|
{#if isAdmin && ws.lastVisit != null && ws.lastVisit !== 0}
|
||||||
|
<div class="text-sm">
|
||||||
|
({lastUsageDays} days)
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
{#if isAdmin && wsName !== ws.workspace}
|
{#if isAdmin && wsName !== ws.workspace}
|
||||||
<span class="text-xs">
|
<span class="text-xs">
|
||||||
|
@ -1246,6 +1246,7 @@ export async function getUserWorkspaces (
|
|||||||
await db
|
await db
|
||||||
.collection<Workspace>(WORKSPACE_COLLECTION)
|
.collection<Workspace>(WORKSPACE_COLLECTION)
|
||||||
.find(withProductId(productId, account.admin === true ? {} : { _id: { $in: account.workspaces } }))
|
.find(withProductId(productId, account.admin === true ? {} : { _id: { $in: account.workspaces } }))
|
||||||
|
.sort({ lastVisit: -1 })
|
||||||
.toArray()
|
.toArray()
|
||||||
)
|
)
|
||||||
.filter((it) => it.disabled !== true || it.creating === true)
|
.filter((it) => it.disabled !== true || it.creating === true)
|
||||||
@ -1272,6 +1273,7 @@ export async function getWorkspaceInfo (
|
|||||||
if (email !== systemAccountEmail && !guest) {
|
if (email !== systemAccountEmail && !guest) {
|
||||||
account = await getAccount(db, email)
|
account = await getAccount(db, email)
|
||||||
if (account === null) {
|
if (account === null) {
|
||||||
|
ctx.error('no account', { email, productId, token })
|
||||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
||||||
}
|
}
|
||||||
} else if (guest) {
|
} else if (guest) {
|
||||||
@ -1294,6 +1296,7 @@ export async function getWorkspaceInfo (
|
|||||||
await db.collection<Workspace>(WORKSPACE_COLLECTION).find(withProductId(productId, query)).toArray()
|
await db.collection<Workspace>(WORKSPACE_COLLECTION).find(withProductId(productId, query)).toArray()
|
||||||
).filter((it) => it.disabled !== true || account?.admin === true || it.creating === true)
|
).filter((it) => it.disabled !== true || account?.admin === true || it.creating === true)
|
||||||
if (ws == null) {
|
if (ws == null) {
|
||||||
|
ctx.error('no workspace', { workspace: workspace.name, email })
|
||||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
||||||
}
|
}
|
||||||
if (_updateLastVisit && isAccount(account)) {
|
if (_updateLastVisit && isAccount(account)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user