From fb5df1681dc8c275425ab1370e35b266fbf210a8 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Thu, 26 Dec 2024 15:33:09 +0700 Subject: [PATCH 1/3] UBERF-9025: Fix backup service (#7557) Signed-off-by: Andrey Sobolev --- dev/tool/src/index.ts | 18 +++++------ plugins/love-resources/src/stores.ts | 2 +- pods/backup/package.json | 4 ++- pods/backup/src/index.ts | 18 ++++++++++- pods/fulltext/src/server.ts | 18 +++++------ pods/server/src/server.ts | 18 +++++------ server/server-pipeline/src/pipeline.ts | 6 ++-- server/workspace-service/src/ws-operations.ts | 30 +++++++++---------- workers/transactor/src/transactor.ts | 12 ++++---- 9 files changed, 72 insertions(+), 54 deletions(-) diff --git a/dev/tool/src/index.ts b/dev/tool/src/index.ts index f7fb1958c5a..db8099ce622 100644 --- a/dev/tool/src/index.ts +++ b/dev/tool/src/index.ts @@ -62,9 +62,9 @@ import { createBackupPipeline, getConfig, getWorkspaceDestroyAdapter, - registerAdapterFactry, - registerDestroyFactry, - registerTxAdapterFactry + registerAdapterFactory, + registerDestroyFactory, + registerTxAdapterFactory } from '@hcengineering/server-pipeline' import serverToken, { decodeToken, generateToken } from '@hcengineering/server-token' import { FileModelLogger } from '@hcengineering/server-tool' @@ -173,13 +173,13 @@ export function devTool ( ): void { const toolCtx = new MeasureMetricsContext('tool', {}) - registerTxAdapterFactry('mongodb', createMongoTxAdapter) - registerAdapterFactry('mongodb', createMongoAdapter) - registerDestroyFactry('mongodb', createMongoDestroyAdapter) + registerTxAdapterFactory('mongodb', createMongoTxAdapter) + registerAdapterFactory('mongodb', createMongoAdapter) + registerDestroyFactory('mongodb', createMongoDestroyAdapter) - registerTxAdapterFactry('postgresql', createPostgresTxAdapter, true) - registerAdapterFactry('postgresql', createPostgresAdapter, true) - registerDestroyFactry('postgresql', createPostgreeDestroyAdapter, true) + registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) + registerAdapterFactory('postgresql', createPostgresAdapter, true) + registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) const serverSecret = process.env.SERVER_SECRET if (serverSecret === undefined) { diff --git a/plugins/love-resources/src/stores.ts b/plugins/love-resources/src/stores.ts index a0780768c84..1e77d61a97a 100644 --- a/plugins/love-resources/src/stores.ts +++ b/plugins/love-resources/src/stores.ts @@ -81,7 +81,7 @@ export const storePromise = writable>(new Promise((resolve) => {}) function fillStores (): void { const client = getClient() - if (client !== undefined) { + if (client !== undefined || getCurrentAccount() != null) { const query = createQuery(true) const roomPromise = new Promise((resolve) => query.query(love.class.Room, {}, (res) => { diff --git a/pods/backup/package.json b/pods/backup/package.json index 3e724b27db8..346ecab6be1 100644 --- a/pods/backup/package.json +++ b/pods/backup/package.json @@ -60,6 +60,8 @@ "dotenv": "~16.0.0", "@hcengineering/backup-service": "^0.6.0", "@hcengineering/analytics": "^0.6.0", - "@hcengineering/analytics-service": "^0.6.0" + "@hcengineering/analytics-service": "^0.6.0", + "@hcengineering/mongo": "^0.6.1", + "@hcengineering/postgres": "^0.6.0" } } diff --git a/pods/backup/src/index.ts b/pods/backup/src/index.ts index 279fe5beff9..7c9a3d41bd3 100644 --- a/pods/backup/src/index.ts +++ b/pods/backup/src/index.ts @@ -18,10 +18,18 @@ import { configureAnalytics, SplitLogger } from '@hcengineering/analytics-servic import { startBackup } from '@hcengineering/backup-service' import { MeasureMetricsContext, newMetrics, type Tx } from '@hcengineering/core' import { initStatisticsContext, type PipelineFactory } from '@hcengineering/server-core' -import { createBackupPipeline, getConfig } from '@hcengineering/server-pipeline' +import { + createBackupPipeline, + getConfig, + registerAdapterFactory, + registerDestroyFactory, + registerTxAdapterFactory +} from '@hcengineering/server-pipeline' import { join } from 'path' import { readFileSync } from 'node:fs' +import { createMongoTxAdapter, createMongoAdapter, createMongoDestroyAdapter } from '@hcengineering/mongo' +import { createPostgresTxAdapter, createPostgresAdapter, createPostgreeDestroyAdapter } from '@hcengineering/postgres' const model = JSON.parse(readFileSync(process.env.MODEL_JSON ?? 'model.json').toString()) as Tx[] const metricsContext = initStatisticsContext('backup', { @@ -43,6 +51,14 @@ const sentryDSN = process.env.SENTRY_DSN configureAnalytics(sentryDSN, {}) Analytics.setTag('application', 'backup-service') +registerTxAdapterFactory('mongodb', createMongoTxAdapter) +registerAdapterFactory('mongodb', createMongoAdapter) +registerDestroyFactory('mongodb', createMongoDestroyAdapter) + +registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) +registerAdapterFactory('postgresql', createPostgresAdapter, true) +registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) + startBackup( metricsContext, (mongoUrl, storageAdapter) => { diff --git a/pods/fulltext/src/server.ts b/pods/fulltext/src/server.ts index 36e25c96b24..93fc5e6d31b 100644 --- a/pods/fulltext/src/server.ts +++ b/pods/fulltext/src/server.ts @@ -47,11 +47,11 @@ import serverCore, { import { FullTextIndexPipeline, searchFulltext, type FulltextDBConfiguration } from '@hcengineering/server-indexer' import { getConfig, - registerAdapterFactry, - registerDestroyFactry, + registerAdapterFactory, + registerDestroyFactory, registerServerPlugins, registerStringLoaders, - registerTxAdapterFactry + registerTxAdapterFactory } from '@hcengineering/server-pipeline' import serverToken, { decodeToken, generateToken, type Token } from '@hcengineering/server-token' import cors from '@koa/cors' @@ -207,13 +207,13 @@ export async function startIndexer ( setMetadata(serverCore.metadata.ElasticIndexName, opt.elasticIndexName) setMetadata(serverClientPlugin.metadata.Endpoint, opt.accountsUrl) - registerTxAdapterFactry('mongodb', createMongoTxAdapter) - registerAdapterFactry('mongodb', createMongoAdapter) - registerDestroyFactry('mongodb', createMongoDestroyAdapter) + registerTxAdapterFactory('mongodb', createMongoTxAdapter) + registerAdapterFactory('mongodb', createMongoAdapter) + registerDestroyFactory('mongodb', createMongoDestroyAdapter) - registerTxAdapterFactry('postgresql', createPostgresTxAdapter, true) - registerAdapterFactry('postgresql', createPostgresAdapter, true) - registerDestroyFactry('postgresql', createPostgreeDestroyAdapter, true) + registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) + registerAdapterFactory('postgresql', createPostgresAdapter, true) + registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) registerServerPlugins() registerStringLoaders() diff --git a/pods/server/src/server.ts b/pods/server/src/server.ts index ce746ade171..dbe06c37916 100644 --- a/pods/server/src/server.ts +++ b/pods/server/src/server.ts @@ -35,11 +35,11 @@ import { type Token } from '@hcengineering/server-token' import { createServerPipeline, - registerAdapterFactry, - registerDestroyFactry, + registerAdapterFactory, + registerDestroyFactory, registerServerPlugins, registerStringLoaders, - registerTxAdapterFactry + registerTxAdapterFactory } from '@hcengineering/server-pipeline' import { readFileSync } from 'node:fs' @@ -74,13 +74,13 @@ export function start ( mongoUrl?: string } ): { shutdown: () => Promise, sessionManager: SessionManager } { - registerTxAdapterFactry('mongodb', createMongoTxAdapter) - registerAdapterFactry('mongodb', createMongoAdapter) - registerDestroyFactry('mongodb', createMongoDestroyAdapter) + registerTxAdapterFactory('mongodb', createMongoTxAdapter) + registerAdapterFactory('mongodb', createMongoAdapter) + registerDestroyFactory('mongodb', createMongoDestroyAdapter) - registerTxAdapterFactry('postgresql', createPostgresTxAdapter, true) - registerAdapterFactry('postgresql', createPostgresAdapter, true) - registerDestroyFactry('postgresql', createPostgreeDestroyAdapter, true) + registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) + registerAdapterFactory('postgresql', createPostgresAdapter, true) + registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) registerServerPlugins() diff --git a/server/server-pipeline/src/pipeline.ts b/server/server-pipeline/src/pipeline.ts index 3a6dc35d018..a6c5e616324 100644 --- a/server/server-pipeline/src/pipeline.ts +++ b/server/server-pipeline/src/pipeline.ts @@ -210,21 +210,21 @@ const txAdapterFactories: Record = {} const adapterFactories: Record = {} const destroyFactories: Record WorkspaceDestroyAdapter> = {} -export function registerTxAdapterFactry (name: string, factory: DbAdapterFactory, useAsDefault: boolean = true): void { +export function registerTxAdapterFactory (name: string, factory: DbAdapterFactory, useAsDefault: boolean = true): void { txAdapterFactories[name] = factory if (useAsDefault) { txAdapterFactories[''] = factory } } -export function registerAdapterFactry (name: string, factory: DbAdapterFactory, useAsDefault: boolean = true): void { +export function registerAdapterFactory (name: string, factory: DbAdapterFactory, useAsDefault: boolean = true): void { adapterFactories[name] = factory if (useAsDefault) { adapterFactories[''] = factory } } -export function registerDestroyFactry ( +export function registerDestroyFactory ( name: string, factory: (url: string) => WorkspaceDestroyAdapter, useAsDefault: boolean = true diff --git a/server/workspace-service/src/ws-operations.ts b/server/workspace-service/src/ws-operations.ts index 30c6171ce1a..20f6b2772bd 100644 --- a/server/workspace-service/src/ws-operations.ts +++ b/server/workspace-service/src/ws-operations.ts @@ -21,11 +21,11 @@ import { SessionDataImpl, wrapPipeline, type Pipeline, type StorageAdapter } fro import { getServerPipeline, getTxAdapterFactory, - registerAdapterFactry, - registerDestroyFactry, + registerAdapterFactory, + registerDestroyFactory, registerServerPlugins, registerStringLoaders, - registerTxAdapterFactry + registerTxAdapterFactory } from '@hcengineering/server-pipeline' import { buildStorageFromConfig, storageConfigFromEnv } from '@hcengineering/server-storage' import { generateToken } from '@hcengineering/server-token' @@ -82,13 +82,13 @@ export async function createWorkspace ( const hierarchy = new Hierarchy() const modelDb = new ModelDb(hierarchy) - registerTxAdapterFactry('mongodb', createMongoTxAdapter) - registerAdapterFactry('mongodb', createMongoAdapter) - registerDestroyFactry('mongodb', createMongoDestroyAdapter) + registerTxAdapterFactory('mongodb', createMongoTxAdapter) + registerAdapterFactory('mongodb', createMongoAdapter) + registerDestroyFactory('mongodb', createMongoDestroyAdapter) - registerTxAdapterFactry('postgresql', createPostgresTxAdapter, true) - registerAdapterFactry('postgresql', createPostgresAdapter, true) - registerDestroyFactry('postgresql', createPostgreeDestroyAdapter, true) + registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) + registerAdapterFactory('postgresql', createPostgresAdapter, true) + registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) registerServerPlugins() registerStringLoaders() @@ -173,13 +173,13 @@ export async function upgradeWorkspace ( ): Promise { const { dbUrl } = prepareTools([]) let pipeline: Pipeline | undefined - registerTxAdapterFactry('mongodb', createMongoTxAdapter) - registerAdapterFactry('mongodb', createMongoAdapter) - registerDestroyFactry('mongodb', createMongoDestroyAdapter) + registerTxAdapterFactory('mongodb', createMongoTxAdapter) + registerAdapterFactory('mongodb', createMongoAdapter) + registerDestroyFactory('mongodb', createMongoDestroyAdapter) - registerTxAdapterFactry('postgresql', createPostgresTxAdapter, true) - registerAdapterFactry('postgresql', createPostgresAdapter, true) - registerDestroyFactry('postgresql', createPostgreeDestroyAdapter, true) + registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) + registerAdapterFactory('postgresql', createPostgresAdapter, true) + registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) registerServerPlugins() registerStringLoaders() diff --git a/workers/transactor/src/transactor.ts b/workers/transactor/src/transactor.ts index 17710ac3871..decbcaa1497 100644 --- a/workers/transactor/src/transactor.ts +++ b/workers/transactor/src/transactor.ts @@ -38,11 +38,11 @@ import { gzip } from 'zlib' import { createPostgreeDestroyAdapter, createPostgresAdapter, createPostgresTxAdapter } from '@hcengineering/postgres' import { createServerPipeline, - registerAdapterFactry, - registerDestroyFactry, + registerAdapterFactory, + registerDestroyFactory, registerServerPlugins, registerStringLoaders, - registerTxAdapterFactry + registerTxAdapterFactory } from '@hcengineering/server-pipeline' import model from './model.json' @@ -65,9 +65,9 @@ export class Transactor extends DurableObject { constructor (ctx: DurableObjectState, env: Env) { super(ctx, env) - registerTxAdapterFactry('postgresql', createPostgresTxAdapter, true) - registerAdapterFactry('postgresql', createPostgresAdapter, true) - registerDestroyFactry('postgresql', createPostgreeDestroyAdapter, true) + registerTxAdapterFactory('postgresql', createPostgresTxAdapter, true) + registerAdapterFactory('postgresql', createPostgresAdapter, true) + registerDestroyFactory('postgresql', createPostgreeDestroyAdapter, true) registerStringLoaders() registerServerPlugins() From b2419221fb1868f9a66c8cb8aee0f4747eaea114 Mon Sep 17 00:00:00 2001 From: Alexander Onnikov Date: Thu, 26 Dec 2024 15:33:43 +0700 Subject: [PATCH 2/3] fix: combine presence avatars (#7551) Signed-off-by: Alexander Onnikov --- dev/prod/public/config-dev.json | 3 +- .../src/components/Header.svelte | 2 +- .../src/components/PresenceAvatars.svelte | 46 ++++++++++++------- .../src/components/PresenceList.svelte | 33 +++++++++++++ 4 files changed, 65 insertions(+), 19 deletions(-) create mode 100644 plugins/presence-resources/src/components/PresenceList.svelte diff --git a/dev/prod/public/config-dev.json b/dev/prod/public/config-dev.json index 8f0b1e22f26..2093d02ddc1 100644 --- a/dev/prod/public/config-dev.json +++ b/dev/prod/public/config-dev.json @@ -7,5 +7,6 @@ "CALENDAR_URL": "https://calendar.hc.engineering", "REKONI_URL": "https://rekoni.hc.engineering", "COLLABORATOR_URL": "wss://collaborator.hc.engineering", - "STATS_URL": "https://stats.hc.engineering" + "STATS_URL": "https://stats.hc.engineering", + "PRESENCE_URL": "wss://presence.hc.engineering" } \ No newline at end of file diff --git a/plugins/chunter-resources/src/components/Header.svelte b/plugins/chunter-resources/src/components/Header.svelte index d8cd07fa49e..5f04a94d269 100644 --- a/plugins/chunter-resources/src/components/Header.svelte +++ b/plugins/chunter-resources/src/components/Header.svelte @@ -122,7 +122,7 @@ {#if withPresence && object} - + {/if} diff --git a/plugins/presence-resources/src/components/PresenceAvatars.svelte b/plugins/presence-resources/src/components/PresenceAvatars.svelte index 4708b5e0792..e5b2704d8a7 100644 --- a/plugins/presence-resources/src/components/PresenceAvatars.svelte +++ b/plugins/presence-resources/src/components/PresenceAvatars.svelte @@ -15,35 +15,47 @@ -{#if items.length > 0} - {#if combine} - +{#if persons.length > 0} + {#if overLimit} +
+ {#each persons.slice(0, limit) as person, i} +
+ +
+ {/each} +
{:else} -
- {#each items as item} - {@const person = $personByIdStore.get(item)} - {#if person} -
- -
- {/if} +
+ {#each persons as person} +
+ +
{/each}
{/if} diff --git a/plugins/presence-resources/src/components/PresenceList.svelte b/plugins/presence-resources/src/components/PresenceList.svelte new file mode 100644 index 00000000000..21a4c75c35b --- /dev/null +++ b/plugins/presence-resources/src/components/PresenceList.svelte @@ -0,0 +1,33 @@ + + + + + {#each persons as person} +
+
+ +
+ {formatName(person.name)} +
+ {/each} +
From 8c4c4ad9b3aa0f4f6f2ac2b05896204ee44c1512 Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Thu, 26 Dec 2024 15:56:56 +0700 Subject: [PATCH 3/3] QFIX: Github Auth (#7558) Signed-off-by: Andrey Sobolev --- plugins/task-resources/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/task-resources/src/index.ts b/plugins/task-resources/src/index.ts index 39b1a69811c..537d2c9b46f 100644 --- a/plugins/task-resources/src/index.ts +++ b/plugins/task-resources/src/index.ts @@ -367,7 +367,7 @@ export const joinedProjectsStore = writable() function fillStores (): void { const client = getClient() - if (client !== undefined) { + if (client !== undefined && getCurrentAccount() != null) { const query = createQuery(true) query.query(task.class.ProjectType, {}, (res) => { typeStore.set(toIdMap(res))