From 714d05a9d27e35db0455da8e0589e998522dcc9a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Mon, 9 Sep 2024 12:36:03 +0100 Subject: [PATCH] Request new name for row actions rather than autonaming --- packages/bbui/src/Modal/ModalContent.svelte | 4 +- .../buttons/grid/GridRowActionsButton.svelte | 66 +++++++++++++++---- .../builder/src/stores/builder/rowActions.js | 12 ++-- 3 files changed, 63 insertions(+), 19 deletions(-) diff --git a/packages/bbui/src/Modal/ModalContent.svelte b/packages/bbui/src/Modal/ModalContent.svelte index 61ceaeb00a..22a14c358f 100644 --- a/packages/bbui/src/Modal/ModalContent.svelte +++ b/packages/bbui/src/Modal/ModalContent.svelte @@ -30,7 +30,9 @@ export let custom = false const { hide, cancel } = getContext(Context.Modal) + let loading = false + $: confirmDisabled = disabled || loading async function secondary(e) { @@ -90,7 +92,7 @@
- +
{#if showCancelButton || showConfirmButton || $$slots.footer}
x.name === newName) const rowActionUrl = derived([url, appStore], ([$url, $appStore]) => { return ({ automationId }) => { @@ -29,17 +37,6 @@ } }) - const createRowAction = async () => { - try { - const newRowAction = await rowActions.createRowAction(tableId, viewId) - notifications.success("Row action created successfully") - $goto($rowActionUrl(newRowAction)) - } catch (error) { - console.error(error) - notifications.error("Error creating row action") - } - } - const toggleAction = async (action, enabled) => { if (enabled) { await rowActions.enableView(tableId, viewId, action.id) @@ -47,9 +44,30 @@ await rowActions.disableView(tableId, viewId, action.id) } } + + const showCreateModal = () => { + newName = null + popover.hide() + createModal.show() + } + + const createRowAction = async () => { + try { + const newRowAction = await rowActions.createRowAction( + tableId, + viewId, + newName + ) + notifications.success("Row action created successfully") + $goto($rowActionUrl(newRowAction)) + } catch (error) { + console.error(error) + notifications.error("Error creating row action") + } + } - + {/if}
-
+ + + + + +