Update with review comments

This commit is contained in:
Dominik Henneke
2021-01-19 16:44:00 +01:00
parent 593632f078
commit 4b5c4cc5ce
3 changed files with 13 additions and 10 deletions
+1 -1
View File
@@ -2,5 +2,5 @@
'@backstage/plugin-catalog': patch
---
Derive the list of to-deleted entities in the `UnregisterEntityDialog` from the `backstage.io/managed-by-origin-location` annotation.
Derive the list of to-delete entities in the `UnregisterEntityDialog` from the `backstage.io/managed-by-origin-location` annotation.
The dialog also rejects deleting entities that are created by the `bootstrap:bootstrap` location.
@@ -50,12 +50,12 @@ metadata:
```
The value of this annotation is a location reference string (see above). It
points to the location, which registration lead to the creation of the entity.
points to the location, whose registration lead to the creation of the entity.
In most cases, the `backstage.io/managed-by-location` and
`backstage.io/managed-by-origin-location` will be equal. It will be different if
the original location delegates to another location. A common case is, that a
location is registered via the `bootstrap:boostrap` which means that is part of
the `app-config.yml` of a backstage installation.
`backstage.io/managed-by-origin-location` will be equal. They will be different
if the original location delegates to another location. A common case is, that a
location is registered as `bootstrap:boostrap` which means that it is part of
the `app-config.yaml` of a backstage installation.
### backstage.io/techdocs-ref
@@ -15,7 +15,7 @@
*/
import { Entity, ORIGIN_LOCATION_ANNOTATION } from '@backstage/catalog-model';
import { alertApiRef, Progress, useApi } from '@backstage/core';
import { alertApiRef, configApiRef, Progress, useApi } from '@backstage/core';
import {
Button,
Dialog,
@@ -81,6 +81,7 @@ export const UnregisterEntityDialog = ({
const fullScreen = useMediaQuery(theme.breakpoints.down('sm'));
const catalogApi = useApi(catalogApiRef);
const alertApi = useApi(alertApiRef);
const configApi = useApi(configApiRef);
const removeEntity = async () => {
const uid = entity.metadata.uid;
@@ -104,12 +105,14 @@ export const UnregisterEntityDialog = ({
{error ? (
<Alert severity="error" style={{ wordBreak: 'break-word' }}>
{error instanceof DeniedLocationException ? (
{error.name === 'DeniedLocationException' ? (
<>
You cannot unregister this entity, since it originates from a
protected Backstage configuration (location
{`"${error.locationName}"`}). If you believe this is in error,
please contact your Backstage operator.
{`"${(error as DeniedLocationException).locationName}"`}). If
you believe this is in error, please contact the{' '}
{configApi.getOptionalString('app.title') ?? 'Backstage'}{' '}
operator.
</>
) : (
error.toString()