From 3ce9124d3d81d4059750b184f9f233e5565578f0 Mon Sep 17 00:00:00 2001 From: kevmodrome Date: Mon, 6 Apr 2020 16:44:53 +0200 Subject: [PATCH] convert delete modal to new type --- .../ModelDataTable/ModelDataTable.svelte | 14 +++++++-- .../ModelDataTable/modals/DeleteRecord.svelte | 30 +++++++++---------- .../[application]/backend/_layout.svelte | 8 ----- 3 files changed, 26 insertions(+), 26 deletions(-) diff --git a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte index ea4185bd93..971afcf3b0 100644 --- a/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte +++ b/packages/builder/src/components/database/ModelDataTable/ModelDataTable.svelte @@ -33,6 +33,17 @@ ) } + const deleteRecord = async row => { + open( + DeleteRecordModal, + { + onClosed: close, + record: await selectRecord(row), + }, + { styleContent: { padding: "0" } } + ) + } + async function selectRecord(record) { return await api.loadRecord(record.key, { appname: $store.appname, @@ -154,8 +165,7 @@
  • { - selectRecord(row) - backendUiStore.actions.modals.show('DELETE_RECORD') + deleteRecord(row) }}> Delete
    diff --git a/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte b/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte index b3cbfb2e60..fc27c6566f 100644 --- a/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte +++ b/packages/builder/src/components/database/ModelDataTable/modals/DeleteRecord.svelte @@ -4,26 +4,25 @@ import * as api from "../api" export let record + export let onClosed $: currentAppInfo = { appname: $store.appname, instanceId: $backendUiStore.selectedDatabase.id, } - - function onClosed() { - backendUiStore.actions.modals.hide() - }
    - - -

    Delete Record

    -
    -

    - Are you sure you want to delete this record? All of your data will be - permanently removed. This action cannot be undone. -

    +
    + + +

    Delete Record

    +
    +

    + Are you sure you want to delete this record? All of your data will be + permanently removed. This action cannot be undone. +

    +