mirror of
https://github.com/hcengineering/platform.git
synced 2024-11-26 04:23:58 +03:00
Add close New Issue confirmation dialog (#2370)
Signed-off-by: muhtimur <timur.mukhamedishin@xored.com>
This commit is contained in:
parent
01a86a2ffd
commit
eb2be10adf
@ -26,6 +26,7 @@
|
||||
export let canSave: boolean = false
|
||||
export let createMore: boolean | undefined = undefined
|
||||
export let okLabel: IntlString = presentation.string.Create
|
||||
export let onCancel: Function | undefined = undefined
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
@ -54,7 +55,11 @@
|
||||
icon={IconClose}
|
||||
kind={'transparent'}
|
||||
on:click={() => {
|
||||
dispatch('close')
|
||||
if (onCancel) {
|
||||
onCancel()
|
||||
} else {
|
||||
dispatch('close')
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
|
@ -100,6 +100,8 @@
|
||||
"IssueTitlePlaceholder": "Issue title",
|
||||
"IssueDescriptionPlaceholder": "Add description",
|
||||
"AddIssueTooltip": "Add issue...",
|
||||
"NewIssueDialogClose": "Do you want to close this dialog?",
|
||||
"NewIssueDialogCloseNote": "All changes will be lost",
|
||||
"DueDatePopupTitle": "Due on {value}",
|
||||
"DueDatePopupOverdueTitle": "Was due on {value}",
|
||||
"DueDatePopupDescription": "{value, plural, =0 {Today} =1 {Tomorrow} other {# days remaining}}",
|
||||
|
@ -100,6 +100,8 @@
|
||||
"IssueTitlePlaceholder": "Имя задачи",
|
||||
"IssueDescriptionPlaceholder": "Описание задачи",
|
||||
"AddIssueTooltip": "Добавить задачу\u2026",
|
||||
"NewIssueDialogClose": "Вы действительно хотите закрыть окно?",
|
||||
"NewIssueDialogCloseNote": "Все внесенные изменения будут потеряны",
|
||||
"DueDatePopupTitle": "Срок {value}",
|
||||
"DueDatePopupOverdueTitle": "Должна была завершится {value}",
|
||||
"DueDatePopupDescription": "{value, plural, =0 {Сегодня} =1 {Завтра} other {# дней осталось}}",
|
||||
|
@ -300,7 +300,6 @@
|
||||
sprint: null,
|
||||
subIssues: [],
|
||||
template: undefined,
|
||||
team: null,
|
||||
title: ''
|
||||
}
|
||||
|
||||
@ -329,13 +328,7 @@
|
||||
return true
|
||||
}
|
||||
|
||||
export async function onOutsideClick () {
|
||||
if (!shouldSaveDraft) {
|
||||
return
|
||||
}
|
||||
|
||||
await descriptionBox?.createAttachments()
|
||||
|
||||
function createDraftFromObject () {
|
||||
const newDraft: Data<IssueDraft> = {
|
||||
issueId: objectId,
|
||||
title: getTitle(object.title),
|
||||
@ -354,6 +347,17 @@
|
||||
subIssues
|
||||
}
|
||||
|
||||
return newDraft
|
||||
}
|
||||
|
||||
export async function onOutsideClick () {
|
||||
if (!shouldSaveDraft) {
|
||||
return
|
||||
}
|
||||
|
||||
await descriptionBox?.createAttachments()
|
||||
|
||||
const newDraft = createDraftFromObject()
|
||||
const isEmpty = await isDraftEmpty(newDraft)
|
||||
|
||||
if (isEmpty) {
|
||||
@ -610,6 +614,30 @@
|
||||
}
|
||||
)
|
||||
}
|
||||
|
||||
async function showConfirmationDialog () {
|
||||
const newDraft = createDraftFromObject()
|
||||
const isFormEmpty = await isDraftEmpty(newDraft)
|
||||
|
||||
if (isFormEmpty) {
|
||||
console.log('isFormEmpty')
|
||||
dispatch('close')
|
||||
} else {
|
||||
showPopup(
|
||||
MessageBox,
|
||||
{
|
||||
label: tracker.string.NewIssueDialogClose,
|
||||
message: tracker.string.NewIssueDialogCloseNote
|
||||
},
|
||||
'top',
|
||||
(result?: boolean) => {
|
||||
if (result === true) {
|
||||
dispatch('close')
|
||||
}
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<Card
|
||||
@ -617,10 +645,9 @@
|
||||
okAction={createIssue}
|
||||
{canSave}
|
||||
okLabel={tracker.string.SaveIssue}
|
||||
on:close={() => {
|
||||
dispatch('close')
|
||||
}}
|
||||
on:close={() => dispatch('close')}
|
||||
createMore={false}
|
||||
onCancel={showConfirmationDialog}
|
||||
>
|
||||
<svelte:fragment slot="header">
|
||||
<div class="flex-row-center">
|
||||
|
@ -163,6 +163,8 @@ export default mergeIds(trackerId, tracker, {
|
||||
IssueDescriptionPlaceholder: '' as IntlString,
|
||||
Unassigned: '' as IntlString,
|
||||
AddIssueTooltip: '' as IntlString,
|
||||
NewIssueDialogClose: '' as IntlString,
|
||||
NewIssueDialogCloseNote: '' as IntlString,
|
||||
|
||||
CopyIssueUrl: '' as IntlString,
|
||||
CopyIssueId: '' as IntlString,
|
||||
|
Loading…
Reference in New Issue
Block a user