mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-25 19:58:30 +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_TX,
|
||||
TxOperations,
|
||||
toIdMap,
|
||||
type Attribute,
|
||||
type Class,
|
||||
type Doc,
|
||||
@ -50,8 +51,8 @@ import {
|
||||
type TaskType
|
||||
} from '@hcengineering/task'
|
||||
|
||||
import task from './plugin'
|
||||
import { DOMAIN_TASK } from '.'
|
||||
import task from './plugin'
|
||||
|
||||
/**
|
||||
* @public
|
||||
@ -566,7 +567,24 @@ function areSameArrays (arr1: any[] | undefined, arr2: any[] | undefined): boole
|
||||
|
||||
export const taskOperation: MigrateOperation = {
|
||||
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> {
|
||||
await tryUpgrade(client, taskId, [
|
||||
|
@ -197,6 +197,7 @@
|
||||
<Button
|
||||
loading={okProcessing}
|
||||
focusIndex={10001}
|
||||
minWidth={'5rem'}
|
||||
disabled={!canSave}
|
||||
label={okLabel}
|
||||
kind={'primary'}
|
||||
|
@ -45,6 +45,7 @@
|
||||
export let disabled: boolean = false
|
||||
export let loading: boolean = false
|
||||
export let width: string | undefined = undefined
|
||||
export let minWidth: string | undefined = undefined
|
||||
export let height: string | undefined = undefined
|
||||
export let resetIconSize: 'none' | 'icon' | 'full' = 'none'
|
||||
export let highlight: boolean = false
|
||||
@ -137,6 +138,7 @@
|
||||
disabled={disabled || loading}
|
||||
class:short
|
||||
class:resetIconSize={resetIconSize === 'full'}
|
||||
style:min-width={minWidth}
|
||||
style:width
|
||||
style:height
|
||||
style:flex-shrink={shrink}
|
||||
|
@ -204,7 +204,8 @@ export async function getWorkspaces (): Promise<Workspace[]> {
|
||||
return [
|
||||
{
|
||||
workspace: DEV_WORKSPACE,
|
||||
workspaceId: DEV_WORKSPACE
|
||||
workspaceId: DEV_WORKSPACE,
|
||||
lastVisit: 0
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -33,6 +33,8 @@ export interface Workspace {
|
||||
|
||||
creating?: boolean
|
||||
createProgress?: number
|
||||
|
||||
lastVisit: number
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,20 +102,22 @@
|
||||
{#if (integration?.value ?? '') === ''}
|
||||
{#if integrationType.createComponent}
|
||||
<Button
|
||||
minWidth={'5rem'}
|
||||
label={setting.string.Add}
|
||||
kind={'primary'}
|
||||
on:click={(ev) => handleConfigure(integrationType.createComponent)}
|
||||
/>
|
||||
{/if}
|
||||
{: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 !== ''}
|
||||
{#if integrationType.onDisconnect}
|
||||
<Button label={setting.string.Disconnect} on:click={disconnect} />
|
||||
<Button label={setting.string.Disconnect} minWidth={'5rem'} on:click={disconnect} />
|
||||
{/if}
|
||||
{#if integrationType.configureComponent !== undefined}
|
||||
<Button
|
||||
label={setting.string.Configure}
|
||||
minWidth={'5rem'}
|
||||
kind={'primary'}
|
||||
on:click={(ev) => handleConfigure(integrationType.configureComponent)}
|
||||
/>
|
||||
|
@ -13,9 +13,10 @@
|
||||
// limitations under the License.
|
||||
-->
|
||||
<script lang="ts">
|
||||
import contact from '@hcengineering/contact'
|
||||
import login, { Workspace } from '@hcengineering/login'
|
||||
import { getMetadata, getResource } from '@hcengineering/platform'
|
||||
import contact from '@hcengineering/contact'
|
||||
import presentation, { decodeTokenPayload, isAdminUser } from '@hcengineering/presentation'
|
||||
import {
|
||||
Icon,
|
||||
IconCheck,
|
||||
@ -34,7 +35,6 @@
|
||||
import { workbenchId } from '@hcengineering/workbench'
|
||||
import { onDestroy, onMount } from 'svelte'
|
||||
import { workspacesStore } from '../utils'
|
||||
import presentation, { isAdminUser } from '@hcengineering/presentation'
|
||||
// import Drag from './icons/Drag.svelte'
|
||||
|
||||
onMount(() => {
|
||||
@ -134,20 +134,29 @@
|
||||
<div class="antiPopup" on:keydown={keyDown}>
|
||||
<div class="ap-space x2" />
|
||||
{#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%'} />
|
||||
{#if isAdminUser()}
|
||||
<div class="p-1">
|
||||
{#if $workspacesStore.length > 500}
|
||||
500 /
|
||||
{/if}
|
||||
{$workspacesStore.length}
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
<div class="p-2 ml-2 mb-4 select-text flex-col bordered">
|
||||
{decodeTokenPayload(getMetadata(presentation.metadata.Token) ?? '').workspace}
|
||||
</div>
|
||||
{/if}
|
||||
<div class="ap-scroll">
|
||||
<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 _activeSession = activeSessions[ws.workspaceId]}
|
||||
{@const lastUsageDays = Math.round((Date.now() - ws.lastVisit) / (1000 * 3600 * 24))}
|
||||
<a
|
||||
class="stealth"
|
||||
href={getWorkspaceLink(ws)}
|
||||
@ -168,8 +177,13 @@
|
||||
<!-- <div class="logo empty" /> -->
|
||||
<!-- <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}
|
||||
{#if isAdmin && ws.lastVisit != null && ws.lastVisit !== 0}
|
||||
<div class="text-sm">
|
||||
({lastUsageDays} days)
|
||||
</div>
|
||||
{/if}
|
||||
</span>
|
||||
{#if isAdmin && wsName !== ws.workspace}
|
||||
<span class="text-xs">
|
||||
|
@ -1246,6 +1246,7 @@ export async function getUserWorkspaces (
|
||||
await db
|
||||
.collection<Workspace>(WORKSPACE_COLLECTION)
|
||||
.find(withProductId(productId, account.admin === true ? {} : { _id: { $in: account.workspaces } }))
|
||||
.sort({ lastVisit: -1 })
|
||||
.toArray()
|
||||
)
|
||||
.filter((it) => it.disabled !== true || it.creating === true)
|
||||
@ -1272,6 +1273,7 @@ export async function getWorkspaceInfo (
|
||||
if (email !== systemAccountEmail && !guest) {
|
||||
account = await getAccount(db, email)
|
||||
if (account === null) {
|
||||
ctx.error('no account', { email, productId, token })
|
||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
||||
}
|
||||
} else if (guest) {
|
||||
@ -1294,6 +1296,7 @@ export async function getWorkspaceInfo (
|
||||
await db.collection<Workspace>(WORKSPACE_COLLECTION).find(withProductId(productId, query)).toArray()
|
||||
).filter((it) => it.disabled !== true || account?.admin === true || it.creating === true)
|
||||
if (ws == null) {
|
||||
ctx.error('no workspace', { workspace: workspace.name, email })
|
||||
throw new PlatformError(new Status(Severity.ERROR, platform.status.Forbidden, {}))
|
||||
}
|
||||
if (_updateLastVisit && isAccount(account)) {
|
||||
|
Loading…
Reference in New Issue
Block a user