[MRM-863] Paginate Used By tab

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1399591 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2012-10-18 11:44:51 +00:00
parent 86f58f2457
commit b06d4e210f
2 changed files with 53 additions and 32 deletions

View File

@ -507,8 +507,8 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
var calculateUsedBy=function(groupId,artifactId,version){ var calculateUsedBy=function(groupId,artifactId,version){
var dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" ); var dependeesContentDiv=$("#main-content" ).find("#artifact-details-used-by-content" );
if( $.trim(dependeesContentDiv.html()).length<1){ //if( $.trim(dependeesContentDiv.html()).length<1){
dependeesContentDiv.html(mediumSpinnerImg()); dependeesContentDiv.append(mediumSpinnerImg());
var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId); var dependeesUrl="restServices/archivaServices/browseService/dependees/"+encodeURIComponent(groupId);
dependeesUrl+="/"+encodeURIComponent(artifactId); dependeesUrl+="/"+encodeURIComponent(artifactId);
dependeesUrl+="/"+encodeURIComponent(version); dependeesUrl+="/"+encodeURIComponent(version);
@ -521,10 +521,25 @@ function(jquery,ui,sammy,tmpl,i18n,jqueryCookie,bootstrap,archivaSearch,jqueryVa
dataType: 'json', dataType: 'json',
success: function(data) { success: function(data) {
var artifacts=mapArtifacts(data); var artifacts=mapArtifacts(data);
dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts})); //dependeesContentDiv.html($("#dependees_tmpl").tmpl({artifacts: artifacts}));
var gridViewModel = new ko.simpleGrid.viewModel({
data: artifacts,
columns: [],
pageSize: 2,
gridUpdateCallBack: function(){
// no op
}
});
$.log("artifacts:"+artifacts.length);
dependeesContentDiv.find("#artifact-usedby-table").attr("data-bind",
"simpleGrid: gridViewModel,simpleGridTemplate:'dependees_tmpl',pageLinksId:'usedbyPagination',data:'artifacts'");
ko.applyBindings({artifacts:artifacts,gridViewModel:gridViewModel},dependeesContentDiv.get(0));
},
complete: function(){
removeMediumSpinnerImg(("#artifact-details-used-by-content"));
} }
}); });
} //}
}; };
this.get('#artifact-used-by/:groupId/:artifactId/:version',function(context){ this.get('#artifact-used-by/:groupId/:artifactId/:version',function(context){

View File

@ -638,7 +638,11 @@
<div id="artifact-details-download-content" class="tab-pane"></div> <div id="artifact-details-download-content" class="tab-pane"></div>
<div id="artifact-details-used-by-content" class="tab-pane"></div> <div id="artifact-details-used-by-content" class="tab-pane">
<table class="table table-striped table-bordered" id="artifact-usedby-table">
</table>
<div id="usedbyPagination"></div>
</div>
<div id="artifact-details-mailing-list-content" class="tab-pane"> <div id="artifact-details-mailing-list-content" class="tab-pane">
{{if projectVersionMetadata.mailingLists && projectVersionMetadata.mailingLists.length>0}} {{if projectVersionMetadata.mailingLists && projectVersionMetadata.mailingLists.length>0}}
@ -713,33 +717,33 @@
<tbody> <tbody>
{{each(i, row) itemsOnCurrentPage()}} {{each(i, row) itemsOnCurrentPage()}}
<tr> <tr>
<th>${row.artifactId}</th> <th>${row.artifactId}</th>
</tr> </tr>
<tr> <tr>
<td> <td>
{{var entries=row.crumbEntries()}} {{var entries=row.crumbEntries()}}
{{each(j,crumbEntry) entries}} {{each(j,crumbEntry) entries}}
{{if j < entries.length - 2}} {{if j < entries.length - 2}}
<a href="#" data-bind="click: function(){displayGroup(crumbEntry.groupId)}">${crumbEntry.displayValue}</a> <a href="#" data-bind="click: function(){displayGroup(crumbEntry.groupId)}">${crumbEntry.displayValue}</a>
{{else j == entries.length - 2}} {{else j == entries.length - 2}}
<a href="#" data-bind="click: function(){displayArtifactDetailView(crumbEntry.groupId,crumbEntry.artifactId)}">${crumbEntry.displayValue}</a> <a href="#" data-bind="click: function(){displayArtifactDetailView(crumbEntry.groupId,crumbEntry.artifactId)}">${crumbEntry.displayValue}</a>
{{else j == entries.length - 1}} {{else j == entries.length - 1}}
&nbsp;|&nbsp;<b>${$.i18n.prop('browse.artifact.version')}:</b>&nbsp; &nbsp;|&nbsp;<b>${$.i18n.prop('browse.artifact.version')}:</b>&nbsp;
<a href="#" data-bind="click: function(){displayArtifactVersionDetailViewModel(crumbEntry.groupId,crumbEntry.artifactId,crumbEntry.version)}">${row.version}</a>&nbsp; <a href="#" data-bind="click: function(){displayArtifactVersionDetailViewModel(crumbEntry.groupId,crumbEntry.artifactId,crumbEntry.version)}">${row.version}</a>&nbsp;
{{/if}} {{/if}}
{{if j < entries.length - 2}} {{if j < entries.length - 2}}
&nbsp;/&nbsp; &nbsp;/&nbsp;
{{/if}} {{/if}}
{{/each}} {{/each}}
{{if row.scope}} {{if row.scope}}
|&nbsp;<b>${$.i18n.prop('browse.artifact.scope')}:</b>&nbsp;${row.scope} |&nbsp;<b>${$.i18n.prop('browse.artifact.scope')}:</b>&nbsp;${row.scope}
{{/if}} {{/if}}
</td> </td>
</tr> </tr>
{{/each}} {{/each}}
</tbody> </tbody>
</script> </script>
@ -771,8 +775,10 @@
</script> </script>
<script id="dependees_tmpl" type="text/html"> <script id="dependees_tmpl" type="text/html">
fooo
<ul> <ul>
{{each(i,artifact) artifacts}} {{each(i, artifact) itemsOnCurrentPage()}}
<li> <li>
{{var entries=artifact.crumbEntries()}} {{var entries=artifact.crumbEntries()}}
{{each(j,crumbEntry) entries}} {{each(j,crumbEntry) entries}}