Scan reactive add
This commit is contained in:
parent
9811ede3b2
commit
f5d14f2e18
@ -8,8 +8,8 @@
|
||||
} from "@odit/lfk-client-js";
|
||||
import Select from "svelte-select";
|
||||
import Toastify from "toastify-js";
|
||||
import { createEventDispatcher } from "svelte";
|
||||
export let modal_open;
|
||||
export let current_scans;
|
||||
const getRunnerLabel = (option) =>
|
||||
option.firstname + " " + (option.middlename || "") + " " + option.lastname;
|
||||
const filterRunners = (label, filterText, option) =>
|
||||
@ -18,6 +18,7 @@
|
||||
function focus(el) {
|
||||
el.focus();
|
||||
}
|
||||
const dispatch = createEventDispatcher();
|
||||
$: runner = 0;
|
||||
$: runners = [];
|
||||
RunnerService.runnerControllerGetAll().then((val) => {
|
||||
@ -63,8 +64,7 @@
|
||||
duration: 500,
|
||||
backgroundColor: "linear-gradient(to right, #00b09b, #96c93d)",
|
||||
}).showToast();
|
||||
current_scans.push(result);
|
||||
current_scans = current_scans;
|
||||
dispatch("created", { scans: [result] });
|
||||
})
|
||||
.catch((err) => {
|
||||
//
|
||||
|
@ -5,6 +5,7 @@
|
||||
import ScansOverview from "./ScansOverview.svelte";
|
||||
$: current_scans = [];
|
||||
export let modal_open = false;
|
||||
let addScans;
|
||||
</script>
|
||||
|
||||
<section class="container p-5">
|
||||
@ -21,9 +22,11 @@
|
||||
</button>
|
||||
{/if}
|
||||
</span>
|
||||
<ScansOverview bind:current_scans />
|
||||
<ScansOverview bind:current_scans bind:addScans />
|
||||
</section>
|
||||
|
||||
{#if store.state.jwtinfo.userdetails.permissions.includes('SCAN:CREATE')}
|
||||
<AddScanModal bind:current_scans bind:modal_open />
|
||||
<AddScanModal bind:modal_open on:created={(event)=>{
|
||||
addScans(event.detail.scans)
|
||||
}} />
|
||||
{/if}
|
||||
|
@ -31,6 +31,14 @@
|
||||
|
||||
$: active_delete = undefined;
|
||||
export let current_scans = [];
|
||||
export const addScans = (scans) => {
|
||||
current_scans = current_scans.concat(...scans);
|
||||
options.update((options) => ({
|
||||
...options,
|
||||
data: current_scans,
|
||||
}));
|
||||
};
|
||||
|
||||
const scans_promise = ScanService.scanControllerGetAll().then((val) => {
|
||||
current_scans = val;
|
||||
// handler.setRows(val);
|
||||
|
Loading…
x
Reference in New Issue
Block a user