Merge pull request #22478 from autodesk-forks/nikolarAutodesk/entity-feedback_defaultResponse

[plugin/feedback-entity] Improvements to Feedback Plugin UI
This commit is contained in:
Fredrik Adelöw
2024-03-01 13:25:36 +01:00
committed by GitHub
7 changed files with 22 additions and 7 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-entity-feedback-backend': patch
---
Add in description for 400 response when encountering an invalid rating request
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-entity-feedback': patch
---
Remove empty Chip in `FeedbackResponseTable.tsx` when there is no response, and fix typo in Feedback Dialog Box.
@@ -33,6 +33,7 @@
"@backstage/catalog-client": "workspace:^",
"@backstage/catalog-model": "workspace:^",
"@backstage/config": "workspace:^",
"@backstage/errors": "workspace:^",
"@backstage/plugin-auth-node": "workspace:^",
"@backstage/plugin-entity-feedback-common": "workspace:^",
"@types/express": "*",
@@ -28,6 +28,7 @@ import {
EntityRatingsData,
Ratings,
} from '@backstage/plugin-entity-feedback-common';
import { InputError } from '@backstage/errors';
import express from 'express';
import Router from 'express-promise-router';
import { Logger } from 'winston';
@@ -138,11 +139,9 @@ export async function createRouter(
const rating = req.body.rating;
if (!rating) {
logger.warn(
throw new InputError(
`Can't save rating because there is not enough info: user=${credentials.principal.userEntityRef}, rating=${rating}`,
);
res.status(400).end();
return;
}
await dbHandler.recordRating({
@@ -108,7 +108,7 @@ export const FeedbackResponseDialog = (props: FeedbackResponseDialogProps) => {
<DialogTitle>{feedbackDialogTitle}</DialogTitle>
<DialogContent>
<FormControl component="fieldset">
<FormLabel component="legend">Choose all that applies</FormLabel>
<FormLabel component="legend">Choose all that apply</FormLabel>
<FormGroup>
{feedbackDialogResponses.map(response => (
<FormControlLabel
@@ -80,9 +80,13 @@ export const FeedbackResponseTable = (props: FeedbackResponseTableProps) => {
width: '35%',
render: (response: ResponseRow) => (
<>
{response.response?.split(',').map(res => (
<Chip key={res} size="small" label={res} />
))}
{(response.response || '')
.split(',')
.map(v => v.trim()) // removes whitespace
.filter(Boolean) // removes accidental empty entries
.map(res => (
<Chip key={res} size="small" label={res} />
))}
</>
),
},
+1
View File
@@ -6522,6 +6522,7 @@ __metadata:
"@backstage/catalog-model": "workspace:^"
"@backstage/cli": "workspace:^"
"@backstage/config": "workspace:^"
"@backstage/errors": "workspace:^"
"@backstage/plugin-auth-node": "workspace:^"
"@backstage/plugin-entity-feedback-common": "workspace:^"
"@types/express": "*"