From 6ed831aaa6021e9da01bfdc86c99deafc22e4598 Mon Sep 17 00:00:00 2001 From: Allison Suarez Miranda Date: Wed, 18 Nov 2020 19:26:01 -0800 Subject: [PATCH 1/2] fixed issue with badge search Signed-off-by: Allison Suarez Miranda --- .../static/js/components/common/BadgeList/index.tsx | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/amundsen_application/static/js/components/common/BadgeList/index.tsx b/amundsen_application/static/js/components/common/BadgeList/index.tsx index 1fd12e7e8..f0379bd9c 100644 --- a/amundsen_application/static/js/components/common/BadgeList/index.tsx +++ b/amundsen_application/static/js/components/common/BadgeList/index.tsx @@ -58,12 +58,10 @@ const ActionableBadge: React.FC = ({ }; export class BadgeList extends React.Component { - idx = 0; - - handleClick = (e) => { - const badgeText = this.props.badges[this.idx].badge_name - ? this.props.badges[this.idx].badge_name - : this.props.badges[this.idx].tag_name; + handleClick = (index: number, e) => { + const badgeText = this.props.badges[index].badge_name + ? this.props.badges[index].badge_name + : this.props.badges[index].tag_name; logClick(e, { target_type: 'badge', label: badgeText, @@ -98,12 +96,11 @@ export class BadgeList extends React.Component { this.handleClick(index, e)} key={`badge-${index}`} /> ); } - this.idx++; })} ); From 13f17afd1e3eef7fd1d6c55fd9c602dc695fd345 Mon Sep 17 00:00:00 2001 From: Allison Suarez Miranda Date: Thu, 19 Nov 2020 10:39:21 -0800 Subject: [PATCH 2/2] added text name as parameter instead Signed-off-by: Allison Suarez Miranda --- .../static/js/components/common/BadgeList/index.tsx | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/amundsen_application/static/js/components/common/BadgeList/index.tsx b/amundsen_application/static/js/components/common/BadgeList/index.tsx index f0379bd9c..ba269d030 100644 --- a/amundsen_application/static/js/components/common/BadgeList/index.tsx +++ b/amundsen_application/static/js/components/common/BadgeList/index.tsx @@ -58,10 +58,7 @@ const ActionableBadge: React.FC = ({ }; export class BadgeList extends React.Component { - handleClick = (index: number, e) => { - const badgeText = this.props.badges[index].badge_name - ? this.props.badges[index].badge_name - : this.props.badges[index].tag_name; + handleClick = (index: number, badgeText: string, e) => { logClick(e, { target_type: 'badge', label: badgeText, @@ -96,7 +93,9 @@ export class BadgeList extends React.Component { this.handleClick(index, e)} + action={(e) => + this.handleClick(index, badgeConfig.displayName, e) + } key={`badge-${index}`} /> );