Merge pull request #18278 from drodil/entity_feedback_user_link

feat: show user as a link in feedback response table
This commit is contained in:
Ben Lambert
2023-06-16 13:35:35 +02:00
committed by GitHub
3 changed files with 13 additions and 6 deletions
@@ -14,6 +14,7 @@
* limitations under the License.
*/
import { entityRouteRef } from '@backstage/plugin-catalog-react';
import { renderInTestApp, TestApiProvider } from '@backstage/test-utils';
import React from 'react';
import { EntityFeedbackApi, entityFeedbackApiRef } from '../../api';
@@ -44,6 +45,9 @@ describe('FeedbackResponseTable', () => {
<TestApiProvider apis={[[entityFeedbackApiRef, feedbackApi]]}>
<FeedbackResponseTable {...props} entityRef="component:default/test" />
</TestApiProvider>,
{
mountedRoutes: { '/catalog/:namespace/:kind/:name': entityRouteRef },
},
);
beforeEach(() => {
@@ -14,10 +14,9 @@
* limitations under the License.
*/
import { parseEntityRef } from '@backstage/catalog-model';
import { ErrorPanel, Table } from '@backstage/core-components';
import { useApi } from '@backstage/core-plugin-api';
import { humanizeEntityRef } from '@backstage/plugin-catalog-react';
import { EntityRefLink } from '@backstage/plugin-catalog-react';
import { FeedbackResponse } from '@backstage/plugin-entity-feedback-common';
import { BackstageTheme } from '@backstage/theme';
import { Chip, makeStyles } from '@material-ui/core';
@@ -65,10 +64,9 @@ export const FeedbackResponseTable = (props: FeedbackResponseTableProps) => {
title: 'User',
field: 'userRef',
width: '15%',
render: (response: ResponseRow) =>
humanizeEntityRef(parseEntityRef(response.userRef), {
defaultKind: 'user',
}),
render: (response: ResponseRow) => (
<EntityRefLink entityRef={response.userRef} defaultKind="user" />
),
},
{
title: 'OK to contact?',