Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE
/
cloud
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
94
Merge Requests
10
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
A prog2-höz tartozó friss repo anyagok itt elérhetőek:
https://git.iit.bme.hu/
Commit
e49f0177
authored
May 16, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: generic functions for collection management
parent
8da01acd
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
54 deletions
+34
-54
firewall_gui/static/js/project.js
+34
-54
No files found.
firewall_gui/static/js/project.js
View file @
e49f0177
...
...
@@ -36,6 +36,35 @@ $.ajaxSetup({
}
});
function
makeAddRemove
(
$scope
,
name
,
model
)
{
$scope
[
'add'
+
name
]
=
function
(
entity
)
{
for
(
var
i
in
$scope
.
entity
[
model
])
{
var
item
=
$scope
.
entity
[
model
][
i
];
if
(
item
.
name
==
entity
&&
item
.
__destroyed
)
{
item
.
__destroyed
=
false
;
return
;
}
else
if
(
item
.
name
==
entity
)
{
return
;
}
}
$scope
.
entity
[
model
].
push
({
name
:
entity
,
__created
:
true
,
});
}
$scope
[
'remove'
+
name
]
=
function
(
entity
)
{
for
(
var
i
in
$scope
.
entity
[
model
])
{
var
item
=
$scope
.
entity
[
model
][
i
];
if
(
item
.
name
==
entity
.
name
&&
item
.
__created
)
{
$scope
.
entity
[
model
].
splice
(
i
,
1
);
}
else
if
(
item
.
name
==
entity
.
name
)
{
item
.
__destroyed
=
true
;
return
;
}
}
}
}
/**
* List of firewall collections, controllers/routes will be dynamically created from them.
*
...
...
@@ -71,63 +100,14 @@ var controllers = {
});
},
host
:
function
(
$scope
)
{
$scope
.
addHostGroup
=
function
(
group
)
{
for
(
var
i
in
$scope
.
entity
.
groups
)
{
var
group_
=
$scope
.
entity
.
groups
[
i
];
if
(
group_
.
name
==
group
&&
group_
.
__destroyed
)
{
group_
.
__destroyed
=
false
;
return
;
}
else
if
(
group_
.
name
==
group
)
{
return
;
}
}
$scope
.
entity
.
groups
.
push
({
name
:
group
,
__created
:
true
,
})
}
$scope
.
removeHostGroup
=
function
(
group
)
{
for
(
var
i
in
$scope
.
entity
.
groups
)
{
var
group_
=
$scope
.
entity
.
groups
[
i
];
if
(
group_
.
name
==
group
.
name
&&
group_
.
__created
)
{
$scope
.
entity
.
groups
.
splice
(
i
,
1
);
}
else
if
(
group_
.
name
==
group
.
name
)
{
group_
.
__destroyed
=
true
;
return
;
}
}
}
makeAddRemove
(
$scope
,
'HostGroup'
,
'groups'
);
},
vlan
:
function
(
$scope
)
{
$scope
.
newVlan
=
''
;
$scope
.
addVlan
=
function
(
vlan
)
{
for
(
var
i
in
$scope
.
entity
.
vlans
)
{
var
vlan_
=
$scope
.
entity
.
vlans
[
i
];
if
(
vlan_
.
name
==
vlan
&&
vlan_
.
__destroyed
)
{
vlan_
.
__destroyed
=
false
;
return
;
}
else
if
(
vlan_
.
name
==
vlan
)
{
return
;
}
}
$scope
.
entity
.
vlans
.
push
({
name
:
vlan
,
__created
:
true
,
})
}
$scope
.
removeVlan
=
function
(
vlan
)
{
for
(
var
i
in
$scope
.
entity
.
vlans
)
{
var
vlan_
=
$scope
.
entity
.
vlans
[
i
];
if
(
vlan_
.
name
==
vlan
.
name
&&
vlan_
.
__created
)
{
$scope
.
entity
.
vlans
.
splice
(
i
,
1
);
}
else
if
(
vlan_
.
name
==
vlan
.
name
)
{
vlan_
.
__destroyed
=
true
;
return
;
}
}
}
makeAddRemove
(
$scope
,
'Vlan'
,
'vlans'
);
},
vlangroup
:
function
(
$scope
)
{
makeAddRemove
(
$scope
,
'Vlan'
,
'vlans'
);
},
vlangroup
:
function
()
{},
hostgroup
:
function
()
{},
firewall
:
function
()
{},
domain
:
function
()
{},
...
...
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