- dsc.setAttribute(up ? 'reconnect' : 'disconnect', force ? 'force' : '');
- L.dom.content(dsc, E('em',
- up ? _('Interface is reconnecting...') : _('Interface is shutting down...')));
+ if (!up) {
+ L.Request.get(L.url('admin/network/remote_addr')).then(function(res) {
+ var info = res.json();
+
+ if (L.isObject(info) &&
+ Array.isArray(info.inbound_interfaces) &&
+ info.inbound_interfaces.filter(function(i) { return i == id })[0]) {
+
+ L.ui.showModal(_('Confirm disconnect'), [
+ E('p', _('You appear to be currently connected to the device via the "%h" interface. Do you really want to shut down the interface?').format(id)),
+ E('div', { 'class': 'right' }, [
+ E('button', {
+ 'class': 'cbi-button cbi-button-neutral',
+ 'click': function(ev) {
+ btns[1].classList.remove('spinning');
+ btns[1].disabled = false;
+ btns[0].disabled = false;
+
+ L.ui.hideModal();
+ }
+ }, _('Cancel')),
+ ' ',
+ E('button', {
+ 'class': 'cbi-button cbi-button-negative important',
+ 'click': function(ev) {
+ dsc.setAttribute('disconnect', '');
+ L.dom.content(dsc, E('em', _('Interface is shutting down...')));
+
+ L.ui.hideModal();
+ }
+ }, _('Disconnect'))
+ ])
+ ]);
+ }
+ else {
+ dsc.setAttribute('disconnect', '');
+ L.dom.content(dsc, E('em', _('Interface is shutting down...')));
+ }
+ });
+ }
+ else {
+ dsc.setAttribute(up ? 'reconnect' : 'disconnect', force ? 'force' : '');
+ L.dom.content(dsc, E('em', up ? _('Interface is reconnecting...') : _('Interface is shutting down...')));
+ }