You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ak...@apache.org on 2016/06/17 17:16:29 UTC
[1/4] ambari git commit: AMBARI-17295 Views in Ambari UI don't render
when proxied by Knox (akovalenko)
Repository: ambari
Updated Branches:
refs/heads/branch-2.4 4ae7b1249 -> b8694fd7f
AMBARI-17295 Views in Ambari UI don't render when proxied by Knox (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/5889ffc1
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/5889ffc1
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/5889ffc1
Branch: refs/heads/branch-2.4
Commit: 5889ffc1908c8ec36b5c4329c25586ddcb57d8e0
Parents: 0545cb5
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jun 17 16:36:36 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jun 17 20:15:47 2016 +0300
----------------------------------------------------------------------
.../src/main/resources/ui/admin-web/app/index.html | 8 ++++----
.../main/resources/ui/admin-web/app/scripts/app.js | 9 +++++----
.../scripts/controllers/ambariViews/ViewUrlCtrl.js | 3 ++-
.../controllers/ambariViews/ViewUrlEditCtrl.js | 3 ++-
.../scripts/controllers/ambariViews/ViewsEditCtrl.js | 1 +
.../ui/admin-web/app/scripts/controllers/mainCtrl.js | 15 +++++++++------
.../stackVersions/StackVersionsListCtrl.js | 4 ++--
.../ui/admin-web/app/scripts/i18n.config.js | 4 ++--
.../resources/ui/admin-web/app/scripts/routes.js | 13 +++++++++++++
.../ui/admin-web/app/views/ambariViews/edit.html | 9 +++++++--
.../ui/admin-web/app/views/ambariViews/listUrls.html | 2 +-
.../resources/ui/admin-web/app/views/leftNavbar.html | 4 ++--
.../main/resources/ui/admin-web/app/views/main.html | 4 ++--
.../ui/admin-web/app/views/stackVersions/list.html | 2 +-
ambari-web/app/config.js | 1 +
ambari-web/app/router.js | 2 +-
ambari-web/app/routes/views.js | 4 +++-
.../views/main/admin/stack_upgrade/versions_view.js | 2 +-
18 files changed, 59 insertions(+), 31 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/index.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/index.html b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
index 25379c1..d603f28 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/index.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/index.html
@@ -48,14 +48,14 @@
<header class="navbar navbar-static-top navbar-inverse">
<div class="navbar-inner">
<div class="container">
- <a href="/#/main/dashboard" class="logo"><img src="/img/logo-white.png" alt="{{'common.apacheAmbari' | translate}}" title="{{'common.apacheAmbari' | translate}}"></a>
- <a href="/#/main/dashboard" class="brand" title="{{'common.apacheAmbari' | translate}}">{{'common.ambari' | translate}}</a>
+ <a href="{{fromSiteRoot('/#/main/dashboard')}}" class="logo"><img src="/img/logo-white.png" alt="{{'common.apacheAmbari' | translate}}" title="{{'common.apacheAmbari' | translate}}"></a>
+ <a href="{{fromSiteRoot('/#/main/dashboard')}}" class="brand" title="{{'common.apacheAmbari' | translate}}">{{'common.ambari' | translate}}</a>
<ul class="nav navbar-nav navbar-right">
<li>
<div class="btn-group navbar-views-dropdown" dropdown is-open="viewsdropdown.isopen" ng-mouseover="viewsdropdown.isopen=true" ng-mouseout="viewsdropdown.isopen=false">
- <a href="/#/main/views" ng-click="gotoViewsDashboard()" class="dropdown-toggle"><i class="fa fa-th"></i></a>
+ <a href="{{fromSiteRoot('/#/main/views')}}" ng-click="gotoViewsDashboard()" class="dropdown-toggle"><i class="fa fa-th"></i></a>
<ul class="dropdown-menu" role="menu">
- <li ng-repeat="instance in viewInstances"><a href="/#/main{{instance.context_path}}" ng-click="about()">{{instance.label}}</a></li>
+ <li ng-repeat="instance in viewInstances"><a href="{{fromSiteRoot('/#/main/views/' + instance.viewUrl)}}" ng-click="about()">{{instance.label}}</a></li>
<li ng-show="!viewInstances.length" class="disabled"><a>{{'common.noViews' | translate}}</a></li>
</ul>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
index b658fb0..39a8e9c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/app.js
@@ -26,16 +26,17 @@ angular.module('ambariAdminConsole', [
'pascalprecht.translate'
])
.constant('Settings', {
- baseUrl: '/api/v1',
+ siteRoot: '{proxy_root}/'.replace(/\{.+\}/g, ''),
+ baseUrl: '{proxy_root}/api/v1'.replace(/\{.+\}/g, ''),
testMode: (window.location.port == 8000),
mockDataPrefix: 'assets/data/',
isLDAPConfigurationSupported: false,
isLoginActivitiesSupported: false,
isJWTSupported: false
})
-.config(['RestangularProvider', '$httpProvider', '$provide', function(RestangularProvider, $httpProvider, $provide) {
+.config(['RestangularProvider', '$httpProvider', '$provide', 'Settings', function(RestangularProvider, $httpProvider, $provide, Settings) {
// Config Ajax-module
- RestangularProvider.setBaseUrl('/api/v1');
+ RestangularProvider.setBaseUrl(Settings.baseUrl);
RestangularProvider.setDefaultHeaders({'X-Requested-By':'ambari'});
$httpProvider.defaults.headers.post['Content-Type'] = 'plain/text';
@@ -67,7 +68,7 @@ angular.module('ambariAdminConsole', [
function error(response) {
if (response.status == 403) {
- window.location = "/";
+ window.location = Settings.siteRoot;
return;
}
return $q.reject(response);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlCtrl.js
index 4a663c4..9a234cc 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlCtrl.js
@@ -18,7 +18,7 @@
'use strict';
angular.module('ambariAdminConsole')
-.controller('ViewUrlCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate', function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate) {
+.controller('ViewUrlCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate', 'Settings', function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate, Settings) {
var $t = $translate.instant;
$scope.form = {};
$scope.constants = {
@@ -115,6 +115,7 @@ angular.module('ambariAdminConsole')
View.updateShortUrl(payload).then(function(urlStatus) {
Alert.success($t('urls.urlCreated', {
+ siteRoot: Settings.siteRoot,
viewName:$scope.url.selectedInstance.cname ,
shortUrl:$scope.url.suffix,
urlName:$scope.url.urlName
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlEditCtrl.js
index 93edc69..4e961f0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewUrlEditCtrl.js
@@ -18,7 +18,7 @@
'use strict';
angular.module('ambariAdminConsole')
-.controller('ViewUrlEditCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate','ConfirmationModal' ,function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate,ConfirmationModal) {
+ .controller('ViewUrlEditCtrl',['$scope', 'View', 'Alert', 'Cluster', '$routeParams', '$location', 'UnsavedDialog', '$translate','ConfirmationModal', 'Settings' ,function($scope, View, Alert, Cluster, $routeParams, $location, UnsavedDialog, $translate,ConfirmationModal, Settings) {
var $t = $translate.instant;
$scope.form = {};
$scope.constants = {
@@ -55,6 +55,7 @@ angular.module('ambariAdminConsole')
View.editShortUrl(payload).then(function(urlStatus) {
Alert.success($t('urls.urlUpdated', {
+ siteRoot: Settings.siteRoot,
viewName:$scope.url.view_instance_common_name ,
shortUrl:$scope.url.suffix,
urlName:$scope.url.url_name
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
index 7bb4039..bd74b16 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/ViewsEditCtrl.js
@@ -35,6 +35,7 @@ angular.module('ambariAdminConsole')
View.getInstance($routeParams.viewId, $routeParams.version, $routeParams.instanceId)
.then(function(instance) {
$scope.instance = instance;
+ $scope.viewUrl = instance.ViewInstanceInfo.view_name + '/' + instance.ViewInstanceInfo.version + '/' + instance.ViewInstanceInfo.instance_name;
$scope.settings = {
'visible': $scope.instance.ViewInstanceInfo.visible,
'label': $scope.instance.ViewInstanceInfo.label,
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
index 2878f88..7937658 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/mainCtrl.js
@@ -22,7 +22,7 @@ angular.module('ambariAdminConsole')
var $t = $translate.instant;
$scope.signOut = function() {
Auth.signout().finally(function() {
- $window.location.pathname = '';
+ $window.location.pathname = Settings.siteRoot;
});
};
@@ -38,7 +38,7 @@ angular.module('ambariAdminConsole')
.then(function(data) {
var auth = !!data.data && !!data.data.items ? data.data.items.map(function (a){return a.AuthorizationInfo.authorization_id}) : [];
if(auth.indexOf('AMBARI.RENAME_CLUSTER') == -1){
- $window.location = "/#/main/dashboard";
+ $window.location = $rootScope.fromSiteRoot("/#/main/dashboard");
}
});
@@ -84,12 +84,15 @@ angular.module('ambariAdminConsole')
$scope.updateInstances = function () {
View.getAllVisibleInstance().then(function(instances) {
- $scope.viewInstances = instances;
+ $scope.viewInstances = instances.map(function(i) {
+ i.viewUrl = i.view_name + '/' + i.version + '/' + i.instance_name;
+ return i;
+ });
});
};
$scope.gotoViewsDashboard =function() {
- window.location = '/#/main/views';
+ window.location = Settings.siteRoot + '#/main/views';
};
$scope.$root.$on('instancesUpdate', function (event, data) {
@@ -137,7 +140,7 @@ angular.module('ambariAdminConsole')
$rootScope.timeoutModal.close();
delete $rootScope.timeoutModal;
Auth.signout().finally(function() {
- $window.location.pathname = '';
+ $window.location.pathname = Settings.siteRoot;
});
};
$scope.countDown = function() {
@@ -145,7 +148,7 @@ angular.module('ambariAdminConsole')
$scope.$apply();
if ($scope.remainTime == 0) {
Auth.signout().finally(function() {
- $window.location.pathname = '';
+ $window.location.pathname = Settings.siteRoot;
});
}
};
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
index 8b697f8..34daa29 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsListCtrl.js
@@ -18,7 +18,7 @@
'use strict';
angular.module('ambariAdminConsole')
- .controller('StackVersionsListCtrl', ['$scope', 'Cluster', 'Stack', '$routeParams', '$translate', function ($scope, Cluster, Stack, $routeParams, $translate) {
+ .controller('StackVersionsListCtrl', ['$scope', 'Cluster', 'Stack', '$routeParams', '$translate', 'Settings', function ($scope, Cluster, Stack, $routeParams, $translate, Settings) {
var $t = $translate.instant;
$scope.getConstant = function (key) {
return $t('common.' + key).toLowerCase();
@@ -65,7 +65,7 @@ angular.module('ambariAdminConsole')
};
$scope.goToCluster = function() {
- window.location.replace('/#/main/admin/stack/versions');
+ window.location.replace(Settings.siteRoot + '#/main/admin/stack/versions');
};
$scope.clearFilters = function () {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
index 6fe46dc..b4138b3 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js
@@ -280,8 +280,8 @@ angular.module('ambariAdminConsole')
'noViewInstances':'No view instances',
'none':'None',
'change':'Change',
- 'urlCreated':'Created short URL <a href="/#/main/view/{{viewName}}/{{shortUrl}}">{{urlName}}</a>',
- 'urlUpdated':'Updated short URL <a href="/#/main/view/{{viewName}}/{{shortUrl}}">{{urlName}}</a>'
+ 'urlCreated':'Created short URL <a href="{{siteRoot}}#/main/view/{{viewName}}/{{shortUrl}}">{{urlName}}</a>',
+ 'urlUpdated':'Updated short URL <a href="{{siteRoot}}#/main/view/{{viewName}}/{{shortUrl}}">{{urlName}}</a>'
},
'clusters': {
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
index 96bcb4c..8c926ec 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/routes.js
@@ -196,4 +196,17 @@ angular.module('ambariAdminConsole')
e.preventDefault();
}
});
+
+ /**
+ * Method using to generate full URI from site root, this method should be used
+ * along with all 'href' attribute or methods which invoke redirect to Ambari Web.
+ * This method is useful to determine actual site root when ambari run under proxy server.
+ *
+ * @param {string} url
+ * @returns {string}
+ */
+ $rootScope.fromSiteRoot = function(url) {
+ var path = url[0] === '/' ? url.substring(1) : url;
+ return Settings.siteRoot + path;
+ };
}]);
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
index f6facb5..69eb1c1 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/edit.html
@@ -18,7 +18,12 @@
<div class="clearfix">
<ol class="breadcrumb pull-left">
<li><a href="#/views">{{'common.views' | translate}}</a></li>
- <li class="active">{{instance.ViewInstanceInfo.label}} <a class="gotoinstance" ng-show="instance.ViewInstanceInfo.visible" href="/#/main{{instance.ViewInstanceInfo.context_path}}">{{'views.goToInstance' | translate}}</a></li>
+ <li class="active">{{instance.ViewInstanceInfo.label}}
+ <a class="gotoinstance" ng-show="instance.ViewInstanceInfo.visible"
+ href="{{fromSiteRoot('/#/main/views/' + viewUrl)}}">
+ {{'views.goToInstance' | translate}}
+ </a>
+ </li>
</ol>
<div class="pull-right top-margin-4" ng-switch="instance.ViewInstanceInfo.static">
<button ng-switch-when="true" class="btn disabled btn-default btn-delete-instance" tooltip="{{'views.alerts.cannotDeleteStaticInstance' | translate}}">{{'common.delete' | translate: '{term: instanceType}'}}</button>
@@ -83,7 +88,7 @@
<div class="col-sm-9">
<div ng-if="settings.shortUrl">
- <p class="form-control-static"><a target="_blank" href="/#/main/view/{{instance.ViewInstanceInfo.view_name}}/{{settings.shortUrl}}" ng-if="settings.shortUrl">/main/view/{{instance.ViewInstanceInfo.view_name}}/{{settings.shortUrl}} <i class="fa fa-external-link" aria-hidden="true"></i></a>
+ <p class="form-control-static"><a target="_blank" href="{{fromSiteRoot('/#/main/view/' + instance.ViewInstanceInfo.view_name + '/' + settings.shortUrl)}}" ng-if="settings.shortUrl">/main/view/{{instance.ViewInstanceInfo.view_name}}/{{settings.shortUrl}} <i class="fa fa-external-link" aria-hidden="true"></i></a>
<a ng-hide="editDetailsSettingsDisabled" href="javascript:void(0)" ng-click="deleteShortURL(settings.shortUrlName)" class="alert-link">{{'common.delete' | translate }}</a>
</p>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listUrls.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listUrls.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listUrls.html
index 4654147..82a4dec 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listUrls.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/ambariViews/listUrls.html
@@ -81,7 +81,7 @@
<a href="#/urls/edit/{{url.ViewUrlInfo.url_name}}">{{url.ViewUrlInfo.url_name}}</a>
</td>
<td>
- <a target="_blank" href="/#/main/view/{{url.ViewUrlInfo.view_instance_common_name}}/{{url.ViewUrlInfo.url_suffix}}">/main/view/{{url.ViewUrlInfo.view_instance_common_name}}/{{url.ViewUrlInfo.url_suffix}}
+ <a target="_blank" href="{{fromSiteRoot('/#/main/view/' + url.ViewUrlInfo.view_instance_common_name + '/' + url.ViewUrlInfo.url_suffix)}}">/main/view/{{url.ViewUrlInfo.view_instance_common_name}}/{{url.ViewUrlInfo.url_suffix}}
<i class="fa fa-external-link" aria-hidden="true"></i></a>
</td>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
index 2649eb0..f7d0215 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/leftNavbar.html
@@ -67,9 +67,9 @@
<li ng-class="{active: isActive('clusters.manageAccess') || isActive('clusters.userAccessList')}">
<a href="#/clusters/{{cluster.Clusters.cluster_name}}/manageAccess" class="permissions">{{'common.roles' | translate}}</a>
</li>
- <li><a href="#/dashboard" class="gotodashboard">{{'common.goToDashboard' | translate}}</a></li>
+ <li><a href="{{fromSiteRoot('/#/dashboard')}}" class="gotodashboard">{{'common.goToDashboard' | translate}}</a></li>
</ul>
- <span class="cluster-installation-progress-label" ng-show="cluster.Clusters.provisioning_state == 'INIT'"><a href="/#/">{{'common.clusterCreationInProgress' | translate}}</a></span>
+ <span class="cluster-installation-progress-label" ng-show="cluster.Clusters.provisioning_state == 'INIT'"><a href="{{fromSiteRoot('/#/')}}">{{'common.clusterCreationInProgress' | translate}}</a></span>
</div>
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
index f9e6e63..d62ae15 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/main.html
@@ -34,7 +34,7 @@
</span>
<span>
<a ng-show="cluster.Clusters.provisioning_state != 'INSTALLED'" href class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'common.goToDashboard' | translate}}</a>
- <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" href="/#/main/dashboard/metrics" class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'common.goToDashboard' | translate}}</a>
+ <a ng-show="cluster.Clusters.provisioning_state == 'INSTALLED'" href="{{fromSiteRoot('/#/main/dashboard/metrics')}}" class="btn btn-primary go-dashboard-button" ng-disabled="cluster.Clusters.provisioning_state != 'INSTALLED' ">{{'common.goToDashboard' | translate}}</a>
</span>
</div>
</div>
@@ -42,7 +42,7 @@
<h4 class="title">{{'main.createCluster.title' | translate}}</h4>
<div class="description">{{'main.createCluster.description' | translate}}</div>
<div class="glyphicon glyphicon-cloud"></div>
- <div class="buttons"> <a href="/#/installer/step0" class="btn btn-primary create-cluster-button">{{'main.createCluster.launchInstallWizard' | translate}}</a></div>
+ <div class="buttons"> <a href="{{fromSiteRoot('/#/installer/step0')}}" class="btn btn-primary create-cluster-button">{{'main.createCluster.launchInstallWizard' | translate}}</a></div>
</div>
<!--Manage Users and groups-->
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
index 10d4a82..ea577f6 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/list.html
@@ -73,7 +73,7 @@
<span>{{repo.repository_version}}</span>
</td>
<td class="col-small">
- <a href="/#/main/admin/stack/versions" ng-show="repo.cluster">
+ <a href="{{fromSiteRoot('/#/main/admin/stack/versions')}}" ng-show="repo.cluster">
{{repo.cluster}}
</a>
<span ng-show="!repo.cluster">
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-web/app/config.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/config.js b/ambari-web/app/config.js
index fe970b1..9dbb9f4 100644
--- a/ambari-web/app/config.js
+++ b/ambari-web/app/config.js
@@ -26,6 +26,7 @@ App.skipBootstrap = false;
App.alwaysGoToInstaller = false;
App.testEnableSecurity = true; // By default enable security is tested; turning it false tests disable security
App.testNameNodeHA = true;
+App.appURLRoot = '{proxy_root}/'.replace(/\{.+\}/g, ''); // determines application root path name, not related to hash route
App.apiPrefix = '/api/v1';
App.defaultStackVersion = 'HDP-2.3';
App.defaultWindowsStackVersion = 'HDPWIN-2.1';
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index a057215..d367ce3 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -631,7 +631,7 @@ App.Router = Em.Router.extend({
}),
sortedMappedVersions = mappedVersions.sort(),
latestVersion = sortedMappedVersions[sortedMappedVersions.length-1];
- window.location.replace('/views/ADMIN_VIEW/' + latestVersion + '/INSTANCE/#/');
+ window.location.replace(App.appURLRoot + 'views/ADMIN_VIEW/' + latestVersion + '/INSTANCE/#/');
}
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-web/app/routes/views.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/routes/views.js b/ambari-web/app/routes/views.js
index c50690c..1d19279 100644
--- a/ambari-web/app/routes/views.js
+++ b/ambari-web/app/routes/views.js
@@ -51,7 +51,9 @@ module.exports = Em.Route.extend({
}
router.get('mainViewsController').dataLoading().done(function() {
- var content = App.router.get('mainViewsController.ambariViews').findProperty('href', href);
+ var content = App.router.get('mainViewsController.ambariViews').filter(function(i) {
+ return Em.get(i, 'href').endsWith(href);
+ })[0];
if (content) content.set('viewPath', viewPath);
router.get('mainController').connectOutlet('mainViewsDetails', content);
});
http://git-wip-us.apache.org/repos/asf/ambari/blob/5889ffc1/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js b/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
index bdf8d7d..31ef677 100644
--- a/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
+++ b/ambari-web/app/views/main/admin/stack_upgrade/versions_view.js
@@ -190,7 +190,7 @@ App.MainAdminStackVersionsView = Em.View.extend({
}),
sortedMappedVersions = mappedVersions.sort(),
latestVersion = sortedMappedVersions[sortedMappedVersions.length-1];
- window.location.replace('/views/ADMIN_VIEW/' + latestVersion + '/INSTANCE/#/stackVersions');
+ window.location.replace(App.appURLRoot + 'views/ADMIN_VIEW/' + latestVersion + '/INSTANCE/#/stackVersions');
}
});
},
[2/4] ambari git commit: AMBARI-17293 Ambari does not refresh yarn
queues when HiveServerIntearctive component is restarted (akovalenko)
Posted by ak...@apache.org.
AMBARI-17293 Ambari does not refresh yarn queues when HiveServerIntearctive component is restarted (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0545cb59
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0545cb59
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0545cb59
Branch: refs/heads/branch-2.4
Commit: 0545cb59772995e4b1c5fe8e1471c3f23b8ee157
Parents: 4ae7b12
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jun 17 16:11:25 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jun 17 20:15:47 2016 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/host/details.js | 69 +++++++++++++++++++-
.../test/controllers/main/host/details_test.js | 13 ++++
2 files changed, 81 insertions(+), 1 deletion(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/0545cb59/ambari-web/app/controllers/main/host/details.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/host/details.js b/ambari-web/app/controllers/main/host/details.js
index 1364adf..517adb2 100644
--- a/ambari-web/app/controllers/main/host/details.js
+++ b/ambari-web/app/controllers/main/host/details.js
@@ -68,6 +68,12 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
isOozieServerAddable: true,
/**
+ * List of components to run refresh YARN queue with
+ * @type {Array}
+ */
+ refreshYARNQueueComponents: ['HIVE_SERVER_INTERACTIVE'],
+
+ /**
* Open dashboard page
* @method routeHome
*/
@@ -510,13 +516,18 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
* @method restartComponent
*/
restartComponent: function (event) {
+ var self = this;
var component = event.context;
- if (event.context.get('componentName') == 'NAMENODE') {
+ if (component.get('componentName') == 'NAMENODE') {
this.checkNnLastCheckpointTime(function () {
return App.showConfirmationPopup(function () {
batchUtils.restartHostComponents([component], Em.I18n.t('rollingrestart.context.selectedComponentOnSelectedHost').format(component.get('displayName')), "HOST_COMPONENT");
});
});
+ } else if (this.get('refreshYARNQueueComponents').contains(component.get('componentName'))) {
+ return App.showConfirmationPopup(function () {
+ self.restartComponentAndRefreshYARNQueue(component);
+ });
} else {
return App.showConfirmationPopup(function () {
batchUtils.restartHostComponents([component], Em.I18n.t('rollingrestart.context.selectedComponentOnSelectedHost').format(component.get('displayName')), "HOST_COMPONENT");
@@ -524,6 +535,62 @@ App.MainHostDetailsController = Em.Controller.extend(App.SupportClientConfigsDow
}
},
+ restartComponentAndRefreshYARNQueue: function (component) {
+ var componentToRestartHost = App.HostComponent.find().findProperty('componentName', component.get('componentName')).get('hostName');
+ var resourceManagerHost = App.HostComponent.find().findProperty('componentName', 'RESOURCEMANAGER').get('hostName');
+ var batches = [
+ {
+ "order_id": 1,
+ "type": "POST",
+ "uri": App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
+ "RequestBodyInfo": {
+ "RequestInfo": {
+ "context": "Restart " + component.get('displayName'),
+ "command": "RESTART",
+ "operation_level": {
+ "level": "HOST_COMPONENT",
+ "cluster_name": App.get('clusterName'),
+ "service_name": component.get('service.serviceName'),
+ "hostcomponent_name": component.get('componentName')
+ }
+ },
+ "Requests/resource_filters": [{
+ "service_name": component.get('service.serviceName'),
+ "component_name": component.get('componentName'),
+ "hosts": componentToRestartHost
+ }]
+ }
+ },
+ {
+ "order_id": 2,
+ "type": "POST",
+ "uri": App.apiPrefix + "/clusters/" + App.get('clusterName') + "/requests",
+ "RequestBodyInfo": {
+ "RequestInfo": {
+ "context": "Refresh YARN Capacity Scheduler",
+ "command": "REFRESHQUEUES",
+ "parameters/forceRefreshConfigTags": "capacity-scheduler"
+ },
+ "Requests/resource_filters": [{
+ "service_name": "YARN",
+ "component_name": "RESOURCEMANAGER",
+ "hosts": resourceManagerHost
+ }]
+ }
+ }
+ ];
+ App.ajax.send({
+ name: 'common.batch.request_schedules',
+ sender: this,
+ data: {
+ intervalTimeSeconds: 1,
+ tolerateSize: 0,
+ batches: batches
+ },
+ success: 'showBackgroundOperationsPopup'
+ });
+ },
+
/**
* add component as <code>addComponent<code> method but perform
* kdc sessionstate if cluster is secure;
http://git-wip-us.apache.org/repos/asf/ambari/blob/0545cb59/ambari-web/test/controllers/main/host/details_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/host/details_test.js b/ambari-web/test/controllers/main/host/details_test.js
index 66bd454..971d0cd 100644
--- a/ambari-web/test/controllers/main/host/details_test.js
+++ b/ambari-web/test/controllers/main/host/details_test.js
@@ -472,11 +472,13 @@ describe('App.MainHostDetailsController', function () {
sinon.spy(App, "showConfirmationPopup");
sinon.stub(batchUtils, "restartHostComponents", Em.K);
sinon.stub(controller, 'checkNnLastCheckpointTime', Em.clb);
+ sinon.stub(controller, "restartComponentAndRefreshYARNQueue", Em.K);
});
afterEach(function () {
App.showConfirmationPopup.restore();
batchUtils.restartHostComponents.restore();
controller.checkNnLastCheckpointTime.restore();
+ controller.restartComponentAndRefreshYARNQueue.restore();
});
it('popup should be displayed', function () {
@@ -497,6 +499,17 @@ describe('App.MainHostDetailsController', function () {
expect(controller.checkNnLastCheckpointTime.calledOnce).to.equal(true);
expect(App.showConfirmationPopup.calledOnce).to.be.true;
});
+
+ it('restart HIVE_SERVER_INTERACTIVE, should call restartComponentAndRefreshYARNQueuet', function () {
+ var event = {
+ context: Em.Object.create({
+ componentName: 'HIVE_SERVER_INTERACTIVE'
+ })
+ };
+ var confirmPopup = controller.restartComponent(event);
+ confirmPopup.onPrimary();
+ expect(controller.restartComponentAndRefreshYARNQueue.calledOnce).to.be.true;
+ });
});
describe('#addComponent()', function () {
[3/4] ambari git commit: AMBARI-17297 While deleting a service,
confirmation popup took a long time (~30 seconds) to
appear (akovalenko)
Posted by ak...@apache.org.
AMBARI-17297 While deleting a service, confirmation popup took a long time (~30 seconds) to appear (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/59148381
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/59148381
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/59148381
Branch: refs/heads/branch-2.4
Commit: 5914838102040461e80a58015d3b4b1ed177834e
Parents: 5889ffc
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jun 17 16:57:20 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jun 17 20:15:48 2016 +0300
----------------------------------------------------------------------
ambari-web/app/controllers/main/service/item.js | 47 ++++++++--
ambari-web/app/messages.js | 1 +
.../app/mixins/common/configs/configs_saver.js | 6 +-
ambari-web/app/styles/application.less | 14 +++
.../test/controllers/main/service/item_test.js | 95 ++++++++++++++++++--
5 files changed, 149 insertions(+), 14 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/59148381/ambari-web/app/controllers/main/service/item.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/controllers/main/service/item.js b/ambari-web/app/controllers/main/service/item.js
index 4f8d9009..79188aa 100644
--- a/ambari-web/app/controllers/main/service/item.js
+++ b/ambari-web/app/controllers/main/service/item.js
@@ -19,6 +19,7 @@
var App = require('app');
var batchUtils = require('utils/batch_scheduled_requests');
var blueprintUtils = require('utils/blueprint');
+var stringUtils = require('utils/string_utils');
App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDownload, App.InstallComponent, App.ConfigsSaverMixin, App.EnhancedConfigsMixin, {
name: 'mainServiceItemController',
@@ -83,6 +84,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
*/
routeToConfigs: false,
+ deleteServiceProgressPopup: null,
+
isClientsOnlyService: function() {
return App.get('services.clientOnly').contains(this.get('content.serviceName'));
}.property('content.serviceName'),
@@ -1341,7 +1344,26 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
* @function onPrimary
*/
onPrimary: function() {
- self.deleteServiceCall([serviceName].concat(dependentServiceNames));
+ var serviceNames = [serviceName].concat(dependentServiceNames),
+ serviceDisplayNames = serviceNames.map(function (serviceName) {
+ return App.Service.find(serviceName).get('displayName');
+ }),
+ progressPopup = App.ModalPopup.show({
+ classNames: ['delete-service-progress'],
+ header: Em.I18n.t('services.service.delete.popup.header'),
+ showFooter: false,
+ message: Em.I18n.t('services.service.delete.progressPopup.message').format(stringUtils.getFormattedStringFromArray(serviceDisplayNames)),
+ bodyClass: Em.View.extend({
+ classNames: ['delete-service-progress-body'],
+ template: Em.Handlebars.compile('{{view App.SpinnerView}}<div class="progress-message">{{message}}</div>')
+ }),
+ onClose: function () {
+ self.set('deleteServiceProgressPopup', null);
+ this._super();
+ }
+ });
+ self.set('deleteServiceProgressPopup', progressPopup);
+ self.deleteServiceCall(serviceNames);
this._super();
},
@@ -1458,7 +1480,8 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
* @override
*/
saveConfigs: function() {
- var data = [];
+ var data = [],
+ progressPopup = this.get('deleteServiceProgressPopup');
this.get('stepConfigs').forEach(function(stepConfig) {
var serviceConfig = this.getServiceConfigToSave(stepConfig.get('serviceName'), stepConfig.get('configs'));
@@ -1468,16 +1491,24 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
}, this);
if (Em.isArray(data) && data.length) {
- this.putChangedConfigurations(data, 'confirmServiceDeletion');
+ this.putChangedConfigurations(data, 'confirmServiceDeletion', function () {
+ if (progressPopup) {
+ progressPopup.onClose();
+ }
+ });
} else {
this.confirmServiceDeletion();
}
},
confirmServiceDeletion: function() {
- var msg = this.get('interDependentServices.length')
- ? Em.I18n.t('services.service.delete.service.success.confirmation.plural').format(this.get('serviceNamesToDelete').join(','))
- : Em.I18n.t('services.service.delete.service.success.confirmation').format(this.get('content.serviceName'));
+ var progressPopup = this.get('deleteServiceProgressPopup'),
+ msg = this.get('interDependentServices.length')
+ ? Em.I18n.t('services.service.delete.service.success.confirmation.plural').format(this.get('serviceNamesToDelete').join(','))
+ : Em.I18n.t('services.service.delete.service.success.confirmation').format(this.get('content.serviceName'));
+ if (progressPopup) {
+ progressPopup.onClose();
+ }
return App.showAlertPopup(Em.I18n.t('popup.confirmation.commonHeader'), msg, function() {
window.location.reload();
})
@@ -1515,6 +1546,10 @@ App.MainServiceItemController = Em.Controller.extend(App.SupportClientConfigsDow
},
deleteServiceCallErrorCallback: function (jqXHR, ajaxOptions, error, opt) {
+ var progressPopup = this.get('deleteServiceProgressPopup');
+ if (progressPopup) {
+ progressPopup.onClose();
+ }
App.ajax.defaultErrorHandler(jqXHR, opt.url, opt.type, jqXHR.status);
}
http://git-wip-us.apache.org/repos/asf/ambari/blob/59148381/ambari-web/app/messages.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/messages.js b/ambari-web/app/messages.js
index 6465812..79fe36a 100644
--- a/ambari-web/app/messages.js
+++ b/ambari-web/app/messages.js
@@ -1845,6 +1845,7 @@ Em.I18n.translations = {
'services.service.confirmDelete.popup.body.type': 'Type "{0}" to confirm',
'services.service.confirmDelete.popup.body.dependent': 'You must confirm delete of <b>{0}</b> and <b>{1}</b> by typing "{2}"' +
' in the confirmation box. <b>This operation is not reversible and all configuration history will be lost.</b>',
+ 'services.service.delete.progressPopup.message': 'Deleting {0}...',
'services.service.delete.service.success.confirmation': 'Service {0} was successfully deleted',
'services.service.delete.service.success.confirmation.plural': 'Services {0} were successfully deleted',
http://git-wip-us.apache.org/repos/asf/ambari/blob/59148381/ambari-web/app/mixins/common/configs/configs_saver.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/mixins/common/configs/configs_saver.js b/ambari-web/app/mixins/common/configs/configs_saver.js
index f486180..a841951 100644
--- a/ambari-web/app/mixins/common/configs/configs_saver.js
+++ b/ambari-web/app/mixins/common/configs/configs_saver.js
@@ -603,10 +603,11 @@ App.ConfigsSaverMixin = Em.Mixin.create({
* contains the site name and tag to be used.
* @param {Object[]} services
* @param {String} [successCallback]
+ * @param {Function} [alwaysCallback]
* @return {$.ajax}
* @method putChangedConfigurations
*/
- putChangedConfigurations: function (services, successCallback) {
+ putChangedConfigurations: function (services, successCallback, alwaysCallback) {
var ajaxData = {
name: 'common.across.services.configurations',
sender: this,
@@ -618,6 +619,9 @@ App.ConfigsSaverMixin = Em.Mixin.create({
if (successCallback) {
ajaxData.success = successCallback;
}
+ if (alwaysCallback) {
+ ajaxData.callback = alwaysCallback;
+ }
return App.ajax.send(ajaxData);
},
http://git-wip-us.apache.org/repos/asf/ambari/blob/59148381/ambari-web/app/styles/application.less
----------------------------------------------------------------------
diff --git a/ambari-web/app/styles/application.less b/ambari-web/app/styles/application.less
index d525fd4..4ae4c61 100644
--- a/ambari-web/app/styles/application.less
+++ b/ambari-web/app/styles/application.less
@@ -6420,3 +6420,17 @@ input[type="radio"].align-checkbox, input[type="checkbox"].align-checkbox {
}
}
+.delete-service-progress {
+ .modal-body {
+ text-align: center;
+ .delete-service-progress-body {
+ display: inline-block;
+ .spinner, .progress-message {
+ float: left;
+ }
+ .progress-message {
+ line-height: @spinner-default-height;
+ }
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/ambari/blob/59148381/ambari-web/test/controllers/main/service/item_test.js
----------------------------------------------------------------------
diff --git a/ambari-web/test/controllers/main/service/item_test.js b/ambari-web/test/controllers/main/service/item_test.js
index 4176b3d..5c2b34a 100644
--- a/ambari-web/test/controllers/main/service/item_test.js
+++ b/ambari-web/test/controllers/main/service/item_test.js
@@ -1494,18 +1494,99 @@ describe('App.MainServiceItemController', function () {
describe("#confirmDeleteService()", function() {
var mainServiceItemController;
- beforeEach(function() {
- mainServiceItemController = App.MainServiceItemController.create({});
- sinon.stub(App.ModalPopup, 'show');
+ beforeEach(function () {
+ mainServiceItemController = App.MainServiceItemController.create();
});
- afterEach(function() {
+
+ afterEach(function () {
App.ModalPopup.show.restore();
});
- it("App.ModalPopup.show should be called", function() {
- mainServiceItemController.confirmDeleteService('S1', [], '');
- expect(App.ModalPopup.show.calledOnce).to.be.true;
+ describe('confirmation popup', function () {
+
+ beforeEach(function () {
+ sinon.stub(App.ModalPopup, 'show', Em.K);
+ mainServiceItemController.confirmDeleteService('S1', [], '');
+ });
+
+ it("App.ModalPopup.show should be called", function() {
+ expect(App.ModalPopup.show.calledOnce).to.be.true;
+ });
+
+ });
+
+ describe('progress popup', function () {
+
+ var cases = [
+ {
+ serviceName: 'S0',
+ dependentServiceNames: [],
+ serviceNames: ['S0'],
+ message: 's0',
+ title: 'no dependent services'
+ },
+ {
+ serviceName: 'S1',
+ dependentServiceNames: ['S2', 'S3', 'S4'],
+ serviceNames: ['S1', 'S2', 'S3', 'S4'],
+ message: 's1, s2, s3 and s4',
+ title: 'dependent services present'
+ }
+ ];
+
+ cases.forEach(function (item) {
+
+ describe(item.title, function () {
+
+ beforeEach(function () {
+ sinon.stub(App.ModalPopup, 'show', function (options) {
+ options._super = Em.K;
+ if (options.onPrimary) {
+ options.onPrimary();
+ }
+ return options;
+ });
+ sinon.stub(App.Service, 'find', function (serviceName) {
+ return Em.Object.create({
+ displayName: serviceName.toLowerCase()
+ });
+ });
+ sinon.stub(mainServiceItemController, 'deleteServiceCall', Em.K);
+ mainServiceItemController.confirmDeleteService(item.serviceName, item.dependentServiceNames, '');
+ });
+
+ afterEach(function () {
+ App.Service.find.restore();
+ mainServiceItemController.deleteServiceCall.restore();
+ });
+
+ it('modal popups display', function () {
+ expect(App.ModalPopup.show.calledTwice).to.be.true;
+ });
+
+ it('progress popup message', function () {
+ expect(mainServiceItemController.get('deleteServiceProgressPopup.message')).to.equal(Em.I18n.t('services.service.delete.progressPopup.message').format(item.message));
+ });
+
+ it('delete service call', function () {
+ expect(mainServiceItemController.deleteServiceCall.calledOnce).to.be.true;
+ });
+
+ it('delete service call arguments', function () {
+ expect(mainServiceItemController.deleteServiceCall.calledWith(item.serviceNames)).to.be.true;
+ });
+
+ it('progress popup close', function () {
+ mainServiceItemController.get('deleteServiceProgressPopup').onClose();
+ expect(mainServiceItemController.get('deleteServiceProgressPopup')).to.be.null;
+ });
+
+ });
+
+ });
+
});
+
});
describe('#interDependentServices', function() {
[4/4] ambari git commit: AMBARI-17298 Add View Operational Logs role
info to RBAC help table (akovalenko)
Posted by ak...@apache.org.
AMBARI-17298 Add View Operational Logs role info to RBAC help table (akovalenko)
Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/b8694fd7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/b8694fd7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/b8694fd7
Branch: refs/heads/branch-2.4
Commit: b8694fd7f57f789bf48e3b6fbceb24274fadc967
Parents: 5914838
Author: Aleksandr Kovalenko <ak...@hortonworks.com>
Authored: Fri Jun 17 17:00:36 2016 +0300
Committer: Aleksandr Kovalenko <ak...@hortonworks.com>
Committed: Fri Jun 17 20:15:48 2016 +0300
----------------------------------------------------------------------
.../src/main/resources/ui/admin-web/app/scripts/services/Cluster.js | 1 +
1 file changed, 1 insertion(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/ambari/blob/b8694fd7/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
index 33ed7ed..3160cd0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/Cluster.js
@@ -48,6 +48,7 @@ angular.module('ambariAdminConsole')
"SERVICE.MANAGE_ALERTS",
"SERVICE.TOGGLE_ALERTS",
"SERVICE.ADD_DELETE_SERVICES",
+ "SERVICE.VIEW_OPERATIONAL_LOGS",
"HOST.VIEW_CONFIGS",
"HOST.VIEW_METRICS",
"HOST.VIEW_STATUS_INFO",