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", () => {
"question",
"dashboard",
"collection",
"metric",
"model",
];
......@@ -140,6 +141,15 @@ describe("ErrorDiagnosticsModal", () => {
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", () => {
setup({
...defaultErrorPayload,
......
......@@ -10,6 +10,7 @@ import type {
export type ReportableEntityName =
| "question"
| "model"
| "metric"
| "dashboard"
| "collection";
......
......@@ -34,7 +34,7 @@ export const useErrorInfo = (
}
// https://regexr.com/7ra8o
const matches = location.match(
/(question|model|dashboard|collection)[[\/\#]([\d\w]+)/,
/(question|model|dashboard|collection|metric)[[\/\#]([\d\w]+)/,
);
const entity = (matches?.[1] ?? undefined) as
......
......@@ -33,6 +33,7 @@ export const getEntityDetails = ({
}
switch (entity) {
case "metric":
case "question":
case "model":
if (isAdHoc) {
......@@ -55,6 +56,7 @@ export const getEntityDetails = ({
export const hasQueryData = (
entityName?: ReportableEntityName | null,
): boolean => !!entityName && ["question", "model"].includes(entityName);
): boolean =>
!!entityName && ["question", "model", "metric"].includes(entityName);
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