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
ddd1c83c
Commit
ddd1c83c
authored
Jul 03, 2015
by
Dietmar Maurer
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
copy grid/FirewallAliases.js from manager to manager5
parent
5f5b408b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
185 additions
and
0 deletions
+185
-0
FirewallAliases.js
www/manager5/grid/FirewallAliases.js
+185
-0
No files found.
www/manager5/grid/FirewallAliases.js
0 → 100644
View file @
ddd1c83c
Ext
.
define
(
'
PVE.FirewallAliasEdit
'
,
{
extend
:
'
PVE.window.Edit
'
,
base_url
:
undefined
,
alias_name
:
undefined
,
initComponent
:
function
()
{
/*jslint confusion: true */
var
me
=
this
;
me
.
create
=
(
me
.
alias_name
===
undefined
);
if
(
me
.
create
)
{
me
.
url
=
'
/api2/extjs
'
+
me
.
base_url
;
me
.
method
=
'
POST
'
;
}
else
{
me
.
url
=
'
/api2/extjs
'
+
me
.
base_url
+
'
/
'
+
me
.
alias_name
;
me
.
method
=
'
PUT
'
;
}
var
items
=
[
{
xtype
:
'
textfield
'
,
name
:
me
.
create
?
'
name
'
:
'
rename
'
,
fieldLabel
:
gettext
(
'
Name
'
),
allowBlank
:
false
},
{
xtype
:
'
textfield
'
,
name
:
'
cidr
'
,
fieldLabel
:
gettext
(
'
IP/CIDR
'
),
allowBlank
:
false
},
{
xtype
:
'
textfield
'
,
name
:
'
comment
'
,
fieldLabel
:
gettext
(
'
Comment
'
)
}
];
var
ipanel
=
Ext
.
create
(
'
PVE.panel.InputPanel
'
,
{
create
:
me
.
create
,
items
:
items
});
Ext
.
apply
(
me
,
{
subject
:
gettext
(
'
Alias
'
),
isAdd
:
true
,
items
:
[
ipanel
]
});
me
.
callParent
();
if
(
!
me
.
create
)
{
me
.
load
({
success
:
function
(
response
,
options
)
{
var
values
=
response
.
result
.
data
;
values
.
rename
=
values
.
name
;
ipanel
.
setValues
(
values
);
}
});
}
}
});
Ext
.
define
(
'
PVE.FirewallAliases
'
,
{
extend
:
'
Ext.grid.Panel
'
,
alias
:
[
'
widget.pveFirewallAliases
'
],
base_url
:
undefined
,
title
:
gettext
(
'
Alias
'
),
initComponent
:
function
()
{
/*jslint confusion: true */
var
me
=
this
;
if
(
!
me
.
base_url
)
{
throw
"
missing base_url configuration
"
;
}
var
store
=
new
Ext
.
data
.
Store
({
fields
:
[
'
name
'
,
'
cidr
'
,
'
comment
'
,
'
digest
'
],
proxy
:
{
type
:
'
pve
'
,
url
:
"
/api2/json
"
+
me
.
base_url
},
idProperty
:
'
name
'
,
sorters
:
{
property
:
'
name
'
,
order
:
'
DESC
'
}
});
var
sm
=
Ext
.
create
(
'
Ext.selection.RowModel
'
,
{});
var
reload
=
function
()
{
var
oldrec
=
sm
.
getSelection
()[
0
];
store
.
load
(
function
(
records
,
operation
,
success
)
{
if
(
oldrec
)
{
var
rec
=
store
.
findRecord
(
'
name
'
,
oldrec
.
data
.
name
);
if
(
rec
)
{
sm
.
select
(
rec
);
}
}
});
};
var
run_editor
=
function
()
{
var
sm
=
me
.
getSelectionModel
();
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
var
win
=
Ext
.
create
(
'
PVE.FirewallAliasEdit
'
,
{
base_url
:
me
.
base_url
,
alias_name
:
rec
.
data
.
name
});
win
.
show
();
win
.
on
(
'
destroy
'
,
reload
);
};
me
.
editBtn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Edit
'
),
disabled
:
true
,
selModel
:
sm
,
handler
:
run_editor
});
me
.
addBtn
=
Ext
.
create
(
'
Ext.Button
'
,
{
text
:
gettext
(
'
Add
'
),
handler
:
function
()
{
var
win
=
Ext
.
create
(
'
PVE.FirewallAliasEdit
'
,
{
base_url
:
me
.
base_url
});
win
.
on
(
'
destroy
'
,
reload
);
win
.
show
();
}
});
me
.
removeBtn
=
new
PVE
.
button
.
Button
({
text
:
gettext
(
'
Remove
'
),
selModel
:
sm
,
disabled
:
true
,
handler
:
function
()
{
var
rec
=
sm
.
getSelection
()[
0
];
if
(
!
rec
)
{
return
;
}
PVE
.
Utils
.
API2Request
({
url
:
me
.
base_url
+
'
/
'
+
rec
.
data
.
name
,
method
:
'
DELETE
'
,
waitMsgTarget
:
me
,
failure
:
function
(
response
,
options
)
{
Ext
.
Msg
.
alert
(
gettext
(
'
Error
'
),
response
.
htmlStatus
);
},
callback
:
reload
});
}
});
Ext
.
applyIf
(
me
,
{
store
:
store
,
tbar
:
[
me
.
addBtn
,
me
.
removeBtn
,
me
.
editBtn
],
selModel
:
sm
,
columns
:
[
{
header
:
gettext
(
'
Name
'
),
dataIndex
:
'
name
'
,
width
:
100
},
{
header
:
gettext
(
'
IP/CIDR
'
),
dataIndex
:
'
cidr
'
,
width
:
100
},
{
header
:
gettext
(
'
Comment
'
),
dataIndex
:
'
comment
'
,
flex
:
1
}
],
listeners
:
{
itemdblclick
:
run_editor
}
});
me
.
callParent
();
me
.
on
(
'
show
'
,
reload
);
}
});
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