feat: show user as a link in feedback response table

Signed-off-by: Heikki Hellgren <heikki.hellgren@op.fi>
This commit is contained in:
Heikki Hellgren
2023-06-15 15:37:23 +03:00
parent 6bb71b9251
commit 5c0f095c76
3 changed files with 16 additions and 5 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-entity-feedback': patch
---
Show user in feedback response table as link
@@ -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(() => {
@@ -17,7 +17,7 @@
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 +65,12 @@ 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={parseEntityRef(response.userRef, { defaultKind: 'user' })}
defaultKind="user"
/>
),
},
{
title: 'OK to contact?',