mirror of https://github.com/apache/archiva.git
fix admin create box call
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1360437 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
450f03a6a6
commit
69f92105d5
|
@ -129,45 +129,6 @@ function() {
|
||||||
$.log("hideElementWithKarma");
|
$.log("hideElementWithKarma");
|
||||||
}
|
}
|
||||||
|
|
||||||
userLoggedCallbackFn=function(user){
|
|
||||||
$.log("userLoggedCallbackFn:"+ (user?user.username:null));
|
|
||||||
|
|
||||||
if (!user) {
|
|
||||||
$("#login-link").show();
|
|
||||||
$("#register-link").show();
|
|
||||||
$("#change-password-link").hide();
|
|
||||||
checkUrlParams();
|
|
||||||
} else {
|
|
||||||
$("#change-password-link").show();
|
|
||||||
$("#logout-link").show();
|
|
||||||
$("#register-link").hide();
|
|
||||||
$("#login-link").hide();
|
|
||||||
decorateMenuWithKarma(user);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
checkSecurityLinks=function(){
|
|
||||||
userLogged(userLoggedCallbackFn);
|
|
||||||
}
|
|
||||||
|
|
||||||
checkCreateAdminLink=function(){
|
|
||||||
$.ajax("restServices/redbackServices/userService/isAdminUserExists", {
|
|
||||||
type: "GET",
|
|
||||||
dataType: 'json',
|
|
||||||
success: function(data) {
|
|
||||||
var adminExists = data;
|
|
||||||
if (adminExists == false) {
|
|
||||||
$("#create-admin-link").show();
|
|
||||||
$("#login-link").hide();
|
|
||||||
$("#register-link").hide();
|
|
||||||
} else {
|
|
||||||
$("#create-admin-link").hide();
|
|
||||||
}
|
|
||||||
$.log("adminExists:"+adminExists);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
//------------------------------------//
|
//------------------------------------//
|
||||||
// Change UI with appearance settings //
|
// Change UI with appearance settings //
|
||||||
//------------------------------------//
|
//------------------------------------//
|
||||||
|
@ -235,6 +196,11 @@ function() {
|
||||||
this.activeMenuId = ko.observable();
|
this.activeMenuId = ko.observable();
|
||||||
|
|
||||||
window.sammyArchivaApplication = Sammy(function () {
|
window.sammyArchivaApplication = Sammy(function () {
|
||||||
|
this.get('#open-admin-create-box',function(){
|
||||||
|
$.log("#open-admin-create-box");
|
||||||
|
adminCreateBox();
|
||||||
|
});
|
||||||
|
|
||||||
// #artifact-(optionnal repositoryId)
|
// #artifact-(optionnal repositoryId)
|
||||||
// format groupId:artifactId org.apache.maven.plugins:maven-jar-plugin
|
// format groupId:artifactId org.apache.maven.plugins:maven-jar-plugin
|
||||||
// or groupId:artifactId:version org.apache.maven.plugins:maven-jar-plugin:2.3.1
|
// or groupId:artifactId:version org.apache.maven.plugins:maven-jar-plugin:2.3.1
|
||||||
|
@ -268,7 +234,8 @@ function() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
this.get('#:folder', function () {
|
this.get('#:folder', function () {
|
||||||
self.activeMenuId(this.params.folder);
|
var folder = this.params.folder;
|
||||||
|
self.activeMenuId(folder);
|
||||||
var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
|
var baseItems = self.artifactMenuItems?self.artifactMenuItems:[];
|
||||||
ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
|
ko.utils.arrayFirst(baseItems.concat(self.usersMenuItems, self.administrationMenuItems), function(p) {
|
||||||
if ( p.href == "#"+self.activeMenuId()) {
|
if ( p.href == "#"+self.activeMenuId()) {
|
||||||
|
@ -276,17 +243,54 @@ function() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
|
||||||
this.get('#open-admin-create-box',function(){
|
|
||||||
$.log("#open-admin-create-box");
|
|
||||||
adminCreateBox();
|
|
||||||
});
|
});
|
||||||
//this.get('', function () { this.app.runRoute('get', '#search') });
|
//this.get('', function () { this.app.runRoute('get', '#search') });
|
||||||
} );
|
});
|
||||||
sammyArchivaApplication.run();
|
sammyArchivaApplication.run();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
userLoggedCallbackFn=function(user){
|
||||||
|
$.log("userLoggedCallbackFn:"+ (user?user.username:null));
|
||||||
|
|
||||||
|
if (!user) {
|
||||||
|
$("#login-link").show();
|
||||||
|
$("#register-link").show();
|
||||||
|
$("#change-password-link").hide();
|
||||||
|
checkUrlParams();
|
||||||
|
} else {
|
||||||
|
$("#change-password-link").show();
|
||||||
|
$("#logout-link").show();
|
||||||
|
$("#register-link").hide();
|
||||||
|
$("#login-link").hide();
|
||||||
|
decorateMenuWithKarma(user);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
checkSecurityLinks=function(){
|
||||||
|
userLogged(userLoggedCallbackFn);
|
||||||
|
}
|
||||||
|
|
||||||
|
checkCreateAdminLink=function(callbackFn){
|
||||||
|
$.ajax("restServices/redbackServices/userService/isAdminUserExists", {
|
||||||
|
type: "GET",
|
||||||
|
dataType: 'json',
|
||||||
|
success: function(data) {
|
||||||
|
var adminExists = data;
|
||||||
|
if (adminExists == false) {
|
||||||
|
$("#create-admin-link").show();
|
||||||
|
$("#login-link").hide();
|
||||||
|
$("#register-link").hide();
|
||||||
|
} else {
|
||||||
|
$("#create-admin-link").hide();
|
||||||
|
}
|
||||||
|
if(callbackFn){
|
||||||
|
callbackFn()
|
||||||
|
}
|
||||||
|
$.log("adminExists:"+adminExists);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
startArchivaApplication=function(){
|
startArchivaApplication=function(){
|
||||||
|
|
||||||
$.log("startArchivaApplication");
|
$.log("startArchivaApplication");
|
||||||
|
|
|
@ -296,10 +296,11 @@ define("redback.user",["jquery","utils","i18n","jquery.validate","knockout","kno
|
||||||
* open a modal box to create admin user
|
* open a modal box to create admin user
|
||||||
*/
|
*/
|
||||||
adminCreateBox=function() {
|
adminCreateBox=function() {
|
||||||
|
$.log("adminCreateBox");
|
||||||
window.redbackModel.createUser=true;
|
window.redbackModel.createUser=true;
|
||||||
$("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
|
$("#main-content").attr("data-bind",'template: {name:"redback/user-edit-tmpl",data: user}');
|
||||||
var viewModel = new AdminUserViewModel();
|
var viewModel = new AdminUserViewModel();
|
||||||
ko.applyBindings(viewModel);
|
ko.applyBindings(viewModel,$("#main-content" ).get(0));
|
||||||
$("#user-create").validate({
|
$("#user-create").validate({
|
||||||
rules: {
|
rules: {
|
||||||
confirmPassword: {
|
confirmPassword: {
|
||||||
|
|
Loading…
Reference in New Issue