From 29153b4c41982bf2819f78e5771166c56b3e8233 Mon Sep 17 00:00:00 2001 From: infidel Date: Wed, 23 Nov 2022 12:03:00 +0700 Subject: [PATCH] MAJOR IMPROVEMENTS: * bind value can sync accross components * Table select on wgFilter can trigger filtered request to backend * Table select on wgFilter can trigger filtered request to backend * Table select on wgFilter can trigger filtered request to backend * Table select on wgFilter can trigger filtered request to backend --- package-lock.json | 2 +- package.json | 2 +- src/components/Cards/CardWGControl.svelte | 25 ++++++++-------- src/components/Cards/CardWGFilter.svelte | 33 +++++++++++++--------- src/components/Cards/CardWGProfiles.svelte | 7 +++-- src/views/admin/wgProfiles.svelte | 4 +-- 6 files changed, 39 insertions(+), 34 deletions(-) diff --git a/package-lock.json b/package-lock.json index a71411a..8c54bbe 100644 --- a/package-lock.json +++ b/package-lock.json @@ -24,7 +24,7 @@ "@rollup/plugin-node-resolve": "11.2.0", "autoprefixer": "10.2.5", "postcss": "8.2.8", - "rollup": "2.41.5", + "rollup": "^2.41.5", "rollup-plugin-livereload": "2.0.0", "rollup-plugin-svelte": "7.1.0", "rollup-plugin-terser": "7.0.2", diff --git a/package.json b/package.json index afe8f99..7751bcc 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,7 @@ "@rollup/plugin-node-resolve": "11.2.0", "autoprefixer": "10.2.5", "postcss": "8.2.8", - "rollup": "2.41.5", + "rollup": "^2.41.5", "rollup-plugin-livereload": "2.0.0", "rollup-plugin-svelte": "7.1.0", "rollup-plugin-terser": "7.0.2", diff --git a/src/components/Cards/CardWGControl.svelte b/src/components/Cards/CardWGControl.svelte index 0f16d0e..9dbf5ef 100644 --- a/src/components/Cards/CardWGControl.svelte +++ b/src/components/Cards/CardWGControl.svelte @@ -5,16 +5,22 @@ import CardWGFilter from "components/Cards/CardWGFilter.svelte"; import Modal from "components/Modals/Modals.svelte" import CardWGControl from "components/Cards/CardWGControl.svelte"; - + + export let filter; let showModal = false; let showFilter = false; - export let filter = null; - let submitFilter = null; + let submitFilter = ""; + + + filter = submitFilter; + + $: submitFilter != ""? + filter = submitFilter : filter = ""; function toggleModal(){ showModal = !showModal; - showFilter = false; + showFilter = false; console.log("Modal..."); } @@ -24,19 +30,12 @@ function toggleFilter(){ showFilter = !showFilter; - showModal = false; - filter = submitFilter; + showModal = false; console.log("toggle Filter..."); console.log(filter); } - function getwgResponse(param) { - const wgResponse = fetch( - '/api2/wgClients?filter='+param - ); - return wgResponse; - } @@ -126,7 +125,7 @@ class="relative flex flex-col min-w-0 break-words w-full mb-6 shadow-lg rounded-lg bg-blueGray-100 border-0" >
- +
diff --git a/src/components/Cards/CardWGFilter.svelte b/src/components/Cards/CardWGFilter.svelte index a06176e..e4606d4 100644 --- a/src/components/Cards/CardWGFilter.svelte +++ b/src/components/Cards/CardWGFilter.svelte @@ -1,10 +1,22 @@
@@ -18,16 +30,9 @@ class="block uppercase text-blueGray-600 text-xs font-bold mb-2" for="grid-username" > - Username + Fuckery - +
@@ -37,7 +42,7 @@ > Organization - @@ -52,7 +57,7 @@ > Email Domain - diff --git a/src/components/Cards/CardWGProfiles.svelte b/src/components/Cards/CardWGProfiles.svelte index bde3534..97d76c5 100644 --- a/src/components/Cards/CardWGProfiles.svelte +++ b/src/components/Cards/CardWGProfiles.svelte @@ -5,7 +5,7 @@ let promise; export let wgResponse = null; - export let filter = null; + export let filter = ""; async function getwgResponse(o_filter) { const wgResponse = await fetch( @@ -16,8 +16,9 @@ } // let promise = getwgResponse(); - $: filter != null ? - promise = getwgResponse(filter) : promise = getwgReseponse(""); + + $: filter != ""? + promise = getwgResponse(filter) : promise = getwgResponse(""); // core components diff --git a/src/views/admin/wgProfiles.svelte b/src/views/admin/wgProfiles.svelte index 2f71bb0..751a26c 100644 --- a/src/views/admin/wgProfiles.svelte +++ b/src/views/admin/wgProfiles.svelte @@ -6,8 +6,8 @@ import CardWGControl from "components/Cards/CardWGControl.svelte"; let wgResponse = null; - let filter = ""; - let unique = {}; + let filter = ""; + let unique = {}; let wgProfileFetch = [];