Skip to content

Commit

Permalink
EPMRPP-92634 || "Add New Dashboard" button" event is missing (#3917)
Browse files Browse the repository at this point in the history
* EPMRPP-92634 || "Add New Dashboard" button" event is missing

* EPMRPP-92634 || added condition for value null
  • Loading branch information
maria-hambardzumian committed Jul 12, 2024
1 parent 717a39f commit 711a085
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,11 @@ export const WIDGETS_EVENTS = {
};

export const DASHBOARD_EVENTS = {
CLICK_ON_ADD_NEW_DASHBOARD_BTN: {
...getBasicClickEventParameters(DASHBOARDS),
element_name: 'add_new_dashboard',
},

clickOnAddNewWidgetButton: (dashboardId) => ({
...getBasicClickEventParameters(DASHBOARDS),
element_name: 'add_new_widget',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,11 @@ const compareFields = (defaultValues, changedValues, parentKey = '') => {
Object.keys(defaultValues).forEach((key) => {
const fullKey = parentKey ? `${parentKey}.${key}` : key;

if (typeof defaultValues[key] === 'object' && !Array.isArray(defaultValues[key])) {
if (
defaultValues[key] &&
typeof defaultValues[key] === 'object' &&
!Array.isArray(defaultValues[key])
) {
const nestedDifferences = compareFields(
defaultValues[key],
changedValues[key] || {},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ import classNames from 'classnames/bind';
import { injectIntl, defineMessages } from 'react-intl';
import { GhostButton } from 'components/buttons/ghostButton';
import { NoResultsForFilter } from 'pages/inside/common/noResultsForFilter';
import { DASHBOARD_EVENTS } from 'components/main/analytics/events/ga4Events/dashboardsPageEvents';
import track from 'react-tracking';
import styles from './emptyDashboards.scss';
import AddDashboardIcon from './img/ic-add-dash-inline.svg';

Expand All @@ -43,21 +45,35 @@ const messages = defineMessages({
},
});

@track()
@injectIntl
export class EmptyDashboards extends Component {
static propTypes = {
intl: PropTypes.object.isRequired,
action: PropTypes.func,
filter: PropTypes.string,
tracking: PropTypes.shape({
trackEvent: PropTypes.func,
getTrackingData: PropTypes.func,
}).isRequired,
};

static defaultProps = {
action: () => {},
filter: '',
};

handleAddDashboardAction = () => {
const {
action,
tracking: { trackEvent },
} = this.props;
trackEvent(DASHBOARD_EVENTS.CLICK_ON_ADD_NEW_DASHBOARD_BTN);
action();
};

render() {
const { action, intl, filter } = this.props;
const { intl, filter } = this.props;

if (filter)
return <NoResultsForFilter filter={filter} notFoundMessage={messages.noDashboardFound} />;
Expand All @@ -72,7 +88,7 @@ export class EmptyDashboards extends Component {
{intl.formatMessage(messages.currentUserDashboardsText)}
</p>
<div className={cx('empty-dashboard-content')}>
<GhostButton icon={AddDashboardIcon} onClick={action}>
<GhostButton icon={AddDashboardIcon} onClick={this.handleAddDashboardAction}>
{intl.formatMessage(messages.currentUserDashboardsActionText)}
</GhostButton>
</div>
Expand Down

0 comments on commit 711a085

Please sign in to comment.