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
10ad5fcd
authored
May 22, 2013
by
Bence Dányi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
firewall_gui: format js
parent
f37d6bc9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
20 deletions
+22
-20
firewall_gui/static/js/project.js
+22
-20
No files found.
firewall_gui/static/js/project.js
View file @
10ad5fcd
...
@@ -37,7 +37,7 @@ $.ajaxSetup({
...
@@ -37,7 +37,7 @@ $.ajaxSetup({
});
});
function
makeAddRemove
(
$scope
,
name
,
model
)
{
function
makeAddRemove
(
$scope
,
name
,
model
)
{
$scope
[
'add'
+
name
]
=
function
(
entity
)
{
$scope
[
'add'
+
name
]
=
function
(
entity
)
{
for
(
var
i
in
$scope
.
entity
[
model
])
{
for
(
var
i
in
$scope
.
entity
[
model
])
{
var
item
=
$scope
.
entity
[
model
][
i
];
var
item
=
$scope
.
entity
[
model
][
i
];
if
(
item
.
name
==
entity
&&
item
.
__destroyed
)
{
if
(
item
.
name
==
entity
&&
item
.
__destroyed
)
{
...
@@ -52,7 +52,7 @@ function makeAddRemove($scope, name, model) {
...
@@ -52,7 +52,7 @@ function makeAddRemove($scope, name, model) {
__created
:
true
,
__created
:
true
,
});
});
}
}
$scope
[
'remove'
+
name
]
=
function
(
entity
)
{
$scope
[
'remove'
+
name
]
=
function
(
entity
)
{
for
(
var
i
in
$scope
.
entity
[
model
])
{
for
(
var
i
in
$scope
.
entity
[
model
])
{
var
item
=
$scope
.
entity
[
model
][
i
];
var
item
=
$scope
.
entity
[
model
][
i
];
if
(
item
.
name
==
entity
.
name
&&
item
.
__created
)
{
if
(
item
.
name
==
entity
.
name
&&
item
.
__created
)
{
...
@@ -118,21 +118,23 @@ var controllers = {
...
@@ -118,21 +118,23 @@ var controllers = {
* Configures AngularJS with the defined controllers
* Configures AngularJS with the defined controllers
*/
*/
var
module
=
angular
.
module
(
'firewall'
,
[]).
config
(
var
module
=
angular
.
module
(
'firewall'
,
[]).
config
(
[
'$routeProvider'
,
function
(
$routeProvider
)
{
[
'$routeProvider'
,
for
(
var
controller
in
controllers
)
{
function
(
$routeProvider
)
{
var
init
=
controllers
[
controller
];
for
(
var
controller
in
controllers
)
{
$routeProvider
.
when
(
'/'
+
controller
+
's/'
,
{
var
init
=
controllers
[
controller
];
templateUrl
:
'/static/partials/'
+
controller
+
'-list.html'
,
$routeProvider
.
when
(
'/'
+
controller
+
's/'
,
{
controller
:
ListController
(
'/firewall/'
+
controller
+
's/'
)
templateUrl
:
'/static/partials/'
+
controller
+
'-list.html'
,
}).
when
(
'/'
+
controller
+
's/:id/'
,
{
controller
:
ListController
(
'/firewall/'
+
controller
+
's/'
)
templateUrl
:
'/static/partials/'
+
controller
+
'-edit.html'
,
}).
when
(
'/'
+
controller
+
's/:id/'
,
{
controller
:
EntityController
(
'/firewall/'
+
controller
+
's/'
,
init
)
templateUrl
:
'/static/partials/'
+
controller
+
'-edit.html'
,
controller
:
EntityController
(
'/firewall/'
+
controller
+
's/'
,
init
)
});
}
$routeProvider
.
otherwise
({
redirectTo
:
'/rules/'
});
});
}
}
$routeProvider
.
otherwise
({
]);
redirectTo
:
'/rules/'
});
}]);
/**
/**
* Generate range [a, b)
* Generate range [a, b)
...
@@ -271,19 +273,19 @@ function EntityController(url, init) {
...
@@ -271,19 +273,19 @@ function EntityController(url, init) {
data
:
JSON
.
stringify
(
$scope
.
entity
),
data
:
JSON
.
stringify
(
$scope
.
entity
),
success
:
function
(
data
)
{
success
:
function
(
data
)
{
console
.
log
(
data
);
console
.
log
(
data
);
$scope
.
$apply
(
function
(){
$scope
.
$apply
(
function
()
{
$scope
.
errors
=
{};
$scope
.
errors
=
{};
})
})
}
}
}).
error
(
function
(
data
){
}).
error
(
function
(
data
)
{
try
{
try
{
data
=
JSON
.
parse
(
data
.
responseText
);
data
=
JSON
.
parse
(
data
.
responseText
);
var
newErrors
=
{};
var
newErrors
=
{};
for
(
var
i
in
data
)
{
for
(
var
i
in
data
)
{
var
id
=
$
(
'#'
+
i
).
length
?
i
:
'targetName'
;
var
id
=
$
(
'#'
+
i
).
length
?
i
:
'targetName'
;
newErrors
[
id
]
=
data
[
i
];
newErrors
[
id
]
=
data
[
i
];
}
}
$scope
.
$apply
(
function
(){
$scope
.
$apply
(
function
()
{
$scope
.
errors
=
newErrors
;
$scope
.
errors
=
newErrors
;
})
})
}
catch
(
ex
)
{
}
catch
(
ex
)
{
...
...
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