🔒 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>
import { _ } from "svelte-i18n";
let modal_open = false;
let delete_org = {};
import { RunnerOrganisationService } from "@odit/lfk-client-js";
import "gridjs/dist/theme/mermaid.css";
import store from "../store";
import OrgsEmptyState from "./OrgsEmptyState.svelte";
import Toastify from "toastify-js";
import ConfirmOrgDeletion from "./ConfirmOrgDeletion.svelte";
$: searchvalue = "";
$: active_deletes = [];
export let current_organizations = [];
@ -15,6 +19,7 @@
);
</script>
<ConfirmOrgDeletion bind:modal_open bind:delete_org />
{#if store.state.jwtinfo.userdetails.permissions.includes('ORGANISATION:GET')}
{#await promise}
<div
@ -111,12 +116,19 @@
Delete</button>
<button
on:click={() => {
RunnerOrganisationService.runnerOrganisationControllerRemove(o.id, true)
RunnerOrganisationService.runnerOrganisationControllerRemove(o.id, false)
.then((resp) => {
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) => {
// error deleting user
modal_open = true;
delete_org = o;
});
}}
tabindex="0"