From 89b1a570a59483053ce44821670be3a9be4068fe Mon Sep 17 00:00:00 2001 From: Andrey Sobolev Date: Tue, 14 Jun 2022 13:40:35 +0700 Subject: [PATCH] Fix TSK-9 (#2066) Signed-off-by: Andrey Sobolev --- changelog.md | 8 + .../presentation/src/components/Card.svelte | 10 +- .../src/components/AttachmentRefInput.svelte | 15 ++ .../src/components/AttachmentStyledBox.svelte | 227 ++++++++++++++++++ plugins/attachment-resources/src/index.ts | 4 +- plugins/tracker-assets/lang/ru.json | 11 +- .../src/components/CreateIssue.svelte | 40 ++- 7 files changed, 298 insertions(+), 17 deletions(-) create mode 100644 plugins/attachment-resources/src/components/AttachmentStyledBox.svelte diff --git a/changelog.md b/changelog.md index b8aa3307ee..7c0fa00225 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,14 @@ ## 0.6.27 (upcoming) +Platform: + +- Allow to attach from clipboard + +Tracker: + +- Attachments support + ## 0.6.26 Platform: diff --git a/packages/presentation/src/components/Card.svelte b/packages/presentation/src/components/Card.svelte index f965e8707a..e0f81505fb 100644 --- a/packages/presentation/src/components/Card.svelte +++ b/packages/presentation/src/components/Card.svelte @@ -21,7 +21,7 @@ export let label: IntlString export let labelProps: any | undefined = undefined - export let okAction: () => void + export let okAction: () => Promise | void export let canSave: boolean = false export let createMore: boolean | undefined = undefined export let okLabel: IntlString = presentation.string.Create @@ -76,8 +76,12 @@ label={okLabel} kind={'primary'} on:click={() => { - okAction() - if (!createMore) { + const r = okAction() + if (r instanceof Promise && !createMore) { + r.then(() => { + dispatch('close') + }) + } else if (!createMore) { dispatch('close') } }} diff --git a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte index cc4b15c736..ce4f54ab0b 100644 --- a/plugins/attachment-resources/src/components/AttachmentRefInput.svelte +++ b/plugins/attachment-resources/src/components/AttachmentRefInput.svelte @@ -152,8 +152,23 @@ await Promise.all(promises) dispatch('message', { message: event.detail, attachments: attachments.size }) } + + function pasteAction (evt: ClipboardEvent): void { + const items = evt.clipboardData?.items ?? [] + for (const index in items) { + const item = items[index] + if (item.kind === 'file') { + const blob = item.getAsFile() + if (blob !== null) { + createAttachment(blob) + } + } + } + } + + + + + + + + +
{}} + on:dragleave={() => {}} + on:drop|preventDefault|stopPropagation={fileDrop} +> + + {#if attachments.size} +
+ {#each Array.from(attachments.values()) as attachment} +
+ { + if (result !== undefined) removeAttachment(attachment) + }} + /> +
+ {/each} +
+ {/if} +
+ + diff --git a/plugins/attachment-resources/src/index.ts b/plugins/attachment-resources/src/index.ts index 757753e0ee..b46287681c 100644 --- a/plugins/attachment-resources/src/index.ts +++ b/plugins/attachment-resources/src/index.ts @@ -31,6 +31,7 @@ import AttachmentsPresenter from './components/AttachmentsPresenter.svelte' import FileBrowser from './components/FileBrowser.svelte' import FileDownload from './components/icons/FileDownload.svelte' import Photos from './components/Photos.svelte' +import AttachmentStyledBox from './components/AttachmentStyledBox.svelte' import { deleteFile, uploadFile } from './utils' export { @@ -44,7 +45,8 @@ export { AttachmentList, AttachmentDocList, FileDownload, - FileBrowser + FileBrowser, + AttachmentStyledBox } export enum FileBrowserSortMode { diff --git a/plugins/tracker-assets/lang/ru.json b/plugins/tracker-assets/lang/ru.json index d5dc11653f..4d2764dd5d 100644 --- a/plugins/tracker-assets/lang/ru.json +++ b/plugins/tracker-assets/lang/ru.json @@ -11,6 +11,8 @@ "Issues": "Задачи", "Views": "Отображения", "Active": "Активные", + "ActiveIssues": "Активные задачи {value}", + "BacklogIssues": "Пул задач {value}", "Backlog": "Пул задач", "Board": "Канбан", "Projects": "Проекты", @@ -66,7 +68,7 @@ "Labels": "Метки", "Project": "Проект", "Space": "", - "DueDate": "Указать срок выполнения\u2026", + "SetDueDate": "Указать срок выполнения\u2026", "Team": "", "Issue": "Задача", "Document": "", @@ -86,6 +88,13 @@ "GotoProjects": "Перейти к проекту", "GotoTrackerApplication": "Перейти к приложению Трекер", + "Filter": "Фильтр", + "ClearFilters": "Очистить фильтр", + "FilterIs": "is", + "FilterIsNot": "is not", + "FilterIsEither": "is either of", + "FilterStatesCount": "{value, plural, =1 {1 state} other {# states}}", + "EditIssue": "Редактирование {title}", "Save": "Сохранить", diff --git a/plugins/tracker-resources/src/components/CreateIssue.svelte b/plugins/tracker-resources/src/components/CreateIssue.svelte index cb903774e6..fe90ee0333 100644 --- a/plugins/tracker-resources/src/components/CreateIssue.svelte +++ b/plugins/tracker-resources/src/components/CreateIssue.svelte @@ -13,31 +13,31 @@ // limitations under the License. -->