Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
fabio martelli
syncope
Commits
a8526333
Commit
a8526333
authored
Nov 10, 2016
by
fabio martelli
Browse files
Fix for choreography unsubscription
parent
280de168
Changes
3
Hide whitespace changes
Inline
Side-by-side
enduser/src/main/webapp/app/js/controllers/UserController.js
View file @
a8526333
...
...
@@ -197,7 +197,7 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
$scope
.
dynamicForm
.
groups
=
new
Array
();
for
(
var
i
in
response
.
groups
)
{
$scope
.
dynamicForm
.
groups
.
push
({
"
rightKey
"
:
response
.
groups
[
i
].
key
,
"
groupName
"
:
response
.
groups
[
i
].
name
});
}
}
for
(
var
i
in
response
.
choreographies
)
{
$scope
.
dynamicForm
.
choreographies
.
push
({
"
rightKey
"
:
response
.
choreographies
[
i
].
key
,
"
groupName
"
:
response
.
choreographies
[
i
].
name
});
}
...
...
@@ -317,24 +317,34 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
var
removeUserSchemas
=
function
(
anyTypeClass
,
group
)
{
//removing plain groupSchemas
// console.log("remove schemas");
// console.log("start: $scope.dynamicForm.groupSchemas", $scope.dynamicForm.groupSchemas);
for
(
var
i
=
0
;
i
<
$scope
.
dynamicForm
.
groupSchemas
.
length
;
i
++
)
{
// console.log("iterazione ", i);
// console.log("1 $scope.dynamicForm.groupSchemas[i]", $scope.dynamicForm.groupSchemas[i]);
if
(
$scope
.
dynamicForm
.
groupSchemas
[
i
]
===
group
)
{
console
.
log
(
"
eliminazione di
"
,
$scope
.
dynamicForm
.
groupSchemas
[
i
]);
$scope
.
dynamicForm
.
groupSchemas
.
splice
(
i
,
1
);
i
--
;
}
}
console
.
log
(
"
result: $scope.dynamicForm.groupSchemas
"
,
$scope
.
dynamicForm
.
groupSchemas
);
//removing plain schemas
for
(
var
i
=
0
;
i
<
$scope
.
dynamicForm
.
plainSchemas
.
length
;
i
++
)
{
if
((
anyTypeClass
&&
$scope
.
dynamicForm
.
plainSchemas
[
i
].
anyTypeClass
===
anyTypeClass
)
||
(
group
&&
$scope
.
dynamicForm
.
plainSchemas
[
i
].
key
.
includes
(
group
+
'
#
'
)))
{
//cleaning both form and user model
delete
$scope
.
user
.
plainAttrs
[
$scope
.
dynamicForm
.
plainSchemas
[
i
].
key
];
$scope
.
dynamicForm
.
plainSchemas
.
splice
(
i
,
1
);
i
--
;
}
}
console
.
log
(
"
2.$scope.user.plainAttrs
"
,
$scope
.
user
.
plainAttrs
);
console
.
log
(
"
2.$scope.dynamicForm.plainSchemas
"
,
$scope
.
dynamicForm
.
plainSchemas
);
//removing derived schemas
for
(
var
i
=
0
;
i
<
$scope
.
dynamicForm
.
derSchemas
.
length
;
i
++
)
{
if
((
anyTypeClass
&&
$scope
.
dynamicForm
.
derSchemas
[
i
].
anyTypeClass
===
anyTypeClass
)
...
...
@@ -375,7 +385,8 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
$scope
.
$on
(
'
groupRemoved
'
,
function
(
event
,
group
)
{
if
(
group
)
removeUserSchemas
(
null
,
group
);
console
.
log
(
"
remove group
"
,
group
);
removeUserSchemas
(
null
,
group
);
});
if
(
$scope
.
createMode
)
{
...
...
@@ -427,6 +438,9 @@ angular.module("self").controller("UserController", ['$scope', '$rootScope', '$l
$scope
.
showError
(
"
Error:
"
+
(
errorMessage
||
response
),
$scope
.
notification
);
});
}
else
{
console
.
log
(
"
groupAdded
"
,
$scope
.
dynamicForm
.
groupSchemas
);
console
.
log
(
"
user
"
,
user
);
console
.
log
(
"
user plainattrs
"
,
user
.
plainAttrs
);
UserSelfService
.
update
(
wrappedUser
,
$scope
.
captchaInput
.
value
).
then
(
function
(
response
)
{
console
.
debug
(
"
Updated user:
"
,
response
);
AuthService
.
logout
().
then
(
function
(
response
)
{
...
...
enduser/src/main/webapp/app/js/directives/choreographies.js
View file @
a8526333
...
...
@@ -47,9 +47,9 @@ angular.module('self')
};
$scope
.
getIndex
=
function
(
selectedChoreography
)
{
var
choreographyIndex
=
$scope
.
user
.
memberships
.
map
(
function
(
groupName
)
{
return
groupName
;
}).
indexOf
(
selectedChoreography
);
var
choreographyIndex
=
$scope
.
user
.
memberships
.
map
(
function
(
membership
)
{
return
membership
.
groupName
;
}).
indexOf
(
selectedChoreography
.
groupName
);
return
choreographyIndex
;
};
}
...
...
enduser/src/main/webapp/app/views/user-type.html
View file @
a8526333
...
...
@@ -17,6 +17,8 @@ limitations under the License.
<type
form=
"dynamicForm"
user=
"user"
></type>
</div>
<div
id=
"attribute"
class=
"form-group row"
>
<button
id=
"save"
ng-show=
"!createMode"
type=
"button"
class=
"btn btn-default pull-right"
ng-click=
"finish()"
>
{{'FINISH'| translate}}
</button>
<button
id=
"save"
ng-show=
"createMode && endReached"
type=
"button"
class=
"btn btn-default pull-right"
ng-click=
"finish()"
>
{{'FINISH'| translate}}
</button>
<navigation-buttons
ng-show=
"createMode"
base=
"create"
current=
"type"
wizard=
"{{wizard}}"
></navigation-buttons>
<navigation-buttons
ng-show=
"!createMode"
base=
"update"
current=
"type"
wizard=
"{{wizard}}"
></navigation-buttons>
<div
class=
"pull-left"
>
...
...
Write
Preview
Supports
Markdown
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