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