chore(review): address comments

Signed-off-by: Phil Kuang <pkuang@factset.com>
This commit is contained in:
Phil Kuang
2023-02-13 09:38:48 -05:00
parent a3c86a7ed2
commit dfbe698743
11 changed files with 42 additions and 32 deletions
+9 -5
View File
@@ -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 -1
View File
@@ -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)}`,
@@ -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: {