Merge pull request #9818 from backstage/jhaals/dep-getEntityMetadataViewUrl
catalog-react: Deprecate getEntityMetadataViewUrl and getEntityMetadataEditUrl
This commit is contained in:
@@ -443,10 +443,10 @@ export function formatEntityRefTitle(
|
||||
},
|
||||
): string;
|
||||
|
||||
// @public (undocumented)
|
||||
// @public @deprecated (undocumented)
|
||||
export function getEntityMetadataEditUrl(entity: Entity): string | undefined;
|
||||
|
||||
// @public (undocumented)
|
||||
// @public @deprecated (undocumented)
|
||||
export function getEntityMetadataViewUrl(entity: Entity): string | undefined;
|
||||
|
||||
// @public
|
||||
|
||||
@@ -20,12 +20,17 @@ import {
|
||||
Entity,
|
||||
} from '@backstage/catalog-model';
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* @public
|
||||
* @deprecated use entity.metadata.annotations?.[ANNOTATION_VIEW_URL] instead. */
|
||||
export function getEntityMetadataViewUrl(entity: Entity): string | undefined {
|
||||
return entity.metadata.annotations?.[ANNOTATION_VIEW_URL];
|
||||
}
|
||||
|
||||
/** @public */
|
||||
/**
|
||||
* @public
|
||||
* @deprecated use entity.metadata.annotations?.[ANNOTATION_EDIT_URL] instead.
|
||||
*/
|
||||
export function getEntityMetadataEditUrl(entity: Entity): string | undefined {
|
||||
return entity.metadata.annotations?.[ANNOTATION_EDIT_URL];
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
ANNOTATION_EDIT_URL,
|
||||
ANNOTATION_LOCATION,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
@@ -32,7 +33,6 @@ import {
|
||||
} from '@backstage/integration-react';
|
||||
import {
|
||||
catalogApiRef,
|
||||
getEntityMetadataEditUrl,
|
||||
getEntitySourceLocation,
|
||||
useEntity,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
@@ -97,7 +97,8 @@ export function AboutCard(props: AboutCardProps) {
|
||||
entity,
|
||||
scmIntegrationsApi,
|
||||
);
|
||||
const entityMetadataEditUrl = getEntityMetadataEditUrl(entity);
|
||||
const entityMetadataEditUrl =
|
||||
entity.metadata.annotations?.[ANNOTATION_EDIT_URL];
|
||||
|
||||
const viewInSource: IconLinkVerticalProps = {
|
||||
label: 'View Source',
|
||||
|
||||
@@ -13,13 +13,16 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { RELATION_OWNED_BY, RELATION_PART_OF } from '@backstage/catalog-model';
|
||||
import {
|
||||
ANNOTATION_EDIT_URL,
|
||||
ANNOTATION_VIEW_URL,
|
||||
RELATION_OWNED_BY,
|
||||
RELATION_PART_OF,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
favoriteEntityIcon,
|
||||
favoriteEntityTooltip,
|
||||
formatEntityRefTitle,
|
||||
getEntityMetadataEditUrl,
|
||||
getEntityMetadataViewUrl,
|
||||
getEntityRelations,
|
||||
useEntityList,
|
||||
useStarredEntities,
|
||||
@@ -86,7 +89,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
|
||||
const defaultActions: TableProps<CatalogTableRow>['actions'] = [
|
||||
({ entity }) => {
|
||||
const url = getEntityMetadataViewUrl(entity);
|
||||
const url = entity.metadata.annotations?.[ANNOTATION_VIEW_URL];
|
||||
return {
|
||||
icon: () => <OpenInNew aria-label="View" fontSize="small" />,
|
||||
tooltip: 'View',
|
||||
@@ -98,7 +101,7 @@ export const CatalogTable = (props: CatalogTableProps) => {
|
||||
};
|
||||
},
|
||||
({ entity }) => {
|
||||
const url = getEntityMetadataEditUrl(entity);
|
||||
const url = entity.metadata.annotations?.[ANNOTATION_EDIT_URL];
|
||||
return {
|
||||
icon: () => <Edit aria-label="Edit" fontSize="small" />,
|
||||
tooltip: 'Edit',
|
||||
|
||||
@@ -20,13 +20,13 @@ import {
|
||||
RELATION_PARENT_OF,
|
||||
ANNOTATION_LOCATION,
|
||||
stringifyEntityRef,
|
||||
ANNOTATION_EDIT_URL,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
catalogApiRef,
|
||||
EntityRefLinks,
|
||||
getEntityRelations,
|
||||
useEntity,
|
||||
getEntityMetadataEditUrl,
|
||||
} from '@backstage/plugin-catalog-react';
|
||||
import {
|
||||
Box,
|
||||
@@ -94,7 +94,8 @@ export const GroupProfileCard = ({
|
||||
const allowRefresh =
|
||||
entityLocation?.startsWith('url:') || entityLocation?.startsWith('file:');
|
||||
|
||||
const entityMetadataEditUrl = getEntityMetadataEditUrl(group);
|
||||
const entityMetadataEditUrl =
|
||||
group.metadata.annotations?.[ANNOTATION_EDIT_URL];
|
||||
|
||||
const displayName = profile?.displayName ?? name;
|
||||
const emailHref = profile?.email ? `mailto:${profile.email}` : '#';
|
||||
|
||||
Reference in New Issue
Block a user