Skip to content
Snippets Groups Projects
Unverified Commit 02039eeb authored by Hervé Labas's avatar Hervé Labas Committed by GitHub
Browse files

Add metrics support in diagnostics dialog (#50329)

* Add metrics support in diagnostics dialog
* Update unit test
parent bc59e291
No related branches found
No related tags found
No related merge requests found
...@@ -88,6 +88,7 @@ describe("ErrorDiagnosticsModal", () => { ...@@ -88,6 +88,7 @@ describe("ErrorDiagnosticsModal", () => {
"question", "question",
"dashboard", "dashboard",
"collection", "collection",
"metric",
"model", "model",
]; ];
...@@ -140,6 +141,15 @@ describe("ErrorDiagnosticsModal", () => { ...@@ -140,6 +141,15 @@ describe("ErrorDiagnosticsModal", () => {
expect(screen.queryByText(/query results/i)).not.toBeInTheDocument(); expect(screen.queryByText(/query results/i)).not.toBeInTheDocument();
}); });
it("should show query results checkbox for metrics", () => {
setup({
...defaultErrorPayload,
entityName: "metric",
localizedEntityName: "Metric",
});
expect(screen.getByText(/query results/i)).toBeInTheDocument();
});
it("should not show backend logs checkboxes when we don't have any logs", () => { it("should not show backend logs checkboxes when we don't have any logs", () => {
setup({ setup({
...defaultErrorPayload, ...defaultErrorPayload,
......
...@@ -10,6 +10,7 @@ import type { ...@@ -10,6 +10,7 @@ import type {
export type ReportableEntityName = export type ReportableEntityName =
| "question" | "question"
| "model" | "model"
| "metric"
| "dashboard" | "dashboard"
| "collection"; | "collection";
......
...@@ -34,7 +34,7 @@ export const useErrorInfo = ( ...@@ -34,7 +34,7 @@ export const useErrorInfo = (
} }
// https://regexr.com/7ra8o // https://regexr.com/7ra8o
const matches = location.match( const matches = location.match(
/(question|model|dashboard|collection)[[\/\#]([\d\w]+)/, /(question|model|dashboard|collection|metric)[[\/\#]([\d\w]+)/,
); );
const entity = (matches?.[1] ?? undefined) as const entity = (matches?.[1] ?? undefined) as
......
...@@ -33,6 +33,7 @@ export const getEntityDetails = ({ ...@@ -33,6 +33,7 @@ export const getEntityDetails = ({
} }
switch (entity) { switch (entity) {
case "metric":
case "question": case "question":
case "model": case "model":
if (isAdHoc) { if (isAdHoc) {
...@@ -55,6 +56,7 @@ export const getEntityDetails = ({ ...@@ -55,6 +56,7 @@ export const getEntityDetails = ({
export const hasQueryData = ( export const hasQueryData = (
entityName?: ReportableEntityName | null, entityName?: ReportableEntityName | null,
): boolean => !!entityName && ["question", "model"].includes(entityName); ): boolean =>
!!entityName && ["question", "model", "metric"].includes(entityName);
const nullOnCatch = () => null; const nullOnCatch = () => null;
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