/* ===== RadiusFreeUsers.js ===== * Vereinfachte freie Benutzer: * - Kein Suchfeld, nur Reload-Button * - Autoload beim ersten Tab-Klick (initIfNeeded() wird von aufgerufen) * - Zweispaltiges Layout bei breiten Screens * - Robust gegen Server-Response (users/count/filter), trimmt Info */ Vue.component('radius-free-users', { template: `
Freie NAT Benutzer {{ nat.length }}
UsernameInfo
{{ u.Username }} {{ u.Info }}
Keine Treffer
Freie STF Benutzer {{ stf.length }}
UsernameInfo
{{ u.Username }} {{ u.Info }}
Keine Treffer
`, data() { return { nat: [], stf: [], loadingNat: false, loadingStf: false, _initialized: false }; }, methods: { initIfNeeded(){ if (this._initialized) return; this._initialized = true; this.reload(); }, normalizeUsers(arr){ if (!Array.isArray(arr)) return []; return arr.map(u => ({ Username: (u.Username || u.username || '').trim(), Info: (u.Info || u.info || '').toString().replace(/\s+$/,'') })).filter(u => u.Username); }, async reload() { // NAT this.loadingNat = true; try { const natRes = await fetch(window.TT_CONFIG['BASE_PATH'] + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=free_user&filter=nat'); const j = natRes.ok ? await natRes.json() : { users: [] }; this.nat = this.normalizeUsers(j.users); } catch { this.nat = []; } this.loadingNat = false; // STF this.loadingStf = true; try { const stfRes = await fetch(window.TT_CONFIG['BASE_PATH'] + '/Radius/proxyUnsecureHTTPRequestToRadius?action2=free_user&filter=stf'); const j = stfRes.ok ? await stfRes.json() : { users: [] }; this.stf = this.normalizeUsers(j.users); } catch { this.stf = []; } this.loadingStf = false; } } });