experiment/tanstack #172

Merged
niggl merged 106 commits from experiment/tanstack into dev 2023-04-12 19:31:47 +00:00
3 changed files with 16 additions and 5 deletions
Showing only changes of commit f5d14f2e18 - Show all commits

View File

@ -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) => {
//

View File

@ -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}

View File

@ -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);