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

fix: analytics chart kebab menu positioning #1785

Merged
merged 3 commits into from
Nov 19, 2024

Conversation

filipgutica
Copy link
Contributor

@filipgutica filipgutica commented Nov 13, 2024

Summary

https://www.loom.com/share/5fa43f74fcbe4764888c49e0d1dc38ea

  • show kebab menu on hover only
  • if there's no title overlap canvas and show on hover

show kebab menu on hover only
if there's no title overlap canvas and show on hover
@filipgutica filipgutica requested a review from a team as a code owner November 13, 2024 07:50
Copy link
Contributor

@adorack adorack left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(Still reviewing; a couple of minor things so far.)

@@ -302,7 +302,7 @@ describe('<AnalyticsChart />', () => {
})
})

it('Renders an "Export" button, and tabulated data in the modal preview', () => {
it.only('Renders an "Export" button, and tabulated data in the modal preview', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove the .only.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wooops 🙈

@@ -153,7 +153,6 @@ const dashboardConfig: DashboardConfig = {
{
definition: {
chart: {
chartTitle: 'Timeseries line chart of mock data',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor, but please remove this change; we might still trigger a new renderer version because it depends on analytics-chart, but it's nice to avoid code changes when possible.

@@ -429,6 +438,22 @@ const chartTooltipSortFn = computed(() => {
}
})

const chartHeaderPosition = computed(() => {
return props.chartTitle || !hasKebabMenuAccess || (resultSetTruncated.value && maxEntitiesShown.value) ? 'relative' : 'absolute'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

resultSetTruncated && maxEntitiesShown -- I know this is the old logic, but shouldn't this be || rather than &&? We need to show a header if either of these warnings is visible? (Honest question, I may not be up to date on the designs.)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't remember how this part of explore works, but may be this was based off an old faulty assumption. 😅

Those computed props are based off the limit and truncated in the explore response. Is the presence of both required to determine that the results are truncated? If not, then may be we can just use trancated ?

Copy link
Contributor

@adorack adorack Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaagh, I'm sorry. I dug a bit deeper and these two things are complementary -- basically, if results are truncated, you can read limit to render a warning message. I lost the thread and thought they were two different concepts. Technically, you could just use truncated, but the current logic is fine. No need for changes.

@@ -364,10 +377,6 @@ const hasValidChartData = computed(() => {
return props.chartData && props.chartData.meta && props.chartData.data.length
})

const showChartHeader = computed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If a chart doesn't have a title and doesn't have valid data, does this behave the same way as before? (It seems like we're showing a header in that case where before we didn't.)

Copy link
Contributor Author

@filipgutica filipgutica Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I don't think the chart header should be hidden any longer in the case that there is no data. We may still want to show the kebab menu that could still contain valid actions a user can take, regardless of the chart having data.

For example, a chart in a dashboard may not have data for whatever reason. A user may still want to "go to explore" or "edit" the tile in order to investigate why the chart has no data, or make changes to the query backing the chart/tile. So I think the old logic had to be changed.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense; my main concern is that this is changing outside of the feature flag. I took a look at the sandbox, and I think the change is basically invisible, so I won't worry about it.

:aria-label="i18n.t('more_actions')"
class="kebab-action-menu"
data-testid="kebab-action-menu"
>
Copy link
Contributor

@mihai-peteu mihai-peteu Nov 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call here. Without the button element, the nested SVG can sometimes "steal" the click action

@@ -364,10 +377,6 @@ const hasValidChartData = computed(() => {
return props.chartData && props.chartData.meta && props.chartData.data.length
})

const showChartHeader = computed(() => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense; my main concern is that this is changing outside of the feature flag. I took a look at the sandbox, and I think the change is basically invisible, so I won't worry about it.

@@ -429,6 +438,22 @@ const chartTooltipSortFn = computed(() => {
}
})

const chartHeaderPosition = computed(() => {
return props.chartTitle || !hasKebabMenuAccess || (resultSetTruncated.value && maxEntitiesShown.value) ? 'relative' : 'absolute'
Copy link
Contributor

@adorack adorack Nov 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Aaagh, I'm sorry. I dug a bit deeper and these two things are complementary -- basically, if results are truncated, you can read limit to render a warning message. I lost the thread and thought they were two different concepts. Technically, you could just use truncated, but the current logic is fine. No need for changes.

@filipgutica filipgutica merged commit 54783b3 into main Nov 19, 2024
10 checks passed
@filipgutica filipgutica deleted the fix/analytics-chart-kebab-menu-positioning branch November 19, 2024 15:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants