Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
pve-manager
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
pve-manager
Commits
778a7af5
Commit
778a7af5
authored
May 30, 2014
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rename IPSetSelector to IPRefSelector, and use it in IPSet
parent
df3feb46
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
106 additions
and
56 deletions
+106
-56
Makefile
www/manager/Makefile
+1
-1
SecurityGroups.js
www/manager/dc/SecurityGroups.js
+1
-1
IPRefSelector.js
www/manager/form/IPRefSelector.js
+38
-25
FirewallRules.js
www/manager/grid/FirewallRules.js
+16
-16
Firewall.js
www/manager/panel/Firewall.js
+7
-3
IPSet.js
www/manager/panel/IPSet.js
+43
-10
No files found.
www/manager/Makefile
View file @
778a7af5
...
...
@@ -44,7 +44,7 @@ JSSRC= \
form/StorageSelector.js
\
form/BridgeSelector.js
\
form/SecurityGroupSelector.js
\
form/IP
Set
Selector.js
\
form/IP
Ref
Selector.js
\
form/IPProtocolSelector.js
\
form/CPUModelSelector.js
\
form/VNCKeyboardSelector.js
\
...
...
www/manager/dc/SecurityGroups.js
View file @
778a7af5
...
...
@@ -200,7 +200,7 @@ Ext.define('PVE.SecurityGroups', {
var
rule_panel
=
Ext
.
createWidget
(
'
pveFirewallRules
'
,
{
region
:
'
center
'
,
allow_groups
:
false
,
ipset_base
_url
:
'
/cluster/firewall/refs
'
,
list_refs
_url
:
'
/cluster/firewall/refs
'
,
tbar_prefix
:
'
<b>
'
+
gettext
(
'
Rules
'
)
+
'
:</b>
'
,
flex
:
0.75
,
border
:
false
...
...
www/manager/form/IP
Set
Selector.js
→
www/manager/form/IP
Ref
Selector.js
View file @
778a7af5
Ext
.
define
(
'
PVE.form.IP
Set
Selector
'
,
{
Ext
.
define
(
'
PVE.form.IP
Ref
Selector
'
,
{
extend
:
'
PVE.form.ComboGrid
'
,
alias
:
[
'
widget.pveIP
Set
Selector
'
],
alias
:
[
'
widget.pveIP
Ref
Selector
'
],
base_url
:
undefined
,
preferredValue
:
''
,
// hack: else Form sets dirty flag?
ref_type
:
undefined
,
// undefined = any [undefined, 'ipset' or 'alias']
initComponent
:
function
()
{
var
me
=
this
;
...
...
@@ -13,13 +15,18 @@ Ext.define('PVE.form.IPSetSelector', {
throw
"
no base_url specified
"
;
}
var
url
=
"
/api2/json
"
+
me
.
base_url
;
if
(
me
.
ref_type
)
{
url
+=
"
?type=
"
+
me
.
ref_type
;
}
var
store
=
Ext
.
create
(
'
Ext.data.Store
'
,
{
autoLoad
:
true
,
fields
:
[
'
type
'
,
'
name
'
,
'
ref
'
,
'
comment
'
],
idProperty
:
'
ref
'
,
proxy
:
{
type
:
'
pve
'
,
url
:
"
/api2/json
"
+
me
.
base_
url
url
:
url
},
sorters
:
{
property
:
'
ref
'
,
...
...
@@ -28,38 +35,44 @@ Ext.define('PVE.form.IPSetSelector', {
});
var
disable_query_for_ips
=
function
(
f
,
value
)
{
if
(
value
.
match
(
/^
\d
/
))
{
// IP address starts with \d
if
(
value
===
null
||
value
.
match
(
/^
\d
/
))
{
// IP address starts with \d
f
.
queryDelay
=
9999999999
;
// hack: disbale with long delay
}
else
{
f
.
queryDelay
=
10
;
}
};
var
columns
=
[];
if
(
!
me
.
ref_type
)
{
columns
.
push
({
header
:
gettext
(
'
Type
'
),
dataIndex
:
'
type
'
,
hideable
:
false
,
width
:
60
});
}
columns
.
push
([
{
header
:
gettext
(
'
Name
'
),
dataIndex
:
'
ref
'
,
hideable
:
false
,
width
:
140
},
{
header
:
gettext
(
'
Comment
'
),
dataIndex
:
'
comment
'
,
flex
:
1
}
]);
Ext
.
apply
(
me
,
{
store
:
store
,
valueField
:
'
ref
'
,
displayField
:
'
ref
'
,
listConfig
:
{
columns
:
[
{
header
:
gettext
(
'
Type
'
),
dataIndex
:
'
type
'
,
hideable
:
false
,
width
:
60
},
{
header
:
gettext
(
'
Name
'
),
dataIndex
:
'
ref
'
,
hideable
:
false
,
width
:
140
},
{
header
:
gettext
(
'
Comment
'
),
dataIndex
:
'
comment
'
,
flex
:
1
}
]
}
listConfig
:
{
columns
:
columns
}
});
me
.
on
(
'
change
'
,
disable_query_for_ips
);
...
...
www/manager/grid/FirewallRules.js
View file @
778a7af5
...
...
@@ -51,7 +51,7 @@ Ext.define('PVE.FirewallRulePanel', {
allow_iface
:
false
,
ipset_base
_url
:
undefined
,
list_refs
_url
:
undefined
,
onGetValues
:
function
(
values
)
{
var
me
=
this
;
...
...
@@ -73,8 +73,8 @@ Ext.define('PVE.FirewallRulePanel', {
initComponent
:
function
()
{
var
me
=
this
;
if
(
!
me
.
ipset_base
_url
)
{
throw
"
no
ipset_base
_url specified
"
;
if
(
!
me
.
list_refs
_url
)
{
throw
"
no
list_refs
_url specified
"
;
}
me
.
column1
=
[
...
...
@@ -129,21 +129,21 @@ Ext.define('PVE.FirewallRulePanel', {
value
:
''
},
{
xtype
:
'
pveIP
Set
Selector
'
,
xtype
:
'
pveIP
Ref
Selector
'
,
name
:
'
source
'
,
autoSelect
:
false
,
editable
:
true
,
base_url
:
me
.
ipset_base
_url
,
base_url
:
me
.
list_refs
_url
,
value
:
''
,
fieldLabel
:
gettext
(
'
Source
'
)
},
{
xtype
:
'
pveIP
Set
Selector
'
,
xtype
:
'
pveIP
Ref
Selector
'
,
name
:
'
dest
'
,
autoSelect
:
false
,
editable
:
true
,
base_url
:
me
.
ipset_base
_url
,
base_url
:
me
.
list_refs
_url
,
value
:
''
,
fieldLabel
:
gettext
(
'
Destination
'
)
}
...
...
@@ -228,7 +228,7 @@ Ext.define('PVE.FirewallRuleEdit', {
extend
:
'
PVE.window.Edit
'
,
base_url
:
undefined
,
ipset_base
_url
:
undefined
,
list_refs
_url
:
undefined
,
allow_iface
:
false
,
...
...
@@ -239,8 +239,8 @@ Ext.define('PVE.FirewallRuleEdit', {
if
(
!
me
.
base_url
)
{
throw
"
no base_url specified
"
;
}
if
(
!
me
.
ipset_base
_url
)
{
throw
"
no
ipset_base
_url specified
"
;
if
(
!
me
.
list_refs
_url
)
{
throw
"
no
list_refs
_url specified
"
;
}
me
.
create
=
(
me
.
rule_pos
===
undefined
);
...
...
@@ -255,7 +255,7 @@ Ext.define('PVE.FirewallRuleEdit', {
var
ipanel
=
Ext
.
create
(
'
PVE.FirewallRulePanel
'
,
{
create
:
me
.
create
,
ipset_base_url
:
me
.
ipset_base
_url
,
list_refs_url
:
me
.
list_refs
_url
,
allow_iface
:
me
.
allow_iface
,
rule_pos
:
me
.
rule_pos
});
...
...
@@ -380,7 +380,7 @@ Ext.define('PVE.FirewallRules', {
alias
:
'
widget.pveFirewallRules
'
,
base_url
:
undefined
,
ipset_base
_url
:
undefined
,
list_refs
_url
:
undefined
,
addBtn
:
undefined
,
removeBtn
:
undefined
,
...
...
@@ -490,8 +490,8 @@ Ext.define('PVE.FirewallRules', {
/*jslint confusion: true */
var
me
=
this
;
if
(
!
me
.
ipset_base
_url
)
{
throw
"
no
ipset_base
_url specified
"
;
if
(
!
me
.
list_refs
_url
)
{
throw
"
no
list_refs
_url specified
"
;
}
var
store
=
new
Ext
.
data
.
Store
({
...
...
@@ -524,7 +524,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
,
list_refs_url
:
me
.
list_refs
_url
,
rule_pos
:
rec
.
data
.
pos
});
...
...
@@ -546,7 +546,7 @@ Ext.define('PVE.FirewallRules', {
var
win
=
Ext
.
create
(
'
PVE.FirewallRuleEdit
'
,
{
allow_iface
:
me
.
allow_iface
,
base_url
:
me
.
base_url
,
ipset_base_url
:
me
.
ipset_base
_url
list_refs_url
:
me
.
list_refs
_url
});
win
.
on
(
'
destroy
'
,
reload
);
win
.
show
();
...
...
www/manager/panel/Firewall.js
View file @
778a7af5
...
...
@@ -20,14 +20,16 @@ Ext.define('PVE.panel.Firewall', {
throw
"
unknown firewall panel type
"
;
}
var
list_refs_url
=
me
.
fwtype
===
'
vm
'
?
(
me
.
base_url
+
'
/refs
'
)
:
'
/cluster/firewall/refs
'
;
var
items
=
[
{
xtype
:
'
pveFirewallRules
'
,
title
:
'
Rules
'
,
allow_iface
:
true
,
base_url
:
me
.
base_url
+
'
/rules
'
,
ipset_base_url
:
me
.
fwtype
===
'
vm
'
?
(
me
.
base_url
+
'
/refs
'
)
:
'
/cluster/firewall/refs
'
,
list_refs_url
:
list_refs_url
,
itemId
:
'
rules
'
}
];
...
...
@@ -45,7 +47,8 @@ Ext.define('PVE.panel.Firewall', {
});
items
.
push
({
xtype
:
'
pveIPSet
'
,
base_url
:
'
/cluster/firewall/ipset
'
,
base_url
:
'
/cluster/firewall/ipset
'
,
list_refs_url
:
list_refs_url
,
itemId
:
'
ipset
'
});
}
...
...
@@ -59,6 +62,7 @@ Ext.define('PVE.panel.Firewall', {
items
.
push
({
xtype
:
'
pveIPSet
'
,
base_url
:
me
.
base_url
+
'
/ipset
'
,
list_refs_url
:
list_refs_url
,
itemId
:
'
ipset
'
});
}
...
...
www/manager/panel/IPSet.js
View file @
778a7af5
...
...
@@ -180,6 +180,7 @@ Ext.define('PVE.IPSetCidrEdit', {
me
.
create
=
(
me
.
cidr
===
undefined
);
if
(
me
.
create
)
{
me
.
url
=
'
/api2/extjs
'
+
me
.
base_url
;
me
.
method
=
'
POST
'
;
...
...
@@ -188,17 +189,36 @@ Ext.define('PVE.IPSetCidrEdit', {
me
.
method
=
'
PUT
'
;
}
var
column1
=
[];
if
(
me
.
create
)
{
if
(
!
me
.
list_refs_url
)
{
throw
"
no alias_base_url specified
"
;
}
column1
.
push
({
xtype
:
'
pveIPRefSelector
'
,
name
:
'
cidr
'
,
ref_type
:
'
alias
'
,
autoSelect
:
false
,
editable
:
true
,
base_url
:
me
.
list_refs_url
,
value
:
''
,
fieldLabel
:
gettext
(
'
IP/CIDR
'
)
});
}
else
{
column1
.
push
({
xtype
:
'
displayfield
'
,
name
:
'
cidr
'
,
height
:
22
,
// hack: set same height as text fields
value
:
''
,
fieldLabel
:
gettext
(
'
IP/CIDR
'
)
});
}
var
ipanel
=
Ext
.
create
(
'
PVE.panel.InputPanel
'
,
{
create
:
me
.
create
,
column1
:
[
{
xtype
:
me
.
create
?
'
textfield
'
:
'
displayfield
'
,
name
:
'
cidr
'
,
height
:
22
,
// hack: set same height as text fields
value
:
''
,
fieldLabel
:
gettext
(
'
IP/CIDR
'
)
}
],
column1
:
column1
,
column2
:
[
{
xtype
:
'
pvecheckbox
'
,
...
...
@@ -242,6 +262,7 @@ Ext.define('PVE.IPSetGrid', {
alias
:
'
widget.pveIPSetGrid
'
,
base_url
:
undefined
,
list_refs_url
:
undefined
,
addBtn
:
undefined
,
removeBtn
:
undefined
,
...
...
@@ -270,6 +291,10 @@ Ext.define('PVE.IPSetGrid', {
/*jslint confusion: true */
var
me
=
this
;
if
(
!
me
.
list_refs_url
)
{
throw
"
no1 list_refs_url specified
"
;
}
var
store
=
new
Ext
.
data
.
Store
({
model
:
'
pve-ipset
'
});
...
...
@@ -308,7 +333,8 @@ Ext.define('PVE.IPSetGrid', {
return
;
}
var
win
=
Ext
.
create
(
'
PVE.IPSetCidrEdit
'
,
{
base_url
:
me
.
base_url
base_url
:
me
.
base_url
,
list_refs_url
:
me
.
list_refs_url
});
win
.
show
();
win
.
on
(
'
destroy
'
,
reload
);
...
...
@@ -393,11 +419,18 @@ Ext.define('PVE.IPSet', {
title
:
'
IPSet
'
,
list_refs_url
:
undefined
,
initComponent
:
function
()
{
var
me
=
this
;
if
(
!
me
.
list_refs_url
)
{
throw
"
no list_refs_url specified
"
;
}
var
ipset_panel
=
Ext
.
createWidget
(
'
pveIPSetGrid
'
,
{
region
:
'
center
'
,
list_refs_url
:
me
.
list_refs_url
,
flex
:
0.5
,
border
:
false
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment