Skip to content
Snippets Groups Projects
Unverified Commit a2d39f00 authored by Alexander Polyankin's avatar Alexander Polyankin Committed by GitHub
Browse files

Do not render timeline events for non-timeseries chart (#21587)

parent f8a27f1c
No related branches found
No related tags found
No related merge requests found
......@@ -209,12 +209,17 @@ export function renderEvents(
{
events = [],
selectedEventIds = [],
isTimeseries,
onHoverChange,
onOpenTimelines,
onSelectTimelineEvents,
onDeselectTimelineEvents,
},
) {
if (!isTimeseries) {
return;
}
const axis = getAxis(chart);
const brush = getBrush(chart);
const scale = getScale(chart);
......
import { restore, visitQuestion, sidebar } from "__support__/e2e/cypress";
import {
restore,
visitQuestion,
sidebar,
visitQuestionAdhoc,
} from "__support__/e2e/cypress";
import { SAMPLE_DB_ID } from "__support__/e2e/cypress_data";
import { SAMPLE_DATABASE } from "__support__/e2e/cypress_sample_database";
const { ORDERS, ORDERS_ID } = SAMPLE_DATABASE;
describe("scenarios > collections > timelines", () => {
beforeEach(() => {
......@@ -169,6 +178,62 @@ describe("scenarios > collections > timelines", () => {
cy.findByText("Releases").should("be.visible");
cy.findByText("Release notes").should("be.visible");
});
it("should show events for ad-hoc questions", () => {
cy.createTimelineWithEvents({
timeline: { name: "Releases" },
events: [{ name: "RC1", timestamp: "2018-10-20T00:00:00Z" }],
});
visitQuestionAdhoc({
dataset_query: {
type: "query",
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
breakout: [["field", ORDERS.CREATED_AT, null]],
},
database: SAMPLE_DB_ID,
},
display: "bar",
visualization_settings: {
"graph.dimensions": ["TOTAL"],
"graph.metrics": ["count"],
},
});
cy.findByText("Visualization").should("be.visible");
cy.findByLabelText("star icon").should("be.visible");
});
it("should not show events for non-timeseries questions", () => {
cy.createTimelineWithEvents({
timeline: { name: "Releases" },
events: [{ name: "RC1", timestamp: "2018-10-20T00:00:00Z" }],
});
visitQuestionAdhoc({
dataset_query: {
type: "query",
query: {
"source-table": ORDERS_ID,
aggregation: [["count"]],
breakout: [
["field", ORDERS.TOTAL, { binning: { strategy: "default" } }],
],
},
database: SAMPLE_DB_ID,
},
display: "bar",
visualization_settings: {
"graph.dimensions": ["TOTAL"],
"graph.metrics": ["count"],
},
});
cy.findByText("Visualization").should("be.visible");
cy.findByLabelText("star icon").should("not.exist");
});
});
describe("as readonly user", () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment