mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-14 08:34:39 +00:00
dashboard: change data fetch in wireguard widget
This commit is contained in:
parent
dd0594ae3f
commit
d042a4800d
@ -237,7 +237,6 @@
|
||||
<users>Users</users>
|
||||
<unconfigured>IPsec is currently disabled. Click to configure IPsec.</unconfigured>
|
||||
<noleases>There are currently no leases.</noleases>
|
||||
<nodata>Failed to load data.</nodata>
|
||||
</translations>
|
||||
</ipsecleases>
|
||||
<ipsectunnels>
|
||||
@ -252,7 +251,6 @@
|
||||
<total>Tunnels</total>
|
||||
<unconfigured>IPsec is currently disabled. Click to configure IPsec.</unconfigured>
|
||||
<notunnels>There are currently no tunnels.</notunnels>
|
||||
<nodata>Failed to load data.</nodata>
|
||||
<notavailable>N/A</notavailable>
|
||||
</translations>
|
||||
</ipsectunnels>
|
||||
|
||||
@ -53,24 +53,20 @@ export default class Wireguard extends BaseTableWidget {
|
||||
}
|
||||
|
||||
async onWidgetTick() {
|
||||
try {
|
||||
const wg = await ajaxGet('/api/wireguard/general/get', {});
|
||||
if (!wg.general || !wg.general.enabled) {
|
||||
this.displayError(`${this.translations.unconfigured}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await ajaxGet('/api/wireguard/service/show', {});
|
||||
|
||||
if (!response || !response.rows || response.rows.length === 0) {
|
||||
this.displayError(`${this.translations.notunnels}`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.processTunnels(response.rows);
|
||||
} catch (error) {
|
||||
this.displayError(`${this.translations.nodata}`);
|
||||
const wg = await this.ajaxGet('/api/wireguard/general/get');
|
||||
if (!wg.general || !wg.general.enabled) {
|
||||
this.displayError(`${this.translations.unconfigured}`);
|
||||
return;
|
||||
}
|
||||
|
||||
const response = await this.ajaxGet('/api/wireguard/service/show');
|
||||
|
||||
if (!response || !response.rows || response.rows.length === 0) {
|
||||
this.displayError(`${this.translations.notunnels}`);
|
||||
return;
|
||||
}
|
||||
|
||||
this.processTunnels(response.rows);
|
||||
}
|
||||
|
||||
displayError(message) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user