Merge pull request #22478 from autodesk-forks/nikolarAutodesk/entity-feedback_defaultResponse
[plugin/feedback-entity] Improvements to Feedback Plugin UI
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-entity-feedback-backend': patch
|
||||
---
|
||||
|
||||
Add in description for 400 response when encountering an invalid rating request
|
||||
@@ -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({
|
||||
|
||||
+1
-1
@@ -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
|
||||
|
||||
+7
-3
@@ -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} />
|
||||
))}
|
||||
</>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -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": "*"
|
||||
|
||||
Reference in New Issue
Block a user