ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nc...@apache.org
Subject [08/40] ambari git commit: AMBARI-14916. Issues with Login Message dialog (alexantonenko)
Date Fri, 05 Feb 2016 21:56:23 GMT
AMBARI-14916. Issues with Login Message dialog (alexantonenko)


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

Branch: refs/heads/branch-dev-patch-upgrade
Commit: 81b46da33da91d672f16e88c9165e69954d2b292
Parents: 04b0227
Author: Alex Antonenko <hiveww@gmail.com>
Authored: Thu Feb 4 13:11:57 2016 +0200
Committer: Alex Antonenko <hiveww@gmail.com>
Committed: Thu Feb 4 17:08:46 2016 +0200

----------------------------------------------------------------------
 .../loginActivities/LoginActivitiesMainCtrl.js  |  4 ++--
 .../loginActivities/LoginMessageMainCtrl.js     |  5 ++--
 .../ui/admin-web/app/scripts/i18n.config.js     |  6 +++--
 .../ui/admin-web/app/scripts/routes.js          |  9 ++++++-
 .../ui/admin-web/app/views/leftNavbar.html      |  2 +-
 .../app/views/loginActivities/loginMessage.html | 25 ++++++++------------
 .../app/views/loginActivities/main.html         |  4 ++--
 .../src/main/resources/ui/admin-web/gulpfile.js |  1 -
 ambari-web/app/router.js                        |  2 +-
 9 files changed, 30 insertions(+), 28 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
index 84af924..3fcf8b2 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginActivitiesMainCtrl.js
@@ -18,6 +18,6 @@
 'use strict';
 
 angular.module('ambariAdminConsole')
-  .controller('LoginActivitiesMainCtrl',['$scope', function($scope) {
-    $scope.tab = 'loginMessage';
+  .controller('LoginActivitiesMainCtrl',['$scope', '$location', function($scope, $location)
{
+    $scope.tab = $location.path().substr(1) == "loginActivities" ? "loginMessage" : $location.path().substr(1);
   }]);

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
index af78dde..763bd59 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/loginActivities/LoginMessageMainCtrl.js
@@ -29,18 +29,17 @@ angular.module('ambariAdminConsole')
     $scope.submitDisabled = true;
 
     $http.get('/api/v1/settings/motd').then(function (res) {
-      var response = JSON.parse(res.data.Settings.content);
+      $scope.motdExists = true;
+      var response = JSON.parse(res.data.Settings.content.replace(/\n/g, "\\n"));
       $scope.text = response.text ? response.text : "";
       $scope.buttonText = response.button ? response.button : "";
       $scope.status = response.status && response.status == "true" ? true : false;
-      $scope.motdExists = true;
     });
 
     $scope.inputChangeEvent = function(){
       $scope.submitDisabled = false;
     };
     $scope.changeStatus = function(){
-      $scope.status = !$scope.status;
       $scope.submitDisabled = false;
     };
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/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 086bc13..91a1645 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
@@ -90,8 +90,10 @@ angular.module('ambariAdminConsole')
         'onlySimpleChars': 'Must contain only simple characters.',
         'saveError': 'Save error',
         'message': 'Message',
-        'buttonText': 'Button text',
-        'switch': 'On/Off'
+        'buttonText': 'Button',
+        'status': 'Status',
+        'status.enabled': 'Enabled',
+        'status.disabled': 'Disabled'
       },
 
       'controls': {

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/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 6da7ff4..8691195 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
@@ -32,9 +32,16 @@ angular.module('ambariAdminConsole')
     }
   },
   loginActivities: {
-      url: '/loginActivities',
+    loginMessage:{
+      url: '/loginMessage',
       templateUrl: 'views/loginActivities/main.html',
       controller: 'LoginActivitiesMainCtrl'
+    },
+    homeDirectory: {
+      url: '/homeDirectory',
+      templateUrl: 'views/loginActivities/main.html',
+      controller: 'LoginActivitiesMainCtrl'
+    }
   },
   users: {
     list: {

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/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 3f01e38..b0a5396 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
@@ -110,7 +110,7 @@
     <div class="panel-body">
       <ul class="nav nav-pills nav-stacked">
         <li ng-class="{active: isActive('authentication.main')}"><link-to route="authentication.main">{{'common.authentication'
| translate}}</link-to></li>
-        <li ng-class="{active: isActive('loginActivities')}"><link-to route="loginActivities">{{'common.loginActivities.loginActivities'
| translate}}</link-to></li>
+        <li ng-class="{active: isActive('loginActivities.loginMessage')}"><link-to
route="loginActivities.loginMessage">{{'common.loginActivities.loginActivities' | translate}}</link-to></li>
       </ul>
     </div>
   </div>

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
index 37b6165..1daf54c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/loginMessage.html
@@ -21,24 +21,17 @@
   <form class="form-horizontal" novalidate name="form" autocomplete="off">
     <div class="well">
       <fieldset>
-        <div class="form-group" ng-class="{'has-error' : (form.login_text.$error.pattern)
&& form.submitted}">
-          <label class="col-sm-2 control-label">{{'common.loginActivities.switch' |
translate}}</label>
-          <div class="on-off-switch-wrap col-sm-10">
-            <i class="fa fa-toggle-on active"
-               ng-if="status == true"
-               ng-click="changeStatus();">
-            </i>
-            <i class="fa fa-toggle-on fa-rotate-180 inactive"
-               ng-if="status == false"
-               ng-click="changeStatus();">
-            </i>
-            <input type="checkbox" name="status" class="hidden" ng-model="status">
+        <div class="form-group">
+          <label class="col-sm-2 control-label">{{'common.loginActivities.status' |
translate}}</label>
+          <div class="col-sm-10">
+            <toggle-switch ng-click="changeStatus();" model="status" on-label="{{'common.loginActivities.status.enabled'
| translate}}" off-label="{{'common.loginActivities.status.disabled' | translate}}" class="switch-primary
userstatus" data-off-color="disabled"></toggle-switch>
           </div>
+          <input type="checkbox" name="status" class="hidden" ng-model="status">
         </div>
         <div class="form-group" ng-class="{'has-error' : (form.login_text.$error.pattern)
&& form.submitted}">
           <label class="col-sm-2 control-label">{{'common.loginActivities.message'
| translate}}</label>
           <div class="col-sm-10">
-            <input type="text"
+            <textarea type="text"
                  class="form-control"
                  name="login_text"
                  placeholder="{{'common.loginActivities.loginMessage.placeholder' | translate}}"
@@ -47,7 +40,7 @@
                  ng-pattern="/^([a-zA-Z0-9._\s]+)$/"
                  ng-disabled="!status"
                  autocomplete="off">
-
+            </textarea>
             <div class="alert alert-danger top-margin" ng-show="form.login_text.$error.pattern
&& form.submitted">
              {{'common.loginActivities.onlySimpleChars' | translate}}
             </div>
@@ -55,7 +48,7 @@
         </div>
         <div class="form-group" ng-class="{'has-error' : (form.login_text.$error.pattern)
&& form.submitted}">
           <label class="col-sm-2 control-label">{{'common.loginActivities.buttonText'
| translate}}</label>
-          <div class="col-sm-5">
+          <div class="col-sm-4">
             <input type="text"
                    class="form-control"
                    name="button_text"
@@ -64,6 +57,8 @@
                    ng-change="inputChangeEvent()"
                    ng-disabled="!status"
                    ng-pattern="/^([a-zA-Z0-9._\s]+)$/"
+                   maxlength="25"
+                   size="25"
                    autocomplete="off">
 
             <div class="alert alert-danger top-margin" ng-show="form.button_text.$error.pattern
&& form.submitted">

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
index 7b35682..e29f50e 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/views/loginActivities/main.html
@@ -25,10 +25,10 @@
   <hr>
   <ul class="nav nav-tabs">
     <li ng-class="{active: tab == 'loginMessage'}">
-      <a ng-click="tab = 'loginMessage'">{{'common.loginActivities.loginMessage' |
translate}}</a>
+      <link-to route="loginActivities.loginMessage">{{'common.loginActivities.loginMessage'
| translate}}</link-to>
     </li>
     <li ng-class="{active: tab == 'homeDirectory'}">
-      <a ng-click="tab = 'homeDirectory'">{{'common.loginActivities.homeDirectory'
| translate}}</a>
+      <link-to route="loginActivities.homeDirectory">{{'common.loginActivities.homeDirectory'
| translate}}</link-to>
     </li>
   </ul>
 

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
----------------------------------------------------------------------
diff --git a/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js b/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
index 8b3dd8c..2f47b85 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/gulpfile.js
@@ -43,7 +43,6 @@ gulp.task('html', ['styles'], function () {
     .pipe($.plumber())
     .pipe($.useref.assets({searchPath: '{.tmp,app}'}))
     .pipe(jsFilter)
-    .pipe($.uglify())
     .pipe(jsFilter.restore())
     .pipe(cssFilter)
     .pipe(cssFilter.restore())

http://git-wip-us.apache.org/repos/asf/ambari/blob/81b46da3/ambari-web/app/router.js
----------------------------------------------------------------------
diff --git a/ambari-web/app/router.js b/ambari-web/app/router.js
index c7cba27..360480f 100644
--- a/ambari-web/app/router.js
+++ b/ambari-web/app/router.js
@@ -363,7 +363,7 @@ App.Router = Em.Router.extend({
    * @param {object} data
    */
   showLoginMessage: function (data){
-    var response = JSON.parse(data.Settings.content),
+    var response = JSON.parse(data.Settings.content.replace(/\n/g, "\\n")),
       text = response.text ? response.text : "",
       buttonText = response.button ? response.button : Em.I18n.t('ok'),
       status = response.status && response.status == "true" ? true : false;


Mime
View raw message