remove plugin cleaner
This commit is contained in:
parent
60c337fe95
commit
bd4d7aaeaf
|
@ -4,12 +4,12 @@
|
|||
|
||||
import { plugins } from "stores/portal"
|
||||
|
||||
export let plugin
|
||||
export let removePlugin
|
||||
|
||||
async function deletePlugin() {
|
||||
try {
|
||||
await plugins.deletePlugin(plugin._id, plugin._rev)
|
||||
notifications.success(`Plugin ${plugin?.name} deleted.`)
|
||||
await plugins.deletePlugin(removePlugin._id, removePlugin._rev)
|
||||
notifications.success(`Plugin ${removePlugin?.name} deleted.`)
|
||||
$goto("./")
|
||||
} catch (error) {
|
||||
notifications.error("Error deleting plugin")
|
||||
|
@ -26,6 +26,6 @@
|
|||
showCloseIcon={false}
|
||||
>
|
||||
<Body>
|
||||
Are you sure you want to delete <strong>{plugin?.name}</strong>
|
||||
Are you sure you want to delete <strong>{removePlugin?.name}</strong>
|
||||
</Body>
|
||||
</ModalContent>
|
||||
|
|
|
@ -1,24 +1,14 @@
|
|||
<script>
|
||||
import { Icon, Body, ActionMenu, MenuItem, Detail } from "@budibase/bbui"
|
||||
import { createEventDispatcher } from "svelte"
|
||||
|
||||
const dispatch = createEventDispatcher()
|
||||
|
||||
export let plugin
|
||||
export let deletePlugin
|
||||
$: console.log(plugin)
|
||||
let modal
|
||||
|
||||
function editGroup() {
|
||||
modal.show()
|
||||
}
|
||||
|
||||
const remove = plugin => {
|
||||
dispatch("delete", {
|
||||
_id: plugin._id,
|
||||
_rev: plugin._rev,
|
||||
name: plugin.name,
|
||||
})
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="row">
|
||||
|
@ -51,7 +41,8 @@
|
|||
<span slot="control">
|
||||
<Icon hoverable name="More" />
|
||||
</span>
|
||||
<MenuItem on:click={() => remove(plugin)} icon="Delete">Delete</MenuItem
|
||||
<MenuItem on:click={() => deletePlugin(plugin)} icon="Delete"
|
||||
>Delete</MenuItem
|
||||
>
|
||||
<MenuItem on:click={() => editGroup(plugin)} icon="Edit">Edit</MenuItem>
|
||||
</ActionMenu>
|
||||
|
|
|
@ -35,11 +35,9 @@
|
|||
plugin?.name?.toLowerCase().includes(searchTerm.toLowerCase())
|
||||
)
|
||||
|
||||
const deletePlugin = evt => {
|
||||
const { detail } = evt
|
||||
|
||||
const deletePlugin = plugin => {
|
||||
deleteModal.show()
|
||||
removePlugin = detail
|
||||
removePlugin = plugin
|
||||
}
|
||||
|
||||
onMount(async () => {
|
||||
|
@ -77,7 +75,7 @@
|
|||
|
||||
{#if $plugins}
|
||||
{#each filteredPlugins as plugin}
|
||||
<PluginRow {plugin} on:delete={deletePlugin} />
|
||||
<PluginRow {plugin} {deletePlugin} />
|
||||
{/each}
|
||||
{/if}
|
||||
</Layout>
|
||||
|
@ -87,7 +85,7 @@
|
|||
<AddPluginModal />
|
||||
</Modal>
|
||||
<Modal bind:this={deleteModal}>
|
||||
<DeletePluginModal plugin={removePlugin} />
|
||||
<DeletePluginModal {removePlugin} />
|
||||
</Modal>
|
||||
|
||||
<style>
|
||||
|
|
Loading…
Reference in New Issue