Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id CC880200C6A for ; Wed, 29 Mar 2017 15:57:18 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id CB0B0160BA1; Wed, 29 Mar 2017 13:57:18 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id B3E82160BA4 for ; Wed, 29 Mar 2017 15:57:17 +0200 (CEST) Received: (qmail 19752 invoked by uid 500); 29 Mar 2017 13:57: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 15947 invoked by uid 99); 29 Mar 2017 13:57:11 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 29 Mar 2017 13:57:11 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E4D42E0061; Wed, 29 Mar 2017 13:57:10 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: oleewere@apache.org To: commits@ambari.apache.org Date: Wed, 29 Mar 2017 13:58:10 -0000 Message-Id: <5dd3c425ce504504bade80b4218d4b57@git.apache.org> In-Reply-To: <4d60496393ea4efdbd9a6f61570bbe9d@git.apache.org> References: <4d60496393ea4efdbd9a6f61570bbe9d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [62/67] [abbrv] ambari git commit: AMBARI-20607. Provide helper for adding data-qa attributes (akovalenko) archived-at: Wed, 29 Mar 2017 13:57:18 -0000 AMBARI-20607. Provide helper for adding data-qa attributes (akovalenko) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/ea3aa22a Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/ea3aa22a Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/ea3aa22a Branch: refs/heads/branch-dev-logsearch Commit: ea3aa22aec0ff875d2127da86701e8caccd78be0 Parents: 742fdff Author: Aleksandr Kovalenko Authored: Wed Mar 29 00:09:16 2017 +0300 Committer: Aleksandr Kovalenko Committed: Wed Mar 29 00:09:16 2017 +0300 ---------------------------------------------------------------------- ambari-web/app/utils/ember_reopen.js | 4 +++- ambari-web/app/utils/helper.js | 20 ++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3aa22a/ambari-web/app/utils/ember_reopen.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/ember_reopen.js b/ambari-web/app/utils/ember_reopen.js index ff55b30..5f7c61b 100644 --- a/ambari-web/app/utils/ember_reopen.js +++ b/ambari-web/app/utils/ember_reopen.js @@ -225,7 +225,9 @@ Em.View.reopen({ } else { console.debug('Calling setProperties on destroyed view'); } - } + }, + + attributeBindings: ['data-qa'] }); Ember._HandlebarsBoundView.reopen({ http://git-wip-us.apache.org/repos/asf/ambari/blob/ea3aa22a/ambari-web/app/utils/helper.js ---------------------------------------------------------------------- diff --git a/ambari-web/app/utils/helper.js b/ambari-web/app/utils/helper.js index f6f2532..6c706b8 100644 --- a/ambari-web/app/utils/helper.js +++ b/ambari-web/app/utils/helper.js @@ -363,6 +363,26 @@ Em.Handlebars.registerHelper('highlight', function (property, words, fn) { /** * Usage: * + *
+ *
+ *
+ * + */ +Em.Handlebars.registerHelper('QAAttr', function(text, data) { + var self = this; + var textToReplace = text.match(/\{(.*?)\}/g); + if (textToReplace) { + textToReplace.forEach(function (t) { + var value = Em.Handlebars.getPath(self, t.slice(1, t.length-1), data); + text = text.replace(t, value); + }); + } + return new Em.Handlebars.SafeString('data-qa="' + text + '"'); +}); + +/** + * Usage: + * *
  *   {{#isAuthorized "SERVICE.TOGGLE_ALERTS"}}
  *     {{! some truly code }}