Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DRILL_TO_DETAIL #29491

Closed
3 tasks done
1sarah opened this issue Jul 4, 2024 · 2 comments
Closed
3 tasks done

DRILL_TO_DETAIL #29491

1sarah opened this issue Jul 4, 2024 · 2 comments
Labels

Comments

@1sarah
Copy link

1sarah commented Jul 4, 2024

Bug description

Drill to detail doesn't apply filters when using jinja tempating

How to reproduce the bug

Embedded dashboard

Screenshots/recordings

No response

Superset version

master / latest-dev

Python version

3.9

Node version

16

Browser

Chrome

Additional context

No response

Checklist

  • I have searched Superset docs and Slack and didn't find a solution to my problem.
  • I have searched the GitHub issue tracker and didn't find a similar bug report.
  • I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Copy link

dosubot bot commented Jul 4, 2024

Hi @1sarah! I'm a bot designed to help you with bugs, questions, and contributions. I'm here to assist you while waiting for a human maintainer.

To resolve the issue where the "Drill to Detail" feature in Superset does not apply filters correctly when using Jinja templating, ensure that the filters are correctly passed and applied in the DrillDetailMenuItems component.

Here is a key part of the code that handles the filters:

const openModal = useCallback(
  (filters, event) => {
    onClick(event);
    onSelection();
    setFilters(filters);
    setShowModal(true);
  },
  [onClick, onSelection],
);

This function is responsible for opening the modal and setting the filters. Ensure that the filters are correctly formatted and passed to this function.

Additionally, the filters are mapped and displayed in the submenu:

const drillToDetailByMenuItem = drillByDisabled ? (
  <DisabledMenuItem {...props} key="drill-to-detail-by-disabled">
    {DRILL_TO_DETAIL_BY}
    <MenuItemTooltip title={drillByDisabled} />
  </DisabledMenuItem>
) : (
  <Menu.SubMenu
    {...props}
    popupOffset={[0, submenuYOffset]}
    popupClassName="chart-context-submenu"
    title={DRILL_TO_DETAIL_BY}
  >
    <div data-test="drill-to-detail-by-submenu">
      {filters.map((filter, i) => (
        <MenuItemWithTruncation
          {...props}
          tooltipText={`${DRILL_TO_DETAIL_BY} ${filter.formattedVal}`}
          key={`drill-detail-filter-${i}`}
          onClick={openModal.bind(null, [filter])}
        >
          {`${DRILL_TO_DETAIL_BY} `}
          <StyledFilter stripHTML>{filter.formattedVal}</StyledFilter>
        </MenuItemWithTruncation>
      ))}
      {filters.length > 1 && (
        <Menu.Item
          {...props}
          key="drill-detail-filter-all"
          onClick={openModal.bind(null, filters)}
        >
          <div>
            {`${DRILL_TO_DETAIL_BY} `}
            <StyledFilter stripHTML={false}>{t('all')}</StyledFilter>
          </div>
        </Menu.Item>
      )}
    </div>
  </Menu.SubMenu>
);

Ensure that the filters are correctly formatted and passed to the openModal function when a menu item is clicked. If the filters are not being applied correctly, check the format and content of the filters array being passed to the openModal function.

If the issue persists, you may need to debug the filters array to ensure it contains the correct values and is being passed correctly to the modal [1].

To continue talking to Dosu, mention @dosu.

@rusackas rusackas added the global:jinja Related to Jinja templating label Jul 7, 2024
@rusackas
Copy link
Member

rusackas commented Jul 7, 2024

Thank you, but I'll close this (as a duplicate) in favor of #27396.

@rusackas rusackas closed this as not planned Won't fix, can't repro, duplicate, stale Jul 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants