mirror of
https://github.com/hcengineering/platform.git
synced 2024-12-22 11:01:54 +03:00
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:
parent
f8c0c905ae
commit
3c0fdc9698
@ -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",
|
||||
|
@ -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,
|
||||
|
@ -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>
|
||||
|
@ -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,
|
||||
|
@ -65,7 +65,6 @@
|
||||
activityQuery.update(
|
||||
object,
|
||||
(result) => {
|
||||
console.log('query txes update')
|
||||
txes = filterCollectionTxes(result)
|
||||
|
||||
if (txes.length > 0) {
|
||||
|
@ -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 {
|
||||
|
@ -88,6 +88,7 @@ export interface DisplayTx {
|
||||
updated: boolean
|
||||
mixin: boolean
|
||||
removed: boolean
|
||||
isOwnTx: boolean
|
||||
|
||||
collectionAttribute?: Attribute<Collection<AttachedDoc>>
|
||||
}
|
||||
|
@ -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>
|
||||
|
@ -104,7 +104,7 @@
|
||||
</div>
|
||||
</div>
|
||||
{#if tx}
|
||||
<TxView {tx} {viewlets} />
|
||||
<TxView {tx} {viewlets} objectId={value.attachedTo} />
|
||||
{/if}
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -289,7 +289,9 @@
|
||||
"EightHoursLength": "Eight Hours",
|
||||
"CreatedOn": "Created on",
|
||||
"HourLabel": "h",
|
||||
"Saved": "Saved..."
|
||||
"Saved": "Saved...",
|
||||
"CreatedIssue": "Created issue",
|
||||
"CreatedSubIssue": "Created sub-issue"
|
||||
},
|
||||
"status": {}
|
||||
}
|
||||
|
@ -289,7 +289,9 @@
|
||||
"EightHoursLength": "Восемь Часов",
|
||||
"CreatedOn": "Создана",
|
||||
"HourLabel": "ч",
|
||||
"Saved": "Сохранено..."
|
||||
"Saved": "Сохранено...",
|
||||
"CreatedIssue": "Создал(а) задачу",
|
||||
"CreatedSubIssue": "Создал(а) подзадачу"
|
||||
},
|
||||
"status": {}
|
||||
}
|
||||
|
@ -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}
|
@ -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,
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user