Prevent spamming the column config save button

This commit is contained in:
Adria Navarro 2024-05-09 18:03:46 +02:00
parent c99e8103e2
commit 910ec6446b
1 changed files with 23 additions and 2 deletions

View File

@ -12,6 +12,7 @@
OptionSelectDnD,
Layout,
AbsTooltip,
ProgressCircle,
} from "@budibase/bbui"
import { SWITCHABLE_TYPES, ValidColumnNameRegex } from "@budibase/shared-core"
import { createEventDispatcher, getContext, onMount } from "svelte"
@ -245,11 +246,11 @@
}
async function saveColumn() {
savingColumn = true
if (errors?.length) {
return
}
savingColumn = true
let saveColumn = cloneDeep(editableColumn)
delete saveColumn.fieldId
@ -289,6 +290,8 @@
}
} catch (err) {
notifications.error(`Error saving column: ${err.message}`)
} finally {
savingColumn = false
}
}
@ -739,7 +742,20 @@
<Button quiet warning text on:click={confirmDelete}>Delete</Button>
{/if}
<Button secondary newStyles on:click={cancelEdit}>Cancel</Button>
<Button disabled={invalid} newStyles cta on:click={saveColumn}>Save</Button>
<Button
disabled={invalid || savingColumn}
newStyles
cta
on:click={saveColumn}
>
{#if savingColumn}
<div class="save-loading">
<ProgressCircle overBackground={true} size="S" />
</div>
{:else}
Save
{/if}
</Button>
</div>
<Modal bind:this={jsonSchemaModal}>
<JSONSchemaModal
@ -804,4 +820,9 @@
cursor: pointer;
color: var(--spectrum-global-color-gray-900);
}
.save-loading {
display: flex;
justify-content: center;
}
</style>