ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pallav...@apache.org
Subject ambari git commit: AMBARI-16697. Remote Cluster: UX edits #1 (pallavkul)
Date Thu, 19 May 2016 17:25:02 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.4 fdbf3da6f -> db387fb9f


AMBARI-16697. Remote Cluster: UX edits #1 (pallavkul)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/db387fb9
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/db387fb9
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/db387fb9

Branch: refs/heads/branch-2.4
Commit: db387fb9f0a4f6c9693e2bd275a6d32079ad1c94
Parents: fdbf3da
Author: Pallav Kulshreshtha <pallav.kul@gmail.com>
Authored: Thu May 19 22:52:20 2016 +0530
Committer: Pallav Kulshreshtha <pallav.kul@gmail.com>
Committed: Thu May 19 22:54:06 2016 +0530

----------------------------------------------------------------------
 .../main/resources/ui/admin-web/app/index.html  |  1 +
 .../remoteClusters/RemoteClustersEditCtrl.js    | 38 ++++++++----
 .../ui/admin-web/app/scripts/i18n.config.js     |  2 +
 .../scripts/services/DeregisterClusterModal.js  | 61 ++++++++++++++++++++
 .../app/scripts/services/RemoteCluster.js       | 16 +++++
 .../views/modals/deregisterClusterModal.html    | 31 ++++++++++
 .../remoteClusters/editRemoteClusterPage.html   |  5 +-
 .../app/views/remoteClusters/list.html          |  2 +-
 .../remoteClusters/modals/changePassword.html   |  2 +-
 9 files changed, 140 insertions(+), 18 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/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 a4a5b28..9344f15 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
@@ -165,6 +165,7 @@
 <script src="scripts/services/PermissionLoader.js"></script>
 <script src="scripts/services/PermissionsSaver.js"></script>
 <script src="scripts/services/ConfirmationModal.js"></script>
+<script src="scripts/services/deregisterClusterModal.js"></script>
 <script src="scripts/services/Auth.js"></script>
 <script src="scripts/services/GetDifference.js"></script>
 <script src="scripts/services/UnsavedDialog.js"></script>

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
index 20eb552..5420ae5 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/remoteClusters/RemoteClustersEditCtrl.js
@@ -18,10 +18,11 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-.controller('RemoteClustersEditCtrl', ['$scope', '$modal', '$routeParams', '$location', 'Alert',
'$translate', 'Cluster', 'Settings','RemoteCluster', 'ConfirmationModal', function($scope,
$modal, $routeParams, $location, Alert, $translate, Cluster, Settings, RemoteCluster, ConfirmationModal)
{
+.controller('RemoteClustersEditCtrl', ['$scope', '$modal', '$routeParams', '$location', 'Alert',
'$translate', 'Cluster', 'Settings','RemoteCluster', 'DeregisterClusterModal', function($scope,
$modal, $routeParams, $location, Alert, $translate, Cluster, Settings, RemoteCluster, DeregisterClusterModal)
{
   var $t = $translate.instant;
 
   $scope.cluster = {};
+  $scope.instancesAffected = [];
 
   $scope.openChangePwdDialog = function() {
     var modalInstance = $modal.open({
@@ -91,19 +92,32 @@ angular.module('ambariAdminConsole')
   };
 
   $scope.deleteCluster = function() {
-      ConfirmationModal.show(
-        $t('common.deregisterCluster', {
-          term: $t('common.cluster')
-        }),
-        $t('common.deleteConfirmation', {
-          instanceType: $t('common.cluster').toLowerCase(),
-          instanceName: '"' + $scope.cluster.cluster_name + '"'
+
+    $scope.instancesAffected = [];
+    RemoteCluster.affectedViews($scope.cluster.cluster_name).then(function(response) {
+
+        response.items.forEach(function(item){
+          item.versions.forEach(function(version){
+            version.instances.forEach(function(instance){
+              $scope.instancesAffected.push(instance.ViewInstanceInfo.instance_name);
+            })
+          })
         })
-      ).then(function() {
-        RemoteCluster.deregister($scope.cluster.cluster_name).then(function() {
-          $location.path('/remoteClusters');
+
+        DeregisterClusterModal.show(
+          $t('common.deregisterCluster',{term: $t('common.cluster')}),
+          $t('common.remoteClusterDelConfirmation', {instanceType: $t('common.cluster').toLowerCase(),
instanceName: '"' + $scope.cluster.cluster_name + '"'}),
+          $scope.instancesAffected
+
+        ).then(function() {
+          RemoteCluster.deregister($scope.cluster.cluster_name).then(function() {
+            $location.path('/remoteClusters');
+          });
         });
-      });
+    })
+    .catch(function(data) {
+      console.log(data);
+    });
   };
 
   $scope.editRemoteCluster = function () {

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/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 d7dc9c7..3ed2687 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
@@ -74,6 +74,8 @@ angular.module('ambariAdminConsole')
       'settings': 'Settings',
       'authentication': 'Authentication',
       'deleteConfirmation': 'Are you sure you want to delete {{instanceType}} {{instanceName}}?',
+      'remoteClusterDelConfirmation':'Are you sure you want to delete {{instanceType}} {{instanceName}}?
This operation cannot be undone.',
+      'messageInstanceAffected':'The following View Instances are using this Remote Cluster
for configuration, and will need to be reconfigured: {{viewInstance}}',
       'local': 'Local',
       'ldap': 'LDAP',
       'jwt': 'JWT',

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/DeregisterClusterModal.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/DeregisterClusterModal.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/DeregisterClusterModal.js
new file mode 100644
index 0000000..174c0d6
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/DeregisterClusterModal.js
@@ -0,0 +1,61 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+'use strict';
+
+angular.module('ambariAdminConsole')
+.factory('DeregisterClusterModal', ['$modal', '$q', '$translate', function($modal, $q, $translate)
{
+
+  var $t = $translate.instant;
+
+	return {
+		show: function(header, body, remoteInstances, confirmText, cancelText ) {
+			var deferred = $q.defer();
+
+			var modalInstance = $modal.open({
+				templateUrl: 'views/modals/DeregisterClusterModal.html',
+				controller: ['$scope', '$modalInstance', function($scope, $modalInstance) {
+					$scope.header = header;
+          $scope.isTempalte = !!body.url;
+					$scope.body = body;
+          $scope.innerScope = body.scope;
+          $scope.confirmText = confirmText || $t('common.controls.ok');
+          $scope.cancelText = cancelText || $t('common.controls.cancel');
+					$scope.remoteInstances = remoteInstances || [];
+
+					$scope.ok = function() {
+						$modalInstance.close();
+						deferred.resolve();
+					};
+					$scope.cancel = function() {
+						$modalInstance.dismiss();
+						deferred.reject();
+					};
+				}]
+			});
+
+      modalInstance.result.then(function() {
+        // Gets triggered on close
+      }, function() {
+        // Gets triggered on dismiss
+        deferred.reject();
+      });
+
+			return deferred.promise;
+		}
+	};
+}]);
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RemoteCluster.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RemoteCluster.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RemoteCluster.js
index e4826e6..1c5f588 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RemoteCluster.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/services/RemoteCluster.js
@@ -99,6 +99,22 @@ angular.module('ambariAdminConsole')
       return deferred.promise;
     };
 
+    RemoteCluster.affectedViews = function(clustername) {
+      var deferred = $q.defer();
+
+      $http.get(Settings.baseUrl + '/views?'
+          + 'fields=versions%2Finstances/ViewInstanceInfo/cluster_handle,versions%2Finstances/ViewInstanceInfo/cluster_type&versions%2FViewVersionInfo%2Fsystem=false&versions%2Finstances/ViewInstanceInfo/cluster_type=REMOTE_AMBARI&versions%2Finstances/ViewInstanceInfo/cluster_handle='
+ clustername
+
+        )
+        .success(function(response) {
+          deferred.resolve(response);
+        })
+        .error(function(data) {
+          deferred.reject(data);
+        });
+      return deferred.promise;
+    };
+
     RemoteCluster.listAll = function() {
       var deferred = $q.defer();
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/deregisterClusterModal.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/deregisterClusterModal.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/deregisterClusterModal.html
new file mode 100644
index 0000000..e6c67ca
--- /dev/null
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/modals/deregisterClusterModal.html
@@ -0,0 +1,31 @@
+<!--
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements.  See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership.  The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+-->
+<div class="modal-header">
+    <h3 class="modal-title">{{header}}</h3>
+</div>
+<div class="modal-body">
+  <div class="default-body" ng-show="!isTempalte">{{body}}</div>
+  <div ng-show="isTempalte" ng-include="body.url"></div>
+  <br />
+  <div ng-show="remoteInstances.length > 0">{{'common.messageInstanceAffected' |
translate}}</div>
+  <ul><li ng-repeat="instanceAffected in remoteInstances">{{instanceAffected}}</li></ul>
+</div>
+<div class="modal-footer">
+    <button class="btn btn-default" ng-click="cancel()">{{cancelText}}</button>
+    <button class="btn btn-primary" ng-click="ok()">{{confirmText}}</button>
+</div>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
index b5890bf..8979cba 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/editRemoteClusterPage.html
@@ -28,9 +28,6 @@
 </div>
 <hr>
 
-
-
-
 <form class="form-horizontal create-user-form" role="form" novalidate name="form" autocomplete="off">
 
   <div class="form-group" ng-class="{'has-error' : form.user_name.$error.required &&
form.submitted}">
@@ -69,7 +66,7 @@
 
   <div class="form-group">
     <div class="col-sm-offset-2 col-sm-10">
-      <button class="btn btn-primary pull-right left-margin saveremotecluster" ng-click="editRemoteCluster()">{{'common.controls.save'
| translate}}</button>
+      <button class="btn btn-primary pull-right left-margin saveremotecluster" ng-disabled="form.$pristine"
ng-click="editRemoteCluster()">{{'common.controls.save' | translate}}</button>
       <a class="btn btn-default pull-right cancel" href ng-click="cancel()">{{'common.controls.cancel'
| translate}}</a>
     </div>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
index e386ffd..7f525e8 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/list.html
@@ -53,7 +53,7 @@
     <tr ng-repeat="remoteCluster in remoteClusters" >
       <td class="col-sm-3"><a href="#/remoteClusters/{{remoteCluster.ClusterInfo.name}}/edit">{{
remoteCluster.ClusterInfo.name }}</a></td>
       <td class="col-sm-9">
-        <span ng-repeat="service in remoteCluster.ClusterInfo.services" ng-if="remoteCluster.ClusterInfo.services.length
> 0">{{ service }} {{$last ? '' : ','}} </span>
+        <span ng-repeat="service in remoteCluster.ClusterInfo.services" ng-if="remoteCluster.ClusterInfo.services.length
> 0">{{ service }}{{$last ? '' : ','}} </span>
         <span ng-if="remoteCluster.ClusterInfo.services.length == 0">--</span>
       </td>
     </tr>

http://git-wip-us.apache.org/repos/asf/ambari/blob/db387fb9/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/modals/changePassword.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/modals/changePassword.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/modals/changePassword.html
index a05e13d..55611a0 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/modals/changePassword.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/remoteClusters/modals/changePassword.html
@@ -42,5 +42,5 @@
 </div>
 <div class="modal-footer">
   <button class="btn btn-default" ng-click="cancel()">{{'common.controls.cancel' |
translate}}</button>
-  <button class="btn btn-primary" ng-click="ok()">{{'common.controls.ok' | translate}}</button>
+  <button class="btn btn-primary" ng-click="ok()">{{'common.controls.update' | translate}}</button>
 </div>
\ No newline at end of file


Mime
View raw message