Bladeren bron

AMBARI-15287. Ambari Admin: externalize string constants used in Versions section (alexantonenko)

Alex Antonenko 9 jaren geleden
bovenliggende
commit
c2aec6fb14

+ 10 - 7
ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js

@@ -20,6 +20,9 @@
 angular.module('ambariAdminConsole')
 angular.module('ambariAdminConsole')
 .controller('StackVersionsCreateCtrl', ['$scope', 'Stack', '$routeParams', '$location', 'Alert', '$translate', 'Cluster', function($scope, Stack, $routeParams, $location, Alert, $translate, Cluster) {
 .controller('StackVersionsCreateCtrl', ['$scope', 'Stack', '$routeParams', '$location', 'Alert', '$translate', 'Cluster', function($scope, Stack, $routeParams, $location, Alert, $translate, Cluster) {
   var $t = $translate.instant;
   var $t = $translate.instant;
+  $scope.constants = {
+    os: $t('versions.os')
+  };
   $scope.createController = true;
   $scope.createController = true;
   $scope.osList = [];
   $scope.osList = [];
   $scope.skipValidation = false;
   $scope.skipValidation = false;
@@ -35,14 +38,14 @@ angular.module('ambariAdminConsole')
 
 
   $scope.option1 = {
   $scope.option1 = {
     index: 1,
     index: 1,
-    displayName: 'Upload Version Definition File',
+    displayName: $t('versions.uploadFile'),
     file: null,
     file: null,
     hasError: false
     hasError: false
   };
   };
   $scope.option2 = {
   $scope.option2 = {
     index: 2,
     index: 2,
-    displayName: 'Version Definition File URL',
-    url: 'https://',
+    displayName: $t('versions.enterURL'),
+    url: $t('versions.defaultURL'),
     hasError: false
     hasError: false
   };
   };
   $scope.selectedOption = {
   $scope.selectedOption = {
@@ -102,10 +105,10 @@ angular.module('ambariAdminConsole')
           .then(function (response) {
           .then(function (response) {
             $scope.id = response.id;
             $scope.id = response.id;
             $scope.isPatch = response.type == 'PATCH';
             $scope.isPatch = response.type == 'PATCH';
-            $scope.stackNameVersion = response.stackNameVersion || 'n/a';
-            $scope.displayName = response.displayName || 'n/a';
-            $scope.version = response.version || 'n/a';
-            $scope.actualVersion = response.actualVersion || 'n/a';
+            $scope.stackNameVersion = response.stackNameVersion || $t('common.NA');
+            $scope.displayName = response.displayName || $t('common.NA');
+            $scope.version = response.version || $t('common.NA');
+            $scope.actualVersion = response.actualVersion || $t('common.NA');
             $scope.updateObj = response.updateObj;
             $scope.updateObj = response.updateObj;
             $scope.upgradeStack = {
             $scope.upgradeStack = {
               stack_name: response.stackName,
               stack_name: response.stackName,

+ 7 - 4
ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js

@@ -20,6 +20,9 @@
 angular.module('ambariAdminConsole')
 angular.module('ambariAdminConsole')
 .controller('StackVersionsEditCtrl', ['$scope', '$location', 'Cluster', 'Stack', '$routeParams', 'ConfirmationModal', 'Alert', '$translate', function($scope, $location, Cluster, Stack, $routeParams, ConfirmationModal, Alert, $translate) {
 .controller('StackVersionsEditCtrl', ['$scope', '$location', 'Cluster', 'Stack', '$routeParams', 'ConfirmationModal', 'Alert', '$translate', function($scope, $location, Cluster, Stack, $routeParams, ConfirmationModal, Alert, $translate) {
   var $t = $translate.instant;
   var $t = $translate.instant;
+  $scope.constants = {
+    os: $t('versions.os')
+  };
   $scope.editController = true;
   $scope.editController = true;
   $scope.osList = [];
   $scope.osList = [];
   $scope.skipValidation = false;
   $scope.skipValidation = false;
@@ -35,10 +38,10 @@ angular.module('ambariAdminConsole')
     return Stack.getRepo($routeParams.versionId, $routeParams.stackName).then(function (response) {
     return Stack.getRepo($routeParams.versionId, $routeParams.stackName).then(function (response) {
       $scope.id = response.id;
       $scope.id = response.id;
       $scope.isPatch = response.type == 'PATCH';
       $scope.isPatch = response.type == 'PATCH';
-      $scope.stackNameVersion = response.stackNameVersion || 'n/a';
-      $scope.displayName = response.displayName || 'n/a';
-      $scope.version = response.version || 'n/a';
-      $scope.actualVersion = response.actualVersion || 'n/a';
+      $scope.stackNameVersion = response.stackNameVersion || $t('common.NA');
+      $scope.displayName = response.displayName || $t('common.NA');
+      $scope.version = response.version || $t('common.NA');
+      $scope.actualVersion = response.actualVersion || $t('common.NA');
       $scope.updateObj = response.updateObj;
       $scope.updateObj = response.updateObj;
       $scope.upgradeStack = {
       $scope.upgradeStack = {
         stack_name: response.stackName,
         stack_name: response.stackName,

+ 5 - 1
ambari-admin/src/main/resources/ui/admin-web/app/scripts/i18n.config.js

@@ -77,6 +77,7 @@ angular.module('ambariAdminConsole')
       'usersGroups': 'Users/Groups',
       'usersGroups': 'Users/Groups',
       'enabled': 'Enabled',
       'enabled': 'Enabled',
       'disabled': 'Disabled',
       'disabled': 'Disabled',
+      'NA': 'n/a',
 
 
       'clusterNameChangeConfirmation': {
       'clusterNameChangeConfirmation': {
         'title': 'Confirm Cluster Name Change',
         'title': 'Confirm Cluster Name Change',
@@ -110,7 +111,8 @@ angular.module('ambariAdminConsole')
         'save': 'Save',
         'save': 'Save',
         'clearFilters': 'clear filters',
         'clearFilters': 'clear filters',
         'confirmChange': 'Confirm Change',
         'confirmChange': 'Confirm Change',
-        'discard': 'Discard'
+        'discard': 'Discard',
+        'remove': 'Remove'
       },
       },
 
 
       'alerts': {
       'alerts': {
@@ -305,6 +307,7 @@ angular.module('ambariAdminConsole')
       'installed': 'Installed',
       'installed': 'Installed',
       'uploadFile': 'Upload Version Definition File',
       'uploadFile': 'Upload Version Definition File',
       'enterURL': 'Version Definition File URL',
       'enterURL': 'Version Definition File URL',
+      'defaultURL': 'https://',
       'readInfo': 'Read Version Info',
       'readInfo': 'Read Version Info',
       'browse': 'Browse',
       'browse': 'Browse',
       'installOn': 'Install on...',
       'installOn': 'Install on...',
@@ -317,6 +320,7 @@ angular.module('ambariAdminConsole')
       'baseURL': 'Base URL',
       'baseURL': 'Base URL',
       'skipValidation': 'Skip Repository Base URL validation (Advanced)',
       'skipValidation': 'Skip Repository Base URL validation (Advanced)',
       'noVersions': 'Select version to display details.',
       'noVersions': 'Select version to display details.',
+      'patch': 'Patch',
       'contents': {
       'contents': {
         'title': 'Contents',
         'title': 'Contents',
         'empty': 'No contents to display'
         'empty': 'No contents to display'

+ 3 - 3
ambari-admin/src/main/resources/ui/admin-web/app/views/stackVersions/stackVersionPage.html

@@ -97,7 +97,7 @@
       <div class="clearfix">
       <div class="clearfix">
         <label class="control-label col-sm-3">{{'versions.details.stackName' | translate}}</label>
         <label class="control-label col-sm-3">{{'versions.details.stackName' | translate}}</label>
         <div class="version-info col-sm-7">{{stackNameVersion}}</div>
         <div class="version-info col-sm-7">{{stackNameVersion}}</div>
-        <div class="col-sm-2 patch-icon" ng-if="isPatch"><span class="glyphicon glyphicon-tree-deciduous"></span>Patch</div>
+        <div class="col-sm-2 patch-icon" ng-if="isPatch"><span class="glyphicon glyphicon-tree-deciduous"></span>{{'versions.patch' | translate}}</div>
       </div>
       </div>
       <div class="clearfix">
       <div class="clearfix">
         <label class="control-label col-sm-3">{{'versions.details.displayName' | translate}}</label>
         <label class="control-label col-sm-3">{{'versions.details.displayName' | translate}}</label>
@@ -152,13 +152,13 @@
                                          ng-change="clearError()" ng-disabled="!os.selected"></div>
                                          ng-change="clearError()" ng-disabled="!os.selected"></div>
               </div>
               </div>
             </div>
             </div>
-            <div class="col-sm-1 remove-icon" ng-click="removeOS()"><span class="glyphicon glyphicon-minus"></span>Remove</div>
+            <div class="col-sm-1 remove-icon" ng-click="removeOS()"><span class="glyphicon glyphicon-minus"></span>{{'common.controls.remove' | translate}}</div>
           </div>
           </div>
         </div>
         </div>
       </div>
       </div>
         <div class="btn-group pull-right" dropdown>
         <div class="btn-group pull-right" dropdown>
           <button class="btn dropdown-toggle">
           <button class="btn dropdown-toggle">
-            <span class="glyphicon glyphicon-plus"></span> Add OS &nbsp;<span class="caret"></span></button>
+            <span class="glyphicon glyphicon-plus"></span> {{'common.add' | translate: '{term: constants.os}'}} &nbsp;<span class="caret"></span></button>
           <ul class="dropdown-menu">
           <ul class="dropdown-menu">
             <li ng-repeat="os in osList"><a ng-if="os.selected==false" ng-click="addOS()">{{os.OperatingSystems.os_type}}</a></li>
             <li ng-repeat="os in osList"><a ng-if="os.selected==false" ng-click="addOS()">{{os.OperatingSystems.os_type}}</a></li>
           </ul>
           </ul>