TSK-978 Изменить отображение создания Issue в событиях activity feed TSK-1108 При создании sub-issue писать текст про sub-issue (подзадача) (#2954)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov 2023-04-12 10:36:24 +06:00 committed by GitHub
parent f8c0c905ae
commit 3c0fdc9698
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 79 additions and 15 deletions

View File

@ -25,6 +25,7 @@
"@rushstack/heft": "^0.47.9"
},
"dependencies": {
"@hcengineering/activity": "^0.6.0",
"@hcengineering/core": "^0.6.22",
"@hcengineering/model": "^0.6.1",
"@hcengineering/ui": "^0.6.5",

View File

@ -46,6 +46,7 @@ import {
UX
} from '@hcengineering/model'
import attachment from '@hcengineering/model-attachment'
import activity from '@hcengineering/activity'
import chunter from '@hcengineering/model-chunter'
import core, { DOMAIN_SPACE, TAttachedDoc, TDoc, TSpace, TStatus, TType } from '@hcengineering/model-core'
import view, { actionTemplates, classPresenter, createAction } from '@hcengineering/model-view'
@ -953,6 +954,19 @@ export function createModel (builder: Builder): void {
component: tracker.component.EditIssueTemplate
})
builder.createDoc(
activity.class.TxViewlet,
core.space.Model,
{
objectClass: tracker.class.Issue,
icon: tracker.icon.Issue,
txClass: core.class.TxCreateDoc,
labelComponent: tracker.activity.TxIssueCreated,
display: 'inline'
},
tracker.ids.TxIssueCreated
)
builder.createDoc(
workbench.class.Application,
core.space.Model,

View File

@ -22,6 +22,7 @@ import tracker from '@hcengineering/tracker-resources/src/plugin'
import type { AnyComponent } from '@hcengineering/ui/src/types'
import { Action, ViewAction, Viewlet } from '@hcengineering/view'
import { Application } from '@hcengineering/workbench'
import { TxViewlet } from '@hcengineering/activity'
export default mergeIds(trackerId, tracker, {
string: {
@ -37,9 +38,10 @@ export default mergeIds(trackerId, tracker, {
Parent: '' as IntlString,
CreatedOn: '' as IntlString
},
activity: {
TxIssueCreated: '' as AnyComponent
},
component: {
// Required to pass build without errorsF
Nope: '' as AnyComponent,
SprintSelector: '' as AnyComponent,
IssueStatistics: '' as AnyComponent,
TimeSpendReportPopup: '' as AnyComponent,
@ -54,6 +56,9 @@ export default mergeIds(trackerId, tracker, {
IssueKanban: '' as Ref<Viewlet>,
SprintList: '' as Ref<Viewlet>
},
ids: {
TxIssueCreated: '' as Ref<TxViewlet>
},
completion: {
IssueQuery: '' as Resource<ObjectSearchFactory>,
IssueCategory: '' as Ref<ObjectSearchCategory>

View File

@ -167,7 +167,7 @@ class ActivityImpl implements Activity {
for (const tx of ownTxes) {
if (!this.filterUpdateTx(tx)) continue
const [result] = this.createDisplayTx(tx, parents)
const [result] = this.createDisplayTx(tx, parents, true)
// Combine previous update transaction for same field and if same operation and time treshold is ok
results = this.integrateTxWithResults(results, result, editable)
this.updateRemovedState(result, results)
@ -182,7 +182,7 @@ class ActivityImpl implements Activity {
if (changeAttached) {
tx = await this.createFakeTx(doc, tx)
}
const [result, isUpdated, isMixin] = this.createDisplayTx(tx, parents)
const [result, isUpdated, isMixin] = this.createDisplayTx(tx, parents, false)
if (!(isUpdated || isMixin)) {
// Combine previous update transaction for same field and if same operation and time treshold is ok
results = this.integrateTxWithResults(results, result, editable)
@ -276,7 +276,7 @@ class ActivityImpl implements Activity {
return !this.hiddenAttributes.has(ops[0])
}
createDisplayTx (tx: TxCUD<Doc>, parents: Map<Ref<Doc>, DisplayTx>): [DisplayTx, boolean, boolean] {
createDisplayTx (tx: TxCUD<Doc>, parents: Map<Ref<Doc>, DisplayTx>, isOwnTx: boolean): [DisplayTx, boolean, boolean] {
let collectionAttribute: Attribute<Collection<AttachedDoc>> | undefined
if (this.hierarchy.isDerived(tx._class, core.class.TxCollectionCUD)) {
const cltx = tx as TxCollectionCUD<Doc, AttachedDoc>
@ -295,7 +295,7 @@ class ActivityImpl implements Activity {
}
}
let firstTx = parents.get(tx.objectId)
const result: DisplayTx = newDisplayTx(tx, this.hierarchy)
const result: DisplayTx = newDisplayTx(tx, this.hierarchy, isOwnTx)
result.collectionAttribute = collectionAttribute
@ -418,10 +418,11 @@ function getCombineOpFromTx (result: DisplayTx): any {
return curUpdate
}
export function newDisplayTx (tx: TxCUD<Doc>, hierarchy: Hierarchy): DisplayTx {
export function newDisplayTx (tx: TxCUD<Doc>, hierarchy: Hierarchy, isOwnTx: boolean): DisplayTx {
const createTx = hierarchy.isDerived(tx._class, core.class.TxCreateDoc) ? (tx as TxCreateDoc<Doc>) : undefined
return {
tx,
isOwnTx,
txes: [],
createTx,
updateTx: hierarchy.isDerived(tx._class, core.class.TxUpdateDoc) ? (tx as TxUpdateDoc<Doc>) : undefined,

View File

@ -65,7 +65,6 @@
activityQuery.update(
object,
(result) => {
console.log('query txes update')
txes = filterCollectionTxes(result)
if (txes.length > 0) {

View File

@ -73,7 +73,7 @@ async function createPseudoViewlet (
}
export function getDTxProps (dtx: DisplayTx): any {
return { tx: dtx.tx, value: dtx.doc }
return { tx: dtx.tx, value: dtx.doc, isOwnTx: dtx.isOwnTx }
}
function getViewlet (viewlets: Map<ActivityKey, TxViewlet>, dtx: DisplayTx): TxDisplayViewlet | undefined {

View File

@ -88,6 +88,7 @@ export interface DisplayTx {
updated: boolean
mixin: boolean
removed: boolean
isOwnTx: boolean
collectionAttribute?: Attribute<Collection<AttachedDoc>>
}

View File

@ -66,6 +66,6 @@
$: update(filtered, newTxes)
function createDisplayTxes (txes: TxCollectionCUD<Doc, AttachedDoc>[]): DisplayTx[] {
return txes.map((p) => newDisplayTx(TxProcessor.extractTx(p) as TxCUD<Doc>, hierarchy))
return txes.map((p) => newDisplayTx(TxProcessor.extractTx(p) as TxCUD<Doc>, hierarchy, false))
}
</script>

View File

@ -104,7 +104,7 @@
</div>
</div>
{#if tx}
<TxView {tx} {viewlets} />
<TxView {tx} {viewlets} objectId={value.attachedTo} />
{/if}
</div>
{/if}

View File

@ -30,6 +30,7 @@
import { ObjectPresenter } from '@hcengineering/view-resources'
export let tx: TxCUD<Doc>
export let objectId: Ref<Doc>
export let viewlets: Map<ActivityKey, TxViewlet>
export let contentHidden: boolean = false
const client = getClient()
@ -42,7 +43,7 @@
let model: AttributeModel[] = []
$: if (tx._id !== ptx?.tx._id) {
ptx = newDisplayTx(tx, client.getHierarchy())
ptx = newDisplayTx(tx, client.getHierarchy(), objectId === tx.objectId)
if (tx.modifiedBy !== employee?._id) {
employee = undefined
}

View File

@ -289,7 +289,9 @@
"EightHoursLength": "Eight Hours",
"CreatedOn": "Created on",
"HourLabel": "h",
"Saved": "Saved..."
"Saved": "Saved...",
"CreatedIssue": "Created issue",
"CreatedSubIssue": "Created sub-issue"
},
"status": {}
}

View File

@ -289,7 +289,9 @@
"EightHoursLength": "Восемь Часов",
"CreatedOn": "Создана",
"HourLabel": "ч",
"Saved": "Сохранено..."
"Saved": "Сохранено...",
"CreatedIssue": "Создал(а) задачу",
"CreatedSubIssue": "Создал(а) подзадачу"
},
"status": {}
}

View File

@ -0,0 +1,32 @@
<!--
// Copyright © 2023 Hardcore Engineering Inc.
//
// 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
// obtain a copy of the License at https://www.eclipse.org/legal/epl-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
//
// See the License for the specific language governing permissions and
// limitations under the License.
-->
<script lang="ts">
import { Issue } from '@hcengineering/tracker'
import { Label } from '@hcengineering/ui'
import tracker from '../../plugin'
import IssuePresenter from '../issues/IssuePresenter.svelte'
export let value: Issue
export let isOwnTx: boolean
$: isSub = value.attachedTo !== tracker.ids.NoParent && !isOwnTx
</script>
<div class="lower">
<Label label={isSub ? tracker.string.CreatedSubIssue : tracker.string.CreatedIssue} />
</div>
{#if !isOwnTx}
<IssuePresenter {value} inline />
{/if}

View File

@ -133,6 +133,7 @@ import ProjectPresenter from './components/projects/ProjectPresenter.svelte'
import MoveIssues from './components/issues/Move.svelte'
import IssueStatistics from './components/sprints/IssueStatistics.svelte'
import SprintRefPresenter from './components/sprints/SprintRefPresenter.svelte'
import TxIssueCreated from './components/activity/TxIssueCreated.svelte'
export { default as SubIssueList } from './components/issues/edit/SubIssueList.svelte'
@ -350,6 +351,9 @@ export async function handleRecordingScrum (
}
export default async (): Promise<Resources> => ({
activity: {
TxIssueCreated
},
component: {
NopeComponent,
Issues,

View File

@ -310,7 +310,9 @@ export default mergeIds(trackerId, tracker, {
SevenHoursLength: '' as IntlString,
EightHoursLength: '' as IntlString,
HourLabel: '' as IntlString,
Saved: '' as IntlString
Saved: '' as IntlString,
CreatedIssue: '' as IntlString,
CreatedSubIssue: '' as IntlString
},
component: {
NopeComponent: '' as AnyComponent,