convert delete modal to new type

This commit is contained in:
kevmodrome 2020-04-06 16:44:53 +02:00
parent 0d4c05c588
commit 09edd6ba3e
3 changed files with 26 additions and 26 deletions

View File

@ -33,6 +33,17 @@
) )
} }
const deleteRecord = async row => {
open(
DeleteRecordModal,
{
onClosed: close,
record: await selectRecord(row),
},
{ styleContent: { padding: "0" } }
)
}
async function selectRecord(record) { async function selectRecord(record) {
return await api.loadRecord(record.key, { return await api.loadRecord(record.key, {
appname: $store.appname, appname: $store.appname,
@ -154,8 +165,7 @@
<li> <li>
<div <div
on:click={() => { on:click={() => {
selectRecord(row) deleteRecord(row)
backendUiStore.actions.modals.show('DELETE_RECORD')
}}> }}>
Delete Delete
</div> </div>

View File

@ -4,18 +4,16 @@
import * as api from "../api" import * as api from "../api"
export let record export let record
export let onClosed
$: currentAppInfo = { $: currentAppInfo = {
appname: $store.appname, appname: $store.appname,
instanceId: $backendUiStore.selectedDatabase.id, instanceId: $backendUiStore.selectedDatabase.id,
} }
function onClosed() {
backendUiStore.actions.modals.hide()
}
</script> </script>
<section> <section>
<div class="content">
<heading> <heading>
<i class="ri-information-line alert" /> <i class="ri-information-line alert" />
<h4 class="budibase__title--4">Delete Record</h4> <h4 class="budibase__title--4">Delete Record</h4>
@ -24,6 +22,7 @@
Are you sure you want to delete this record? All of your data will be Are you sure you want to delete this record? All of your data will be
permanently removed. This action cannot be undone. permanently removed. This action cannot be undone.
</p> </p>
</div>
<div class="modal-actions"> <div class="modal-actions">
<ActionButton on:click={onClosed}>Cancel</ActionButton> <ActionButton on:click={onClosed}>Cancel</ActionButton>
<ActionButton <ActionButton
@ -47,18 +46,17 @@
.modal-actions { .modal-actions {
padding: 10px; padding: 10px;
position: absolute;
bottom: 0;
left: 0;
background: #fafafa; background: #fafafa;
border-top: 1px solid #ccc; border-top: 1px solid #ccc;
width: 100%;
} }
heading { heading {
display: flex; display: flex;
align-items: center; align-items: center;
} }
.content {
padding: 30px;
}
h4 { h4 {
margin: 0 0 0 10px; margin: 0 0 0 10px;

View File

@ -28,25 +28,17 @@
backendUiStore.actions.modals.hide() backendUiStore.actions.modals.hide()
} }
$: recordOpen = $backendUiStore.visibleModal === "RECORD"
$: modelOpen = $backendUiStore.visibleModal === "MODEL" $: modelOpen = $backendUiStore.visibleModal === "MODEL"
$: viewOpen = $backendUiStore.visibleModal === "VIEW" $: viewOpen = $backendUiStore.visibleModal === "VIEW"
$: deleteRecordOpen = $backendUiStore.visibleModal === "DELETE_RECORD"
</script> </script>
<!-- <Modal isOpen={!!$backendUiStore.visibleModal} {onClosed}> <!-- <Modal isOpen={!!$backendUiStore.visibleModal} {onClosed}>
{#if recordOpen}
<CreateEditRecordModal record={selectedRecord} {onClosed} />
{/if}
{#if modelOpen} {#if modelOpen}
<CreateEditModelModal {onClosed} /> <CreateEditModelModal {onClosed} />
{/if} {/if}
{#if viewOpen} {#if viewOpen}
<CreateEditViewModal {onClosed} /> <CreateEditViewModal {onClosed} />
{/if} {/if}
{#if deleteRecordOpen}
<DeleteRecordModal record={selectedRecord} {onClosed} />
{/if}
</Modal> --> </Modal> -->
<div class="root"> <div class="root">