From e9559562bda4d66aa0ed3fd5e66a3c193562511f Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Mon, 22 Nov 2021 17:29:29 +0700 Subject: [PATCH] Fix Comment panning in Activity 1. Fix Comment panning in Activity 2. Apply formatting. --- .../src/components/Activity.svelte | 12 +++-- .../src/components/TxView.svelte | 52 ++++++++++--------- 2 files changed, 35 insertions(+), 29 deletions(-) diff --git a/plugins/activity-resources/src/components/Activity.svelte b/plugins/activity-resources/src/components/Activity.svelte index 4bbf78aa56..2bc7f1c635 100644 --- a/plugins/activity-resources/src/components/Activity.svelte +++ b/plugins/activity-resources/src/components/Activity.svelte @@ -32,7 +32,9 @@ let txes: TxCUD[] - $: txes = Array.from(txes1).concat(txes2).sort((a, b) => b.modifiedOn - a.modifiedOn) + $: txes = Array.from(txes1) + .concat(txes2) + .sort((a, b) => b.modifiedOn - a.modifiedOn) const client = getClient() @@ -79,10 +81,10 @@ const descriptors = createQuery() $: descriptors.query(activity.class.TxViewlet, {}, (result) => { - viewlets = new Map(result.map(r => ([activityKey(r.objectClass, r.txClass), r]))) + viewlets = new Map(result.map((r) => [activityKey(r.objectClass, r.txClass), r])) }) - + {#if fullSize}
@@ -93,7 +95,7 @@ {#if txes} {#each txes as tx} - + {/each} {/if} @@ -114,7 +116,7 @@ {#if txes} {#each txes as tx} - + {/each} {/if} diff --git a/plugins/activity-resources/src/components/TxView.svelte b/plugins/activity-resources/src/components/TxView.svelte index aff68c35f2..f3c08bbe13 100644 --- a/plugins/activity-resources/src/components/TxView.svelte +++ b/plugins/activity-resources/src/components/TxView.svelte @@ -36,7 +36,7 @@ const client = getClient() $: if (client.getHierarchy().isDerived(tx._class, core.class.TxCollectionCUD)) { - const colCUD = (tx as TxCollectionCUD) + const colCUD = tx as TxCollectionCUD displayTx = colCUD.tx } else if (client.getHierarchy().isDerived(tx._class, core.class.TxCUD)) { displayTx = tx as TxCUD @@ -50,13 +50,14 @@ } let employee: EmployeeAccount | undefined - $: client.findOne(contact.class.EmployeeAccount, { _id: tx.modifiedBy as Ref }).then(account => { employee = account }) + $: client.findOne(contact.class.EmployeeAccount, { _id: tx.modifiedBy as Ref }).then((account) => { + employee = account + }) - $: client.findAll(contact.class.EmployeeAccount, { }).then(accounts => { console.log(tx.modifiedBy, 'accounts', accounts) }) let model: AttributeModel[] = [] - let buildModel: ((options: BuildModelOptions) => Promise)|undefined - getResource(view.api.buildModel).then(bm => { + let buildModel: ((options: BuildModelOptions) => Promise) | undefined + getResource(view.api.buildModel).then((bm) => { buildModel = bm }) @@ -64,7 +65,7 @@ utx = displayTx as TxUpdateDoc const ops = { client, _class: utx.objectClass, keys: Object.keys(utx.operations), ignoreMissing: true } model = [] - buildModel?.(ops).then(m => { + buildModel?.(ops).then((m) => { model = m }) } else { @@ -79,45 +80,46 @@ {#if displayTx && (viewlet !== undefined || model.length > 0)}
-
-
-
- {#if viewlet} - - {:else} - - {/if} -
+
+
+
+ {#if viewlet} + + {:else} + + {/if}
+
{#if employee} - {formatName(employee.name)} + {formatName(employee.name)} {:else} No employee {/if} - + {#if viewlet} -
-
+
{#if viewlet && viewlet.component && viewlet.display !== 'inline'} -
+
{/if}
{/if} +