Fix activity merge collapse (#1600)

Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
Andrey Sobolev 2022-04-29 23:47:22 +07:00 committed by GitHub
parent dc9c3a1ae1
commit be49938461
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
16 changed files with 114 additions and 58 deletions

View File

@ -53,7 +53,7 @@ jobs:
run: node common/scripts/install-run-rush.js bump-model-version
- name: Building...
run: node common/scripts/install-run-rush.js rebuild -l --verbose
run: node common/scripts/install-run-rush.js rebuild -p 16 -l --verbose
- name: Cache build results
uses: actions/cache@v3
@ -112,6 +112,40 @@ jobs:
- name: Checking svelte sources...
run: node common/scripts/install-run-rush.js svelte-check
linting:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Cache build results
uses: actions/cache@v3
env:
cache-name: cache-build-results
with:
path: |
cloud
common
deploy
dev
models
packages
plugins
pods
products
server
server-plugins
templates
tests
rush.json
.prettierrc
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Linting...
run: node common/scripts/install-run-rush.js lint -p 16
formatting:
needs: build
runs-on: ubuntu-latest
@ -145,8 +179,15 @@ jobs:
restore-keys: ${{ runner.os }}-build-${{ env.cache-name }}-${{ github.sha }}
- name: Formatting...
run: node common/scripts/install-run-rush.js format
run: node common/scripts/install-run-rush.js format -p 16
- name: Check files formatting
run: |
echo '================================================================'
echo 'Checking for diff files'
echo '================================================================'
git diff '*.ts' '*.svelte' | cat
[ -z "$(git diff --name-only '*.ts' '*.svelte' | cat)" ]
echo '================================================================'
test:
needs: build
runs-on: ubuntu-latest
@ -251,7 +292,7 @@ jobs:
path: ./tests/sanity/playwright-report/
docker-build:
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') }}
needs: [ build, uitest, test, formatting, svelte-check ]
needs: [ build, uitest, test, linting, svelte-check ]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
@ -287,7 +328,7 @@ jobs:
- name: Setting model version from git release...
run: node common/scripts/install-run-rush.js bump-model-version
- name: Build, to include new model version
run: node common/scripts/install-run-rush.js build
run: node common/scripts/install-run-rush.js build -p 16
- name: Bundle
run: node common/scripts/install-run-rush.js bundle
- name: Docker build

View File

@ -408,7 +408,7 @@ export function createModel (builder: Builder): void {
editable: false,
hideOnRemove: true
},
chunter.ids.TxCommentCreate
chunter.ids.TxBacklinkCreate
)
// We need to define this one, to hide default attached object removed case

View File

@ -65,6 +65,7 @@ export default mergeIds(chunterId, chunter, {
},
ids: {
TxCommentCreate: '' as Ref<TxViewlet>,
TxBacklinkCreate: '' as Ref<TxViewlet>,
TxCommentRemove: '' as Ref<TxViewlet>,
TxBacklinkRemove: '' as Ref<TxViewlet>
},

View File

@ -92,9 +92,9 @@
{/if}
{#if $$slots['custom-attributes']}
{#if isSub}<div class="header-row"><slot name="custom-attributes" direction="row" /></div>{/if}
{:else}
{#if $$slots.attributes && minimize}<div class="header-row"><slot name="attributes" direction="row" /></div>{/if}
{/if}
{:else if $$slots.attributes && minimize}<div class="header-row">
<slot name="attributes" direction="row" />
</div>{/if}
</svelte:fragment>
<svelte:fragment slot="aside">
@ -109,9 +109,7 @@
{/if}
{#if $$slots['custom-attributes']}
<slot name="custom-attributes" direction="column" />
{:else}
{#if $$slots.attributes}<slot name="attributes" direction="column" />{/if}
{/if}
{:else if $$slots.attributes}<slot name="attributes" direction="column" />{/if}
{#if $$slots.aside}<slot name="aside" />{/if}
</div>
</svelte:fragment>

View File

@ -45,12 +45,7 @@
{#if $$slots.space}
<slot name="space" />
{:else}
<SpaceSelect
_class={spaceClass}
{spaceQuery}
label={spaceLabel}
bind:value={space}
/>
<SpaceSelect _class={spaceClass} {spaceQuery} label={spaceLabel} bind:value={space} />
{/if}
<span class="antiCard-header__divider"></span>
{/if}

View File

@ -86,7 +86,7 @@
<div class="flex-row-center" on:click={() => dispatch('addMembers')}>
<div class="flex-center ml-1 mr-1"><IconAdd size={'large'} /></div>
<div class="flex-col ml-2 min-w-0 content-accent-color">
<Label label={presentation.string.Add} />
<Label label={presentation.string.Add} />
</div>
</div>
</div>

View File

@ -117,7 +117,7 @@
color: var(--caption-color);
background-color: var(--body-color);
border: 1px solid var(--button-border-color);
border-radius: .25rem;
border-radius: 0.25rem;
box-shadow: none;
}
</style>

View File

@ -218,7 +218,9 @@
}
}
&.transparent:hover,
&.transparent.selected { background-color: var(--button-bg-hover); }
&.transparent.selected {
background-color: var(--button-bg-hover);
}
&.link {
padding: 0 0.875rem;
&:hover {

View File

@ -37,7 +37,14 @@
<svelte:window bind:innerWidth={docWidth} />
<div class="popupPanel" bind:clientWidth={panelWidth}>
<div class="popupPanel-title">
<Button icon={IconClose} kind={'transparent'} size={'medium'} on:click={() => { dispatch('close') }} />
<Button
icon={IconClose}
kind={'transparent'}
size={'medium'}
on:click={() => {
dispatch('close')
}}
/>
<div class="popupPanel-title__content"><slot name="title" /></div>
<div class="buttons-group xsmall-gap">
<slot name="utils" />

View File

@ -13,13 +13,16 @@
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
export let size: 'x-small' | 'small' | 'medium' | 'large'
const fill: string = 'currentColor'
</script>
<svg class="svg-{size}" {fill} viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg">
<path fill-rule="evenodd" clip-rule="evenodd" d="M 4.25 2 C 2.45508 2 1 3.45508 1 5.25 V 10.7499 C 1 12.5449 2.45508 13.9999 4.25 13.9999 H 11.75 C 13.5449 13.9999 15 12.5449 15 10.7499 V 5.25 C 15 3.45508 13.5449 2 11.75 2 H 4.25 Z M 2.5 10.4999 C 2.5 11.6045 3.39543 12.4999 4.5 12.4999 H 11.75 C 12.7165 12.4999 13.5 11.7164 13.5 10.7499 V 5.25 C 13.5 4.28351 12.7165 3.5 11.75 3.5 H 4.5 C 3.39543 3.5 2.5 4.39543 2.5 5.5 V 10.4999 Z" />
<path
fill-rule="evenodd"
clip-rule="evenodd"
d="M 4.25 2 C 2.45508 2 1 3.45508 1 5.25 V 10.7499 C 1 12.5449 2.45508 13.9999 4.25 13.9999 H 11.75 C 13.5449 13.9999 15 12.5449 15 10.7499 V 5.25 C 15 3.45508 13.5449 2 11.75 2 H 4.25 Z M 2.5 10.4999 C 2.5 11.6045 3.39543 12.4999 4.5 12.4999 H 11.75 C 12.7165 12.4999 13.5 11.7164 13.5 10.7499 V 5.25 C 13.5 4.28351 12.7165 3.5 11.75 3.5 H 4.5 C 3.39543 3.5 2.5 4.39543 2.5 5.5 V 10.4999 Z"
/>
<rect x="9" y="3" width="1.5" height="10" />
</svg>

View File

@ -72,7 +72,16 @@ export interface PopupPositionElement {
h: HorizontalAlignment
}
}
export type PopupAlignment = PopupPositionElement | null | 'right' | 'top' | 'float' | 'account' | 'full' | 'content' | 'middle'
export type PopupAlignment =
| PopupPositionElement
| null
| 'right'
| 'top'
| 'float'
| 'account'
| 'full'
| 'content'
| 'middle'
export type TooltipAlignment = 'top' | 'bottom' | 'left' | 'right'
export type VerticalAlignment = 'top' | 'bottom'
export type HorizontalAlignment = 'left' | 'right'

View File

@ -99,6 +99,7 @@ class ActivityImpl implements Activity {
private readonly txQuery1: LiveQuery
private readonly txQuery2: LiveQuery
private readonly hiddenAttributes: Set<string>
private editable: Map<Ref<Class<Doc>>, boolean> | undefined
private txes1: Array<TxCUD<Doc>> = []
private txes2: Array<TxCUD<Doc>> = []
@ -110,21 +111,18 @@ class ActivityImpl implements Activity {
this.txQuery2 = createQuery()
}
private notify (
object: Doc,
listener: DisplayTxListener,
sort: SortingOrder,
editable: Map<Ref<Class<Doc>>, boolean>
): void {
this.combineTransactions(object, this.txes1, this.txes2, editable).then(
(result) => {
const sorted = result.sort((a, b) => (a.tx.modifiedOn - b.tx.modifiedOn) * sort)
listener(sorted)
},
(err) => {
console.error(err)
}
)
private notify (object: Doc, listener: DisplayTxListener, sort: SortingOrder): void {
if (this.editable != null) {
this.combineTransactions(object, this.txes1, this.txes2, this.editable).then(
(result) => {
const sorted = result.sort((a, b) => (a.tx.modifiedOn - b.tx.modifiedOn) * sort)
listener(sorted)
},
(err) => {
console.error(err)
}
)
}
}
update (object: Doc, listener: DisplayTxListener, sort: SortingOrder, editable: Map<Ref<Class<Doc>>, boolean>): void {
@ -132,6 +130,8 @@ class ActivityImpl implements Activity {
isAttached = this.client.getHierarchy().isDerived(object._class, core.class.AttachedDoc)
this.editable = editable
this.txQuery1.query<TxCollectionCUD<Doc, AttachedDoc>>(
isAttached ? core.class.TxCollectionCUD : core.class.TxCUD,
isAttached
@ -144,7 +144,7 @@ class ActivityImpl implements Activity {
},
(result) => {
this.txes1 = result
this.notify(object, listener, sort, editable)
this.notify(object, listener, sort)
},
{ sort: { modifiedOn: SortingOrder.Descending } }
)
@ -157,10 +157,12 @@ class ActivityImpl implements Activity {
},
(result) => {
this.txes2 = result
this.notify(object, listener, sort, editable)
this.notify(object, listener, sort)
},
{ sort: { modifiedOn: SortingOrder.Descending } }
)
// In case editable is changed
this.notify(object, listener, sort)
}
async combineTransactions (

View File

@ -16,7 +16,7 @@
<script lang="ts">
import activity, { TxViewlet } from '@anticrm/activity'
import chunter from '@anticrm/chunter'
import { Class, Doc, Ref, SortingOrder } from '@anticrm/core'
import core, { Doc, SortingOrder } from '@anticrm/core'
import { createQuery, getClient } from '@anticrm/presentation'
import { Component, Grid, IconActivity, Label, Scroller } from '@anticrm/ui'
import { ActivityKey, activityKey, DisplayTx, newActivity } from '../activity'
@ -35,22 +35,27 @@
const activityQuery = newActivity(client, attrs)
let viewlets: Map<ActivityKey, TxViewlet>
let editable: Map<Ref<Class<Doc>>, boolean> = new Map()
let allViewlets: TxViewlet[] = []
const descriptors = createQuery()
$: descriptors.query(activity.class.TxViewlet, {}, (result) => {
viewlets = new Map(result.map((r) => [activityKey(r.objectClass, r.txClass), r]))
editable = new Map(result.map((it) => [it.objectClass, it.editable ?? false]))
allViewlets = result
})
$: viewlets = new Map(allViewlets.map((r) => [activityKey(r.objectClass, r.txClass), r]))
$: activityQuery.update(
object,
(result) => {
txes = result
},
SortingOrder.Descending,
editable
new Map(
allViewlets
.filter((tx) => tx.txClass === core.class.TxCreateDoc)
.map((it) => [it.objectClass, it.editable ?? false])
)
)
</script>
@ -119,7 +124,6 @@
.ref-input {
flex-shrink: 0;
padding: 1.5rem 0;
}
.p-activity {
padding: 1.5rem 0;

View File

@ -86,7 +86,7 @@
on:close={() => dispatch('close')}
>
<svelte:fragment slot="navigator">
<UpDownNavigator element={object}/>
<UpDownNavigator element={object} />
</svelte:fragment>
<!-- TODO cover -->

View File

@ -31,13 +31,7 @@
if (ev.detail.presenter !== undefined && Array.isArray(value)) {
const channel = value[0]
if (channel !== undefined) {
showPanel(
ev.detail.presenter,
channel.attachedTo,
channel.attachedToClass,
'float',
ev.detail.presenter
)
showPanel(ev.detail.presenter, channel.attachedTo, channel.attachedToClass, 'float', ev.detail.presenter)
}
}
}

View File

@ -298,7 +298,7 @@
}
}
let navFloat: boolean = window.innerWidth < 1024 ? false : true
let navFloat: boolean = !(window.innerWidth < 1024)
const windowResize = (): void => {
if (window.innerWidth < 1024 && !navFloat) {
visibileNav = false