Commit 2f9ca384 authored by Dietmar Maurer's avatar Dietmar Maurer

use correct url for IPSetSelector

parent a37afc49
...@@ -200,6 +200,7 @@ Ext.define('PVE.SecurityGroups', { ...@@ -200,6 +200,7 @@ Ext.define('PVE.SecurityGroups', {
var rule_panel = Ext.createWidget('pveFirewallRules', { var rule_panel = Ext.createWidget('pveFirewallRules', {
region: 'center', region: 'center',
allow_groups: false, allow_groups: false,
ipset_base_url: '/cluster/firewall/ipset',
tbar_prefix: '<b>' + gettext('Rules') + ':</b>', tbar_prefix: '<b>' + gettext('Rules') + ':</b>',
flex: 0.75, flex: 0.75,
border: false border: false
......
...@@ -2,9 +2,15 @@ Ext.define('PVE.form.IPSetSelector', { ...@@ -2,9 +2,15 @@ Ext.define('PVE.form.IPSetSelector', {
extend: 'PVE.form.ComboGrid', extend: 'PVE.form.ComboGrid',
alias: ['widget.pveIPSetSelector'], alias: ['widget.pveIPSetSelector'],
base_url: undefined,
initComponent: function() { initComponent: function() {
var me = this; var me = this;
if (!me.base_url) {
throw "no base_url specified";
}
var store = Ext.create('Ext.data.Store', { var store = Ext.create('Ext.data.Store', {
autoLoad: true, autoLoad: true,
fields: [ { name: 'name', fields: [ { name: 'name',
...@@ -13,7 +19,7 @@ Ext.define('PVE.form.IPSetSelector', { ...@@ -13,7 +19,7 @@ Ext.define('PVE.form.IPSetSelector', {
idProperty: 'name', idProperty: 'name',
proxy: { proxy: {
type: 'pve', type: 'pve',
url: "/api2/json/cluster/firewall/ipset" url: "/api2/json" + me.base_url
}, },
sorters: { sorters: {
property: 'name', property: 'name',
......
...@@ -51,6 +51,8 @@ Ext.define('PVE.FirewallRulePanel', { ...@@ -51,6 +51,8 @@ Ext.define('PVE.FirewallRulePanel', {
allow_iface: false, allow_iface: false,
ipset_base_url: undefined,
onGetValues: function(values) { onGetValues: function(values) {
var me = this; var me = this;
...@@ -71,6 +73,10 @@ Ext.define('PVE.FirewallRulePanel', { ...@@ -71,6 +73,10 @@ Ext.define('PVE.FirewallRulePanel', {
initComponent : function() { initComponent : function() {
var me = this; var me = this;
if (!me.ipset_base_url) {
throw "no ipset_base_url specified";
}
me.column1 = [ me.column1 = [
{ {
// hack: we use this field to mark the form 'dirty' when the // hack: we use this field to mark the form 'dirty' when the
...@@ -127,6 +133,7 @@ Ext.define('PVE.FirewallRulePanel', { ...@@ -127,6 +133,7 @@ Ext.define('PVE.FirewallRulePanel', {
name: 'source', name: 'source',
autoSelect: false, autoSelect: false,
editable: true, editable: true,
base_url: me.ipset_base_url,
queryDelay: 900000000, // disable query queryDelay: 900000000, // disable query
value: '', value: '',
preferredValue: '', // hack: else Form sets dirty flag? preferredValue: '', // hack: else Form sets dirty flag?
...@@ -138,6 +145,7 @@ Ext.define('PVE.FirewallRulePanel', { ...@@ -138,6 +145,7 @@ Ext.define('PVE.FirewallRulePanel', {
autoSelect: false, autoSelect: false,
queryDelay: 900000000, // disable query queryDelay: 900000000, // disable query
editable: true, editable: true,
base_url: me.ipset_base_url,
value: '', value: '',
preferredValue: '', // hack: else Form sets dirty flag? preferredValue: '', // hack: else Form sets dirty flag?
fieldLabel: gettext('Destination') fieldLabel: gettext('Destination')
...@@ -224,6 +232,7 @@ Ext.define('PVE.FirewallRuleEdit', { ...@@ -224,6 +232,7 @@ Ext.define('PVE.FirewallRuleEdit', {
extend: 'PVE.window.Edit', extend: 'PVE.window.Edit',
base_url: undefined, base_url: undefined,
ipset_base_url: undefined,
allow_iface: false, allow_iface: false,
...@@ -231,6 +240,13 @@ Ext.define('PVE.FirewallRuleEdit', { ...@@ -231,6 +240,13 @@ Ext.define('PVE.FirewallRuleEdit', {
/*jslint confusion: true */ /*jslint confusion: true */
var me = this; var me = this;
if (!me.base_url) {
throw "no base_url specified";
}
if (!me.ipset_base_url) {
throw "no ipset_base_url specified";
}
me.create = (me.rule_pos === undefined); me.create = (me.rule_pos === undefined);
if (me.create) { if (me.create) {
...@@ -243,6 +259,7 @@ Ext.define('PVE.FirewallRuleEdit', { ...@@ -243,6 +259,7 @@ Ext.define('PVE.FirewallRuleEdit', {
var ipanel = Ext.create('PVE.FirewallRulePanel', { var ipanel = Ext.create('PVE.FirewallRulePanel', {
create: me.create, create: me.create,
ipset_base_url: me.ipset_base_url,
allow_iface: me.allow_iface, allow_iface: me.allow_iface,
rule_pos: me.rule_pos rule_pos: me.rule_pos
}); });
...@@ -367,6 +384,7 @@ Ext.define('PVE.FirewallRules', { ...@@ -367,6 +384,7 @@ Ext.define('PVE.FirewallRules', {
alias: 'widget.pveFirewallRules', alias: 'widget.pveFirewallRules',
base_url: undefined, base_url: undefined,
ipset_base_url: undefined,
addBtn: undefined, addBtn: undefined,
removeBtn: undefined, removeBtn: undefined,
...@@ -476,6 +494,10 @@ Ext.define('PVE.FirewallRules', { ...@@ -476,6 +494,10 @@ Ext.define('PVE.FirewallRules', {
/*jslint confusion: true */ /*jslint confusion: true */
var me = this; var me = this;
if (!me.ipset_base_url) {
throw "no ipset_base_url specified";
}
var store = new Ext.data.Store({ var store = new Ext.data.Store({
model: 'pve-fw-rule' model: 'pve-fw-rule'
}); });
...@@ -506,6 +528,7 @@ Ext.define('PVE.FirewallRules', { ...@@ -506,6 +528,7 @@ Ext.define('PVE.FirewallRules', {
digest: rec.data.digest, digest: rec.data.digest,
allow_iface: me.allow_iface, allow_iface: me.allow_iface,
base_url: me.base_url, base_url: me.base_url,
ipset_base_url: me.ipset_base_url,
rule_pos: rec.data.pos rule_pos: rec.data.pos
}); });
...@@ -526,7 +549,8 @@ Ext.define('PVE.FirewallRules', { ...@@ -526,7 +549,8 @@ Ext.define('PVE.FirewallRules', {
handler: function() { handler: function() {
var win = Ext.create('PVE.FirewallRuleEdit', { var win = Ext.create('PVE.FirewallRuleEdit', {
allow_iface: me.allow_iface, allow_iface: me.allow_iface,
base_url: me.base_url base_url: me.base_url,
ipset_base_url: me.ipset_base_url
}); });
win.on('destroy', reload); win.on('destroy', reload);
win.show(); win.show();
......
...@@ -26,6 +26,8 @@ Ext.define('PVE.panel.Firewall', { ...@@ -26,6 +26,8 @@ Ext.define('PVE.panel.Firewall', {
title: 'Rules', title: 'Rules',
allow_iface: true, allow_iface: true,
base_url: me.base_url + '/rules', base_url: me.base_url + '/rules',
ipset_base_url: me.fwtype === 'vm' ? (me.base_url + '/ipset') :
'/cluster/firewall/ipset',
itemId: 'rules' itemId: 'rules'
} }
]; ];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment