mirror of https://github.com/apache/archiva.git
fix issue with webkit for users role assignement double list
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1227643 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
47e0ece16c
commit
dbc43a4e3c
|
@ -160,6 +160,8 @@ $(function() {
|
|||
hideElementWithKarma();
|
||||
checkSecurityLinks();
|
||||
|
||||
|
||||
|
||||
})
|
||||
});
|
||||
|
||||
|
|
|
@ -1021,7 +1021,7 @@ ko.observableArray['fn'] = {
|
|||
|
||||
// Populate ko.observableArray.fn with read/write functions from native arrays
|
||||
ko.utils.arrayForEach(["pop", "push", "reverse", "shift", "sort", "splice", "unshift"], function (methodName) {
|
||||
ko.observableArray['fn'][methodName] = function () {
|
||||
ko.observableArray['fn'][methodName] = function () {
|
||||
var underlyingArray = this();
|
||||
this.valueWillMutate();
|
||||
var methodCallResult = underlyingArray[methodName].apply(underlyingArray, arguments);
|
||||
|
|
|
@ -18,7 +18,7 @@
|
|||
*/
|
||||
$(function() {
|
||||
|
||||
role = function(name,description,assignable,childRoleNames,parentRoleNames,users,parentsRolesUsers,permissions,otherUsers){
|
||||
Role = function(name,description,assignable,childRoleNames,parentRoleNames,users,parentsRolesUsers,permissions,otherUsers){
|
||||
this.name = ko.observable(name);
|
||||
this.description = ko.observable(description);
|
||||
this.assignable = ko.observable(assignable);
|
||||
|
@ -28,8 +28,8 @@ $(function() {
|
|||
this.parentsRolesUsers = ko.observableArray(parentsRolesUsers);//read only
|
||||
this.permissions = ko.observableArray(permissions);//read only
|
||||
// when editing a role other users not assign to this role are populated
|
||||
this.otherUsers = ko.observableArray(otherUsers);
|
||||
this.removedUsers=ko.observableArray([]);
|
||||
this.otherUsers = ko.observableArray(otherUsers?otherUsers:new Array());
|
||||
this.removedUsers= ko.observableArray(new Array());
|
||||
|
||||
this.updateDescription=function(){
|
||||
var url = "restServices/redbackServices/roleManagementService/updateRoleDescription?";
|
||||
|
@ -50,6 +50,7 @@ $(function() {
|
|||
}
|
||||
);
|
||||
}
|
||||
var self=this;
|
||||
this.updateUsers=function(){
|
||||
var url = "restServices/redbackServices/roleManagementService/updateRoleUsers";
|
||||
$.ajax(url,
|
||||
|
@ -57,7 +58,7 @@ $(function() {
|
|||
type: "POST",
|
||||
dataType: 'json',
|
||||
contentType: 'application/json',
|
||||
data: "{\"role\": " + ko.toJSON(this)+"}",
|
||||
data: "{\"role\": " + ko.toJSON(self)+"}",
|
||||
success: function(data) {
|
||||
displaySuccessMessage($.i18n.prop("role.users.updated",this.name));
|
||||
},
|
||||
|
@ -68,14 +69,6 @@ $(function() {
|
|||
);
|
||||
}
|
||||
|
||||
this.updateMode=function(){
|
||||
$("#main-content #role-list-users").hide();
|
||||
$("#main-content #role-edit-users").show();
|
||||
}
|
||||
this.viewMode=function(){
|
||||
$("#main-content #role-edit-users").hide();
|
||||
$("#main-content #role-list-users").show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -156,13 +149,15 @@ $(function() {
|
|||
}
|
||||
|
||||
RoleViewModel=function(role){
|
||||
selectedOtherUsers=new ko.observableArray();
|
||||
selectedUsers=new ko.observableArray();
|
||||
selectedOtherUsers= ko.observableArray();
|
||||
selectedUsers= ko.observableArray();
|
||||
currentRole=role;
|
||||
var self=this;
|
||||
addUser=function(){
|
||||
$.log("addUser");
|
||||
var removed = currentRole.otherUsers.removeAll(selectedOtherUsers());
|
||||
for (var i = 0; i < removed.length; i++) {
|
||||
$.log("add user:"+removed[i].username());
|
||||
currentRole.users.push(removed[i]);
|
||||
}
|
||||
selectedOtherUsers([]);
|
||||
|
@ -184,6 +179,15 @@ $(function() {
|
|||
saveUsers=function(){
|
||||
currentRole.updateUsers();
|
||||
}
|
||||
|
||||
updateMode=function(){
|
||||
$("#main-content #role-list-users").hide();
|
||||
$("#main-content #role-edit-users").show();
|
||||
}
|
||||
viewMode=function(){
|
||||
$("#main-content #role-edit-users").hide();
|
||||
$("#main-content #role-list-users").show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -212,7 +216,7 @@ $(function() {
|
|||
return mapUser(item);
|
||||
}):new Array(mapUser(data.otherUsers)):null;
|
||||
|
||||
return new role(data.name, data.description?data.description:"",data.assignable,childRoleNames,parentRoleNames,users,parentsRolesUsers,permissions,otherUsers);
|
||||
return new Role(data.name, data.description?data.description:"",data.assignable,childRoleNames,parentRoleNames,users,parentsRolesUsers,permissions,otherUsers);
|
||||
}
|
||||
|
||||
activateRolesGridTab=function(){
|
||||
|
|
|
@ -130,7 +130,7 @@
|
|||
${$.i18n.prop('role.edit.no.user.defined')}
|
||||
{{/if}}
|
||||
|
||||
<button class="btn" data-bind="click:updateMode">${$.i18n.prop('role.update.mode')}</button>
|
||||
<input class="btn" type="button" id="role-list-users-update-mode" data-bind="click: updateMode" value="${$.i18n.prop('role.update.mode')}"/>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -141,21 +141,23 @@
|
|||
</div>
|
||||
<div class="ar-multiselect-column ar-multiselect-center">
|
||||
<ul style="list-style: none">
|
||||
<li><button class="btn" data-bind="click: addUser">></button></li>
|
||||
<li><button class="btn" data-bind="click: removeUser"><</button></li>
|
||||
<li><input class="btn" id="role-edit-users-add-user" type="button" data-bind="click: addUser" value=">"/></li>
|
||||
<li><input class="btn" id="role-edit-users-remove-user" type="button" data-bind="click: removeUser" value="<"/></li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="ar-multiselect-column ar-multiselect-right">
|
||||
<select data-bind="options: users ,optionsText: 'username',selectedOptions:selectedUsers" multiple="true" id="role-edit-affected-users"></select>
|
||||
</div>
|
||||
<button class="btn" data-bind="click: saveUsers">${$.i18n.prop('save')}</button>
|
||||
<button class="btn" id="role-edit-users-save" data-bind="click: saveUsers">${$.i18n.prop('save')}</button>
|
||||
<br/>
|
||||
<button class="btn" data-bind="click:viewMode">${$.i18n.prop('role.view.mode')}</button>
|
||||
<input class="btn" id="role-edit-users-view-mode" type="button" data-bind="click: viewMode" value="${$.i18n.prop('role.view.mode')}"/>
|
||||
</div>
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script id='ko_rolesGrid' type='text/x-jquery-tmpl'>
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
|
@ -73,6 +73,7 @@ public abstract class AbstractSeleniumTest
|
|||
if ( getSelenium() == null )
|
||||
{
|
||||
DefaultSelenium s = new DefaultSelenium( seleniumHost, seleniumPort, browser, baseUrl );
|
||||
|
||||
s.start();
|
||||
s.setTimeout( maxWaitTimeInMs );
|
||||
selenium.set( s );
|
||||
|
|
Loading…
Reference in New Issue