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

alexantonenko pushed a commit to branch branch-2.7
in repository https://gitbox.apache.org/repos/asf/ambari.git


The following commit(s) were added to refs/heads/branch-2.7 by this push:
     new cbf44c3  AMBARI-25420 Cannot add or remove columns to logsearch log 
tables (santal)
     new a2218c6  Merge pull request #3138 from sziszo/AMBARI-25420-branch-2.7
cbf44c3 is described below

commit cbf44c30dca37b2e9eaed66408befb5f7d27b15a
Author: Szilard Antal <san...@cloudera.com>
AuthorDate: Wed Nov 20 11:47:55 2019 +0100

    AMBARI-25420 Cannot add or remove columns to logsearch log tables (santal)
---
 .../dropdown-button/dropdown-button.component.ts         | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git 
a/ambari-logsearch/ambari-logsearch-web/src/app/modules/shared/components/dropdown-button/dropdown-button.component.ts
 
b/ambari-logsearch/ambari-logsearch-web/src/app/modules/shared/components/dropdown-button/dropdown-button.component.ts
index fefd2e8..ff70421 100644
--- 
a/ambari-logsearch/ambari-logsearch-web/src/app/modules/shared/components/dropdown-button/dropdown-button.component.ts
+++ 
b/ambari-logsearch/ambari-logsearch-web/src/app/modules/shared/components/dropdown-button/dropdown-button.component.ts
@@ -55,8 +55,18 @@ export class DropdownButtonComponent {
   selectItem: EventEmitter<any> = new EventEmitter();
 
   // PROXY PROPERTIES TO DROPDOWN LIST COMPONENT
+  private _options: ListItem[] = [];
+  private originalOptions: ListItem[] = [];
+
   @Input()
-  options: ListItem[] = [];
+  set options(options: ListItem[]) {
+    this._options = options;
+    this.originalOptions = options.map(option => Object.assign({}, option));
+  }
+
+  get options(): ListItem[] {
+    return this._options;
+  }
 
   @Input()
   listItemArguments: any[] = [];
@@ -106,8 +116,8 @@ export class DropdownButtonComponent {
       const items: ListItem[] = Array.isArray(updates) ? updates : [updates];
       if (this.isMultipleChoice) {
         items.forEach((item: ListItem) => {
-          if (this.options && this.options.length) {
-            const itemToUpdate: ListItem = this.options.find((option: 
ListItem) => this.utils.isEqual(option.value, item.value));
+          if (this.originalOptions && this.originalOptions.length) {
+            const itemToUpdate: ListItem = this.originalOptions.find((option: 
ListItem) => this.utils.isEqual(option.value, item.value));
             if (itemToUpdate) {
               hasChange = hasChange || itemToUpdate.isChecked !== 
item.isChecked;
               itemToUpdate.isChecked = item.isChecked;

Reply via email to