Author: yusaku
Date: Tue Jan 15 20:53:10 2013
New Revision: 1433640
URL: http://svn.apache.org/viewvc?rev=1433640&view=rev
Log:
AMBARI-1185. Refactor the method to check if the user is an admin. (yusaku)
Modified:
incubator/ambari/trunk/CHANGES.txt
incubator/ambari/trunk/ambari-web/app/app.js
incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js
incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
incubator/ambari/trunk/ambari-web/app/controllers/main/service.js
incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js
incubator/ambari/trunk/ambari-web/app/models.js
incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs
Modified: incubator/ambari/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/CHANGES.txt?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/CHANGES.txt (original)
+++ incubator/ambari/trunk/CHANGES.txt Tue Jan 15 20:53:10 2013
@@ -17,6 +17,9 @@ Trunk (unreleased changes):
IMPROVEMENTS
+ AMBARI-1185. Refactor the method to check if the user is an admin.
+ (yusaku)
+
AMBARI-1183. Directories in the service config textarea should not wrap.
(yusaku)
Modified: incubator/ambari/trunk/ambari-web/app/app.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/app.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/app.js (original)
+++ incubator/ambari/trunk/ambari-web/app/app.js Tue Jan 15 20:53:10 2013
@@ -27,7 +27,11 @@ module.exports = Em.Application.create({
adapter: DS.FixtureAdapter.create({
simulateRemoteResponse: false
})
- })
+ }),
+ isAdmin : function(){
+ var user = this.db && this.db.getUser();
+ return user ? user.admin : false;
+ }.property()
});
/**
Modified: incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/login_controller.js Tue
Jan 15 20:53:10 2013
@@ -27,10 +27,6 @@ App.LoginController = Em.Object.extend({
errorMessage: '',
- isAdmin: function(){
- return App.db.getUser().admin;
- }.property('loginName'),
-
submit: function (e) {
this.set('errorMessage', '');
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host.js Tue Jan 15
20:53:10 2013
@@ -25,10 +25,6 @@ App.MainHostController = Em.ArrayControl
content: App.Host.find(),
comeWithFilter: false,
- isAdmin: function(){
- return App.router.getUser().admin;
- }.property('App.router.loginController.loginName'),
-
/**
* Components which will be shown in component filter
*/
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/host/details.js Tue
Jan 15 20:53:10 2013
@@ -22,9 +22,7 @@ App.MainHostDetailsController = Em.Contr
name: 'mainHostDetailsController',
content: null,
isFromHosts: false,
- isAdmin: function(){
- return App.db.getUser().admin;
- }.property('App.router.loginController.loginName'),
+
routeHome: function () {
App.router.transitionTo('main.dashboard');
},
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service.js (original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service.js Tue Jan
15 20:53:10 2013
@@ -26,9 +26,7 @@ App.MainServiceController = Em.ArrayCont
}
return App.Service.find();
}.property('App.router.clusterController.isLoaded'),
- isAdmin: function(){
- return App.db.getUser().admin;
- }.property('App.router.loginController.loginName'),
+
hdfsService: function () {
var hdfsSvcs = App.HDFSService.find();
if (hdfsSvcs && hdfsSvcs.get('length') > 0) {
Modified: incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js
(original)
+++ incubator/ambari/trunk/ambari-web/app/controllers/main/service/item.js Tue
Jan 15 20:53:10 2013
@@ -20,9 +20,7 @@ var App = require('app');
App.MainServiceItemController = Em.Controller.extend({
name: 'mainServiceItemController',
- isAdmin: function(){
- return App.db.getUser().admin;
- }.property('App.router.loginController.loginName'),
+
/**
* Send specific command to server
* @param url
Modified: incubator/ambari/trunk/ambari-web/app/models.js
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/models.js?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/models.js (original)
+++ incubator/ambari/trunk/ambari-web/app/models.js Tue Jan 15 20:53:10 2013
@@ -40,4 +40,6 @@ require('models/job');
require('models/run');
require('models/app');
require('models/background_operation');
-require('models/host_component');
\ No newline at end of file
+require('models/host_component');
+
+require('classes/run_class');
\ No newline at end of file
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host.hbs Tue Jan 15
20:53:10 2013
@@ -17,7 +17,7 @@
}}
<div id="hosts">
- {{#if controller.isAdmin}}
+ {{#if App.isAdmin}}
<div class="box-header">
<div class="button-section">
<button class="btn btn-inverse add-host-button" {{action addHost}}>
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs
(original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host/details.hbs Tue
Jan 15 20:53:10 2013
@@ -19,7 +19,7 @@
<div id="host-details">
<span {{bindAttr class="view.content.healthClass"}}></span><span
class='host-title'>{{unbound view.content.publicHostName}}</span>
<div><a href="javascript:void(null)" data-toggle="modal" {{action
backToHostsList}}><i class="icon-arrow-left"></i> Back to Hosts</a></div>
-<!-- {{#if controller.isAdmin}} -->
+<!-- {{#if App.isAdmin}} -->
<!-- <div class="host-maintenance"> -->
<!-- <div class="host-maintenance-btn btn-group display-inline-block"> -->
<!-- <a class="btn dropdown-toggle" data-toggle="dropdown" href="#"> -->
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs
(original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/host/summary.hbs Tue
Jan 15 20:53:10 2013
@@ -54,7 +54,7 @@
<a href="#" {{action routeToService component.service
target="controller" }}>{{component.service.displayName}}</a>
</div>
<div class="span4">
- {{#if controller.isAdmin}}
+ {{#if App.isAdmin}}
<div class="btn-group">
<a {{ bindAttr class=":btn :dropdown-toggle
view.disabledClass"}} data-toggle="dropdown">
Action
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/service.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service.hbs?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/service.hbs (original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/service.hbs Tue Jan 15
20:53:10 2013
@@ -19,7 +19,7 @@
<div class="row-fluid">
<div id="services-menu" class="well span2" style="padding: 8px 0">
{{view App.MainServiceMenuView}}
- {{#if controller.isAdmin}}
+ {{#if App.isAdmin}}
{{#if App.addServicesEnabled}}
<div class="add-service-button">
<a class="btn" {{action addService href="true"}}>
Modified:
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
---
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
(original)
+++
incubator/ambari/trunk/ambari-web/app/templates/main/service/info/configs.hbs
Tue Jan 15 20:53:10 2013
@@ -54,7 +54,7 @@
</div>
{{/each}}
</div>
- {{#if App.router.loginController.isAdmin}}
+ {{#if App.isAdmin}}
<p class="pull-right">
<!--<input class="btn btn-primary" type="button" value="Save"
{{!bindAttr disabled="isSubmitDisabled"}} />-->
<a class="btn btn-primary" {{bindAttr disabled="isSubmitDisabled"}}
Modified: incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs
URL:
http://svn.apache.org/viewvc/incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs?rev=1433640&r1=1433639&r2=1433640&view=diff
==============================================================================
--- incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs
(original)
+++ incubator/ambari/trunk/ambari-web/app/templates/main/service/item.hbs Tue
Jan 15 20:53:10 2013
@@ -17,7 +17,7 @@
}}
{{view App.MainServiceInfoMenuView configTabBinding="view.hasConfigTab"}}
-{{#if controller.isAdmin}}
+{{#if App.isAdmin}}
<div class="service-button">
{{#if view.hasMaintenanceControl}}
<div class="btn-group display-inline-block">