mirror of
https://github.com/hcengineering/platform.git
synced 2025-01-08 21:27:45 +03:00
Show activity line last view (#2105)
Signed-off-by: Denis Bykhov <80476319+BykhovDenis@users.noreply.github.com>
This commit is contained in:
parent
71b2cd438f
commit
da07828036
@ -2,6 +2,10 @@
|
|||||||
|
|
||||||
## 0.6.28 (upcoming)
|
## 0.6.28 (upcoming)
|
||||||
|
|
||||||
|
Core:
|
||||||
|
|
||||||
|
- Show activity line last view
|
||||||
|
|
||||||
Tracker:
|
Tracker:
|
||||||
|
|
||||||
- Issue state history.
|
- Issue state history.
|
||||||
|
5
common/config/rush/pnpm-lock.yaml
generated
5
common/config/rush/pnpm-lock.yaml
generated
@ -9997,7 +9997,7 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:projects/activity-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c:
|
file:projects/activity-resources.tgz_1e3963ebf0ceeb25b2fa6a1cc87e253c:
|
||||||
resolution: {integrity: sha512-3qOFOo1wgN0U2L66jIpfdizhweVg+Bt+CblBFjdpQD8anPqMX5Bpm4LbCqQfACtY+XSl92anmiCEYfvQbTL0rw==, tarball: file:projects/activity-resources.tgz}
|
resolution: {integrity: sha512-GdQlfWQ1T4zhtHShJ/qNtQS6pLovUO9tX3Vn67eqX5qNYDFp0Taf47+DTbYBSd6ZrmtMWhusl8T4LsRQgj5tuw==, tarball: file:projects/activity-resources.tgz}
|
||||||
id: file:projects/activity-resources.tgz
|
id: file:projects/activity-resources.tgz
|
||||||
name: '@rush-temp/activity-resources'
|
name: '@rush-temp/activity-resources'
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
@ -12371,7 +12371,7 @@ packages:
|
|||||||
dev: false
|
dev: false
|
||||||
|
|
||||||
file:projects/notification.tgz:
|
file:projects/notification.tgz:
|
||||||
resolution: {integrity: sha512-T0MHErZvhtTwdclos98GglKOGizrwTcrfU6u0s0Oio37PzD3jzOSvaJkgzePqt0sFee5XY8qXlLm7xLvVW9zPw==, tarball: file:projects/notification.tgz}
|
resolution: {integrity: sha512-6BJ+zX3Wj70Wk6KKBPvfV6oBMh5/9fijekSDAzhnLKRhJPwuIBD5tCRJcqz4FJn8ZwqhjBMzB1op0rxJa2wYvg==, tarball: file:projects/notification.tgz}
|
||||||
name: '@rush-temp/notification'
|
name: '@rush-temp/notification'
|
||||||
version: 0.0.0
|
version: 0.0.0
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -12385,6 +12385,7 @@ packages:
|
|||||||
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
eslint-plugin-node: 11.1.0_eslint@7.32.0
|
||||||
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
eslint-plugin-promise: 5.2.0_eslint@7.32.0
|
||||||
prettier: 2.6.2
|
prettier: 2.6.2
|
||||||
|
svelte: 3.48.0
|
||||||
typescript: 4.7.2
|
typescript: 4.7.2
|
||||||
transitivePeerDependencies:
|
transitivePeerDependencies:
|
||||||
- eslint-import-resolver-typescript
|
- eslint-import-resolver-typescript
|
||||||
|
@ -39,6 +39,7 @@
|
|||||||
"@anticrm/chunter": "~0.6.1",
|
"@anticrm/chunter": "~0.6.1",
|
||||||
"@anticrm/text-editor": "~0.6.0",
|
"@anticrm/text-editor": "~0.6.0",
|
||||||
"@anticrm/contact": "~0.6.5",
|
"@anticrm/contact": "~0.6.5",
|
||||||
|
"@anticrm/notification": "~0.6.0",
|
||||||
"@anticrm/view": "~0.6.0",
|
"@anticrm/view": "~0.6.0",
|
||||||
"@anticrm/view-resources": "~0.6.0"
|
"@anticrm/view-resources": "~0.6.0"
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
<!--
|
<!--
|
||||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
// Copyright © 2022 Hardcore Engineering Inc.
|
||||||
// Copyright © 2021 Hardcore Engineering Inc.
|
|
||||||
//
|
//
|
||||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License. You may
|
// you may not use this file except in compliance with the License. You may
|
||||||
@ -16,12 +15,15 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import activity, { TxViewlet } from '@anticrm/activity'
|
import activity, { TxViewlet } from '@anticrm/activity'
|
||||||
import chunter from '@anticrm/chunter'
|
import chunter from '@anticrm/chunter'
|
||||||
import core, { Doc, SortingOrder } from '@anticrm/core'
|
import core, { Doc, Ref, SortingOrder } from '@anticrm/core'
|
||||||
|
import { getResource } from '@anticrm/platform'
|
||||||
import { createQuery, getClient } from '@anticrm/presentation'
|
import { createQuery, getClient } from '@anticrm/presentation'
|
||||||
|
import notification from '@anticrm/notification'
|
||||||
import { Component, Grid, IconActivity, Label, Scroller } from '@anticrm/ui'
|
import { Component, Grid, IconActivity, Label, Scroller } from '@anticrm/ui'
|
||||||
import { ActivityKey, activityKey, DisplayTx, newActivity } from '../activity'
|
import { ActivityKey, activityKey, DisplayTx, newActivity } from '../activity'
|
||||||
import TxView from './TxView.svelte'
|
import TxView from './TxView.svelte'
|
||||||
import { filterCollectionTxes } from './utils'
|
import { filterCollectionTxes } from './utils'
|
||||||
|
import { Writable } from 'svelte/store'
|
||||||
|
|
||||||
export let object: Doc
|
export let object: Doc
|
||||||
export let integrate: boolean = false
|
export let integrate: boolean = false
|
||||||
@ -34,6 +36,10 @@
|
|||||||
const attrs = client.getHierarchy().getAllAttributes(object._class)
|
const attrs = client.getHierarchy().getAllAttributes(object._class)
|
||||||
|
|
||||||
const activityQuery = newActivity(client, attrs)
|
const activityQuery = newActivity(client, attrs)
|
||||||
|
getResource(notification.function.GetNotificationClient).then((res) => {
|
||||||
|
lastViews = res().getLastViews()
|
||||||
|
})
|
||||||
|
let lastViews: Writable<Map<Ref<Doc>, number>> | undefined
|
||||||
|
|
||||||
let viewlets: Map<ActivityKey, TxViewlet>
|
let viewlets: Map<ActivityKey, TxViewlet>
|
||||||
|
|
||||||
@ -46,7 +52,8 @@
|
|||||||
|
|
||||||
$: viewlets = new Map(allViewlets.map((r) => [activityKey(r.objectClass, r.txClass), r]))
|
$: viewlets = new Map(allViewlets.map((r) => [activityKey(r.objectClass, r.txClass), r]))
|
||||||
|
|
||||||
$: activityQuery.update(
|
function updateTxes (object: Doc): void {
|
||||||
|
activityQuery.update(
|
||||||
object,
|
object,
|
||||||
(result) => {
|
(result) => {
|
||||||
txes = filterCollectionTxes(result)
|
txes = filterCollectionTxes(result)
|
||||||
@ -58,6 +65,21 @@
|
|||||||
.map((it) => [it.objectClass, it.editable ?? false])
|
.map((it) => [it.objectClass, it.editable ?? false])
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
$: updateTxes(object)
|
||||||
|
|
||||||
|
$: newTxPos = newTx(txes, $lastViews)
|
||||||
|
|
||||||
|
function newTx (txes: DisplayTx[], lastViews: Map<Ref<Doc>, number> | undefined): number {
|
||||||
|
const lastView = lastViews?.get(object._id)
|
||||||
|
if (lastView === undefined || lastView === -1) return -1
|
||||||
|
for (let index = 0; index < txes.length; index++) {
|
||||||
|
const tx = txes[index]
|
||||||
|
if (tx.tx.modifiedOn <= lastView) return index - 1
|
||||||
|
}
|
||||||
|
return -1
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !integrate || transparent}
|
{#if !integrate || transparent}
|
||||||
@ -74,8 +96,8 @@
|
|||||||
<div class="p-10 select-text" id={activity.string.Activity}>
|
<div class="p-10 select-text" id={activity.string.Activity}>
|
||||||
{#if txes}
|
{#if txes}
|
||||||
<Grid column={1} rowGap={1.5}>
|
<Grid column={1} rowGap={1.5}>
|
||||||
{#each txes as tx}
|
{#each txes as tx, i}
|
||||||
<TxView {tx} {viewlets} />
|
<TxView {tx} {viewlets} isNew={newTxPos === i} />
|
||||||
{/each}
|
{/each}
|
||||||
</Grid>
|
</Grid>
|
||||||
{/if}
|
{/if}
|
||||||
@ -104,8 +126,8 @@
|
|||||||
<div class="p-activity select-text" id={activity.string.Activity}>
|
<div class="p-activity select-text" id={activity.string.Activity}>
|
||||||
{#if txes}
|
{#if txes}
|
||||||
<Grid column={1} rowGap={1.5}>
|
<Grid column={1} rowGap={1.5}>
|
||||||
{#each txes as tx}
|
{#each txes as tx, i}
|
||||||
<TxView {tx} {viewlets} />
|
<TxView {tx} {viewlets} isNew={newTxPos === i} />
|
||||||
{/each}
|
{/each}
|
||||||
</Grid>
|
</Grid>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -41,6 +41,7 @@
|
|||||||
export let tx: DisplayTx
|
export let tx: DisplayTx
|
||||||
export let viewlets: Map<ActivityKey, TxViewlet>
|
export let viewlets: Map<ActivityKey, TxViewlet>
|
||||||
export let showIcon: boolean = true
|
export let showIcon: boolean = true
|
||||||
|
export let isNew: boolean = false
|
||||||
|
|
||||||
let ptx: DisplayTx | undefined
|
let ptx: DisplayTx | undefined
|
||||||
|
|
||||||
@ -152,7 +153,7 @@
|
|||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
||||||
<div class="flex-grow flex-col clear-mins">
|
<div class="flex-grow flex-col clear-mins" class:isNew>
|
||||||
<div class="flex-between">
|
<div class="flex-between">
|
||||||
<div class="flex-row-center flex-grow label">
|
<div class="flex-row-center flex-grow label">
|
||||||
<div class="bold">
|
<div class="bold">
|
||||||
@ -317,6 +318,11 @@
|
|||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.isNew {
|
||||||
|
padding-bottom: 0.25rem;
|
||||||
|
border-bottom: 1px solid var(--highlight-red);
|
||||||
|
}
|
||||||
|
|
||||||
.showIcon {
|
.showIcon {
|
||||||
&::after,
|
&::after,
|
||||||
&::before {
|
&::before {
|
||||||
|
@ -28,6 +28,7 @@
|
|||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@anticrm/platform": "~0.6.6",
|
"@anticrm/platform": "~0.6.6",
|
||||||
"@anticrm/core": "~0.6.16",
|
"@anticrm/core": "~0.6.16",
|
||||||
"@anticrm/ui": "~0.6.0"
|
"@anticrm/ui": "~0.6.0",
|
||||||
|
"svelte": "^3.47"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
//
|
//
|
||||||
// Copyright © 2020, 2021 Anticrm Platform Contributors.
|
// Copyright © 2022 Hardcore Engineering Inc.
|
||||||
// Copyright © 2021, 2022 Hardcore Engineering Inc.
|
|
||||||
//
|
//
|
||||||
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
|
||||||
// you may not use this file except in compliance with the License. You may
|
// you may not use this file except in compliance with the License. You may
|
||||||
@ -18,6 +17,7 @@ import type { Account, AttachedDoc, Class, Doc, Mixin, Ref, Space, Timestamp, Tx
|
|||||||
import type { Asset, IntlString, Plugin, Resource } from '@anticrm/platform'
|
import type { Asset, IntlString, Plugin, Resource } from '@anticrm/platform'
|
||||||
import { plugin } from '@anticrm/platform'
|
import { plugin } from '@anticrm/platform'
|
||||||
import { AnyComponent } from '@anticrm/ui'
|
import { AnyComponent } from '@anticrm/ui'
|
||||||
|
import { Writable } from 'svelte/store'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @public
|
* @public
|
||||||
@ -107,6 +107,7 @@ export const notificationId = 'notification' as Plugin
|
|||||||
* @public
|
* @public
|
||||||
*/
|
*/
|
||||||
export interface NotificationClient {
|
export interface NotificationClient {
|
||||||
|
getLastViews: () => Writable<Map<Ref<Doc>, Timestamp>>
|
||||||
updateLastView: (_id: Ref<Doc>, _class: Ref<Class<Doc>>, time?: Timestamp, force?: boolean) => Promise<void>
|
updateLastView: (_id: Ref<Doc>, _class: Ref<Class<Doc>>, time?: Timestamp, force?: boolean) => Promise<void>
|
||||||
unsubscribe: (_id: Ref<Doc>) => Promise<void>
|
unsubscribe: (_id: Ref<Doc>) => Promise<void>
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user