mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
UBER-226 UBER-227 fix activity collapse (#3248)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
parent
edfc99ccd8
commit
867bc5ae91
@ -31,7 +31,7 @@ export class TTxViewlet extends TDoc implements TxViewlet {
|
||||
// Component to display on.
|
||||
component!: AnyComponent
|
||||
// Filter
|
||||
match!: DocumentQuery<Tx>
|
||||
match?: DocumentQuery<Tx>
|
||||
label!: IntlString
|
||||
display!: 'inline' | 'content' | 'emphasized'
|
||||
editable!: boolean
|
||||
|
@ -51,6 +51,7 @@ export type DisplayTxListener = (txes: DisplayTx[]) => void
|
||||
|
||||
// Use 5 minutes to combine similar transactions.
|
||||
const combineThreshold = 5 * 60 * 1000
|
||||
const createCombineThreshold = 10 * 1000
|
||||
|
||||
/**
|
||||
* Define activity.
|
||||
@ -64,7 +65,7 @@ export interface Activity {
|
||||
listener: DisplayTxListener,
|
||||
sort: SortingOrder,
|
||||
editable: Map<Ref<Class<Doc>>, boolean>
|
||||
) => void
|
||||
) => boolean
|
||||
}
|
||||
|
||||
class ActivityImpl implements Activity {
|
||||
@ -110,16 +111,17 @@ class ActivityImpl implements Activity {
|
||||
listener: DisplayTxListener,
|
||||
sort: SortingOrder,
|
||||
editable: Map<Ref<Class<Doc>>, boolean>
|
||||
): void {
|
||||
if (objectId === this.prevObjectId && objectClass === this.prevObjectClass) return
|
||||
): boolean {
|
||||
this.editable = editable
|
||||
if (objectId === this.prevObjectId && objectClass === this.prevObjectClass) {
|
||||
return false
|
||||
}
|
||||
this.prevObjectClass = objectClass
|
||||
this.prevObjectId = objectId
|
||||
let isAttached = false
|
||||
|
||||
isAttached = this.hierarchy.isDerived(objectClass, core.class.AttachedDoc)
|
||||
|
||||
this.editable = editable
|
||||
|
||||
this.ownTxQuery.query<TxCUD<Doc>>(
|
||||
isAttached ? core.class.TxCollectionCUD : core.class.TxCUD,
|
||||
isAttached
|
||||
@ -164,6 +166,7 @@ class ActivityImpl implements Activity {
|
||||
)
|
||||
// In case editable is changed
|
||||
this.notify(objectId, listener, sort)
|
||||
return true
|
||||
}
|
||||
|
||||
async combineTransactions (
|
||||
@ -404,7 +407,7 @@ class ActivityImpl implements Activity {
|
||||
(result.tx.objectId === prevTx.createTx.objectId ||
|
||||
(result.doc as AttachedDoc)?.attachedTo === prevTx.createTx.objectId)
|
||||
) {
|
||||
return result.tx.modifiedOn - prevTx.createTx.modifiedOn < combineThreshold
|
||||
return result.tx.modifiedOn - prevTx.createTx.modifiedOn < createCombineThreshold
|
||||
}
|
||||
}
|
||||
return false
|
||||
|
@ -71,7 +71,7 @@
|
||||
editableMap: Map<Ref<Class<Doc>>, boolean> | undefined
|
||||
): void {
|
||||
loading = true
|
||||
activityQuery.update(
|
||||
const res = activityQuery.update(
|
||||
objectId,
|
||||
objectClass,
|
||||
(result) => {
|
||||
@ -84,6 +84,9 @@
|
||||
SortingOrder.Ascending,
|
||||
editableMap ?? new Map()
|
||||
)
|
||||
if (!res) {
|
||||
loading = false
|
||||
}
|
||||
}
|
||||
|
||||
$: updateTxes(object._id, object._class, editableMap)
|
||||
|
Loading…
Reference in New Issue
Block a user