diff --git a/src/components/scans/AddScanModal.svelte b/src/components/scans/AddScanModal.svelte
index bd386856..ad646b7c 100644
--- a/src/components/scans/AddScanModal.svelte
+++ b/src/components/scans/AddScanModal.svelte
@@ -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) => {
//
diff --git a/src/components/scans/Scans.svelte b/src/components/scans/Scans.svelte
index 984190a2..8663aee3 100644
--- a/src/components/scans/Scans.svelte
+++ b/src/components/scans/Scans.svelte
@@ -5,6 +5,7 @@
import ScansOverview from "./ScansOverview.svelte";
$: current_scans = [];
export let modal_open = false;
+ let addScans;
@@ -21,9 +22,11 @@
{/if}
-
+
{#if store.state.jwtinfo.userdetails.permissions.includes('SCAN:CREATE')}
-
+ {
+ addScans(event.detail.scans)
+ }} />
{/if}
diff --git a/src/components/scans/ScansOverview.svelte b/src/components/scans/ScansOverview.svelte
index 52fc0318..486f7cb2 100644
--- a/src/components/scans/ScansOverview.svelte
+++ b/src/components/scans/ScansOverview.svelte
@@ -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);