You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by xi...@apache.org on 2013/11/11 22:57:48 UTC
[5/5] git commit: AMBARI-3720. Provide read-only view of repo options
in Ambari Web
AMBARI-3720. Provide read-only view of repo options in Ambari Web
Project: http://git-wip-us.apache.org/repos/asf/incubator-ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-ambari/commit/695a3bcd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-ambari/tree/695a3bcd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-ambari/diff/695a3bcd
Branch: refs/heads/trunk
Commit: 695a3bcdafbf39ecaff520a18c21a48d40173868
Parents: b98d660
Author: Xi Wang <xi...@apache.org>
Authored: Thu Nov 7 19:26:27 2013 -0800
Committer: Xi Wang <xi...@apache.org>
Committed: Mon Nov 11 13:57:24 2013 -0800
----------------------------------------------------------------------
.../app/controllers/main/admin/cluster.js | 39 ++++++++++
ambari-web/app/messages.js | 3 +
ambari-web/app/templates/main/admin/cluster.hbs | 76 +++++++++++++-------
ambari-web/app/utils/ajax.js | 10 +++
4 files changed, 103 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/695a3bcd/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 a67880f..88c4486 100644
--- a/ambari-web/app/controllers/main/admin/cluster.js
+++ b/ambari-web/app/controllers/main/admin/cluster.js
@@ -22,6 +22,7 @@ var stringUtils = require('utils/string_utils');
App.MainAdminClusterController = Em.Controller.extend({
name:'mainAdminClusterController',
services: [],
+ repositories: [],
upgradeVersion: '',
/**
* get the newest version of HDP from server
@@ -70,6 +71,44 @@ App.MainAdminClusterController = Em.Controller.extend({
},
/**
+ * get the installed repositories of HDP from server
+ */
+ loadRepositories: function(){
+ if(App.router.get('clusterController.isLoaded')){
+ var nameVersionCombo = App.get('currentStackVersion');
+ var stackName = nameVersionCombo.split('-')[0];
+ var stackVersion = nameVersionCombo.split('-')[1];
+ App.ajax.send({
+ name: 'cluster.load_repositories',
+ sender: this,
+ data: {
+ stackName: stackName,
+ stackVersion: stackVersion
+ },
+ success: 'loadRepositoriesSuccessCallback',
+ error: 'loadRepositoriesErrorCallback'
+ });
+ }
+ }.observes('App.router.clusterController.isLoaded'),
+
+ loadRepositoriesSuccessCallback: function (data) {
+ var allRepos = [];
+ data.items.forEach(function(os) {
+ var repo = Em.Object.create({
+ baseUrl: os.repositories[0].Repositories.base_url,
+ osType: os.repositories[0].Repositories.os_type
+ });
+ allRepos.push(repo);
+ }, this);
+ allRepos.stackVersion = App.get('currentStackVersionNumber');
+ this.set('repositories', allRepos);
+ },
+
+ loadRepositoriesErrorCallback: function(request, ajaxOptions, error) {
+ console.log('Error message is: ' + request.responseText);
+ },
+
+ /**
* parse services info(versions, description) by version
*/
parseServicesInfo: function (currentStack, upgradeStack) {
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/695a3bcd/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 28035f1..ad4db57 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -878,6 +878,9 @@ Em.I18n.translations = {
'admin.cluster.stackVersion':'Cluster Stack Version',
'admin.cluster.upgradeAvailable':'Upgrade available',
'admin.cluster.upgradeUnavailable':'Upgrade unavailable',
+ 'admin.cluster.repositories.repositories':'Repositories',
+ 'admin.cluster.repositories.os':'OS',
+ 'admin.cluster.repositories.baseUrl':'Base URL',
'admin.userSettings.header': 'Customize User Settings',
'admin.userSettings.showBgOperations': 'Show background operations dialog when an operation is started',
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/695a3bcd/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 4f1a275..a2647fa 100644
--- a/ambari-web/app/templates/main/admin/cluster.hbs
+++ b/ambari-web/app/templates/main/admin/cluster.hbs
@@ -18,34 +18,60 @@
<div class="admin-cluster">
<div class="header">
- <strong>{{t admin.cluster.stackVersion}}: {{App.currentStackVersion}}
- {{#if App.supports.stackUpgrade}}
- (<a href="true" {{bindAttr class="view.isUpgradeAvailable::inactive"}}{{action "upgradeStack"}}>
- {{#if view.isUpgradeAvailable}}{{t admin.cluster.upgradeAvailable}}: {{upgradeVersion}}
- {{else}} {{t admin.cluster.upgradeUnavailable}}
- {{/if}}
- </a>)
+ <strong>{{t admin.cluster.stackVersion}}: {{App.currentStackVersion}}
+ {{#if App.supports.stackUpgrade}}
+ (<a href="true" {{bindAttr class="view.isUpgradeAvailable::inactive"}}{{action "upgradeStack"}}>
+ {{#if view.isUpgradeAvailable}}{{t admin.cluster.upgradeAvailable}}: {{upgradeVersion}}
+ {{else}} {{t admin.cluster.upgradeUnavailable}}
{{/if}}
- </strong>
+ </a>)
+ {{/if}}
+ </strong>
</div>
<table class="table table-bordered table-striped">
- <thead>
- <tr>
- <th>{{t common.service}}</th>
- <th>{{t common.version}}</th>
- <th>{{t common.description}}</th>
- </tr>
- </thead>
- <tbody>
- {{#each service in services}}
- {{#unless service.isHidden}}
- <tr>
- <td>{{service.displayName}}</td>
- <td>{{service.version}}</td>
- <td>{{service.description}}</td>
- </tr>
- {{/unless}}
+ <thead>
+ <tr>
+ <th>{{t common.service}}</th>
+ <th>{{t common.version}}</th>
+ <th>{{t common.description}}</th>
+ </tr>
+ </thead>
+ <tbody>
+ {{#each service in services}}
+ {{#unless service.isHidden}}
+ <tr>
+ <td>{{service.displayName}}</td>
+ <td>{{service.version}}</td>
+ <td>{{service.description}}</td>
+ </tr>
+ {{/unless}}
+ {{/each}}
+ </tbody>
+ </table>
+
+ <div class="header">
+ <strong>{{t admin.cluster.repositories.repositories}}</strong>
+ </div>
+ <ul class="nav nav-tabs">
+ <li class="active">
+ <a href="#">{{repositories.stackVersion}}</a>
+ </li>
+ </ul>
+
+ <table class="table table-bordered table-striped">
+ <thead>
+ <tr>
+ <th>{{t admin.cluster.repositories.os}}</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}}
- </tbody>
+ </tbody>
</table>
</div>
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/695a3bcd/ambari-web/app/utils/ajax.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/utils/ajax.js b/ambari-web/app/utils/ajax.js
index 847ea57..226224c 100644
--- a/ambari-web/app/utils/ajax.js
+++ b/ambari-web/app/utils/ajax.js
@@ -550,6 +550,16 @@ var urls = {
};
}
},
+ 'cluster.load_repositories': {
+ 'real': '/stacks2/{stackName}/versions/{stackVersion}/operatingSystems?fields=repositories/*',
+ 'mock': '',
+ 'type': 'GET',
+ 'format': function (data, opt) {
+ return {
+ async: false
+ };
+ }
+ },
'admin.high_availability.stop_all_services': {
'real': '/clusters/{clusterName}/services',
'mock': '',