Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Fukász Rómeó Ervin
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
0da1ad15
authored
May 07, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: typeahead added
parent
6e156b87
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
3 deletions
+39
-3
firewall_gui/static/js/project.js
+17
-0
firewall_gui/static/partials/rule-edit.html
+21
-2
firewall_gui/views.py
+1
-1
No files found.
firewall_gui/static/js/project.js
View file @
0da1ad15
...
@@ -119,6 +119,23 @@ function EntityController(url) {
...
@@ -119,6 +119,23 @@ function EntityController(url) {
$http
.
get
(
url
+
id
+
'/'
).
success
(
function
success
(
data
)
{
$http
.
get
(
url
+
id
+
'/'
).
success
(
function
success
(
data
)
{
console
.
log
(
data
);
console
.
log
(
data
);
$scope
.
rule
=
data
;
$scope
.
rule
=
data
;
$
(
'#targetName'
).
typeahead
({
source
:
function
(
query
,
process
)
{
$
.
ajax
({
url
:
'/firewall/autocomplete/'
+
data
.
target
.
type
+
'/'
,
type
:
'post'
,
data
:
'name='
+
query
,
success
:
function
autocompleteSuccess
(
data
)
{
process
(
data
.
map
(
function
(
obj
)
{
return
obj
.
name
;
}));
}
});
},
matcher
:
function
()
{
return
true
;
}
});
});
});
}
}
}
}
firewall_gui/static/partials/rule-edit.html
View file @
0da1ad15
...
@@ -6,9 +6,28 @@
...
@@ -6,9 +6,28 @@
</div>
</div>
</div>
</div>
<div
class=
"control-group"
>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"
inputPassword"
>
Password
</label>
<label
class=
"control-label"
for=
"
targetType"
>
Target type
</label>
<div
class=
"controls"
>
<div
class=
"controls"
>
<input
type=
"password"
id=
"inputPassword"
placeholder=
"Password"
>
<select
id=
"targetType"
>
<option
value=
"vlan"
>
Vlan
</option>
<option
value=
"vlangroup"
>
VlanGroup
</option>
<option
value=
"host"
>
Host
</option>
<option
value=
"hostgroup"
>
HostGroup
</option>
<option
value=
"firewall"
>
Firewall
</option>
</select>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"targetName"
>
Target
</label>
<div
class=
"controls"
>
<input
type=
"text"
data-provide=
"typeahead"
autocomplete=
"off"
id=
"targetName"
value=
"{{rule.target.name}}"
/>
</div>
</div>
<div
class=
"control-group"
>
<label
class=
"control-label"
for=
"direction"
>
Direction
</label>
<div
class=
"controls"
>
<select
id=
"direction"
ng-options=
"choice[0] as choice[1] for choice in rule.direction.choices"
ng-model=
"rule.direction.value"
>
</select>
</div>
</div>
</div>
</div>
<div
class=
"control-group"
>
<div
class=
"control-group"
>
...
...
firewall_gui/views.py
View file @
0da1ad15
...
@@ -264,7 +264,7 @@ def autocomplete_hostgroup(request):
...
@@ -264,7 +264,7 @@ def autocomplete_hostgroup(request):
def
autocomplete_host
(
request
):
def
autocomplete_host
(
request
):
return
HttpResponse
(
json
.
dumps
([{
return
HttpResponse
(
json
.
dumps
([{
'id'
:
host
.
id
,
'id'
:
host
.
id
,
'name'
:
host
.
name
'name'
:
host
.
host
name
}
for
host
in
Host
.
objects
.
filter
(
hostname__icontains
=
request
.
POST
[
'name'
])[:
5
]]),
content_type
=
'application/json'
)
}
for
host
in
Host
.
objects
.
filter
(
hostname__icontains
=
request
.
POST
[
'name'
])[:
5
]]),
content_type
=
'application/json'
)
def
autocomplete_firewall
(
request
):
def
autocomplete_firewall
(
request
):
...
...
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