From 8765cba7e6b2657abe28ded389be1e8109ab8cec Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Wed, 1 Dec 2021 16:27:55 +0700 Subject: [PATCH] Fix Devmodel plugin Live Query functionality (#441) Signed-off-by: Andrey Sobolev --- dev/client-resources/src/connection.ts | 1 - dev/server/src/server.ts | 1 - .../devmodel-resources/src/components/ModelView.svelte | 6 ++++-- plugins/devmodel-resources/src/index.ts | 10 ++++++---- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dev/client-resources/src/connection.ts b/dev/client-resources/src/connection.ts index 8702336e2f..5ecf0e522b 100644 --- a/dev/client-resources/src/connection.ts +++ b/dev/client-resources/src/connection.ts @@ -38,7 +38,6 @@ class ServerStorageWrapper implements Storage { class NullFullTextAdapter implements FullTextAdapter { async index (doc: IndexedDoc): Promise { - console.log('noop full text indexer: ', doc) return {} } diff --git a/dev/server/src/server.ts b/dev/server/src/server.ts index e5acde82bb..c837d148db 100644 --- a/dev/server/src/server.ts +++ b/dev/server/src/server.ts @@ -26,7 +26,6 @@ import { serverChunterId } from '@anticrm/server-chunter' class NullFullTextAdapter implements FullTextAdapter { async index (doc: IndexedDoc): Promise { - console.log('noop full text indexer: ', doc) return {} } diff --git a/plugins/devmodel-resources/src/components/ModelView.svelte b/plugins/devmodel-resources/src/components/ModelView.svelte index 5539f02424..df4507dfc1 100644 --- a/plugins/devmodel-resources/src/components/ModelView.svelte +++ b/plugins/devmodel-resources/src/components/ModelView.svelte @@ -20,12 +20,13 @@ import { toIntl } from '..' import ContentPopup from './ContentPopup.svelte' - let txes: TxCUD[] = [] + let txes: (TxCUD & {index:number})[] = [] const activityQuery = createQuery() $: activityQuery.query(core.class.TxCUD, { objectSpace: core.space.Model }, (result) => { - txes = result + let c = 0 + txes = result.map(t => ({ ...t, index: c++ })) }) @@ -42,6 +43,7 @@ import { toIntl } from '..' {#each txes as tx} + {tx.index} {tx.objectId} {tx.objectClass} diff --git a/plugins/devmodel-resources/src/index.ts b/plugins/devmodel-resources/src/index.ts index cdd3b3d38e..d728413e18 100644 --- a/plugins/devmodel-resources/src/index.ts +++ b/plugins/devmodel-resources/src/index.ts @@ -41,12 +41,14 @@ export const queries: QueryWithResult[] = [] class ModelClient implements Client { constructor (readonly client: Client) { + client.notify = (tx) => { + this.notify?.(tx) + console.info('devmodel# notify=>', tx, this.client.getModel()) + notifications.push(tx) + } } - notify (tx: Tx): void { - this.client.notify?.(tx) - notifications.push(tx) - } + notify?: (tx: Tx) => void getHierarchy (): Hierarchy { return this.client.getHierarchy()