Return-Path: X-Original-To: apmail-ambari-dev-archive@www.apache.org Delivered-To: apmail-ambari-dev-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 1DE7C18ACB for ; Mon, 18 May 2015 14:50:01 +0000 (UTC) Received: (qmail 71241 invoked by uid 500); 18 May 2015 14:50:01 -0000 Delivered-To: apmail-ambari-dev-archive@ambari.apache.org Received: (qmail 71209 invoked by uid 500); 18 May 2015 14:50:01 -0000 Mailing-List: contact dev-help@ambari.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ambari.apache.org Delivered-To: mailing list dev@ambari.apache.org Received: (qmail 71194 invoked by uid 99); 18 May 2015 14:50:00 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Mon, 18 May 2015 14:50:00 +0000 Date: Mon, 18 May 2015 14:50:00 +0000 (UTC) From: "Andrii Babiichuk (JIRA)" To: dev@ambari.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (AMBARI-11216) Refactor service-config 'defaultValue' property into 'savedValue' and 'recommendedValue' MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/AMBARI-11216?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14548107#comment-14548107 ] Andrii Babiichuk commented on AMBARI-11216: ------------------------------------------- https://reviews.apache.org/r/34356/ > Refactor service-config 'defaultValue' property into 'savedValue' and 'recommendedValue' > ---------------------------------------------------------------------------------------- > > Key: AMBARI-11216 > URL: https://issues.apache.org/jira/browse/AMBARI-11216 > Project: Ambari > Issue Type: Bug > Components: ambari-web > Affects Versions: 2.1.0 > Reporter: Andrii Babiichuk > Assignee: Andrii Babiichuk > Priority: Critical > Fix For: 2.1.0 > > Attachments: AMBARI-11216.patch > > > {{App.ServiceConfigProperty}} class has this property called {{defaultValue}} which is overloaded and confusing. We want to refactor it into distinct properties called {{savedValue}} and {{recommendedValue}}. > *Background* > Originally this property represented the default value provided by the {{/api/v1/stacks}} endpoint so that when installing cluster the {{value}} could be accurately populated. Later to support the _Undo_ action we put the values saved in {{/api/v1/clusters/c1/configurations}} into the same {{defaultValue}} property. So if {{/api/v1/stacks}} had value '1', and user saved '2', then {{defaultValue}} would become '2'. If ever {{value}} differed from {{defaultValue}}, then _Undo_ action and other logics would trigger. > *Problem* > With the increasing usage of {{/recommendations}} endpoint for config's dynamic values and value-attributes, the {{defaultValue}} is getting complex to understand and comprehend. We generally tend to update {{defaultValue}} whenever {{value}} is updated - which is hard to explain. For example in the add-service wizard we [suppress any updates to core-site.xml|https://github.com/apache/ambari/blob/trunk/ambari-web/app/controllers/wizard/step8_controller.js#L864] because we cannot tell when core-site.xml configs were changed from what is saved on server. > *Proposal* > Each config should have 3 values, as they are 3 different entities: > # {{value}} - Represents the value shown in UI only to the user > # {{savedValue}} - Represents the value saved in Ambari DB in {{/api/v1/clusters/c1/configurations}}. Should only be set when loading configs from API. > # {{recommendedValue}} - Represents the value either provided by {{/api/v1/stacks}} or by {{/recommendations}}. > This will cleanly differentiate the purpose of each variable. This will have an effect on the logic used like {{#isNotDefaultValue}} and {{#isOverrideChanged}} etc. > Undo action should be whenever {{value}} != {{savedValue}}. > Set recommended action should be whenever {{value}} != {{recommendedValue}} > Add-service wizard should basically save only those config-types which have {{value}} != {{savedValue}} etc. > The change might be as simple as renaming {{defaultValue}} to {{savedValue}}, but the semantics will be clearer to understand and code. -- This message was sent by Atlassian JIRA (v6.3.4#6332)