mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
TSK-458: Create of sub-issue not show Issue created notification (#2419)
Signed-off-by: Denis Maslennikov <denis.maslennikov@gmail.com>
This commit is contained in:
parent
107c73593f
commit
d9fac2dddb
@ -13,8 +13,11 @@
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import { generateId } from '@hcengineering/core'
|
||||
import type { Metadata } from '@hcengineering/platform'
|
||||
import { setMetadata } from '@hcengineering/platform'
|
||||
import { Notification, notificationsStore, NotificationPosition, NotificationSeverity } from '.'
|
||||
import { AnyComponent, AnySvelteComponent } from './types'
|
||||
|
||||
export function setMetadataLocalStorage<T> (id: Metadata<T>, value: T | null): void {
|
||||
if (value != null) {
|
||||
@ -47,3 +50,23 @@ export function checkMobile (): boolean {
|
||||
export function floorFractionDigits (n: number | string, amount: number): number {
|
||||
return Number(Number(n).toFixed(amount))
|
||||
}
|
||||
|
||||
export function addNotification (
|
||||
title: string,
|
||||
subTitle: string,
|
||||
component: AnyComponent | AnySvelteComponent,
|
||||
params?: { [key: string]: any }
|
||||
): void {
|
||||
const notification: Notification = {
|
||||
id: generateId(),
|
||||
title,
|
||||
subTitle,
|
||||
severity: NotificationSeverity.Success,
|
||||
position: NotificationPosition.BottomRight,
|
||||
component,
|
||||
closeTimeout: 10000,
|
||||
params
|
||||
}
|
||||
|
||||
notificationsStore.addNotification(notification)
|
||||
}
|
||||
|
@ -44,6 +44,7 @@
|
||||
} from '@hcengineering/tracker'
|
||||
import {
|
||||
ActionIcon,
|
||||
addNotification,
|
||||
Button,
|
||||
Component,
|
||||
DatePresenter,
|
||||
@ -54,11 +55,7 @@
|
||||
Menu,
|
||||
setMetadataLocalStorage,
|
||||
showPopup,
|
||||
Spinner,
|
||||
NotificationPosition,
|
||||
NotificationSeverity,
|
||||
Notification,
|
||||
notificationsStore
|
||||
Spinner
|
||||
} from '@hcengineering/ui'
|
||||
import view from '@hcengineering/view'
|
||||
import { ObjectBox } from '@hcengineering/view-resources'
|
||||
@ -518,21 +515,10 @@
|
||||
}
|
||||
}
|
||||
|
||||
const notification: Notification = {
|
||||
id: generateId(),
|
||||
title: tracker.string.IssueCreated,
|
||||
subTitle: getTitle(object.title),
|
||||
severity: NotificationSeverity.Success,
|
||||
position: NotificationPosition.BottomRight,
|
||||
component: IssueNotification,
|
||||
closeTimeout: 10000,
|
||||
params: {
|
||||
issueId: objectId,
|
||||
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
|
||||
}
|
||||
}
|
||||
|
||||
notificationsStore.addNotification(notification)
|
||||
addNotification(tracker.string.IssueCreated, getTitle(object.title), IssueNotification, {
|
||||
issueId: objectId,
|
||||
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
|
||||
})
|
||||
|
||||
objectId = generateId()
|
||||
resetObject()
|
||||
|
@ -18,13 +18,15 @@
|
||||
import presentation, { getClient, KeyedAttribute } from '@hcengineering/presentation'
|
||||
import { StyledTextArea } from '@hcengineering/text-editor'
|
||||
import { IssueStatus, IssuePriority, Issue, Team, calcRank } from '@hcengineering/tracker'
|
||||
import { Button, Component, EditBox } from '@hcengineering/ui'
|
||||
import { addNotification, Button, Component, EditBox } from '@hcengineering/ui'
|
||||
import tags, { TagElement, TagReference } from '@hcengineering/tags'
|
||||
import tracker from '../../../plugin'
|
||||
import AssigneeEditor from '../AssigneeEditor.svelte'
|
||||
import StatusEditor from '../StatusEditor.svelte'
|
||||
import PriorityEditor from '../PriorityEditor.svelte'
|
||||
import EstimationEditor from '../timereport/EstimationEditor.svelte'
|
||||
import IssueNotification from '../IssueNotification.svelte'
|
||||
import { translate } from '@hcengineering/platform'
|
||||
|
||||
export let parentIssue: Issue
|
||||
export let issueStatuses: WithLookup<IssueStatus>[]
|
||||
@ -123,6 +125,11 @@
|
||||
tag: label.tag
|
||||
})
|
||||
}
|
||||
|
||||
addNotification(tracker.string.IssueCreated, getTitle(newIssue.title), IssueNotification, {
|
||||
issueId: objectId,
|
||||
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
|
||||
})
|
||||
} finally {
|
||||
resetToDefaults()
|
||||
loading = false
|
||||
|
Loading…
Reference in New Issue
Block a user