🔒 ConfirmOrgDeletion in OrgOverview

ref #16
This commit is contained in:
Philipp Dormann 2021-01-15 22:35:40 +01:00
parent a1a4c8b56d
commit 83f19a7572

View File

@ -1,9 +1,13 @@
<script> <script>
import { _ } from "svelte-i18n"; import { _ } from "svelte-i18n";
let modal_open = false;
let delete_org = {};
import { RunnerOrganisationService } from "@odit/lfk-client-js"; import { RunnerOrganisationService } from "@odit/lfk-client-js";
import "gridjs/dist/theme/mermaid.css"; import "gridjs/dist/theme/mermaid.css";
import store from "../store"; import store from "../store";
import OrgsEmptyState from "./OrgsEmptyState.svelte"; import OrgsEmptyState from "./OrgsEmptyState.svelte";
import Toastify from "toastify-js";
import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte";
$: searchvalue = ""; $: searchvalue = "";
$: active_deletes = []; $: active_deletes = [];
export let current_organizations = []; export let current_organizations = [];
@ -15,6 +19,7 @@
); );
</script> </script>
<ConfirmOrgDeletion bind:modal_open bind:delete_org />
{#if store.state.jwtinfo.userdetails.permissions.includes('ORGANISATION:GET')} {#if store.state.jwtinfo.userdetails.permissions.includes('ORGANISATION:GET')}
{#await promise} {#await promise}
<div <div
@ -111,12 +116,19 @@
Delete</button> Delete</button>
<button <button
on:click={() => { on:click={() => {
RunnerOrganisationService.runnerOrganisationControllerRemove(o.id, true) RunnerOrganisationService.runnerOrganisationControllerRemove(o.id, false)
.then((resp) => { .then((resp) => {
current_organizations = current_organizations.filter((obj) => obj.id !== o.id); current_organizations = current_organizations.filter((obj) => obj.id !== o.id);
Toastify({
text: 'Organization deleted',
duration: 500,
backgroundColor:
'linear-gradient(to right, #00b09b, #96c93d)',
}).showToast();
}) })
.catch((err) => { .catch((err) => {
// error deleting user modal_open = true;
delete_org = o;
}); });
}} }}
tabindex="0" tabindex="0"