fix url display in repository groups definition page

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1390147 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-09-25 21:17:24 +00:00
parent 3d0e7062fc
commit 3163bbd09a
3 changed files with 46 additions and 34 deletions

View File

@ -34,7 +34,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
ManagedRepository=function(id,name,layout,indexDirectory,location,snapshots,releases,blockRedeployments,cronExpression,
scanned,daysOlder,retentionCount,deleteReleasedSnapshots,stageRepoNeeded,description,
skipPackedIndexCreation,feedsUrl){
skipPackedIndexCreation,feedsUrl,url){
var self=this;
@ -105,6 +105,8 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
this.feedsUrl=feedsUrl;
this.url=url;
this.getTypeLabel=function(){
for(var i=0;i<window.managedRepositoryTypes.length;i++){
if (window.managedRepositoryTypes[i].type==self.layout()){
@ -154,6 +156,7 @@ define("archiva.repositories",["jquery","i18n","jquery.tmpl","bootstrap","jquery
var mappedManagedRepositories = $.map(data, function(item) {
var managedRepository = mapManagedRepository(item);
managedRepository.feedsUrl=applicationUrl+"/feeds/"+managedRepository.id();
managedRepository.url=applicationUrl+"/repository/"+managedRepository.id()
return managedRepository;
});
return mappedManagedRepositories;

View File

@ -177,44 +177,53 @@ function() {
var self=this;
loadManagedRepositories(function(data) {
self.repositoryGroupsViewModel.managedRepositories(mapManagedRepositories(data));
$.ajax("restServices/archivaServices/repositoryGroupService/getRepositoriesGroups", {
$.ajax({
url: "restServices/archivaServices/archivaAdministrationService/applicationUrl",
type: "GET",
dataType: 'json',
success: function(data) {
var mappedRepositoryGroups=mapRepositoryGroups(data);
for(var i=0;i<mappedRepositoryGroups.length;i++){
mappedRepositoryGroups[i]
.managedRepositories(self.mapManagedRepositoriesToRepositoryGroup(mappedRepositoryGroups[i]));
mappedRepositoryGroups[i].modified(false);
$.log("mappedRepositoryGroups.repositories().length:"+mappedRepositoryGroups[i].repositories().length);
}
mainContent.html($("#repositoryGroupsMain").tmpl());
self.repositoryGroupsViewModel.repositoryGroups(mappedRepositoryGroups);
$.log("displayRepositoryGroups#applyBindings before");
ko.applyBindings(repositoryGroupsViewModel,mainContent.find("#repository-groups-view" ).get(0));
$.log("displayRepositoryGroups#applyBindings after");
dataType: 'text',
success: function(applicationUrl){
self.repositoryGroupsViewModel.managedRepositories(mapManagedRepositories(data,applicationUrl));
$.ajax("restServices/archivaServices/repositoryGroupService/getRepositoriesGroups", {
type: "GET",
dataType: 'json',
success: function(data) {
var mappedRepositoryGroups=mapRepositoryGroups(data);
for(var i=0;i<mappedRepositoryGroups.length;i++){
mappedRepositoryGroups[i]
.managedRepositories(self.mapManagedRepositoriesToRepositoryGroup(mappedRepositoryGroups[i]));
mappedRepositoryGroups[i].modified(false);
$.log("mappedRepositoryGroups.repositories().length:"+mappedRepositoryGroups[i].repositories().length);
}
mainContent.html($("#repositoryGroupsMain").tmpl());
self.repositoryGroupsViewModel.repositoryGroups(mappedRepositoryGroups);
$.log("displayRepositoryGroups#applyBindings before");
ko.applyBindings(repositoryGroupsViewModel,mainContent.find("#repository-groups-view" ).get(0));
$.log("displayRepositoryGroups#applyBindings after");
mainContent.find("#repository-groups-view-tabs").on('show', function (e) {
if ($(e.target).attr("href")=="#repository-groups-edit") {
var repositoryGroup = new RepositoryGroup();
var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,false,self.repositoryGroupsViewModel);
activateRepositoryGroupEditTab();
ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
mainContent.find("#repository-groups-view-tabs").on('show', function (e) {
if ($(e.target).attr("href")=="#repository-groups-edit") {
var repositoryGroup = new RepositoryGroup();
var repositoryGroupViewModel=new RepositoryGroupViewModel(repositoryGroup,false,self.repositoryGroupsViewModel);
activateRepositoryGroupEditTab();
ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-edit" ).get(0));
}
if ($(e.target).attr("href")=="#repository-groups-view") {
mainContent.find("#repository-groups-view-tabs-li-edit a").html($.i18n.prop("add"));
clearUserMessages();
}
});
}
}
if ($(e.target).attr("href")=="#repository-groups-view") {
mainContent.find("#repository-groups-view-tabs-li-edit a").html($.i18n.prop("add"));
clearUserMessages();
}
});
);
}
}
);
});
});
this.mapManagedRepositoriesToRepositoryGroup=function(repositoryGroup){

View File

@ -1181,8 +1181,8 @@
<br/>
${$data.name()}
<br/>
<a href="${window.archivaRuntimeInfo.baseUrl}/repository/${$data.id()}" target="_blank">
${window.archivaRuntimeInfo.baseUrl}/repository/${$data.id()}
<a href="${$data.url}" target="_blank">
${$data.url}
</a>
<br/>
</blockquote>