Change firewall url to match to other part of the UI

This commit is contained in:
Laurent Peuch 2015-10-01 21:54:16 +02:00
parent 646b2fe377
commit f2d2aa44a5
2 changed files with 26 additions and 25 deletions

View file

@ -1472,7 +1472,7 @@ var app = Sammy('#main', function (sam) {
*/
// Firewall status
sam.get('#/firewall', function (c) {
sam.get('#/tools/firewall', function (c) {
c.api('/firewall?raw', function(data) {
var firewall = {
ports : {},
@ -1493,12 +1493,12 @@ var app = Sammy('#main', function (sam) {
// Get UPnP status
firewall.upnp = data.uPnP.enabled;
c.view('firewall/firewall', firewall);
c.view('tools/tools_firewall', firewall);
});
});
// Enable/Disable UPnP
sam.get('#/firewall/upnp/:action', function (c) {
sam.get('#/tools/firewall/upnp/:action', function (c) {
c.confirm(
y18n.t('firewall'),
y18n.t('confirm_upnp_action', [y18n.t(c.params['action'])]),
@ -1506,12 +1506,12 @@ var app = Sammy('#main', function (sam) {
params = {'action' : c.params['action']};
c.api('/firewall/upnp', function(data) {
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}, 'GET', params);
},
function(){
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}
);
});
@ -1526,7 +1526,7 @@ var app = Sammy('#main', function (sam) {
if (port != parseInt(port) || port < 0 || port > 65535) {
c.flash('fail', y18n.t('unknown_argument', [port]));
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}
switch (connection) {
@ -1559,7 +1559,7 @@ var app = Sammy('#main', function (sam) {
default:
c.flash('fail', y18n.t('unknown_action', [action]));
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}
if (method !== null && protocol !== null && port !== null) {
@ -1577,19 +1577,19 @@ var app = Sammy('#main', function (sam) {
};
c.api('/firewall/port?'+endurl, function(data) {
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}, method, params);
}
else {
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}
return;
});
// Update port status from direct link
// #/firewall/port/{{@key}}/tcp/ipv4/close
sam.get('#/firewall/port/:port/:protocol/:connection/:action', function (c) {
sam.get('#/tools/firewall/port/:port/:protocol/:connection/:action', function (c) {
c.confirm(
y18n.t('firewall'),
y18n.t( 'confirm_firewall', [ y18n.t(c.params['action']), c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection'])]),
@ -1603,13 +1603,13 @@ var app = Sammy('#main', function (sam) {
},
function(){
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}
);
});
// Update port status from form
sam.post('#/firewall/port', function (c) {
sam.post('#/tools/firewall/port', function (c) {
c.confirm(
y18n.t('firewall'),
y18n.t('confirm_firewall', [ y18n.t(c.params['action']), c.params['port'], y18n.t(c.params['protocol']), y18n.t(c.params['connection']) ]),
@ -1623,7 +1623,7 @@ var app = Sammy('#main', function (sam) {
},
function(){
store.clear('slide');
c.redirect('#/firewall');
c.redirect('#/tools/firewall');
}
);
});

View file

@ -1,6 +1,7 @@
<div class="btn-breadcrumb">
<a href="#/" ><i class="fa-home"></i><span class="sr-only">{{t 'home'}}</span></a>
<a href="#/firewall">{{t 'firewall'}}</a>
<a href="#/tools">{{t 'tools'}}</a>
<a href="#/tools/firewall">{{t 'firewall'}}</a>
</div>
<div class="separator"></div>
@ -28,20 +29,20 @@
<td>
{{#if this.ipv4}}
<span class="fa-check"></span>
<a class="btn btn-xs btn-danger" href="#/firewall/port/{{@key}}/tcp/ipv4/close">{{t 'close'}}</a>
<a class="btn btn-xs btn-danger" href="#/tools/firewall/port/{{@key}}/tcp/ipv4/close">{{t 'close'}}</a>
{{else}}
<span></span>
<span class="fa-times"></span>
<a class="btn btn-xs btn-success" href="#/firewall/port/{{@key}}/tcp/ipv4/open">{{t 'open'}}</a>
<a class="btn btn-xs btn-success" href="#/tools/firewall/port/{{@key}}/tcp/ipv4/open">{{t 'open'}}</a>
{{/if}}
</td>
<td>
{{#if this.ipv6}}
<span class="fa-check"></span>
<a class="btn btn-xs btn-danger" href="#/firewall/port/{{@key}}/tcp/ipv6/close">{{t 'close'}}</a>
<a class="btn btn-xs btn-danger" href="#/tools/firewall/port/{{@key}}/tcp/ipv6/close">{{t 'close'}}</a>
{{else}}
<span class="fa-times"></span>
<a class="btn btn-xs btn-success" href="#/firewall/port/{{@key}}/tcp/ipv6/open">{{t 'open'}}</a>
<a class="btn btn-xs btn-success" href="#/tools/firewall/port/{{@key}}/tcp/ipv6/open">{{t 'open'}}</a>
{{/if}}
</td>
<td>
@ -74,20 +75,20 @@
<td>
{{#if this.ipv4}}
<span class="fa-check"></span>
<a class="btn btn-xs btn-danger" href="#/firewall/port/{{@key}}/udp/ipv4/close">{{t 'close'}}</a>
<a class="btn btn-xs btn-danger" href="#/tools/firewall/port/{{@key}}/udp/ipv4/close">{{t 'close'}}</a>
{{else}}
<span></span>
<span class="fa-times"></span>
<a class="btn btn-xs btn-success" href="#/firewall/port/{{@key}}/udp/ipv4/open">{{t 'open'}}</a>
<a class="btn btn-xs btn-success" href="#/tools/firewall/port/{{@key}}/udp/ipv4/open">{{t 'open'}}</a>
{{/if}}
</td>
<td>
{{#if this.ipv6}}
<span class="fa-check"></span>
<a class="btn btn-xs btn-danger" href="#/firewall/port/{{@key}}/udp/ipv6/close">{{t 'close'}}</a>
<a class="btn btn-xs btn-danger" href="#/tools/firewall/port/{{@key}}/udp/ipv6/close">{{t 'close'}}</a>
{{else}}
<span class="fa-times"></span>
<a class="btn btn-xs btn-success" href="#/firewall/port/{{@key}}/udp/ipv6/open">{{t 'open'}}</a>
<a class="btn btn-xs btn-success" href="#/tools/firewall/port/{{@key}}/udp/ipv6/open">{{t 'open'}}</a>
{{/if}}
</td>
<td>
@ -121,7 +122,7 @@
<h2 class="panel-title"><span class="fa-fw fa-cog"></span> {{t 'operations'}}</h2>
</div>
<div class="panel-body">
<form action="#/firewall/port" method="POST" class="">
<form action="#/tools/firewall/port" method="POST" class="">
<div class="form-group row">
<div class="col-xs-6 col-sm-3">
<label for="action" class="control-label">{{t 'action'}}</label>
@ -167,10 +168,10 @@
<div class="panel-body">
{{#if upnp}}
<p class="text-success">{{t 'upnp_enabled'}}</p>
<a href="#/firewall/upnp/disable" class="btn btn-danger">{{t 'disable'}}</a>
<a href="#/tools/firewall/upnp/disable" class="btn btn-danger">{{t 'disable'}}</a>
{{else}}
<p class="text-danger">{{t 'upnp_disabled'}}</p>
<a href="#/firewall/upnp/enable" class="btn btn-success">{{t 'enable'}}</a>
<a href="#/tools/firewall/upnp/enable" class="btn btn-success">{{t 'enable'}}</a>
{{/if}}
</div>
</div>