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-teal-600 {
--tw-border-opacity: 1;
border-color: rgba(13, 148, 136, var(--tw-border-opacity));
}
.border-red-600 {
--tw-border-opacity: 1;
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));
}
.bg-amber-500 {
--tw-bg-opacity: 1;
background-color: rgba(245, 158, 11, var(--tw-bg-opacity));
}
.bg-orange-200 {
--tw-bg-opacity: 1;
background-color: rgba(254, 215, 170, var(--tw-bg-opacity));
@ -3466,11 +3466,6 @@ select {
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 {
--tw-text-opacity: 1;
color: rgba(56, 189, 248, var(--tw-text-opacity));
@ -3506,6 +3501,11 @@ select {
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 {
--tw-text-opacity: 1;
color: rgba(249, 115, 22, var(--tw-text-opacity));
@ -4050,18 +4050,10 @@ select {
display: block;
}
.sm\:flex {
display: flex;
}
.sm\:w-6\/12 {
width: 50%;
}
.sm\:flex-col {
flex-direction: column;
}
.sm\:pt-0 {
padding-top: 0px;
}

View File

@ -14,12 +14,16 @@
export let checked_vals;
let submitFilter = "";
$: getCookie("csrftoken") == null?
login_wg() : console.log("Cookie Error");
function login_wg() {
async function apply_sys_config() {
const rawResponse = await fetch('/api2/wgSysApply');
console.log("Apply system config");
console.log(rawResponse);
}
const rawResponse = fetch('/api2/wgLogin', {
async function login_wg() {
const rawResponse = await fetch('/api2/wgLogin', {
method: 'GET',
headers: {
'Authorization': 'Basic ' + btoa('tipadmin:tiplab123'),
@ -27,8 +31,6 @@
'Content-Type': 'application/json'
}
});
console.log(rawResponse);
}
$: submitFilter != ""?
@ -77,9 +79,17 @@
}
async function bulk_disable_req(state) {
login_wg();
// login_wg();
let tmp_filter = filter
filter = "";
filter = tmp_filter;
let csrftoken = getCookie('csrftoken');
console.log("Bulk Disable -->");
console.log(csrftoken);
console.log("-<>-"+checked_vals);
const rawResponse = await fetch('/api2/wgEditState?id=bulk&state='+state, {
method: 'POST',
@ -93,9 +103,11 @@
body: JSON.stringify(checked_vals)
});
const content = await rawResponse.json();
// const content = await rawResponse.json();
}
login_wg();
</script>
<div
@ -120,8 +132,9 @@
Filter
</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"
on:click="{() => apply_sys_config()}"
>
Apply to System
</button>
@ -170,6 +183,7 @@
<div class="text-center flex justify-between">
<h6 class="text-teal-50 text-xl font-bold">Create Filter</h6>
<div>
<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"
type="button"
@ -177,6 +191,7 @@
>
Reset Filter
</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"
type="button"
@ -184,6 +199,7 @@
>
Close Filter
</button>
</div>
</div>
</div>
@ -212,17 +228,17 @@
<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"
type="button"
on:click="{bulk_disable_req('false')}"
on:click="{() => bulk_disable_req('true')}"
>
Disable Selected
Enable Selected
</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"
type="button"
on:click="{toggleModal}"
on:click="{() => bulk_disable_req('false')}"
>
Edit Profile
Disable Bulk
</button>
<button

View File

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