Skip to content
Snippets Groups Projects
Unverified Commit a5be6324 authored by Cal Herries's avatar Cal Herries Committed by GitHub
Browse files

FE: Prevent setting linked filters if filter widget is input box (#34663)

parent 8d1a2bbd
Branches
Tags
No related merge requests found
......@@ -77,6 +77,9 @@ function Content({
if (parameter.values_source_type != null) {
return <ParametersFromOtherSource />;
}
if (parameter.values_query_type === "none") {
return <ParameterIsInputBoxType />;
}
return (
<UsableParameters
parameter={parameter}
......@@ -107,6 +110,14 @@ function NoUsableParameters({
);
}
function ParameterIsInputBoxType(): JSX.Element {
return (
<SectionMessage>
{t`This filter can't be limited by another dashboard filter because its widget type is an input box.`}
</SectionMessage>
);
}
function ParametersFromOtherSource(): JSX.Element {
return (
<div>
......
......@@ -74,4 +74,30 @@ describe("ParameterLinkedFilters", () => {
expect(screen.queryByRole("switch")).not.toBeInTheDocument();
},
);
it("should not show linked filter options if the parameter has values_query_type = 'none'", () => {
setup({
parameter: createMockUiParameter({
id: "p1",
name: "P1",
values_query_type: "none",
values_source_config: {
values: ["foo", "bar"],
},
}),
otherParameters: [
createMockUiParameter({
id: "p2",
name: "P2",
}),
],
});
expect(
screen.getByText(
"This filter can't be limited by another dashboard filter because its widget type is an input box.",
),
).toBeInTheDocument();
expect(screen.queryByRole("switch")).not.toBeInTheDocument();
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment