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