mirror of
https://github.com/openwrt/luci.git
synced 2025-04-15 12:55:48 +00:00
.github
applications
luci-app-acl
luci-app-acme
luci-app-adblock
luci-app-adblock-fast
luci-app-advanced-reboot
luci-app-alist
luci-app-antiblock
luci-app-apinger
luci-app-aria2
luci-app-attendedsysupgrade
luci-app-babeld
luci-app-banip
luci-app-bcp38
luci-app-bmx7
luci-app-clamav
luci-app-cloudflared
luci-app-commands
luci-app-coovachilli
luci-app-crowdsec-firewall-bouncer
luci-app-cshark
luci-app-dawn
luci-app-dcwapd
luci-app-ddns
luci-app-dockerman
luci-app-dump1090
luci-app-dynapoint
luci-app-email
luci-app-eoip
luci-app-example
luci-app-filebrowser
luci-app-filemanager
luci-app-firewall
luci-app-frpc
luci-app-frps
luci-app-fwknopd
luci-app-hd-idle
luci-app-https-dns-proxy
luci-app-irqbalance
luci-app-keepalived
htdocs
luci-static
resources
view
keepalived
globals.js
ipaddress.js
notification.js
overview.js
peers.js
route.js
script.js
servers.js
track_interface.js
url.js
vrrp_instance.js
vrrp_sync_group.js
status
po
root
Makefile
luci-app-ksmbd
luci-app-ledtrig-rssi
luci-app-ledtrig-switch
luci-app-ledtrig-usbport
luci-app-libreswan
luci-app-lldpd
luci-app-lorawan-basicstation
luci-app-ltqtapi
luci-app-lxc
luci-app-minidlna
luci-app-mjpg-streamer
luci-app-mosquitto
luci-app-mwan3
luci-app-natmap
luci-app-nextdns
luci-app-nft-qos
luci-app-nlbwmon
luci-app-nut
luci-app-ocserv
luci-app-olsr
luci-app-olsr-services
luci-app-olsr-viz
luci-app-omcproxy
luci-app-openvpn
luci-app-openwisp
luci-app-p910nd
luci-app-package-manager
luci-app-pagekitec
luci-app-pbr
luci-app-privoxy
luci-app-qos
luci-app-radicale
luci-app-radicale2
luci-app-rp-pppoe-server
luci-app-samba4
luci-app-ser2net
luci-app-siitwizard
luci-app-smartdns
luci-app-snmpd
luci-app-softether
luci-app-splash
luci-app-sqm
luci-app-squid
luci-app-sshtunnel
luci-app-statistics
luci-app-strongswan-swanctl
luci-app-tinyproxy
luci-app-tor
luci-app-transmission
luci-app-travelmate
luci-app-ttyd
luci-app-udpxy
luci-app-uhttpd
luci-app-unbound
luci-app-upnp
luci-app-usteer
luci-app-v2raya
luci-app-vnstat2
luci-app-watchcat
luci-app-wifischedule
luci-app-wol
luci-app-xfrpc
luci-app-xinetd
build
collections
contrib
docs
libs
modules
protocols
themes
.gitignore
CONTRIBUTING.md
LICENSE
NOTICE
README.md
jsdoc.conf.json
luci.mk
package.json
This commit distinguishes between active state (how it is at the moment) and how the keepalived was configured initially (Initial State). These states are separated in two columns. Signed-off-by: Christian Korber <ck@dev.tdt.de>
94 lines
2.3 KiB
JavaScript
94 lines
2.3 KiB
JavaScript
'use strict';
|
|
'require view';
|
|
'require form';
|
|
'require uci';
|
|
'require rpc';
|
|
'require poll';
|
|
|
|
const callKeepalivedStatus = rpc.declare({
|
|
object: 'keepalived',
|
|
method: 'dump',
|
|
expect: { },
|
|
});
|
|
|
|
return view.extend({
|
|
load: function() {
|
|
return Promise.all([
|
|
uci.load('keepalived'),
|
|
]);
|
|
},
|
|
|
|
render: function() {
|
|
var table =
|
|
E('table', { 'class': 'table lases' }, [
|
|
E('tr', { 'class': 'tr table-titles' }, [
|
|
E('th', { 'class': 'th' }, _('Name')),
|
|
E('th', { 'class': 'th' }, _('Interface')),
|
|
E('th', { 'class': 'th' }, _('Active State')),
|
|
E('th', { 'class': 'th' }, _('Initial State')),
|
|
E('th', { 'class': 'th' }, _('Probes Sent')),
|
|
E('th', { 'class': 'th' }, _('Probes Received')),
|
|
E('th', { 'class': 'th' }, _('Last Transition')),
|
|
E([])
|
|
])
|
|
]);
|
|
|
|
poll.add(function() {
|
|
return callKeepalivedStatus().then(function(instancesInfo) {
|
|
var targets = Array.isArray(instancesInfo.status) ? instancesInfo.status : [];
|
|
var instances = uci.sections('keepalived', 'vrrp_instance');
|
|
|
|
cbi_update_table(table,
|
|
targets.map(function(target) {
|
|
var state;
|
|
var state_initial;
|
|
var instance_state = target.data.state;
|
|
|
|
if (instance_state === 2) {
|
|
state = 'MASTER';
|
|
} else if (instance_state === 1) {
|
|
state = 'BACKUP';
|
|
} else if (instance_state === 0) {
|
|
state = 'INIT';
|
|
} else if (instance_state === 3) {
|
|
state = 'FAULT';
|
|
} else {
|
|
state = 'UNKNOWN';
|
|
}
|
|
|
|
if (instances != '') {
|
|
for (var i = 0; i < instances.length; i++) {
|
|
if (instances[i]['name'] == target.data.iname) {
|
|
state = state;
|
|
state_initial = instances[i]['state'];
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
return [
|
|
target.data.iname,
|
|
target.data.ifp_ifname,
|
|
state,
|
|
state_initial,
|
|
target.stats.advert_sent,
|
|
target.stats.advert_rcvd,
|
|
new Date(target.data.last_transition * 1000)
|
|
];
|
|
}),
|
|
E('em', _('There are no active instances'))
|
|
);
|
|
});
|
|
});
|
|
|
|
return E('div', {'class': 'cbi-map'}, [
|
|
E('h2', _('VRRP')),
|
|
E('div', {'class': 'cbi-map-descr'}, _('This overview shows the current status of the VRRP instances on this device.')),
|
|
E('div', { 'class': 'cbi-section' }, table)
|
|
]);
|
|
},
|
|
|
|
handleSave: null,
|
|
handleSaveApply:null,
|
|
handleReset: null
|
|
});
|