diff --git a/models/core/src/index.ts b/models/core/src/index.ts index 64ff9b648b..f98436830c 100644 --- a/models/core/src/index.ts +++ b/models/core/src/index.ts @@ -141,10 +141,18 @@ export function createModel (builder: Builder): void { 'tx._class', 'tx.objectClass', 'tx.operations.attachedTo', + 'space', 'objectSpace', { + _class: 1, objectSpace: 1, - _id: 1 + _id: 1, + modifiedOn: 1 + }, + { + _class: 1, + _id: 1, + modifiedOn: 1 } ] } diff --git a/packages/core/src/client.ts b/packages/core/src/client.ts index 90b3da54d0..26d37ddc9a 100644 --- a/packages/core/src/client.ts +++ b/packages/core/src/client.ts @@ -198,7 +198,7 @@ export async function createClient ( const atxes = await conn.findAll( core.class.Tx, { modifiedOn: { $gt: lastTx } }, - { sort: { _id: SortingOrder.Ascending }, limit: transactionThreshold } + { sort: { modifiedOn: SortingOrder.Ascending, _id: SortingOrder.Ascending }, limit: transactionThreshold } ) if (atxes.total < transactionThreshold) { console.log('applying input transactions', atxes.length) @@ -226,7 +226,7 @@ async function loadModel ( const atxes = await conn.findAll( core.class.Tx, { objectSpace: core.space.Model, _id: { $nin: Array.from(processedTx.values()) } }, - { sort: { _id: SortingOrder.Ascending } } + { sort: { modifiedOn: SortingOrder.Ascending, _id: SortingOrder.Ascending } } ) let systemTx: Tx[] = [] diff --git a/packages/presentation/src/components/message/Nodes.svelte b/packages/presentation/src/components/message/Nodes.svelte index b069b543be..5a6434468f 100644 --- a/packages/presentation/src/components/message/Nodes.svelte +++ b/packages/presentation/src/components/message/Nodes.svelte @@ -29,7 +29,11 @@ {:else if node.nodeName === 'STRONG'} <strong><svelte:self nodes={node.childNodes} /></strong> {:else if node.nodeName === 'P'} - <p class="p-inline"><svelte:self nodes={node.childNodes} /></p> + {#if node.childNodes.length > 0} + <p class="p-inline"> + <svelte:self nodes={node.childNodes} /> + </p> + {/if} {:else if node.nodeName === 'BLOCKQUOTE'} <blockquote><svelte:self nodes={node.childNodes} /></blockquote> {:else if node.nodeName === 'CODE'} diff --git a/plugins/attachment-resources/src/components/AttachmentPopup.svelte b/plugins/attachment-resources/src/components/AttachmentPopup.svelte index 6fce7539d7..fb49b1b9ca 100644 --- a/plugins/attachment-resources/src/components/AttachmentPopup.svelte +++ b/plugins/attachment-resources/src/components/AttachmentPopup.svelte @@ -14,16 +14,26 @@ // limitations under the License. --> <script lang="ts"> - import type { Ref, Doc } from '@hcengineering/core' - import { Table } from '@hcengineering/view-resources' + import type { Doc, Ref } from '@hcengineering/core' + import { DocNavLink, ObjectPresenter, Table } from '@hcengineering/view-resources' - import attachment from '../plugin' + import { Label } from '@hcengineering/ui' import view from '@hcengineering/view' + import attachment from '../plugin' export let objectId: Ref<Doc> export let attachments: number + export let object: Doc </script> +<div class="flex flex-between flex-grow p-1 mb-4"> + <div class="fs-title"> + <Label label={attachment.string.Attachments} /> + </div> + <DocNavLink {object}> + <ObjectPresenter _class={object._class} objectId={object._id} value={object} /> + </DocNavLink> +</div> <Table _class={attachment.class.Attachment} config={[ diff --git a/plugins/attachment-resources/src/components/AttachmentsPresenter.svelte b/plugins/attachment-resources/src/components/AttachmentsPresenter.svelte index 74f25c79cd..6c3ebacf7d 100644 --- a/plugins/attachment-resources/src/components/AttachmentsPresenter.svelte +++ b/plugins/attachment-resources/src/components/AttachmentsPresenter.svelte @@ -16,7 +16,7 @@ <script lang="ts"> import type { Doc } from '@hcengineering/core' import { IconAttachment, tooltip } from '@hcengineering/ui' - import attachment from '../plugin' + import { DocNavLink } from '@hcengineering/view-resources' import AttachmentPopup from './AttachmentPopup.svelte' export let value: number | undefined @@ -27,18 +27,18 @@ {#if value && value > 0} <!-- svelte-ignore a11y-click-events-have-key-events --> - <div - use:tooltip={{ - label: attachment.string.Attachments, - component: AttachmentPopup, - props: { objectId: object._id, attachments: value } - }} - on:click|preventDefault|stopPropagation={() => {}} - class="sm-tool-icon ml-1 mr-1" - > - <span class="icon"><IconAttachment {size} /></span> - {#if showCounter} - {value} - {/if} - </div> + <DocNavLink {object} inline noUnderline={true}> + <div + use:tooltip={{ + component: AttachmentPopup, + props: { objectId: object._id, attachments: value, object } + }} + class="sm-tool-icon ml-1 mr-1" + > + <span class="icon"><IconAttachment {size} /></span> + {#if showCounter} + {value} + {/if} + </div> + </DocNavLink> {/if} diff --git a/plugins/chunter-resources/src/components/CommentPopup.svelte b/plugins/chunter-resources/src/components/CommentPopup.svelte index 65e0499123..3a3b03574e 100644 --- a/plugins/chunter-resources/src/components/CommentPopup.svelte +++ b/plugins/chunter-resources/src/components/CommentPopup.svelte @@ -14,13 +14,16 @@ // limitations under the License. --> <script lang="ts"> - import { Ref, Doc, SortingOrder } from '@hcengineering/core' + import { Doc, Ref, SortingOrder } from '@hcengineering/core' import chunter, { Comment } from '@hcengineering/chunter' import { createQuery } from '@hcengineering/presentation' + import { Label } from '@hcengineering/ui' + import { DocNavLink, ObjectPresenter } from '@hcengineering/view-resources' import CommentPresenter from './CommentPresenter.svelte' export let objectId: Ref<Doc> + export let object: Doc let comments: Comment[] = [] const query = createQuery() @@ -30,21 +33,34 @@ (res) => { comments = res }, - { limit: 3, sort: { modifiedOn: SortingOrder.Descending } } + { sort: { modifiedOn: SortingOrder.Descending } } ) </script> -{#each comments as comment} - <div class="item"> - <CommentPresenter value={comment} /> +<div class="flex flex-between flex-grow p-1 mb-4"> + <div class="fs-title"> + <Label label={chunter.string.Comments} /> </div> -{/each} + <DocNavLink {object}> + <ObjectPresenter _class={object._class} objectId={object._id} value={object} /> + </DocNavLink> +</div> +<div class="comments max-h-120 flex-row"> + {#each comments as comment} + <div class="item"> + <CommentPresenter value={comment} /> + </div> + {/each} +</div> <style lang="scss"> .item { max-width: 30rem; } .item + .item { - margin-top: 1.25rem; + margin-top: 0.75rem; + } + .comments { + overflow: auto; } </style> diff --git a/plugins/chunter-resources/src/components/CommentPresenter.svelte b/plugins/chunter-resources/src/components/CommentPresenter.svelte index a090e46d5a..822afb5a21 100644 --- a/plugins/chunter-resources/src/components/CommentPresenter.svelte +++ b/plugins/chunter-resources/src/components/CommentPresenter.svelte @@ -18,10 +18,9 @@ import type { Comment } from '@hcengineering/chunter' import chunter from '@hcengineering/chunter' import contact, { Employee, EmployeeAccount, getName } from '@hcengineering/contact' - import { employeeByIdStore } from '@hcengineering/contact-resources' + import { Avatar, employeeByIdStore } from '@hcengineering/contact-resources' import { Ref } from '@hcengineering/core' import { getClient, MessageViewer } from '@hcengineering/presentation' - import { Avatar } from '@hcengineering/contact-resources' import { Icon, ShowMore, TimeSince } from '@hcengineering/ui' export let value: Comment @@ -64,7 +63,7 @@ </div> <div class="dark-color ml-4"><TimeSince value={value.modifiedOn} /></div> </div> - <ShowMore limit={126} fixed> + <ShowMore fixed> <MessageViewer message={value.message} /> <AttachmentDocList {value} /> </ShowMore> diff --git a/plugins/chunter-resources/src/components/CommentsPresenter.svelte b/plugins/chunter-resources/src/components/CommentsPresenter.svelte index 8ff7d33817..264bf89b1b 100644 --- a/plugins/chunter-resources/src/components/CommentsPresenter.svelte +++ b/plugins/chunter-resources/src/components/CommentsPresenter.svelte @@ -14,9 +14,9 @@ // limitations under the License. --> <script lang="ts"> - import chunter from '@hcengineering/chunter' import type { Doc } from '@hcengineering/core' import { IconThread, tooltip } from '@hcengineering/ui' + import { DocNavLink } from '@hcengineering/view-resources' import CommentPopup from './CommentPopup.svelte' export let value: number | undefined @@ -27,18 +27,18 @@ {#if value && value > 0} <!-- svelte-ignore a11y-click-events-have-key-events --> - <div - use:tooltip={{ - label: chunter.string.Comments, - component: CommentPopup, - props: { objectId: object._id } - }} - on:click|preventDefault|stopPropagation={() => {}} - class="sm-tool-icon ml-1 mr-1" - > - <span class="icon"><IconThread {size} /></span> - {#if showCounter} - {value} - {/if} - </div> + <DocNavLink {object} inline noUnderline={true}> + <div + use:tooltip={{ + component: CommentPopup, + props: { objectId: object._id, object } + }} + class="sm-tool-icon ml-1 mr-1" + > + <span class="icon"><IconThread {size} /></span> + {#if showCounter} + {value} + {/if} + </div> + </DocNavLink> {/if} diff --git a/plugins/recruit-resources/src/components/ApplicationsPopup.svelte b/plugins/recruit-resources/src/components/ApplicationsPopup.svelte index 6650bf134f..8a4f3a0f6e 100644 --- a/plugins/recruit-resources/src/components/ApplicationsPopup.svelte +++ b/plugins/recruit-resources/src/components/ApplicationsPopup.svelte @@ -15,12 +15,21 @@ --> <script lang="ts"> import type { Candidate } from '@hcengineering/recruit' - import recruit from '@hcengineering/recruit' - import { Table } from '@hcengineering/view-resources' + import { Label } from '@hcengineering/ui' + import { DocNavLink, ObjectPresenter, Table } from '@hcengineering/view-resources' + import recruit from '../plugin' export let value: Candidate </script> +<div class="flex flex-between flex-grow p-1 mb-4"> + <div class="fs-title"> + <Label label={recruit.string.Applications} /> + </div> + <DocNavLink object={value}> + <ObjectPresenter _class={value._class} objectId={value._id} {value} /> + </DocNavLink> +</div> <Table _class={recruit.class.Applicant} config={['', '$lookup.space.name', '$lookup.space.company', 'state', 'doneState']} diff --git a/plugins/recruit-resources/src/components/ApplicationsPresenter.svelte b/plugins/recruit-resources/src/components/ApplicationsPresenter.svelte index 754577022a..1a0febdf13 100644 --- a/plugins/recruit-resources/src/components/ApplicationsPresenter.svelte +++ b/plugins/recruit-resources/src/components/ApplicationsPresenter.svelte @@ -16,6 +16,7 @@ <script lang="ts"> import type { Candidate } from '@hcengineering/recruit' import { Icon, tooltip } from '@hcengineering/ui' + import { DocNavLink } from '@hcengineering/view-resources' import recruit from '../plugin' import ApplicationsPopup from './ApplicationsPopup.svelte' @@ -24,14 +25,15 @@ </script> {#if value && value > 0} - <div - use:tooltip={{ - label: recruit.string.Applications, - component: ApplicationsPopup, - props: { value: object } - }} - class="sm-tool-icon" - > - <span class="icon"><Icon icon={recruit.icon.Application} size={'small'} /></span> {value} - </div> + <DocNavLink {object} inline noUnderline={true}> + <div + use:tooltip={{ + component: ApplicationsPopup, + props: { value: object } + }} + class="sm-tool-icon" + > + <span class="icon"><Icon icon={recruit.icon.Application} size={'small'} /></span> {value} + </div> + </DocNavLink> {/if} diff --git a/plugins/tracker-resources/src/components/issues/IssuePreview.svelte b/plugins/tracker-resources/src/components/issues/IssuePreview.svelte index 6a7a43b61c..5ce6f3ad9e 100644 --- a/plugins/tracker-resources/src/components/issues/IssuePreview.svelte +++ b/plugins/tracker-resources/src/components/issues/IssuePreview.svelte @@ -114,7 +114,7 @@ <Label label={chunter.string.Comments} />: </div> <div class="ml-2"> - <CommentPopup objectId={issue._id} /> + <CommentPopup objectId={issue._id} object={issue} /> </div> {/if} {/if} diff --git a/server/tool/src/index.ts b/server/tool/src/index.ts index fbdf0b113a..7aeb6337c2 100644 --- a/server/tool/src/index.ts +++ b/server/tool/src/index.ts @@ -249,7 +249,11 @@ async function createUpdateIndexes (connection: CoreClient, db: Db): Promise<voi const collection = db.collection(d) const bb: (string | FieldIndex<Doc>)[] = [] for (const vv of v.values()) { - await collection.createIndex(vv) + try { + await collection.createIndex(vv) + } catch (err: any) { + console.error(err) + } bb.push(vv) } if (bb.length > 0) {