diff --git a/superset-frontend/cypress-base/cypress/support/e2e.ts b/superset-frontend/cypress-base/cypress/support/e2e.ts index 4a471c87d1b05..87229278b7ee5 100644 --- a/superset-frontend/cypress-base/cypress/support/e2e.ts +++ b/superset-frontend/cypress-base/cypress/support/e2e.ts @@ -169,7 +169,7 @@ Cypress.Commands.add('login', () => { }).then(response => { if (response.status === 302) { // If there's a redirect, follow it manually - const redirectUrl = response.headers['location']; + const redirectUrl = response.headers.location; cy.request({ method: 'GET', url: redirectUrl, diff --git a/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx index ae51762d788ae..8eed30af93007 100644 --- a/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx +++ b/superset-frontend/src/features/allEntities/AllEntitiesTable.tsx @@ -25,6 +25,7 @@ import Tag from 'src/types/TagType'; import Owner from 'src/types/Owner'; import { EmptyState } from 'src/components/EmptyState'; import { NumberParam, useQueryParam } from 'use-query-params'; +import { ConfigType } from 'dayjs'; const MAX_TAGS_TO_SHOW = 3; const PAGE_SIZE = 10; @@ -49,12 +50,12 @@ const AllEntitiesTableContainer = styled.div` } `; -interface TaggedObject { +export interface TaggedObject { id: number; type: string; name: string; url: string; - changed_on: string | number | Date; + changed_on: ConfigType; created_by: number | undefined; creator: string; owners: Owner[]; diff --git a/superset-frontend/src/features/tags/tags.ts b/superset-frontend/src/features/tags/tags.ts index c1f5c3815106c..46eda8d2ab4d3 100644 --- a/superset-frontend/src/features/tags/tags.ts +++ b/superset-frontend/src/features/tags/tags.ts @@ -194,10 +194,7 @@ export function fetchObjects( } export function fetchObjectsByTagIds( - { - tagIds = [], - types, - }: { tagIds: number[] | undefined; types: string | null }, + { tagIds = [], types }: { tagIds: number[] | string; types: string | null }, callback: (json: JsonObject) => void, error: (response: Response) => void, ) { diff --git a/superset-frontend/src/pages/AllEntities/index.tsx b/superset-frontend/src/pages/AllEntities/index.tsx index 3a1959b72d53f..f6b51e63aad25 100644 --- a/superset-frontend/src/pages/AllEntities/index.tsx +++ b/superset-frontend/src/pages/AllEntities/index.tsx @@ -20,6 +20,7 @@ import { useEffect, useState } from 'react'; import { styled, t, css, SupersetTheme } from '@superset-ui/core'; import { NumberParam, useQueryParam } from 'use-query-params'; import AllEntitiesTable, { + TaggedObject, TaggedObjects, } from 'src/features/allEntities/AllEntitiesTable'; import Button from 'src/components/Button'; @@ -36,19 +37,6 @@ import withToasts, { useToasts } from 'src/components/MessageToasts/withToasts'; import { fetchObjectsByTagIds, fetchSingleTag } from 'src/features/tags/tags'; import Loading from 'src/components/Loading'; import getOwnerName from 'src/utils/getOwnerName'; -import { ConfigType } from 'dayjs'; - -interface TaggedObject { - id: number; - type: string; - name: string; - url: string; - changed_on: ConfigType; - created_by: number | undefined; - creator: string; - owners: Owner[]; - tags: Tag[]; -} const additionalItemsStyles = (theme: SupersetTheme) => css` display: flex; @@ -152,12 +140,16 @@ function AllEntities() { return; } fetchObjectsByTagIds( - { tagIds: [tag?.id] || '', types: null }, + { tagIds: tag ? [tag.id] : '', types: null }, (data: TaggedObject[]) => { - const objects = { dashboard: [], chart: [], query: [] }; + const objects = { + dashboard: [], + chart: [], + query: [], + } as TaggedObjects; data.forEach(function (object) { const object_type = object.type; - objects[object_type].push(object); + objects[object_type as keyof TaggedObjects].push(object); }); setObjects(objects); setLoading(false);