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

View file

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