Merge pull request #19416 from adamdmharvey/adamdmharvey/entity-feedback

chore(entity-feedback): Improve backend logging if posts fail
This commit is contained in:
Ben Lambert
2023-08-17 15:10:02 +02:00
committed by GitHub
5 changed files with 24 additions and 2 deletions
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-entity-feedback': patch
---
Improve README to note that Backstage identity is required to be configured
+5
View File
@@ -0,0 +1,5 @@
---
'@backstage/plugin-entity-feedback-backend': patch
---
Improve backend logging if method calls fail
@@ -4,6 +4,10 @@ Welcome to the entity-feedback backend plugin!
## Installation
Note: this plugin requires authentication and identity configured so Backstage can identify
which user has rated the entity. If you are using the guest identity provider which comes
out of the box, this plugin will not work when you test it.
### Install the package
```bash
@@ -134,6 +134,9 @@ export async function createRouter(
const user = await identity.getIdentity({ request: req });
const rating = req.body.rating;
if (!user || !rating) {
logger.warn(
`Can't save rating because there is not enough info: user=${user}, rating=${rating}`,
);
res.status(400).end();
return;
}
@@ -188,6 +191,7 @@ export async function createRouter(
const { response, comments, consent } = req.body;
if (!user) {
logger.warn(`Could not identify user to save responses, user=${user}`);
res.status(400).end();
return;
}
+6 -2
View File
@@ -36,7 +36,11 @@ This plugin allows you give and view feedback on entities available in the Backs
## Setup
The following sections will help you get the Entity Feedback plugin setup and running
The following sections will help you get the Entity Feedback plugin setup and running.
Note: this plugin requires authentication and identity configured so Backstage can identify
which user has rated the entity. If you are using the guest identity provider which comes
out of the box, this plugin will not work when you test it.
### Backend
@@ -133,4 +137,4 @@ const groupPage = (
);
```
Note: For a full example of this you can look at [this EntityPage](../../packages/app/src/components/catalog/EntityPage.tsx)
Note: For a full example of this you can look at [this EntityPage](../../packages/app/src/components/catalog/EntityPage.tsx).