From e2ee9804932cb09a59da8867bc04f4f6c943b0e1 Mon Sep 17 00:00:00 2001 From: Luca Haid Date: Thu, 6 Feb 2025 11:24:14 +0100 Subject: [PATCH] Radius added auto fetching for under 5 results / enabled checkbox --- public/js/pages/Radius/Radius.css | 2 +- public/js/pages/Radius/Radius.js | 54 ++++++++++++++++++++++++++++++- 2 files changed, 54 insertions(+), 2 deletions(-) diff --git a/public/js/pages/Radius/Radius.css b/public/js/pages/Radius/Radius.css index 66f1a5ee1..ac8f00c41 100644 --- a/public/js/pages/Radius/Radius.css +++ b/public/js/pages/Radius/Radius.css @@ -19,7 +19,7 @@ .filters { display: grid; - grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); + grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); grid-gap: 15px; margin-bottom: 20px; justify-content: center; diff --git a/public/js/pages/Radius/Radius.js b/public/js/pages/Radius/Radius.js index 182f7a37b..bb57045ca 100644 --- a/public/js/pages/Radius/Radius.js +++ b/public/js/pages/Radius/Radius.js @@ -273,6 +273,45 @@ Vue.component('radius-ont-parser', { } }); +Vue.component('radius-online-state', { + props: ['username'], + template: ` +
+ + +
+ `, + data() { + return { + data: null, + }; + }, + async created() { + await this.fetchOnlineState(); + }, + methods: { + async fetchOnlineState() { + const response = await fetch(window.TT_CONFIG['BASE_PATH'] + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=fetchRadacct&username=' + this.username); + if (response.ok) this.data = await response.json(); + } + } +}) Vue.component('radius', { template: ` @@ -292,6 +331,7 @@ Vue.component('radius', { + @@ -301,6 +341,7 @@ Vue.component('radius', { Kundennummer Username Info + Status Aktionen @@ -317,6 +358,11 @@ Vue.component('radius', { {{ user.info }} + + + @@ -419,10 +465,12 @@ Vue.component('radius', { custnum: '', window: window, showRadacctModal: false, + checkOnlineState: 0, radacctData: null, } }, async mounted() { + console.log("hallo"); await this.loadFreeUsers(); }, methods: { @@ -442,7 +490,11 @@ Vue.component('radius', { }); const response = await fetch(`${window.TT_CONFIG['BASE_PATH']}/Radius/proxyUnsecureHTTPRequestToRadius?${params.toString()}`); if (response.ok) { - this.radiusUsers = await response.json(); + const users = await response.json() + if (users.length < 6) { + this.checkOnlineState = 1; + } + this.radiusUsers = users; } else { console.error('Failed to load radius users'); }