+
setMenuOpen(!menuOpen)}
+ onClick={onOpen}
data-testid="menu-button"
+ className={classes.button}
>
-
+
+
+
+
+
);
};
+
export default ComponentContextMenu;
diff --git a/plugins/catalog/src/components/ComponentRemovalDialog/ComponentRemovalDialog.tsx b/plugins/catalog/src/components/ComponentRemovalDialog/ComponentRemovalDialog.tsx
index a923382111..9a8fdafbf3 100644
--- a/plugins/catalog/src/components/ComponentRemovalDialog/ComponentRemovalDialog.tsx
+++ b/plugins/catalog/src/components/ComponentRemovalDialog/ComponentRemovalDialog.tsx
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
import { Entity, LOCATION_ANNOTATION } from '@backstage/catalog-model';
-import { Progress, useApi, alertApiRef } from '@backstage/core';
+import { Progress, useApi } from '@backstage/core';
import {
Button,
Dialog,
@@ -22,12 +23,14 @@ import {
DialogContent,
DialogContentText,
DialogTitle,
+ Typography,
useMediaQuery,
useTheme,
List,
ListItem,
ListItemText,
} from '@material-ui/core';
+import Alert from '@material-ui/lab/Alert';
import React, { FC } from 'react';
import { useAsync } from 'react-use';
import { AsyncState } from 'react-use/lib/useAsync';
diff --git a/plugins/catalog/src/data/component.ts b/plugins/catalog/src/data/component.ts
index 50cfffe58a..86749c6faa 100644
--- a/plugins/catalog/src/data/component.ts
+++ b/plugins/catalog/src/data/component.ts
@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import { EntityMeta, LocationSpec } from '@backstage/catalog-model';
+import { EntityMeta } from '@backstage/catalog-model';
import { ReactNode } from 'react';
export type Component = {
@@ -21,5 +21,4 @@ export type Component = {
kind: string;
metadata: EntityMeta;
description: ReactNode;
- location?: LocationSpec;
};
diff --git a/plugins/catalog/src/data/utils.tsx b/plugins/catalog/src/data/utils.tsx
index b4f2a15bf3..3e8e0458d6 100644
--- a/plugins/catalog/src/data/utils.tsx
+++ b/plugins/catalog/src/data/utils.tsx
@@ -13,16 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-import React from 'react';
-import { Component } from './component';
import {
Entity,
- LOCATION_ANNOTATION,
LocationSpec,
+ LOCATION_ANNOTATION,
+ EntityMeta,
} from '@backstage/catalog-model';
-import Edit from '@material-ui/icons/Edit';
import IconButton from '@material-ui/core/IconButton';
import { styled } from '@material-ui/core/styles';
+import Edit from '@material-ui/icons/Edit';
+import React from 'react';
+import { Component } from './component';
const DescriptionWrapper = styled('span')({
display: 'flex',
@@ -39,7 +40,7 @@ const createEditLink = (location: LocationSpec): string => {
};
export function entityToComponent(envelope: Entity): Component {
- const location = findLocationForEntity(envelope);
+ const location = findLocationForEntityMeta(envelope.metadata);
return {
name: envelope.metadata?.name ?? '',
kind: envelope.kind ?? 'unknown',
@@ -56,14 +57,17 @@ export function entityToComponent(envelope: Entity): Component {
) : null}
),
- location: findLocationForEntity(envelope),
};
}
-export function findLocationForEntity(
- entity: Entity,
+export function findLocationForEntityMeta(
+ meta: EntityMeta,
): LocationSpec | undefined {
- const annotation = entity.metadata.annotations?.[LOCATION_ANNOTATION];
+ if (!meta) {
+ return undefined;
+ }
+
+ const annotation = meta.annotations?.[LOCATION_ANNOTATION];
if (!annotation) {
return undefined;
}