fix some javascript mapping for redback part. git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1295498 13f79535-47bb-0310-9956-ffa450edef68tags/archiva-1.4-M3
@@ -39,11 +39,17 @@ | |||
<context:component-scan | |||
base-package="org.apache.archiva.rest.services"/> | |||
<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"> | |||
<property name="mapper" ref="redbackJacksonMapper"/> | |||
</bean> | |||
<bean id="redbackJacksonMapper" class="org.codehaus.jackson.map.ObjectMapper"> | |||
</bean> | |||
<jaxrs:server id="archivaServices" address="/archivaServices"> | |||
<jaxrs:providers> | |||
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/> | |||
<ref bean="jsonProvider"/> | |||
<ref bean="authenticationInterceptor#rest"/> | |||
<ref bean="permissionInterceptor#rest"/> |
@@ -526,6 +526,18 @@ | |||
<artifactId>jcl-over-slf4j</artifactId> | |||
<scope>runtime</scope> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.jackson</groupId> | |||
<artifactId>jackson-jaxrs</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.jackson</groupId> | |||
<artifactId>jackson-xc</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.codehaus.jackson</groupId> | |||
<artifactId>jackson-core-asl</artifactId> | |||
</dependency> | |||
<dependency> | |||
<groupId>org.apache.cxf</groupId> | |||
<artifactId>cxf-bundle-jaxrs</artifactId> | |||
@@ -542,6 +554,10 @@ | |||
<groupId>org.apache.geronimo.specs</groupId> | |||
<artifactId>geronimo-javamail_1.4_spec</artifactId> | |||
</exclusion> | |||
<exclusion> | |||
<groupId>org.codehaus.jettison</groupId> | |||
<artifactId>jettison</artifactId> | |||
</exclusion> | |||
</exclusions> | |||
</dependency> | |||
<dependency> |
@@ -57,6 +57,7 @@ | |||
<jaxrs:server id="archivaUiServices" address="/archivaUiServices"> | |||
<jaxrs:providers> | |||
<bean class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/> | |||
<ref bean="authenticationInterceptor#rest"/> | |||
<ref bean="permissionInterceptor#rest"/> | |||
<ref bean="archivaRestServiceExceptionMapper"/> |
@@ -53,14 +53,19 @@ appendArchivaVersion=function(){ | |||
buildLoadJsUrl=function(srcScript){ | |||
return srcScript+"?"+appendArchivaVersion(); | |||
} | |||
$.ajaxSetup({ | |||
dataType: 'json' | |||
}); | |||
$.ajax( | |||
{ | |||
url: "restServices/archivaUiServices/runtimeInfoService/archivaRuntimeInfo", | |||
dataType: 'json', | |||
success:function(data){ | |||
window.archivaDevMode=data.applicationRuntimeInfo.devMode; | |||
window.archivaJavascriptLog=data.applicationRuntimeInfo.javascriptLog; | |||
window.archivaRuntimeInfo=data.applicationRuntimeInfo; | |||
window.archivaDevMode=data.devMode; | |||
window.archivaJavascriptLog=data.javascriptLog; | |||
window.archivaRuntimeInfo=data; | |||
require.config({ | |||
baseUrl: "js/" | |||
}); |
@@ -73,7 +73,7 @@ $(function() { | |||
$.ajax({ | |||
url: url, | |||
success: function(data){ | |||
var mappedOperations = $.map(data.operation, function(item) { | |||
var mappedOperations = $.map(data, function(item) { | |||
return mapOperation(item); | |||
}); | |||
window.redbackModel.operatioNames = $.map(mappedOperations, function(item){ | |||
@@ -143,7 +143,7 @@ $(function() { | |||
type: "GET", | |||
dataType: 'json', | |||
success: function(data) { | |||
var adminExists = JSON.parse(data); | |||
var adminExists = data; | |||
if (adminExists == false) { | |||
$("#create-admin-link").show(); | |||
$("#login-link").hide(); |
@@ -42,7 +42,7 @@ $(function() { | |||
$.ajax("restServices/redbackServices/loginService/isLogged", { | |||
type: "GET", | |||
success: function(data) { | |||
userLogged = JSON.parse(data); | |||
userLogged = data; | |||
if (successFn){ | |||
successFn(userLogged == false ? null : jQuery.parseJSON($.cookie('redback_login'))); | |||
} |
@@ -85,7 +85,7 @@ $(function() { | |||
type: "POST", | |||
dataType: 'json', | |||
contentType: 'application/json', | |||
data: "{\"role\": " + ko.toJSON(self)+"}", | |||
data: ko.toJSON(self), | |||
success: function(data) { | |||
clearUserMessages(); | |||
displaySuccessMessage($.i18n.prop("role.users.updated",this.name)); | |||
@@ -134,7 +134,7 @@ $(function() { | |||
type: "GET", | |||
dataType: 'json', | |||
success: function(data) { | |||
var mappedRole = mapRole(data.role); | |||
var mappedRole = mapRole(data); | |||
role.parentRoleNames(mappedRole.parentRoleNames()); | |||
role.parentsRolesUsers(mappedRole.parentsRolesUsers()); | |||
role.users(mappedRole.users()); | |||
@@ -215,7 +215,7 @@ $(function() { | |||
type: "GET", | |||
dataType: 'json', | |||
success: function(data) { | |||
var mappedRoles = $.map(data.role, function(item) { | |||
var mappedRoles = $.map(data, function(item) { | |||
return mapRole(item); | |||
}); | |||
var rolesViewModel = new RolesViewModel(); | |||
@@ -263,7 +263,6 @@ $(function() { | |||
activateRoleUsersEditTab() | |||
} | |||
saveRoleDescription=function(){ | |||
$.log("saveRoleDescription:"+currentRole.description()); | |||
currentRole.updateDescription(); | |||
} | |||
saveUsers=function(){ |
@@ -95,12 +95,12 @@ $(function() { | |||
} | |||
var currentUser = this; | |||
$.ajax("restServices/redbackServices/userService/createUser", { | |||
data: "{\"user\": " + ko.toJSON(this)+"}", | |||
data: ko.toJSON(this), | |||
contentType: 'application/json', | |||
type: "POST", | |||
dataType: 'json', | |||
success: function(result) { | |||
var created = JSON.parse(result); | |||
var created = result; | |||
if (created == true) { | |||
displaySuccessMessage( $.i18n.prop("user.created",currentUser.username())); | |||
if (successFnCallback){ | |||
@@ -130,12 +130,12 @@ $(function() { | |||
} | |||
var currentAdminUser = this; | |||
$.ajax("restServices/redbackServices/userService/createAdminUser", { | |||
data: "{\"user\": " + ko.toJSON(this)+"}", | |||
data: ko.toJSON(this), | |||
contentType: 'application/json', | |||
type: "POST", | |||
dataType: 'json', | |||
success: function(result) { | |||
var created = JSON.parse(result); | |||
var created = result; | |||
if (created == true) { | |||
displaySuccessMessage( $.i18n.prop("user.admin.created")); | |||
var onSuccessCall=function(){ | |||
@@ -161,12 +161,12 @@ $(function() { | |||
this.update=function(){ | |||
var currentUser = this; | |||
$.ajax("restServices/redbackServices/userService/updateUser", { | |||
data: "{\"user\": " + ko.toJSON(this)+"}", | |||
data: ko.toJSON(this), | |||
contentType: 'application/json', | |||
type: "POST", | |||
dataType: 'json', | |||
success: function(result) { | |||
var updated = JSON.parse(result); | |||
var updated = result; | |||
if (updated == true) { | |||
clearUserMessages(); | |||
displaySuccessMessage($.i18n.prop("user.updated",currentUser.username())); | |||
@@ -207,7 +207,7 @@ $(function() { | |||
var curUser = this; | |||
clearUserMessages(); | |||
$.ajax("restServices/redbackServices/roleManagementService/updateUserRoles", { | |||
data: "{\"user\": " + ko.toJSON(this)+"}", | |||
data: ko.toJSON(this), | |||
contentType: 'application/json', | |||
type: "POST", | |||
dataType: 'json', | |||
@@ -280,6 +280,13 @@ $(function() { | |||
*/ | |||
AdminUserViewModel=function() { | |||
this.user = new User("admin","","", "the administrator"); | |||
var self=this; | |||
saveUser=function(){ | |||
if(! $("#user-create" ).valid() ) { | |||
return; | |||
} | |||
self.user.createAdmin(); | |||
} | |||
} | |||
/** | |||
@@ -343,12 +350,12 @@ $(function() { | |||
if (result == null) { | |||
logged = false; | |||
} else { | |||
if (result.user) { | |||
if (result.username) { | |||
logged = true; | |||
} | |||
} | |||
if (logged == true) { | |||
var user = mapUser(result.user); | |||
var user = mapUser(result); | |||
if (user.passwordChangeRequired()==true){ | |||
changePasswordBox(true,false,user); | |||
return; | |||
@@ -538,12 +545,12 @@ $(function() { | |||
editUserDetails=function(user){ | |||
$("#modal-user-edit-err-message").html(""); | |||
$.ajax("restServices/redbackServices/userService/updateMe", { | |||
data: "{\"user\": " + ko.toJSON(user)+"}", | |||
data: ko.toJSON(user), | |||
contentType: 'application/json', | |||
type: "POST", | |||
dataType: 'json', | |||
success: function(result) { | |||
var created = JSON.parse(result); | |||
var created = result; | |||
// FIXME i18n | |||
if (created == true) { | |||
displaySuccessMessage( $.i18n.prop("user.details.updated")); | |||
@@ -595,7 +602,7 @@ $(function() { | |||
url: url, | |||
success: function(result){ | |||
$.log("changePassword#success result:"+result); | |||
var user = mapUser(result.user); | |||
var user = mapUser(result); | |||
if (user) { | |||
window.modalChangePasswordBox.modal('hide'); | |||
$.log("changePassword#sucess,registration:"+registration); |
@@ -134,7 +134,7 @@ $(function() { | |||
type: "GET", | |||
dataType: 'json', | |||
success: function(data) { | |||
var mappedRoles = $.map(data.role, function(item) { | |||
var mappedRoles = $.map(data, function(item) { | |||
return item.name; | |||
}); | |||
user.assignedRoles = ko.observableArray(mappedRoles); | |||
@@ -193,7 +193,7 @@ $(function() { | |||
type: "GET", | |||
dataType: 'json', | |||
success: function(data) { | |||
var mappedApplicationRoles = $.map(data.applicationRole, function(item) { | |||
var mappedApplicationRoles = $.map(data, function(item) { | |||
return mapApplicationRoles(item); | |||
}); | |||
viewModel.applicationRoles=ko.observableArray(mappedApplicationRoles); | |||
@@ -242,7 +242,7 @@ $(function() { | |||
type: "GET", | |||
dataType: 'json', | |||
success: function(data) { | |||
var mappedUsers = $.map(data.user, function(item) { | |||
var mappedUsers = $.map(data, function(item) { | |||
return mapUser(item); | |||
}); | |||
var usersViewModel = new UsersViewModel(); |