diff --git a/packages/ui/src/components/Loading.svelte b/packages/ui/src/components/Loading.svelte
index 47cab768af..50620b562d 100644
--- a/packages/ui/src/components/Loading.svelte
+++ b/packages/ui/src/components/Loading.svelte
@@ -14,10 +14,22 @@
// limitations under the License.
-->
diff --git a/plugins/attachment-resources/src/components/AttachmentPopup.svelte b/plugins/attachment-resources/src/components/AttachmentPopup.svelte
index ead79c9ca0..e3ba9921ae 100644
--- a/plugins/attachment-resources/src/components/AttachmentPopup.svelte
+++ b/plugins/attachment-resources/src/components/AttachmentPopup.svelte
@@ -17,7 +17,7 @@
import type { Doc } from '@hcengineering/core'
import { Attachment } from '@hcengineering/attachment'
import { createQuery, getClient } from '@hcengineering/presentation'
- import { ActionIcon, IconAdd, Label } from '@hcengineering/ui'
+ import { ActionIcon, IconAdd, Label, Loading } from '@hcengineering/ui'
import { AttachmentPresenter } from '..'
import attachment from '../plugin'
import { uploadFile } from '../utils'
@@ -31,6 +31,8 @@
let docs: Attachment[] = []
+ let progress = false
+
const query = createQuery()
$: query.query(
attachment.class.Attachment,
@@ -59,14 +61,19 @@
})
}
- function fileSelected () {
+ async function fileSelected (): Promise {
+ progress = true
+
const list = inputFile.files
if (list === null || list.length === 0) return
for (let index = 0; index < list.length; index++) {
const file = list.item(index)
- if (file !== null) createAttachment(file)
+ if (file !== null) {
+ await createAttachment(file)
+ }
}
inputFile.value = ''
+ progress = false
}
let inputFile: HTMLInputElement
@@ -94,7 +101,11 @@
{#if canAdd}
-
+ {#if progress}
+
+ {:else}
+
+ {/if}
{/if}
diff --git a/plugins/attachment-resources/src/components/AttachmentPresenter.svelte b/plugins/attachment-resources/src/components/AttachmentPresenter.svelte
index 4d02a2bb82..16de02d8c1 100644
--- a/plugins/attachment-resources/src/components/AttachmentPresenter.svelte
+++ b/plugins/attachment-resources/src/components/AttachmentPresenter.svelte
@@ -16,7 +16,7 @@
@@ -263,8 +276,13 @@
on:dragleave={() => {}}
on:drop|preventDefault|stopPropagation={fileDrop}
>
- {#if attachments.size}
+ {#if attachments.size || progress}
diff --git a/plugins/gmail-resources/src/components/NewMessage.svelte b/plugins/gmail-resources/src/components/NewMessage.svelte
index 3c72349a52..2fce00edbf 100644
--- a/plugins/gmail-resources/src/components/NewMessage.svelte
+++ b/plugins/gmail-resources/src/components/NewMessage.svelte
@@ -36,6 +36,8 @@
const notificationClient = NotificationClientImpl.getClient()
let objectId = generateId()
+ let progress = false
+
let copy: string = ''
const obj: Data = {
@@ -82,6 +84,7 @@
let inputFile: HTMLInputElement
function fileSelected () {
+ progress = true
const list = inputFile.files
if (list === null || list.length === 0) return
for (let index = 0; index < list.length; index++) {
@@ -89,17 +92,20 @@
if (file !== null) createAttachment(file)
}
inputFile.value = ''
+ progress = false
}
function fileDrop (e: DragEvent) {
e.preventDefault()
e.stopPropagation()
+ progress = true
const list = e.dataTransfer?.files
if (list === undefined || list.length === 0) return
for (let index = 0; index < list.length; index++) {
const file = list.item(index)
if (file !== null) createAttachment(file)
}
+ progress = false
}
async function createAttachment (file: File) {
@@ -187,11 +193,12 @@