Repository: ambari Updated Branches: refs/heads/trunk e6e79b222 -> 53eba086d
AMBARI-5771. Multiple repositories support in UI Admin > Cluster. (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/53eba086 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/53eba086 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/53eba086 Branch: refs/heads/trunk Commit: 53eba086dd767f9cf2f9d6da7ac42a2258112c07 Parents: e6e79b2 Author: Aleksandr Kovalenko <[email protected]> Authored: Thu May 15 13:52:59 2014 +0300 Committer: Aleksandr Kovalenko <[email protected]> Committed: Thu May 15 13:52:59 2014 +0300 ---------------------------------------------------------------------- .../app/controllers/main/admin/cluster.js | 24 ++++++++++++++++---- ambari-web/app/templates/main/admin/cluster.hbs | 18 ++++++++++----- 2 files changed, 31 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/53eba086/ambari-web/app/controllers/main/admin/cluster.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/controllers/main/admin/cluster.js b/ambari-web/app/controllers/main/admin/cluster.js index d65c4cb..7a348b1 100644 --- a/ambari-web/app/controllers/main/admin/cluster.js +++ b/ambari-web/app/controllers/main/admin/cluster.js @@ -90,13 +90,27 @@ App.MainAdminClusterController = Em.Controller.extend({ loadRepositoriesSuccessCallback: function (data) { var allRepos = []; - data.items.forEach(function(os) { + data.items.forEach(function (os) { if (!App.supports.ubuntu && os.OperatingSystems.os_type == 'debian12') return; // @todo: remove after Ubuntu support confirmation - var repo = Em.Object.create({ - baseUrl: os.repositories[0].Repositories.base_url, - osType: os.repositories[0].Repositories.os_type + os.repositories.forEach(function (repository) { + var osType = repository.Repositories.os_type; + var repo = Em.Object.create({ + baseUrl: repository.Repositories.base_url, + osType: osType, + repoId: repository.Repositories.repo_id, + isFirst: false + }); + var group = allRepos.findProperty('name', osType); + if (!group) { + group = { + name: osType, + repositories: [] + }; + repo.set('isFirst', true); + allRepos.push(group); + } + group.repositories.push(repo); }); - allRepos.push(repo); }, this); allRepos.stackVersion = App.get('currentStackVersionNumber'); this.set('repositories', allRepos); http://git-wip-us.apache.org/repos/asf/ambari/blob/53eba086/ambari-web/app/templates/main/admin/cluster.hbs ---------------------------------------------------------------------- diff --git a/ambari-web/app/templates/main/admin/cluster.hbs b/ambari-web/app/templates/main/admin/cluster.hbs index 6297b41..771b261 100644 --- a/ambari-web/app/templates/main/admin/cluster.hbs +++ b/ambari-web/app/templates/main/admin/cluster.hbs @@ -60,19 +60,25 @@ </li> </ul> - <table class="table table-bordered table-striped"> + <table class="table table-bordered"> <thead> <tr> <th>{{t admin.cluster.repositories.os}}</th> + <th>{{t common.name}}</th> <th>{{t admin.cluster.repositories.baseUrl}}</th> </tr> </thead> <tbody> - {{#each repo in repositories}} - <tr> - <td>{{repo.osType}}</td> - <td>{{repo.baseUrl}}</td> - </tr> + {{#each repoGroup in repositories}} + {{#each repo in repoGroup.repositories}} + <tr> + {{#if repo.isFirst}} + <td {{bindAttr rowspan="repoGroup.repositories.length"}}>{{repo.osType}}</td> + {{/if}} + <td>{{repo.repoId}}</td> + <td>{{repo.baseUrl}}</td> + </tr> + {{/each}} {{/each}} </tbody> </table>
