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
7e62b497
authored
Apr 26, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: universal match function added
parent
a2ee0bbd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
9 deletions
+9
-9
firewall_gui/static/js/project.js
+9
-9
No files found.
firewall_gui/static/js/project.js
View file @
7e62b497
...
@@ -16,14 +16,14 @@ function range(a, b) {
...
@@ -16,14 +16,14 @@ function range(a, b) {
return
res
;
return
res
;
}
}
function
ruleMatch
(
rule
,
query
)
{
function
matchAnything
(
obj
,
query
)
{
return
rule
.
description
.
match
(
query
)
||
for
(
var
i
in
obj
)
{
rule
.
proto
&&
rule
.
proto
.
match
(
query
)
||
var
prop
=
obj
[
i
];
rule
.
target
.
name
.
match
(
query
)
||
if
(
typeof
prop
===
'number'
&&
prop
==
query
)
return
true
;
rule
.
direction
.
match
(
query
)
||
if
(
typeof
prop
===
'string'
&&
prop
.
match
(
query
))
return
true
;
rule
.
owner
.
name
.
match
(
query
)
||
if
(
typeof
prop
===
'object'
&&
matchAnything
(
prop
,
query
))
return
true
;
rule
.
type
.
match
(
query
)
||
}
r
ule
.
foreignNetwork
.
name
.
match
(
query
)
;
r
eturn
false
;
}
}
function
RuleListCtrl
(
$scope
,
$http
,
$routeParams
)
{
function
RuleListCtrl
(
$scope
,
$http
,
$routeParams
)
{
...
@@ -36,7 +36,7 @@ function RuleListCtrl($scope, $http, $routeParams) {
...
@@ -36,7 +36,7 @@ function RuleListCtrl($scope, $http, $routeParams) {
if
(
$scope
.
query
)
{
if
(
$scope
.
query
)
{
for
(
var
i
in
rules
)
{
for
(
var
i
in
rules
)
{
var
rule
=
rules
[
i
];
var
rule
=
rules
[
i
];
if
(
ruleMatch
(
rule
,
$scope
.
query
))
{
if
(
matchAnything
(
rule
,
$scope
.
query
))
{
res
.
push
(
rule
);
res
.
push
(
rule
);
}
}
}
}
...
...
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