.script(buildLoadJsUrl("archiva/network-proxies.js")).wait()
.script(buildLoadJsUrl("archiva/proxy-connectors.js")).wait()
.script(buildLoadJsUrl("redback/operation.js")).wait()
- .script(buildLoadJsUrl("repository-groups.js")).wait()
+ .script(buildLoadJsUrl("archiva/repository-groups.js")).wait()
.script(buildLoadJsUrl("redback/redback-tmpl.js")).wait()
.script(buildLoadJsUrl("bootstrap.js"))
.script(buildLoadJsUrl("knockout.simpleGrid.js"))
*/
$(function() {
+ RepositoryGroup=function(id,repositories){
+
+ var self=this;
+
+ //private String id;
+ this.id=ko.observable(id);
+ this.id.subscribe(function(newValue){self.modified(true)});
+
+ // private List<String> repositories;
+ this.repositories=ko.observableArray(repositories);
+ this.repositories.subscribe(function(newValue){self.modified(true)});
+
+ this.modified=ko.observable(false);
+ }
+
+ RepositoryGroupViewModel=function(){
+ this.repositoryGroups=ko.observableArray([]);
+ this.managedRepositories=ko.observableArray([]);
+
+ findManagedRepository=function(id){
+ return findManagedRepository(id,self.managedRepositories());
+ }
+ }
+
+ displayRepositoryGroups=function(){
+ screenChange();
+ var mainContent = $("#main-content");
+ mainContent.html(mediumSpinnerImg());
+ this.repositoryGroupViewModel=new RepositoryGroupViewModel();
+ var self=this;
+
+ loadManagedRepositories(function(data) {
+ self.repositoryGroupViewModel.managedRepositories(mapManagedRepositories(data));
+
+ $.ajax("restServices/archivaServices/repositoryGroupService/getRepositoriesGroups", {
+ type: "GET",
+ dataType: 'json',
+ success: function(data) {
+ var mappedRepositoryGroups=mapRepositoryGroups(data);
+ mainContent.html($("#repositoryGroupsMain").tmpl());
+ self.repositoryGroupViewModel.repositoryGroups(mappedRepositoryGroups);
+ //ko.applyBindings(repositoryGroupViewModel,mainContent.find("#repository-groups-table" ).get(0));
+ ko.applyBindings(repositoryGroupViewModel,mainContent.get(0));
+
+ }
+ }
+ );
+
+ });
+
+
+ }
+
+ mapRepositoryGroups=function(data){
+ if (data == null){
+ return new Array();
+ }
+ var mappedRepositoryGroups = $.map(data.repositoryGroup, function(item) {
+ return mapRepositoryGroup(item);
+ });
+ return mappedRepositoryGroups;
+ }
+
+ mapRepositoryGroup=function(data){
+ return new RepositoryGroup(data.id, mapStringArray(data.repositories));
+ }
});
<ul class="nav nav-list" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<li class="nav-header">${$.i18n.prop('menu.administration')}</li>
+ <li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
+ <a href="#" id="menu-repository-groups-list-a" onclick="displayRepositoryGroups()">${$.i18n.prop('menu.repository.groups')}</a>
+ </li>
<li style="display: none" redback-permissions="{permissions: ['archiva-manage-configuration']}">
<a href="#" id="menu-repositories-list-a" onclick="displayRepositoriesGrid()">${$.i18n.prop('menu.repositories')}</a>
</li>
~ specific language governing permissions and limitations
~ under the License.
-->
+<script id="repositoryGroupsMain" type="text/x-jquery-tmpl">
+ <div class="page-header">
+ <h2>${$.i18n.prop('repository.groups.list')}</h2>
+ </div>
+ <div id="repository-groups-table" data-bind='template:{name:"repository-groups-table-tmpl"}'>
+
+ </div>
+ <br/><br/>
+ <table class="table table-striped table-bordered">
+ <thead>
+ <th>group</th>
+ <th>repos</th>
+ </thead>
+ <tbody>
+ <div id="repository-groups-table-bind" data-bind="foreach: repositoryGroups">
+ <tr>
+ <td data-bind="value: $data.id"></td>
+ </tr>
+ </div>
+ </tbody>
+ </table>
+
+ </div>
+</script>
+
+<script id="repository-groups-table-tmpl" type="text/html">
+ <table class="table table-striped table-bordered">
+ <thead>
+ <th>group</th>
+ <th>repos</th>
+ </thead>
+ <tbody>
+ {{each(i, repositoryGroup) repositoryGroups}}
+ <tr>
+ <td>${repositoryGroup.id}</td>
+ <td>
+ <ul>
+ {{each(j,id) repositoryGroup.repositories()}}
+ <li>${id}</li>
+ {{/each}}
+ </ul>
+ </td>
+ </tr>
+ {{/each}}
+ </tbody>
+ </table>
+</script>
\ No newline at end of file