Return-Path: X-Original-To: apmail-ambari-commits-archive@www.apache.org Delivered-To: apmail-ambari-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 9F7C917881 for ; Thu, 23 Oct 2014 09:41:15 +0000 (UTC) Received: (qmail 23190 invoked by uid 500); 23 Oct 2014 09:41:15 -0000 Delivered-To: apmail-ambari-commits-archive@ambari.apache.org Received: (qmail 23156 invoked by uid 500); 23 Oct 2014 09:41:15 -0000 Mailing-List: contact commits-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: ambari-dev@ambari.apache.org Delivered-To: mailing list commits@ambari.apache.org Received: (qmail 23147 invoked by uid 99); 23 Oct 2014 09:41:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 23 Oct 2014 09:41:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 468C9944F55; Thu, 23 Oct 2014 09:41:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: onechiporenko@apache.org To: commits@ambari.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: AMBARI-7916. Admin View: description is being variable replaced. (Max Shepel via onechiporenko) Date: Thu, 23 Oct 2014 09:41:15 +0000 (UTC) Repository: ambari Updated Branches: refs/heads/branch-1.7.0 fbb17091e -> 0565c0769 AMBARI-7916. Admin View: description is being variable replaced. (Max Shepel via onechiporenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/0565c076 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/0565c076 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/0565c076 Branch: refs/heads/branch-1.7.0 Commit: 0565c076961dc5451a28e0b8a37e95edbd089d36 Parents: fbb1709 Author: Oleg Nechiporenko Authored: Thu Oct 23 12:21:09 2014 +0300 Committer: Oleg Nechiporenko Committed: Thu Oct 23 12:21:09 2014 +0300 ---------------------------------------------------------------------- .../ambariViews/CreateViewInstanceCtrl.js | 10 +-- .../ambariViews/CreateViewInstanceCtrl_test.js | 77 -------------------- 2 files changed, 1 insertion(+), 86 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/0565c076/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js index 68421fa..946d334 100644 --- a/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js +++ b/ambari-admin/src/main/resources/ui/admin-web/app/scripts/controllers/ambariViews/CreateViewInstanceCtrl.js @@ -18,21 +18,13 @@ 'use strict'; angular.module('ambariAdminConsole') -.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', 'Auth', '$routeParams', '$location', 'UnsavedDialog', function($scope, View, Alert, Auth, $routeParams, $location, UnsavedDialog) { +.controller('CreateViewInstanceCtrl',['$scope', 'View', 'Alert', '$routeParams', '$location', 'UnsavedDialog', function($scope, View, Alert, $routeParams, $location, UnsavedDialog) { $scope.form = {}; var targetUrl = ''; function loadMeta(){ View.getMeta($routeParams.viewId, $scope.version).then(function(data) { var viewVersion = data.data; - var pattern = /{username}/; - viewVersion.ViewVersionInfo.parameters = viewVersion.ViewVersionInfo.parameters.map(function (item) { - var parameter = item; - if (pattern.test(item.description)) { - parameter.description = item.description.replace(pattern, Auth.getCurrentUser()); - } - return parameter; - }); $scope.view = viewVersion; $scope.instance = { http://git-wip-us.apache.org/repos/asf/ambari/blob/0565c076/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/CreateViewInstanceCtrl_test.js ---------------------------------------------------------------------- diff --git a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/CreateViewInstanceCtrl_test.js b/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/CreateViewInstanceCtrl_test.js deleted file mode 100644 index 4deaf52..0000000 --- a/ambari-admin/src/main/resources/ui/admin-web/test/unit/controllers/ambariViews/CreateViewInstanceCtrl_test.js +++ /dev/null @@ -1,77 +0,0 @@ -/** - * 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. - */ - -describe('#CreateViewInstanceCtrl', function () { - - describe('loadMeta', function () { - - var scope, ctrl, $window, $q, deferred; - - beforeEach(module('ambariAdminConsole', function ($provide) { - $provide.value('$window', { - location: { - pathname: 'http://c6401.ambari.apache.org:8080/views/ADMIN_VIEW/1.0.0/INSTANCE/#/' - } - }); - $provide.value('Auth', { - getCurrentUser: function () { - return 'admin'; - } - }); - $provide.value('View', { - getMeta: function () { - return deferred.promise; - }, - getVersions: function () { - var dfd = $q.defer(); - return dfd.promise; - } - }); - $provide.value('$routeParams', { - viewId: 'ADMIN_VIEW' - }); - })); - - beforeEach(inject(function ($rootScope, $controller, _$window_, _$q_) { - $q = _$q_; - $window = _$window_; - scope = $rootScope.$new(); - deferred = $q.defer(); - ctrl = $controller('CreateViewInstanceCtrl', { - $scope: scope - }); - })); - - it('should parse {username}', function () { - deferred.resolve({ - data: { - ViewVersionInfo: { - parameters: [{ - description: '{username}' - }] - } - } - }); - scope.version = '1.0.0'; - scope.$digest(); - chai.expect(scope.view.ViewVersionInfo.parameters[0].description).to.equal('admin'); - }); - - }); - -});