You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by wu...@apache.org on 2022/11/28 11:02:55 UTC

[ambari] 01/01: Revert "AMBARI-25410: Add autocomplete for all repos url for login and password (#3503)"

This is an automated email from the ASF dual-hosted git repository.

wuzhiguo pushed a commit to branch revert-3503-ambari-25410
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit cf3498936b01744d03d799fb6385382919811d3b
Author: Zhiguo Wu <wu...@apache.org>
AuthorDate: Mon Nov 28 19:02:44 2022 +0800

    Revert "AMBARI-25410: Add autocomplete for all repos url for login and password (#3503)"
    
    This reverts commit e87e2b65652723457d0173f777ba86aeff57e5e0.
---
 .../stackVersions/StackVersionsCreateCtrl.js       | 26 --------------------
 .../stackVersions/StackVersionsEditCtrl.js         | 25 -------------------
 ambari-web/app/views/wizard/step1_view.js          | 28 ----------------------
 3 files changed, 79 deletions(-)

diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
index 6fa434c390..ed5af5b67b 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsCreateCtrl.js
@@ -440,32 +440,6 @@ angular.module('ambariAdminConsole')
   $scope.onRepoUrlChange = function (repository) {
     $scope.clearError(repository);
     $scope.setInvalidUrlError(repository);
-    $scope.setUsernameAndPasswordsIfNeeded(repository);
-  };
-
-  $scope.setUsernameAndPasswordsIfNeeded = function(repo) {
-    try {
-      var urlObject = new URL(repo.Repositories.base_url);
-      var username = urlObject.username;
-      var password = urlObject.password;
-    } catch (e) {
-      return;
-    }
-    $scope.osList.forEach(function(os) {
-      if (os.repositories) {
-        os.repositories.forEach(function (repo) {
-          var currentUrl = repo.Repositories.base_url;
-          try {
-            var currentUrlObject = new URL(currentUrl);
-          } catch (e) {
-            return;
-          }
-          currentUrlObject.username = username;
-          currentUrlObject.password = password;
-          repo.Repositories.base_url = currentUrlObject.toString();
-        });
-      }
-    });
   };
 
   $scope.undoChange = function(repo) {
diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
index 5452c60ce8..7b10a1e60c 100644
--- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
+++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/stackVersions/StackVersionsEditCtrl.js
@@ -322,31 +322,6 @@ angular.module('ambariAdminConsole')
     repo.Repositories.base_url = repo.Repositories.initial_base_url;
   };
 
-  $scope.onRepoUrlChange = function(repo) {
-    try {
-      var urlObject = new URL(repo.Repositories.base_url);
-      var username = urlObject.username;
-      var password = urlObject.password;
-    } catch (e) {
-      return;
-    }
-    $scope.osList.forEach(function(os) {
-      if (os.repositories) {
-        os.repositories.forEach(function (repo) {
-          var currentUrl = repo.Repositories.base_url;
-          try {
-            var currentUrlObject = new URL(currentUrl);
-          } catch (e) {
-            return;
-          }
-          currentUrlObject.username = username;
-          currentUrlObject.password = password;
-          repo.Repositories.base_url = currentUrlObject.toString();
-        });
-      }
-    });
-  };
-
   $scope.clearErrors = function() {
     if ($scope.osList) {
       $scope.osList.forEach(function(os) {
diff --git a/ambari-web/app/views/wizard/step1_view.js b/ambari-web/app/views/wizard/step1_view.js
index eb107b9edd..ba23c06454 100644
--- a/ambari-web/app/views/wizard/step1_view.js
+++ b/ambari-web/app/views/wizard/step1_view.js
@@ -313,9 +313,6 @@ App.WizardStep1View = Em.View.extend({
     if (!repositories) {
       return;
     }
-    var changedRepo = repositories.find(function(repository) {
-      return repository.get('lastBaseUrl') && repository.get('lastBaseUrl') !== repository.get('baseUrl');
-    });
     repositories.forEach(function (repository) {
       if (repository.get('lastBaseUrl') !== repository.get('baseUrl')) {
         repository.setProperties({
@@ -324,31 +321,6 @@ App.WizardStep1View = Em.View.extend({
         });
       }
     }, this);
-    if (changedRepo) {
-      try {
-        var urlObject = new URL(changedRepo.get('baseUrl'));
-      } catch (e) {
-        return;
-      }
-      var username = urlObject.username;
-      var password = urlObject.password;
-      repositories.forEach(function (repository) {
-        var currentUrl = repository.get('baseUrl');
-        try {
-          var currentUrlObject = new URL(currentUrl);
-        } catch (e) {
-          return;
-        }
-        currentUrlObject.username = username;
-        currentUrlObject.password = password;
-        var newUrl = currentUrlObject.toString();
-        if (newUrl !== currentUrl) {
-          setTimeout(function () {
-            repository.set('baseUrl', newUrl);
-          }, 0);
-        }
-      }, this);
-    }
   }.observes('allRepositories.@each.baseUrl')
 
 });


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@ambari.apache.org
For additional commands, e-mail: commits-help@ambari.apache.org