diff --git a/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx b/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx index 7866375fb1..8d51c9c403 100644 --- a/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx +++ b/plugins/scaffolder/src/components/ListTasksPage/ListTasksPage.tsx @@ -24,7 +24,10 @@ import { Progress, } from '@backstage/core-components'; import { useApi, useRouteRef } from '@backstage/core-plugin-api'; -import { CatalogFilterLayout } from '@backstage/plugin-catalog-react'; +import { + CatalogFilterLayout, + EntityRefLink, +} from '@backstage/plugin-catalog-react'; import useAsync from 'react-use/lib/useAsync'; import MaterialTable from '@material-table/core'; import React, { useState } from 'react'; @@ -38,6 +41,7 @@ import { TaskStatusColumn, TemplateTitleColumn, } from './columns'; +import { parseEntityRef } from '@backstage/catalog-model'; export interface MyTaskPageProps { initiallySelectedFilter?: TasksOwnerFilterKind; diff --git a/plugins/scaffolder/src/components/ListTasksPage/columns/OwnerEntityColumn.tsx b/plugins/scaffolder/src/components/ListTasksPage/columns/OwnerEntityColumn.tsx index 49c00316c7..0c83c7cbc2 100644 --- a/plugins/scaffolder/src/components/ListTasksPage/columns/OwnerEntityColumn.tsx +++ b/plugins/scaffolder/src/components/ListTasksPage/columns/OwnerEntityColumn.tsx @@ -13,37 +13,37 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { Link } from '@backstage/core-components'; -import { useApi, useRouteRef } from '@backstage/core-plugin-api'; +import { useApi } from '@backstage/core-plugin-api'; import React from 'react'; import useAsync from 'react-use/lib/useAsync'; -import { ListItemText } from '@material-ui/core'; -import { catalogApiRef, entityRouteRef } from '@backstage/plugin-catalog-react'; +import { catalogApiRef, EntityRefLink } from '@backstage/plugin-catalog-react'; import { parseEntityRef, UserEntity } from '@backstage/catalog-model'; export const OwnerEntityColumn = ({ entityRef }: { entityRef?: string }) => { const catalogApi = useApi(catalogApiRef); - const catalogEntityRoute = useRouteRef(entityRouteRef); const { value, loading, error } = useAsync( () => catalogApi.getEntityByRef(entityRef || ''), [catalogApi, entityRef], ); + if (!entityRef) { + return
Unknown
; + } + if (loading || error) { return null; } return ( - -{value?.title}
; + return ( +