Firewall/alias, add reconfigure button + action for https://github.com/opnsense/core/issues/1858

This commit is contained in:
Ad Schellevis 2018-08-24 11:33:10 +02:00
parent 270e6de7ff
commit ab94750568
2 changed files with 42 additions and 0 deletions

View File

@ -30,6 +30,7 @@
namespace OPNsense\Firewall\Api;
use \OPNsense\Base\ApiMutableModelControllerBase;
use \OPNsense\Core\Backend;
/**
* @package OPNsense\Firewall
@ -170,4 +171,22 @@ class AliasController extends ApiMutableModelControllerBase
}
return $result;
}
/**
* reconfigure aliases
*/
public function reconfigureAction()
{
if ($this->request->isPost()) {
$backend = new Backend();
$backend->configdRun('template reload OPNsense/Filter');
$bckresult = strtolower(
trim($backend->configdRun("filter refresh_aliases"))
);
return array("status" => $bckresult);
} else {
return array("status" => "failed");
}
}
}

View File

@ -191,6 +191,24 @@
}
});
/**
* reconfigure
*/
$("#reconfigureAct").click(function(){
$("#reconfigureAct_progress").addClass("fa fa-spinner fa-pulse");
ajaxCall("/api/firewall/alias/reconfigure", {}, function(data,status) {
// when done, disable progress animation.
$("#reconfigureAct_progress").removeClass("fa fa-spinner fa-pulse");
if (status != "success" || data['status'] != 'ok') {
BootstrapDialog.show({
type: BootstrapDialog.TYPE_WARNING,
title: "{{ lang._('Error reconfiguring aliases') }}",
message: data['status'],
draggable: true
});
}
});
});
});
</script>
@ -222,6 +240,11 @@
</tr>
</tfoot>
</table>
<div class="col-md-12">
<hr/>
<button class="btn btn-primary" id="reconfigureAct" type="button"><b>{{ lang._('Apply') }}</b> <i id="reconfigureAct_progress" class=""></i></button>
<br/><br/>
</div>
</div>
</section>
</div>