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:
Denis Maslennikov 2022-12-06 15:29:06 +07:00 committed by GitHub
parent 107c73593f
commit d9fac2dddb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 21 deletions

View File

@ -13,8 +13,11 @@
// limitations under the License. // limitations under the License.
// //
import { generateId } from '@hcengineering/core'
import type { Metadata } from '@hcengineering/platform' import type { Metadata } from '@hcengineering/platform'
import { setMetadata } 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 { export function setMetadataLocalStorage<T> (id: Metadata<T>, value: T | null): void {
if (value != null) { if (value != null) {
@ -47,3 +50,23 @@ export function checkMobile (): boolean {
export function floorFractionDigits (n: number | string, amount: number): number { export function floorFractionDigits (n: number | string, amount: number): number {
return Number(Number(n).toFixed(amount)) 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)
}

View File

@ -44,6 +44,7 @@
} from '@hcengineering/tracker' } from '@hcengineering/tracker'
import { import {
ActionIcon, ActionIcon,
addNotification,
Button, Button,
Component, Component,
DatePresenter, DatePresenter,
@ -54,11 +55,7 @@
Menu, Menu,
setMetadataLocalStorage, setMetadataLocalStorage,
showPopup, showPopup,
Spinner, Spinner
NotificationPosition,
NotificationSeverity,
Notification,
notificationsStore
} from '@hcengineering/ui' } from '@hcengineering/ui'
import view from '@hcengineering/view' import view from '@hcengineering/view'
import { ObjectBox } from '@hcengineering/view-resources' import { ObjectBox } from '@hcengineering/view-resources'
@ -518,21 +515,10 @@
} }
} }
const notification: Notification = { addNotification(tracker.string.IssueCreated, getTitle(object.title), IssueNotification, {
id: generateId(), issueId: objectId,
title: tracker.string.IssueCreated, subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
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)
objectId = generateId() objectId = generateId()
resetObject() resetObject()

View File

@ -18,13 +18,15 @@
import presentation, { getClient, KeyedAttribute } from '@hcengineering/presentation' import presentation, { getClient, KeyedAttribute } from '@hcengineering/presentation'
import { StyledTextArea } from '@hcengineering/text-editor' import { StyledTextArea } from '@hcengineering/text-editor'
import { IssueStatus, IssuePriority, Issue, Team, calcRank } from '@hcengineering/tracker' 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 tags, { TagElement, TagReference } from '@hcengineering/tags'
import tracker from '../../../plugin' import tracker from '../../../plugin'
import AssigneeEditor from '../AssigneeEditor.svelte' import AssigneeEditor from '../AssigneeEditor.svelte'
import StatusEditor from '../StatusEditor.svelte' import StatusEditor from '../StatusEditor.svelte'
import PriorityEditor from '../PriorityEditor.svelte' import PriorityEditor from '../PriorityEditor.svelte'
import EstimationEditor from '../timereport/EstimationEditor.svelte' import EstimationEditor from '../timereport/EstimationEditor.svelte'
import IssueNotification from '../IssueNotification.svelte'
import { translate } from '@hcengineering/platform'
export let parentIssue: Issue export let parentIssue: Issue
export let issueStatuses: WithLookup<IssueStatus>[] export let issueStatuses: WithLookup<IssueStatus>[]
@ -123,6 +125,11 @@
tag: label.tag tag: label.tag
}) })
} }
addNotification(tracker.string.IssueCreated, getTitle(newIssue.title), IssueNotification, {
issueId: objectId,
subTitlePostfix: (await translate(tracker.string.Created, { value: 1 })).toLowerCase()
})
} finally { } finally {
resetToDefaults() resetToDefaults()
loading = false loading = false