refactor: id to entityId

Signed-off-by: Kurt King <kurtaking@gmail.com>
This commit is contained in:
Kurt King
2024-02-02 13:12:51 -07:00
committed by blam
parent fc4a5b0a7f
commit 1f471f0ac4
3 changed files with 11 additions and 9 deletions
@@ -14,7 +14,7 @@ import { RouteRef } from '@backstage/core-plugin-api';
// @public
export interface CatalogUnprocessedEntitiesApi {
delete(entity_id: string): Promise<void>;
delete(entityId: string): Promise<void>;
failed(): Promise<CatalogUnprocessedEntitiesApiResponse>;
pending(): Promise<CatalogUnprocessedEntitiesApiResponse>;
}
@@ -57,7 +57,7 @@ export interface CatalogUnprocessedEntitiesApi {
/**
* Deletes an entity from the refresh_state table
*/
delete(entity_id: string): Promise<void>;
delete(entityId: string): Promise<void>;
}
/**
@@ -89,8 +89,8 @@ export class CatalogUnprocessedEntitiesClient
return await this.fetch('entities/unprocessed/failed');
}
async delete(entity_id: string): Promise<void> {
await this.fetch(`entities/unprocessed/delete/${entity_id}`, {
async delete(entityId: string): Promise<void> {
await this.fetch(`entities/unprocessed/delete/${entityId}`, {
method: 'DELETE',
});
}
@@ -108,14 +108,14 @@ export const FailedEntities = () => {
}
const handleDelete = async ({
id,
entityId,
entityRef,
}: {
id: string;
entityId: string;
entityRef: string;
}) => {
try {
await unprocessedEntityApi.delete(id);
await unprocessedEntityApi.delete(entityId);
alertApi.post({
message: `Entity ${entityRef} has been deleted`,
severity: 'success',
@@ -165,13 +165,15 @@ export const FailedEntities = () => {
{
title: <Typography>Actions</Typography>,
render: (rowData: UnprocessedEntity | {}) => {
const { entity_id, entity_ref } = rowData as UnprocessedEntity;
return (
<IconButton
aria-label="delete"
onClick={async () =>
await handleDelete({
id: (rowData as UnprocessedEntity).entity_id,
entityRef: (rowData as UnprocessedEntity).entity_ref,
entityId: entity_id,
entityRef: entity_ref,
})
}
>