chore(review): address comments
Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
@@ -37,6 +37,8 @@ yarn.lock @backstage/maintainers @back
|
||||
/plugins/code-coverage-backend @backstage/maintainers @alde @nissayeva
|
||||
/plugins/cost-insights @backstage/maintainers @backstage/silver-lining
|
||||
/plugins/cost-insights-* @backstage/maintainers @backstage/silver-lining
|
||||
/plugins/entity-feedback @backstage/maintainers @kuangp
|
||||
/plugins/entity-feedback-* @backstage/maintainers @kuangp
|
||||
/plugins/events-backend @backstage/maintainers @pjungermann
|
||||
/plugins/events-backend-module-aws-sqs @backstage/maintainers @pjungermann
|
||||
/plugins/events-backend-module-azure @backstage/maintainers @pjungermann
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@backstage/plugin-entity-feedback-backend",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -15,7 +15,10 @@
|
||||
*/
|
||||
|
||||
import { resolvePackagePath } from '@backstage/backend-common';
|
||||
import { Rating, Response } from '@backstage/plugin-entity-feedback-common';
|
||||
import {
|
||||
FeedbackResponse,
|
||||
Rating,
|
||||
} from '@backstage/plugin-entity-feedback-common';
|
||||
import { Knex } from 'knex';
|
||||
|
||||
const migrationsDir = resolvePackagePath(
|
||||
@@ -119,7 +122,7 @@ export class DatabaseHandler {
|
||||
).map(rating => ({ userRef: rating.user_ref, rating: rating.rating }));
|
||||
}
|
||||
|
||||
async recordResponse(response: Response) {
|
||||
async recordResponse(response: FeedbackResponse) {
|
||||
await this.database('responses').insert({
|
||||
entity_ref: response.entityRef,
|
||||
response: response.response,
|
||||
@@ -131,7 +134,7 @@ export class DatabaseHandler {
|
||||
|
||||
async getResponses(
|
||||
entityRef: string,
|
||||
): Promise<Omit<Response, 'entityRef'>[]> {
|
||||
): Promise<Omit<FeedbackResponse, 'entityRef'>[]> {
|
||||
return (
|
||||
await this.database('responses')
|
||||
.where('entity_ref', entityRef)
|
||||
|
||||
@@ -16,17 +16,7 @@ export interface EntityRatingsData {
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export interface Rating {
|
||||
// (undocumented)
|
||||
entityRef: string;
|
||||
// (undocumented)
|
||||
rating: string;
|
||||
// (undocumented)
|
||||
userRef: string;
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
interface Response_2 {
|
||||
export interface FeedbackResponse {
|
||||
// (undocumented)
|
||||
comments?: string;
|
||||
// (undocumented)
|
||||
@@ -38,5 +28,14 @@ interface Response_2 {
|
||||
// (undocumented)
|
||||
userRef: string;
|
||||
}
|
||||
export { Response_2 as Response };
|
||||
|
||||
// @public (undocumented)
|
||||
export interface Rating {
|
||||
// (undocumented)
|
||||
entityRef: string;
|
||||
// (undocumented)
|
||||
rating: string;
|
||||
// (undocumented)
|
||||
userRef: string;
|
||||
}
|
||||
```
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "@backstage/plugin-entity-feedback-common",
|
||||
"description": "Common functionalities for the entity-feedback plugin",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -32,7 +32,7 @@ export interface Rating {
|
||||
/**
|
||||
* @public
|
||||
*/
|
||||
export interface Response {
|
||||
export interface FeedbackResponse {
|
||||
entityRef: string;
|
||||
response?: string;
|
||||
comments?: string;
|
||||
|
||||
@@ -10,10 +10,10 @@ import { BackstagePlugin } from '@backstage/core-plugin-api';
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { Entity } from '@backstage/catalog-model';
|
||||
import { EntityRatingsData } from '@backstage/plugin-entity-feedback-common';
|
||||
import { FeedbackResponse } from '@backstage/plugin-entity-feedback-common';
|
||||
import { FetchApi } from '@backstage/core-plugin-api';
|
||||
import { Rating } from '@backstage/plugin-entity-feedback-common';
|
||||
import { ReactNode } from 'react';
|
||||
import { Response as Response_2 } from '@backstage/plugin-entity-feedback-common';
|
||||
import { RouteRef } from '@backstage/core-plugin-api';
|
||||
|
||||
// @public (undocumented)
|
||||
@@ -25,13 +25,15 @@ export interface EntityFeedbackApi {
|
||||
// (undocumented)
|
||||
getRatings(entityRef: string): Promise<Omit<Rating, 'entityRef'>[]>;
|
||||
// (undocumented)
|
||||
getResponses(entityRef: string): Promise<Omit<Response_2, 'entityRef'>[]>;
|
||||
getResponses(
|
||||
entityRef: string,
|
||||
): Promise<Omit<FeedbackResponse, 'entityRef'>[]>;
|
||||
// (undocumented)
|
||||
recordRating(entityRef: string, rating: string): Promise<void>;
|
||||
// (undocumented)
|
||||
recordResponse(
|
||||
entityRef: string,
|
||||
response: Omit<Response_2, 'entityRef' | 'userRef'>,
|
||||
response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>,
|
||||
): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -48,13 +50,15 @@ export class EntityFeedbackClient implements EntityFeedbackApi {
|
||||
// (undocumented)
|
||||
getRatings(entityRef: string): Promise<Omit<Rating, 'entityRef'>[]>;
|
||||
// (undocumented)
|
||||
getResponses(entityRef: string): Promise<Omit<Response_2, 'entityRef'>[]>;
|
||||
getResponses(
|
||||
entityRef: string,
|
||||
): Promise<Omit<FeedbackResponse, 'entityRef'>[]>;
|
||||
// (undocumented)
|
||||
recordRating(entityRef: string, rating: string): Promise<void>;
|
||||
// (undocumented)
|
||||
recordResponse(
|
||||
entityRef: string,
|
||||
response: Omit<Response_2, 'entityRef' | 'userRef'>,
|
||||
response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>,
|
||||
): Promise<void>;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@backstage/plugin-entity-feedback",
|
||||
"version": "0.1.0",
|
||||
"version": "0.0.0",
|
||||
"main": "src/index.ts",
|
||||
"types": "src/index.ts",
|
||||
"license": "Apache-2.0",
|
||||
|
||||
@@ -17,8 +17,8 @@
|
||||
import { createApiRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
EntityRatingsData,
|
||||
FeedbackResponse,
|
||||
Rating,
|
||||
Response,
|
||||
} from '@backstage/plugin-entity-feedback-common';
|
||||
|
||||
/**
|
||||
@@ -42,8 +42,10 @@ export interface EntityFeedbackApi {
|
||||
|
||||
recordResponse(
|
||||
entityRef: string,
|
||||
response: Omit<Response, 'entityRef' | 'userRef'>,
|
||||
response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>,
|
||||
): Promise<void>;
|
||||
|
||||
getResponses(entityRef: string): Promise<Omit<Response, 'entityRef'>[]>;
|
||||
getResponses(
|
||||
entityRef: string,
|
||||
): Promise<Omit<FeedbackResponse, 'entityRef'>[]>;
|
||||
}
|
||||
|
||||
@@ -18,8 +18,8 @@ import { DiscoveryApi, FetchApi } from '@backstage/core-plugin-api';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import {
|
||||
EntityRatingsData,
|
||||
FeedbackResponse,
|
||||
Rating,
|
||||
Response,
|
||||
} from '@backstage/plugin-entity-feedback-common';
|
||||
|
||||
import { EntityFeedbackApi } from './EntityFeedbackApi';
|
||||
@@ -99,7 +99,7 @@ export class EntityFeedbackClient implements EntityFeedbackApi {
|
||||
|
||||
async recordResponse(
|
||||
entityRef: string,
|
||||
response: Omit<Response, 'entityRef' | 'userRef'>,
|
||||
response: Omit<FeedbackResponse, 'entityRef' | 'userRef'>,
|
||||
) {
|
||||
const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');
|
||||
const resp = await this.fetchApi.fetch(
|
||||
@@ -118,7 +118,7 @@ export class EntityFeedbackClient implements EntityFeedbackApi {
|
||||
|
||||
async getResponses(
|
||||
entityRef: string,
|
||||
): Promise<Omit<Response, 'entityRef'>[]> {
|
||||
): Promise<Omit<FeedbackResponse, 'entityRef'>[]> {
|
||||
const baseUrl = await this.discoveryApi.getBaseUrl('entity-feedback');
|
||||
const resp = await this.fetchApi.fetch(
|
||||
`${baseUrl}/responses/${encodeURIComponent(entityRef)}`,
|
||||
|
||||
+2
-2
@@ -18,7 +18,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 { Response } from '@backstage/plugin-entity-feedback-common';
|
||||
import { FeedbackResponse } from '@backstage/plugin-entity-feedback-common';
|
||||
import { BackstageTheme } from '@backstage/theme';
|
||||
import { Chip, makeStyles } from '@material-ui/core';
|
||||
import CheckIcon from '@material-ui/icons/Check';
|
||||
@@ -27,7 +27,7 @@ import useAsync from 'react-use/lib/useAsync';
|
||||
|
||||
import { entityFeedbackApiRef } from '../../api';
|
||||
|
||||
type ResponseRow = Omit<Response, 'entityRef'>;
|
||||
type ResponseRow = Omit<FeedbackResponse, 'entityRef'>;
|
||||
|
||||
const useStyles = makeStyles<BackstageTheme>(theme => ({
|
||||
consentCheck: {
|
||||
|
||||
Reference in New Issue
Block a user