mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-22 11:42:30 +03: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.objectClass',
|
||||
'tx.operations.attachedTo',
|
||||
'space',
|
||||
'objectSpace',
|
||||
{
|
||||
_class: 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(
|
||||
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[] = []
|
||||
|
@ -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'}
|
||||
|
@ -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={[
|
||||
|
@ -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}
|
||||
|
@ -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>
|
||||
|
@ -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>
|
||||
|
@ -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}
|
||||
|
@ -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']}
|
||||
|
@ -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}
|
||||
|
@ -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}
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user