mirror of
https://github.com/hcengineering/platform.git
synced 2025-06-05 15:24:22 +00:00
TSK-1038: Fix comments presenter (#2896)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
parent
1f966a36c1
commit
972e82eb32
@ -141,10 +141,18 @@ export function createModel (builder: Builder): void {
|
|||||||
'tx._class',
|
'tx._class',
|
||||||
'tx.objectClass',
|
'tx.objectClass',
|
||||||
'tx.operations.attachedTo',
|
'tx.operations.attachedTo',
|
||||||
|
'space',
|
||||||
'objectSpace',
|
'objectSpace',
|
||||||
{
|
{
|
||||||
|
_class: 1,
|
||||||
objectSpace: 1,
|
objectSpace: 1,
|
||||||
_id: 1
|
_id: 1,
|
||||||
|
modifiedOn: 1
|
||||||
|
},
|
||||||
|
{
|
||||||
|
_class: 1,
|
||||||
|
_id: 1,
|
||||||
|
modifiedOn: 1
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -198,7 +198,7 @@ export async function createClient (
|
|||||||
const atxes = await conn.findAll(
|
const atxes = await conn.findAll(
|
||||||
core.class.Tx,
|
core.class.Tx,
|
||||||
{ modifiedOn: { $gt: lastTx } },
|
{ modifiedOn: { $gt: lastTx } },
|
||||||
{ sort: { _id: SortingOrder.Ascending }, limit: transactionThreshold }
|
{ sort: { modifiedOn: SortingOrder.Ascending, _id: SortingOrder.Ascending }, limit: transactionThreshold }
|
||||||
)
|
)
|
||||||
if (atxes.total < transactionThreshold) {
|
if (atxes.total < transactionThreshold) {
|
||||||
console.log('applying input transactions', atxes.length)
|
console.log('applying input transactions', atxes.length)
|
||||||
@ -226,7 +226,7 @@ async function loadModel (
|
|||||||
const atxes = await conn.findAll(
|
const atxes = await conn.findAll(
|
||||||
core.class.Tx,
|
core.class.Tx,
|
||||||
{ objectSpace: core.space.Model, _id: { $nin: Array.from(processedTx.values()) } },
|
{ objectSpace: core.space.Model, _id: { $nin: Array.from(processedTx.values()) } },
|
||||||
{ sort: { _id: SortingOrder.Ascending } }
|
{ sort: { modifiedOn: SortingOrder.Ascending, _id: SortingOrder.Ascending } }
|
||||||
)
|
)
|
||||||
|
|
||||||
let systemTx: Tx[] = []
|
let systemTx: Tx[] = []
|
||||||
|
@ -29,7 +29,11 @@
|
|||||||
{:else if node.nodeName === 'STRONG'}
|
{:else if node.nodeName === 'STRONG'}
|
||||||
<strong><svelte:self nodes={node.childNodes} /></strong>
|
<strong><svelte:self nodes={node.childNodes} /></strong>
|
||||||
{:else if node.nodeName === 'P'}
|
{: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'}
|
{:else if node.nodeName === 'BLOCKQUOTE'}
|
||||||
<blockquote><svelte:self nodes={node.childNodes} /></blockquote>
|
<blockquote><svelte:self nodes={node.childNodes} /></blockquote>
|
||||||
{:else if node.nodeName === 'CODE'}
|
{:else if node.nodeName === 'CODE'}
|
||||||
|
@ -14,16 +14,26 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Ref, Doc } from '@hcengineering/core'
|
import type { Doc, Ref } from '@hcengineering/core'
|
||||||
import { Table } from '@hcengineering/view-resources'
|
import { DocNavLink, ObjectPresenter, Table } from '@hcengineering/view-resources'
|
||||||
|
|
||||||
import attachment from '../plugin'
|
import { Label } from '@hcengineering/ui'
|
||||||
import view from '@hcengineering/view'
|
import view from '@hcengineering/view'
|
||||||
|
import attachment from '../plugin'
|
||||||
|
|
||||||
export let objectId: Ref<Doc>
|
export let objectId: Ref<Doc>
|
||||||
export let attachments: number
|
export let attachments: number
|
||||||
|
export let object: Doc
|
||||||
</script>
|
</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
|
<Table
|
||||||
_class={attachment.class.Attachment}
|
_class={attachment.class.Attachment}
|
||||||
config={[
|
config={[
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Doc } from '@hcengineering/core'
|
import type { Doc } from '@hcengineering/core'
|
||||||
import { IconAttachment, tooltip } from '@hcengineering/ui'
|
import { IconAttachment, tooltip } from '@hcengineering/ui'
|
||||||
import attachment from '../plugin'
|
import { DocNavLink } from '@hcengineering/view-resources'
|
||||||
import AttachmentPopup from './AttachmentPopup.svelte'
|
import AttachmentPopup from './AttachmentPopup.svelte'
|
||||||
|
|
||||||
export let value: number | undefined
|
export let value: number | undefined
|
||||||
@ -27,18 +27,18 @@
|
|||||||
|
|
||||||
{#if value && value > 0}
|
{#if value && value > 0}
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<div
|
<DocNavLink {object} inline noUnderline={true}>
|
||||||
use:tooltip={{
|
<div
|
||||||
label: attachment.string.Attachments,
|
use:tooltip={{
|
||||||
component: AttachmentPopup,
|
component: AttachmentPopup,
|
||||||
props: { objectId: object._id, attachments: value }
|
props: { objectId: object._id, attachments: value, object }
|
||||||
}}
|
}}
|
||||||
on:click|preventDefault|stopPropagation={() => {}}
|
class="sm-tool-icon ml-1 mr-1"
|
||||||
class="sm-tool-icon ml-1 mr-1"
|
>
|
||||||
>
|
<span class="icon"><IconAttachment {size} /></span>
|
||||||
<span class="icon"><IconAttachment {size} /></span>
|
{#if showCounter}
|
||||||
{#if showCounter}
|
{value}
|
||||||
{value}
|
{/if}
|
||||||
{/if}
|
</div>
|
||||||
</div>
|
</DocNavLink>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -14,13 +14,16 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import { Ref, Doc, SortingOrder } from '@hcengineering/core'
|
import { Doc, Ref, SortingOrder } from '@hcengineering/core'
|
||||||
|
|
||||||
import chunter, { Comment } from '@hcengineering/chunter'
|
import chunter, { Comment } from '@hcengineering/chunter'
|
||||||
import { createQuery } from '@hcengineering/presentation'
|
import { createQuery } from '@hcengineering/presentation'
|
||||||
|
import { Label } from '@hcengineering/ui'
|
||||||
|
import { DocNavLink, ObjectPresenter } from '@hcengineering/view-resources'
|
||||||
import CommentPresenter from './CommentPresenter.svelte'
|
import CommentPresenter from './CommentPresenter.svelte'
|
||||||
|
|
||||||
export let objectId: Ref<Doc>
|
export let objectId: Ref<Doc>
|
||||||
|
export let object: Doc
|
||||||
|
|
||||||
let comments: Comment[] = []
|
let comments: Comment[] = []
|
||||||
const query = createQuery()
|
const query = createQuery()
|
||||||
@ -30,21 +33,34 @@
|
|||||||
(res) => {
|
(res) => {
|
||||||
comments = res
|
comments = res
|
||||||
},
|
},
|
||||||
{ limit: 3, sort: { modifiedOn: SortingOrder.Descending } }
|
{ sort: { modifiedOn: SortingOrder.Descending } }
|
||||||
)
|
)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#each comments as comment}
|
<div class="flex flex-between flex-grow p-1 mb-4">
|
||||||
<div class="item">
|
<div class="fs-title">
|
||||||
<CommentPresenter value={comment} />
|
<Label label={chunter.string.Comments} />
|
||||||
</div>
|
</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">
|
<style lang="scss">
|
||||||
.item {
|
.item {
|
||||||
max-width: 30rem;
|
max-width: 30rem;
|
||||||
}
|
}
|
||||||
.item + .item {
|
.item + .item {
|
||||||
margin-top: 1.25rem;
|
margin-top: 0.75rem;
|
||||||
|
}
|
||||||
|
.comments {
|
||||||
|
overflow: auto;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -18,10 +18,9 @@
|
|||||||
import type { Comment } from '@hcengineering/chunter'
|
import type { Comment } from '@hcengineering/chunter'
|
||||||
import chunter from '@hcengineering/chunter'
|
import chunter from '@hcengineering/chunter'
|
||||||
import contact, { Employee, EmployeeAccount, getName } from '@hcengineering/contact'
|
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 { Ref } from '@hcengineering/core'
|
||||||
import { getClient, MessageViewer } from '@hcengineering/presentation'
|
import { getClient, MessageViewer } from '@hcengineering/presentation'
|
||||||
import { Avatar } from '@hcengineering/contact-resources'
|
|
||||||
import { Icon, ShowMore, TimeSince } from '@hcengineering/ui'
|
import { Icon, ShowMore, TimeSince } from '@hcengineering/ui'
|
||||||
|
|
||||||
export let value: Comment
|
export let value: Comment
|
||||||
@ -64,7 +63,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="dark-color ml-4"><TimeSince value={value.modifiedOn} /></div>
|
<div class="dark-color ml-4"><TimeSince value={value.modifiedOn} /></div>
|
||||||
</div>
|
</div>
|
||||||
<ShowMore limit={126} fixed>
|
<ShowMore fixed>
|
||||||
<MessageViewer message={value.message} />
|
<MessageViewer message={value.message} />
|
||||||
<AttachmentDocList {value} />
|
<AttachmentDocList {value} />
|
||||||
</ShowMore>
|
</ShowMore>
|
||||||
|
@ -14,9 +14,9 @@
|
|||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import chunter from '@hcengineering/chunter'
|
|
||||||
import type { Doc } from '@hcengineering/core'
|
import type { Doc } from '@hcengineering/core'
|
||||||
import { IconThread, tooltip } from '@hcengineering/ui'
|
import { IconThread, tooltip } from '@hcengineering/ui'
|
||||||
|
import { DocNavLink } from '@hcengineering/view-resources'
|
||||||
import CommentPopup from './CommentPopup.svelte'
|
import CommentPopup from './CommentPopup.svelte'
|
||||||
|
|
||||||
export let value: number | undefined
|
export let value: number | undefined
|
||||||
@ -27,18 +27,18 @@
|
|||||||
|
|
||||||
{#if value && value > 0}
|
{#if value && value > 0}
|
||||||
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
<!-- svelte-ignore a11y-click-events-have-key-events -->
|
||||||
<div
|
<DocNavLink {object} inline noUnderline={true}>
|
||||||
use:tooltip={{
|
<div
|
||||||
label: chunter.string.Comments,
|
use:tooltip={{
|
||||||
component: CommentPopup,
|
component: CommentPopup,
|
||||||
props: { objectId: object._id }
|
props: { objectId: object._id, object }
|
||||||
}}
|
}}
|
||||||
on:click|preventDefault|stopPropagation={() => {}}
|
class="sm-tool-icon ml-1 mr-1"
|
||||||
class="sm-tool-icon ml-1 mr-1"
|
>
|
||||||
>
|
<span class="icon"><IconThread {size} /></span>
|
||||||
<span class="icon"><IconThread {size} /></span>
|
{#if showCounter}
|
||||||
{#if showCounter}
|
{value}
|
||||||
{value}
|
{/if}
|
||||||
{/if}
|
</div>
|
||||||
</div>
|
</DocNavLink>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -15,12 +15,21 @@
|
|||||||
-->
|
-->
|
||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Candidate } from '@hcengineering/recruit'
|
import type { Candidate } from '@hcengineering/recruit'
|
||||||
import recruit from '@hcengineering/recruit'
|
import { Label } from '@hcengineering/ui'
|
||||||
import { Table } from '@hcengineering/view-resources'
|
import { DocNavLink, ObjectPresenter, Table } from '@hcengineering/view-resources'
|
||||||
|
import recruit from '../plugin'
|
||||||
|
|
||||||
export let value: Candidate
|
export let value: Candidate
|
||||||
</script>
|
</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
|
<Table
|
||||||
_class={recruit.class.Applicant}
|
_class={recruit.class.Applicant}
|
||||||
config={['', '$lookup.space.name', '$lookup.space.company', 'state', 'doneState']}
|
config={['', '$lookup.space.name', '$lookup.space.company', 'state', 'doneState']}
|
||||||
|
@ -16,6 +16,7 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type { Candidate } from '@hcengineering/recruit'
|
import type { Candidate } from '@hcengineering/recruit'
|
||||||
import { Icon, tooltip } from '@hcengineering/ui'
|
import { Icon, tooltip } from '@hcengineering/ui'
|
||||||
|
import { DocNavLink } from '@hcengineering/view-resources'
|
||||||
import recruit from '../plugin'
|
import recruit from '../plugin'
|
||||||
import ApplicationsPopup from './ApplicationsPopup.svelte'
|
import ApplicationsPopup from './ApplicationsPopup.svelte'
|
||||||
|
|
||||||
@ -24,14 +25,15 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if value && value > 0}
|
{#if value && value > 0}
|
||||||
<div
|
<DocNavLink {object} inline noUnderline={true}>
|
||||||
use:tooltip={{
|
<div
|
||||||
label: recruit.string.Applications,
|
use:tooltip={{
|
||||||
component: ApplicationsPopup,
|
component: ApplicationsPopup,
|
||||||
props: { value: object }
|
props: { value: object }
|
||||||
}}
|
}}
|
||||||
class="sm-tool-icon"
|
class="sm-tool-icon"
|
||||||
>
|
>
|
||||||
<span class="icon"><Icon icon={recruit.icon.Application} size={'small'} /></span> {value}
|
<span class="icon"><Icon icon={recruit.icon.Application} size={'small'} /></span> {value}
|
||||||
</div>
|
</div>
|
||||||
|
</DocNavLink>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -114,7 +114,7 @@
|
|||||||
<Label label={chunter.string.Comments} />:
|
<Label label={chunter.string.Comments} />:
|
||||||
</div>
|
</div>
|
||||||
<div class="ml-2">
|
<div class="ml-2">
|
||||||
<CommentPopup objectId={issue._id} />
|
<CommentPopup objectId={issue._id} object={issue} />
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -249,7 +249,11 @@ async function createUpdateIndexes (connection: CoreClient, db: Db): Promise<voi
|
|||||||
const collection = db.collection(d)
|
const collection = db.collection(d)
|
||||||
const bb: (string | FieldIndex<Doc>)[] = []
|
const bb: (string | FieldIndex<Doc>)[] = []
|
||||||
for (const vv of v.values()) {
|
for (const vv of v.values()) {
|
||||||
await collection.createIndex(vv)
|
try {
|
||||||
|
await collection.createIndex(vv)
|
||||||
|
} catch (err: any) {
|
||||||
|
console.error(err)
|
||||||
|
}
|
||||||
bb.push(vv)
|
bb.push(vv)
|
||||||
}
|
}
|
||||||
if (bb.length > 0) {
|
if (bb.length > 0) {
|
||||||
|
Loading…
Reference in New Issue
Block a user