Merge pull request #1735 from sumpfralle/olsr-jsoninfo-parser-handle-empty-result
[oweals/luci.git] / applications / luci-app-firewall / htdocs / luci-static / resources / view / firewall / forwards.js
index ffbfe3ccd07bb6bf08a5d158a9d42a1bbb0f8b66..80938711e9d416f121cd7f0ea8b886597652c3d7 100644 (file)
@@ -75,7 +75,8 @@ function forward_via_txt(s) {
 return L.view.extend({
        callHostHints: rpc.declare({
                object: 'luci',
-               method: 'host_hints'
+               method: 'getHostHints',
+               expect: { '': {} }
        }),
 
        load: function() {
@@ -107,6 +108,16 @@ return L.view.extend({
                        return uci.get('firewall', section_id, 'name') || _('Unnamed forward');
                };
 
+               s.handleAdd = function(ev) {
+                       var config_name = this.uciconfig || this.map.config,
+                           section_id = uci.add(config_name, this.sectiontype);
+
+                       uci.set(config_name, section_id, 'target', 'DNAT');
+
+                       this.addedSection = section_id;
+                       this.renderMoreOptionsModal(section_id);
+               };
+
                o = s.taboption('general', form.Value, 'name', _('Name'));
                o.placeholder = _('Unnamed forward');
                o.modalonly = true;