Apply config function added, synced with django backend

This commit is contained in:
infidel 2022-12-01 13:05:00 +07:00
parent c08c689a14
commit 9746a2914c
3 changed files with 41 additions and 33 deletions

View File

@ -2609,11 +2609,6 @@ select {
border-style: none; border-style: none;
} }
.border-teal-600 {
--tw-border-opacity: 1;
border-color: rgba(13, 148, 136, var(--tw-border-opacity));
}
.border-red-600 { .border-red-600 {
--tw-border-opacity: 1; --tw-border-opacity: 1;
border-color: rgba(220, 38, 38, var(--tw-border-opacity)); border-color: rgba(220, 38, 38, var(--tw-border-opacity));
@ -2769,6 +2764,11 @@ select {
background-color: rgba(234, 179, 8, var(--tw-bg-opacity)); background-color: rgba(234, 179, 8, var(--tw-bg-opacity));
} }
.bg-amber-500 {
--tw-bg-opacity: 1;
background-color: rgba(245, 158, 11, var(--tw-bg-opacity));
}
.bg-orange-200 { .bg-orange-200 {
--tw-bg-opacity: 1; --tw-bg-opacity: 1;
background-color: rgba(254, 215, 170, var(--tw-bg-opacity)); background-color: rgba(254, 215, 170, var(--tw-bg-opacity));
@ -3466,11 +3466,6 @@ select {
color: rgba(79, 70, 229, var(--tw-text-opacity)); color: rgba(79, 70, 229, var(--tw-text-opacity));
} }
.text-blue-600 {
--tw-text-opacity: 1;
color: rgba(37, 99, 235, var(--tw-text-opacity));
}
.text-lightBlue-400 { .text-lightBlue-400 {
--tw-text-opacity: 1; --tw-text-opacity: 1;
color: rgba(56, 189, 248, var(--tw-text-opacity)); color: rgba(56, 189, 248, var(--tw-text-opacity));
@ -3506,6 +3501,11 @@ select {
color: rgba(16, 185, 129, var(--tw-text-opacity)); color: rgba(16, 185, 129, var(--tw-text-opacity));
} }
.text-amber-100 {
--tw-text-opacity: 1;
color: rgba(254, 243, 199, var(--tw-text-opacity));
}
.text-orange-500 { .text-orange-500 {
--tw-text-opacity: 1; --tw-text-opacity: 1;
color: rgba(249, 115, 22, var(--tw-text-opacity)); color: rgba(249, 115, 22, var(--tw-text-opacity));
@ -4050,18 +4050,10 @@ select {
display: block; display: block;
} }
.sm\:flex {
display: flex;
}
.sm\:w-6\/12 { .sm\:w-6\/12 {
width: 50%; width: 50%;
} }
.sm\:flex-col {
flex-direction: column;
}
.sm\:pt-0 { .sm\:pt-0 {
padding-top: 0px; padding-top: 0px;
} }

View File

@ -14,12 +14,16 @@
export let checked_vals; export let checked_vals;
let submitFilter = ""; let submitFilter = "";
$: getCookie("csrftoken") == null?
login_wg() : console.log("Cookie Error"); async function apply_sys_config() {
const rawResponse = await fetch('/api2/wgSysApply');
console.log("Apply system config");
console.log(rawResponse);
}
function login_wg() { async function login_wg() {
const rawResponse = fetch('/api2/wgLogin', { const rawResponse = await fetch('/api2/wgLogin', {
method: 'GET', method: 'GET',
headers: { headers: {
'Authorization': 'Basic ' + btoa('tipadmin:tiplab123'), 'Authorization': 'Basic ' + btoa('tipadmin:tiplab123'),
@ -27,8 +31,6 @@
'Content-Type': 'application/json' 'Content-Type': 'application/json'
} }
}); });
console.log(rawResponse);
} }
$: submitFilter != ""? $: submitFilter != ""?
@ -75,11 +77,19 @@
} }
return cookieValue; return cookieValue;
} }
async function bulk_disable_req(state) { async function bulk_disable_req(state) {
login_wg(); // login_wg();
let tmp_filter = filter
filter = "";
filter = tmp_filter;
let csrftoken = getCookie('csrftoken'); let csrftoken = getCookie('csrftoken');
console.log("Bulk Disable -->");
console.log(csrftoken); console.log(csrftoken);
console.log("-<>-"+checked_vals);
const rawResponse = await fetch('/api2/wgEditState?id=bulk&state='+state, { const rawResponse = await fetch('/api2/wgEditState?id=bulk&state='+state, {
method: 'POST', method: 'POST',
@ -93,9 +103,11 @@
body: JSON.stringify(checked_vals) body: JSON.stringify(checked_vals)
}); });
const content = await rawResponse.json(); // const content = await rawResponse.json();
} }
login_wg();
</script> </script>
<div <div
@ -120,8 +132,9 @@
Filter Filter
</button> </button>
<button <button
class="mt-3 bg-teal-500 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150" class="mt-3 bg-amber-500 text-amber-100 active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150"
type="button" type="button"
on:click="{() => apply_sys_config()}"
> >
Apply to System Apply to System
</button> </button>
@ -170,6 +183,7 @@
<div class="text-center flex justify-between"> <div class="text-center flex justify-between">
<h6 class="text-teal-50 text-xl font-bold">Create Filter</h6> <h6 class="text-teal-50 text-xl font-bold">Create Filter</h6>
<div> <div>
<button <button
class="bg-blueGray-700 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150" class="bg-blueGray-700 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150"
type="button" type="button"
@ -177,6 +191,7 @@
> >
Reset Filter Reset Filter
</button> </button>
<button <button
class="bg-red-400 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150" class="bg-red-400 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150"
type="button" type="button"
@ -184,6 +199,7 @@
> >
Close Filter Close Filter
</button> </button>
</div> </div>
</div> </div>
</div> </div>
@ -212,17 +228,17 @@
<button <button
class="mt-3 bg-teal-500 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150" class="mt-3 bg-teal-500 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150"
type="button" type="button"
on:click="{bulk_disable_req('false')}" on:click="{() => bulk_disable_req('true')}"
> >
Disable Selected Enable Selected
</button> </button>
<button <button
class="mt-3 bg-teal-500 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150" class="mt-3 bg-teal-500 text-white active:bg-red-500 font-bold uppercase text-xs px-4 py-2 rounded shadow hover:shadow-md outline-none focus:outline-none mr-1 ease-linear transition-all duration-150"
type="button" type="button"
on:click="{toggleModal}" on:click="{() => bulk_disable_req('false')}"
> >
Edit Profile Disable Bulk
</button> </button>
<button <button

View File

@ -48,6 +48,7 @@
selectedID.clear(); selectedID.clear();
} }
selectedID = selectedID; selectedID = selectedID;
checked_vals = checkbox_vals;
}; };
// let promise = getwgResponse(); // let promise = getwgResponse();
@ -56,7 +57,6 @@
checkbox_vals = [] checkbox_vals = []
const wg_promise = getwgResponse(filter); const wg_promise = getwgResponse(filter);
const wg_resp = await wg_promise; const wg_resp = await wg_promise;
console.log("[+] ID Arrays"); console.log("[+] ID Arrays");