Browse Source

Lint and fix size of S3 upload component overlay

master
Andrew Kingston 5 years ago
parent
commit
5f357ad2d8
  1. 3
      packages/client/src/api/attachments.js
  2. 45
      packages/client/src/components/app/forms/S3Upload.svelte
  3. 1
      packages/client/src/utils/buttonActions.js

3
packages/client/src/api/attachments.js

@ -1,5 +1,4 @@
import API from "./api"
import { notificationStore } from "../stores/index.js"
/**
* Uploads an attachment to the server.
@ -40,7 +39,7 @@ export const externalUpload = async (datasourceId, bucket, key, data) => {
json: false,
external: true,
})
if (res.error) {
if (res?.error) {
throw "Could not upload file to signed URL"
}
}

45
packages/client/src/components/app/forms/S3Upload.svelte

@ -98,29 +98,34 @@
bind:fieldApi
defaultValue={[]}
>
{#if fieldState}
<CoreDropzone
value={fieldState.value}
disabled={loading || fieldState.disabled}
error={fieldState.error}
on:change={e => {
fieldApi.setValue(e.detail)
}}
{processFiles}
{handleFileTooLarge}
maximum={1}
fileSizeLimit={MaxFileSize}
/>
{/if}
{#if loading}
<div class="overlay" />
<div class="loading">
<ProgressCircle />
</div>
{/if}
<div class="content">
{#if fieldState}
<CoreDropzone
value={fieldState.value}
disabled={loading || fieldState.disabled}
error={fieldState.error}
on:change={e => {
fieldApi.setValue(e.detail)
}}
{processFiles}
{handleFileTooLarge}
maximum={1}
fileSizeLimit={MaxFileSize}
/>
{/if}
{#if loading}
<div class="overlay" />
<div class="loading">
<ProgressCircle />
</div>
{/if}
</div>
</Field>
<style>
.content {
position: relative;
}
.overlay,
.loading {
position: absolute;

1
packages/client/src/utils/buttonActions.js

@ -6,7 +6,6 @@ import {
authStore,
stateStore,
uploadStore,
notificationStore,
} from "stores"
import { saveRow, deleteRow, executeQuery, triggerAutomation } from "api"
import { ActionTypes } from "constants"

Loading…
Cancel
Save