catalog-model: deprecate ENTITY_DEFAULT_NAMESPACE, replace with DEFAULT_NAMESPACE
Signed-off-by: Johan Haals <johan.haals@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/catalog-model': patch
|
||||
---
|
||||
|
||||
Deprecates `ENTITY_DEFAULT_NAMESPACE` constant in favour of `DEFAULT_NAMESPACE`.
|
||||
@@ -0,0 +1,18 @@
|
||||
---
|
||||
'@backstage/techdocs-common': patch
|
||||
'@backstage/plugin-auth-backend': patch
|
||||
'@backstage/plugin-badges': patch
|
||||
'@backstage/plugin-badges-backend': patch
|
||||
'@backstage/plugin-catalog': patch
|
||||
'@backstage/plugin-catalog-backend': patch
|
||||
'@backstage/plugin-catalog-graph': patch
|
||||
'@backstage/plugin-catalog-react': patch
|
||||
'@backstage/plugin-cost-insights': patch
|
||||
'@backstage/plugin-ilert': patch
|
||||
'@backstage/plugin-org': patch
|
||||
'@backstage/plugin-pagerduty': patch
|
||||
'@backstage/plugin-search': patch
|
||||
'@backstage/plugin-techdocs-backend': patch
|
||||
---
|
||||
|
||||
Replace use of deprecated `ENTITY_DEFAULT_NAMESPACE` constant with `DEFAULT_NAMESPACE`.
|
||||
@@ -97,6 +97,9 @@ export { ComponentEntityV1alpha1 };
|
||||
// @public
|
||||
export const componentEntityV1alpha1Validator: KindValidator;
|
||||
|
||||
// @public
|
||||
export const DEFAULT_NAMESPACE = 'default';
|
||||
|
||||
// @public
|
||||
export class DefaultNamespaceEntityPolicy implements EntityPolicy {
|
||||
constructor(namespace?: string);
|
||||
@@ -133,7 +136,7 @@ export type Entity = {
|
||||
relations?: EntityRelation[];
|
||||
};
|
||||
|
||||
// @public
|
||||
// @public @deprecated
|
||||
export const ENTITY_DEFAULT_NAMESPACE = 'default';
|
||||
|
||||
// @public @deprecated
|
||||
|
||||
@@ -18,9 +18,17 @@
|
||||
* The namespace that entities without an explicit namespace fall into.
|
||||
*
|
||||
* @public
|
||||
* @deprecated use {@link DEFAULT_NAMESPACE} instead.
|
||||
*/
|
||||
export const ENTITY_DEFAULT_NAMESPACE = 'default';
|
||||
|
||||
/**
|
||||
* The namespace that entities without an explicit namespace fall into.
|
||||
*
|
||||
* @public
|
||||
*/
|
||||
export const DEFAULT_NAMESPACE = 'default';
|
||||
|
||||
/**
|
||||
* The keys of EntityMeta that are auto-generated.
|
||||
*
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
export {
|
||||
EDIT_URL_ANNOTATION,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
ENTITY_META_GENERATED_FIELDS,
|
||||
VIEW_URL_ANNOTATION,
|
||||
ANNOTATION_EDIT_URL,
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
@@ -34,7 +34,7 @@ const getEntityRootDir = (entity: Entity) => {
|
||||
metadata: { namespace, name },
|
||||
} = entity;
|
||||
|
||||
return path.join(rootDir, namespace || ENTITY_DEFAULT_NAMESPACE, kind, name);
|
||||
return path.join(rootDir, namespace || DEFAULT_NAMESPACE, kind, name);
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
@@ -34,7 +34,7 @@ const getEntityRootDir = (entity: Entity) => {
|
||||
metadata: { namespace, name },
|
||||
} = entity;
|
||||
|
||||
return path.join(rootDir, namespace || ENTITY_DEFAULT_NAMESPACE, kind, name);
|
||||
return path.join(rootDir, namespace || DEFAULT_NAMESPACE, kind, name);
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { getVoidLogger } from '@backstage/backend-common';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import express from 'express';
|
||||
import request from 'supertest';
|
||||
@@ -34,7 +34,7 @@ const getEntityRootDir = (entity: Entity) => {
|
||||
metadata: { namespace, name },
|
||||
} = entity;
|
||||
|
||||
return path.join(rootDir, namespace || ENTITY_DEFAULT_NAMESPACE, kind, name);
|
||||
return path.join(rootDir, namespace || DEFAULT_NAMESPACE, kind, name);
|
||||
};
|
||||
|
||||
const logger = getVoidLogger();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
import mockFs from 'mock-fs';
|
||||
import * as os from 'os';
|
||||
import * as path from 'path';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import {
|
||||
getStaleFiles,
|
||||
getFileTreeRecursively,
|
||||
@@ -189,7 +189,7 @@ describe('getCloudPathForLocalPath', () => {
|
||||
localPath,
|
||||
);
|
||||
expect(remoteBucket).toBe(
|
||||
`${ENTITY_DEFAULT_NAMESPACE}/component/backstage/${localPath}`,
|
||||
`${DEFAULT_NAMESPACE}/component/backstage/${localPath}`,
|
||||
);
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import mime from 'mime-types';
|
||||
import path from 'path';
|
||||
import createLimiter from 'p-limit';
|
||||
@@ -188,9 +188,9 @@ export const getCloudPathForLocalPath = (
|
||||
const relativeFilePathPosix = localPath.split(path.sep).join(path.posix.sep);
|
||||
|
||||
// The / delimiter is intentional since it represents the cloud storage and not the local file system.
|
||||
const entityRootDir = `${
|
||||
entity.metadata?.namespace ?? ENTITY_DEFAULT_NAMESPACE
|
||||
}/${entity.kind}/${entity.metadata.name}`;
|
||||
const entityRootDir = `${entity.metadata?.namespace ?? DEFAULT_NAMESPACE}/${
|
||||
entity.kind
|
||||
}/${entity.metadata.name}`;
|
||||
|
||||
const relativeFilePathTriplet = `${entityRootDir}/${relativeFilePathPosix}`;
|
||||
|
||||
|
||||
@@ -18,7 +18,7 @@ import { getVoidLogger } from '@backstage/backend-common';
|
||||
import {
|
||||
Entity,
|
||||
EntityName,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
} from '@backstage/catalog-model';
|
||||
import { ConfigReader } from '@backstage/config';
|
||||
import express from 'express';
|
||||
@@ -59,7 +59,7 @@ const getEntityRootDir = (entity: Entity) => {
|
||||
metadata: { namespace, name },
|
||||
} = entity;
|
||||
|
||||
return path.join(rootDir, namespace || ENTITY_DEFAULT_NAMESPACE, kind, name);
|
||||
return path.join(rootDir, namespace || DEFAULT_NAMESPACE, kind, name);
|
||||
};
|
||||
|
||||
const getPosixEntityRootDir = (entity: Entity) => {
|
||||
@@ -70,7 +70,7 @@ const getPosixEntityRootDir = (entity: Entity) => {
|
||||
|
||||
return path.posix.join(
|
||||
'/rootDir',
|
||||
namespace || ENTITY_DEFAULT_NAMESPACE,
|
||||
namespace || DEFAULT_NAMESPACE,
|
||||
kind,
|
||||
name,
|
||||
);
|
||||
|
||||
@@ -18,7 +18,7 @@ import express, { CookieOptions } from 'express';
|
||||
import crypto from 'crypto';
|
||||
import { URL } from 'url';
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
@@ -271,7 +271,7 @@ export class OAuthAdapter implements AuthProviderRouteHandlers {
|
||||
const userEntityRef = stringifyEntityRef(
|
||||
parseEntityRef(identity.id, {
|
||||
defaultKind: 'user',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
}),
|
||||
);
|
||||
const token = await this.options.tokenIssuer.issueToken({
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
@@ -44,7 +44,7 @@ export function prepareBackstageIdentityResponse(
|
||||
const userEntityRef = stringifyEntityRef(
|
||||
parseEntityRef(sub, {
|
||||
defaultKind: 'user',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
}),
|
||||
);
|
||||
return {
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { InputError } from '@backstage/errors';
|
||||
import { Badge, BadgeContext, BadgeFactories } from './types';
|
||||
|
||||
@@ -24,9 +24,9 @@ function appTitle(context: BadgeContext): string {
|
||||
|
||||
function entityUrl(context: BadgeContext): string {
|
||||
const e = context.entity!;
|
||||
const entityUri = `${e.metadata.namespace || ENTITY_DEFAULT_NAMESPACE}/${
|
||||
e.kind
|
||||
}/${e.metadata.name}`;
|
||||
const entityUri = `${e.metadata.namespace || DEFAULT_NAMESPACE}/${e.kind}/${
|
||||
e.metadata.name
|
||||
}`;
|
||||
const catalogUrl = `${context.config.getString('app.baseUrl')}/catalog`;
|
||||
return `${catalogUrl}/${entityUri}`.toLowerCase();
|
||||
}
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import { generatePath } from 'react-router';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { BadgesApi, BadgeSpec } from './types';
|
||||
import { DiscoveryApi, IdentityApi } from '@backstage/core-plugin-api';
|
||||
|
||||
@@ -63,7 +63,7 @@ export class BadgesClient implements BadgesApi {
|
||||
kind: entity.kind.toLocaleLowerCase('en-US'),
|
||||
namespace:
|
||||
entity.metadata.namespace?.toLocaleLowerCase('en-US') ??
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
name: entity.metadata.name,
|
||||
};
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { buildEntitySearch, mapToRows, traverse } from './buildEntitySearch';
|
||||
|
||||
describe('buildEntitySearch', () => {
|
||||
@@ -133,7 +133,7 @@ describe('buildEntitySearch', () => {
|
||||
{
|
||||
entity_id: 'eid',
|
||||
key: 'metadata.namespace',
|
||||
value: ENTITY_DEFAULT_NAMESPACE,
|
||||
value: DEFAULT_NAMESPACE,
|
||||
},
|
||||
]);
|
||||
});
|
||||
@@ -157,7 +157,7 @@ describe('buildEntitySearch', () => {
|
||||
{
|
||||
entity_id: 'eid',
|
||||
key: 'metadata.namespace',
|
||||
value: ENTITY_DEFAULT_NAMESPACE,
|
||||
value: DEFAULT_NAMESPACE,
|
||||
},
|
||||
{ entity_id: 'eid', key: 'relations.t1', value: 'k:ns/a' },
|
||||
{ entity_id: 'eid', key: 'relations.t2', value: 'k:ns/b' },
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { InputError } from '@backstage/errors';
|
||||
@@ -174,7 +174,7 @@ export function buildEntitySearch(
|
||||
// Namespace not specified has the default value "default", so we want to
|
||||
// match on that as well
|
||||
if (!entity.metadata.namespace) {
|
||||
raw.push({ key: 'metadata.namespace', value: ENTITY_DEFAULT_NAMESPACE });
|
||||
raw.push({ key: 'metadata.namespace', value: DEFAULT_NAMESPACE });
|
||||
}
|
||||
|
||||
// Visit relations
|
||||
|
||||
@@ -17,7 +17,7 @@ import { GetEntitiesResponse } from '@backstage/catalog-client';
|
||||
import {
|
||||
Entity,
|
||||
EntityName,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
RELATION_API_CONSUMED_BY,
|
||||
RELATION_API_PROVIDED_BY,
|
||||
RELATION_CONSUMES_API,
|
||||
@@ -117,7 +117,7 @@ const entities = (
|
||||
name,
|
||||
},
|
||||
relations: relations.map(([type, k, n]) => ({
|
||||
target: { kind: k, name: n, namespace: ENTITY_DEFAULT_NAMESPACE },
|
||||
target: { kind: k, name: n, namespace: DEFAULT_NAMESPACE },
|
||||
type,
|
||||
})),
|
||||
};
|
||||
|
||||
+2
-2
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { MouseEvent, useState } from 'react';
|
||||
@@ -77,7 +77,7 @@ export function useEntityRelationNodesAndEdges({
|
||||
title: entity.metadata?.title ?? undefined,
|
||||
kind: entity.kind,
|
||||
name: entity.metadata.name,
|
||||
namespace: entity.metadata.namespace ?? ENTITY_DEFAULT_NAMESPACE,
|
||||
namespace: entity.metadata.namespace ?? DEFAULT_NAMESPACE,
|
||||
focused,
|
||||
color: focused ? 'secondary' : 'primary',
|
||||
};
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import {
|
||||
Entity,
|
||||
EntityName,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
} from '@backstage/catalog-model';
|
||||
import React, { forwardRef } from 'react';
|
||||
import { entityRouteRef } from '../../routes';
|
||||
@@ -66,8 +66,7 @@ export const EntityRefLink = forwardRef<any, EntityRefLinkProps>(
|
||||
|
||||
const routeParams = {
|
||||
kind,
|
||||
namespace:
|
||||
namespace?.toLocaleLowerCase('en-US') ?? ENTITY_DEFAULT_NAMESPACE,
|
||||
namespace: namespace?.toLocaleLowerCase('en-US') ?? DEFAULT_NAMESPACE,
|
||||
name,
|
||||
};
|
||||
const formattedEntityRefTitle = formatEntityRefTitle(entityRef, {
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
import {
|
||||
Entity,
|
||||
EntityName,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
} from '@backstage/catalog-model';
|
||||
|
||||
export function formatEntityRefTitle(
|
||||
@@ -39,7 +39,7 @@ export function formatEntityRefTitle(
|
||||
name = entityRef.name;
|
||||
}
|
||||
|
||||
if (namespace === ENTITY_DEFAULT_NAMESPACE) {
|
||||
if (namespace === DEFAULT_NAMESPACE) {
|
||||
namespace = undefined;
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@
|
||||
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -143,7 +143,7 @@ function CustomNode({ node }: DependencyGraphTypes.RenderNodeProps<NodeType>) {
|
||||
navigate(
|
||||
entityRoute({
|
||||
kind: node.kind,
|
||||
namespace: node.metadata.namespace || ENTITY_DEFAULT_NAMESPACE,
|
||||
namespace: node.metadata.namespace || DEFAULT_NAMESPACE,
|
||||
name: node.metadata.name,
|
||||
}),
|
||||
);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
UserEntity,
|
||||
} from '@backstage/catalog-model';
|
||||
@@ -35,7 +35,7 @@ export function useOwnUser(): AsyncState<UserEntity | undefined> {
|
||||
return catalogApi.getEntityByName(
|
||||
parseEntityRef(identity.userEntityRef, {
|
||||
defaultKind: 'User',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
}),
|
||||
) as Promise<UserEntity | undefined>;
|
||||
}, [catalogApi, identityApi]);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { createRouteRef } from '@backstage/core-plugin-api';
|
||||
import { getOrCreateGlobalSingleton } from '@backstage/version-bridge';
|
||||
|
||||
@@ -61,7 +61,7 @@ export function entityRouteParams(entity: Entity) {
|
||||
kind: entity.kind.toLocaleLowerCase('en-US'),
|
||||
namespace:
|
||||
entity.metadata.namespace?.toLocaleLowerCase('en-US') ??
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
name: entity.metadata.name,
|
||||
} as const;
|
||||
}
|
||||
|
||||
@@ -16,8 +16,8 @@
|
||||
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
ANNOTATION_LOCATION,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -107,7 +107,7 @@ export function AboutCard({ variant }: AboutCardProps) {
|
||||
href:
|
||||
viewTechdocLink &&
|
||||
viewTechdocLink({
|
||||
namespace: entity.metadata.namespace || ENTITY_DEFAULT_NAMESPACE,
|
||||
namespace: entity.metadata.namespace || DEFAULT_NAMESPACE,
|
||||
kind: entity.kind,
|
||||
name: entity.metadata.name,
|
||||
}),
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
RELATION_OWNED_BY,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -99,9 +99,7 @@ const headerProps = (
|
||||
entity?.metadata.title ?? paramName ?? entity?.metadata.name ?? '';
|
||||
return {
|
||||
headerTitle: `${name}${
|
||||
namespace && namespace !== ENTITY_DEFAULT_NAMESPACE
|
||||
? ` in ${namespace}`
|
||||
: ''
|
||||
namespace && namespace !== DEFAULT_NAMESPACE ? ` in ${namespace}` : ''
|
||||
}`,
|
||||
headerType: (() => {
|
||||
let t = kind.toLocaleLowerCase('en-US');
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
RELATION_OWNED_BY,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -90,9 +90,7 @@ const headerProps = (
|
||||
): { headerTitle: string; headerType: string } => {
|
||||
return {
|
||||
headerTitle: `${name}${
|
||||
namespace && namespace !== ENTITY_DEFAULT_NAMESPACE
|
||||
? ` in ${namespace}`
|
||||
: ''
|
||||
namespace && namespace !== DEFAULT_NAMESPACE ? ` in ${namespace}` : ''
|
||||
}`,
|
||||
headerType: (() => {
|
||||
let t = kind.toLocaleLowerCase('en-US');
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
import { ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import {
|
||||
AsyncEntityProvider,
|
||||
useEntity,
|
||||
@@ -61,7 +61,7 @@ const OldEntityRouteRedirect = () => {
|
||||
const { optionalNamespaceAndName, '*': rest } = useParams() as any;
|
||||
const [name, namespace] = optionalNamespaceAndName.split(':').reverse();
|
||||
const namespaceLower =
|
||||
namespace?.toLocaleLowerCase('en-US') ?? ENTITY_DEFAULT_NAMESPACE;
|
||||
namespace?.toLocaleLowerCase('en-US') ?? DEFAULT_NAMESPACE;
|
||||
const restWithSlash = rest ? `/${rest}` : '';
|
||||
return (
|
||||
<Navigate
|
||||
|
||||
@@ -20,7 +20,7 @@ import {
|
||||
RELATION_PROVIDES_API,
|
||||
RELATION_PART_OF,
|
||||
stringifyEntityRef,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import {
|
||||
@@ -92,7 +92,7 @@ function readableEntityName(
|
||||
): string {
|
||||
return stringifyEntityRef(ref)
|
||||
.toLocaleLowerCase('en-US')
|
||||
.replace(`:${ENTITY_DEFAULT_NAMESPACE}/`, ':')
|
||||
.replace(`:${DEFAULT_NAMESPACE}/`, ':')
|
||||
.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ export function SystemDiagramCard() {
|
||||
'spec.system': [
|
||||
currentSystemName,
|
||||
`${
|
||||
entity.metadata.namespace || ENTITY_DEFAULT_NAMESPACE
|
||||
entity.metadata.namespace || DEFAULT_NAMESPACE
|
||||
}/${currentSystemName}`,
|
||||
],
|
||||
},
|
||||
|
||||
@@ -26,10 +26,7 @@ import { MapLoadingToProps, useLoading } from './useLoading';
|
||||
import { Group, Maybe } from '../types';
|
||||
import { DefaultLoadingAction } from '../utils/loading';
|
||||
import { useApi, identityApiRef } from '@backstage/core-plugin-api';
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';
|
||||
|
||||
type GroupsProviderLoadingProps = {
|
||||
dispatchLoadingGroups: (isLoading: boolean) => void;
|
||||
@@ -66,7 +63,7 @@ export const GroupsProvider = ({ children }: PropsWithChildren<{}>) => {
|
||||
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
||||
const { name: userId } = parseEntityRef(userEntityRef, {
|
||||
defaultKind: 'User',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
});
|
||||
const g = await client.getUserGroups(userId);
|
||||
setGroups(g);
|
||||
|
||||
@@ -27,10 +27,7 @@ import {
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { Progress, Link } from '@backstage/core-components';
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';
|
||||
|
||||
export const IncidentActionsMenu = ({
|
||||
incident,
|
||||
@@ -71,7 +68,7 @@ export const IncidentActionsMenu = ({
|
||||
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
||||
const { name: userName } = parseEntityRef(userEntityRef, {
|
||||
defaultKind: 'User',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
});
|
||||
const newIncident = await ilertApi.acceptIncident(incident, userName);
|
||||
alertApi.post({ message: 'Incident accepted.' });
|
||||
@@ -91,7 +88,7 @@ export const IncidentActionsMenu = ({
|
||||
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
||||
const { name: userName } = parseEntityRef(userEntityRef, {
|
||||
defaultKind: 'User',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
});
|
||||
const newIncident = await ilertApi.resolveIncident(incident, userName);
|
||||
alertApi.post({ message: 'Incident resolved.' });
|
||||
|
||||
@@ -14,10 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import React from 'react';
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import Alert from '@material-ui/lab/Alert';
|
||||
import Button from '@material-ui/core/Button';
|
||||
@@ -108,7 +105,7 @@ export const IncidentNewModal = ({
|
||||
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
||||
const { name: userName } = parseEntityRef(userEntityRef, {
|
||||
defaultKind: 'User',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
});
|
||||
await ilertApi.createIncident({
|
||||
integrationKey,
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
GroupEntity,
|
||||
UserEntity,
|
||||
stringifyEntityRef,
|
||||
@@ -124,7 +124,7 @@ export const MembersListCard = (_props: {
|
||||
|
||||
const displayName = profile?.displayName ?? groupName;
|
||||
|
||||
const groupNamespace = grpNamespace || ENTITY_DEFAULT_NAMESPACE;
|
||||
const groupNamespace = grpNamespace || DEFAULT_NAMESPACE;
|
||||
|
||||
const [page, setPage] = React.useState(1);
|
||||
const pageChange = (_: React.ChangeEvent<unknown>, pageIndex: number) => {
|
||||
|
||||
@@ -34,10 +34,7 @@ import {
|
||||
alertApiRef,
|
||||
identityApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import {
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
parseEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { DEFAULT_NAMESPACE, parseEntityRef } from '@backstage/catalog-model';
|
||||
|
||||
type Props = {
|
||||
showDialog: boolean;
|
||||
@@ -61,7 +58,7 @@ export const TriggerDialog = ({
|
||||
const { userEntityRef } = await identityApi.getBackstageIdentity();
|
||||
const { name: userName } = parseEntityRef(userEntityRef, {
|
||||
defaultKind: 'User',
|
||||
defaultNamespace: ENTITY_DEFAULT_NAMESPACE,
|
||||
defaultNamespace: DEFAULT_NAMESPACE,
|
||||
});
|
||||
await api.triggerAlarm({
|
||||
integrationKey: integrationKey as string,
|
||||
|
||||
@@ -20,7 +20,7 @@ import useAsync from 'react-use/lib/useAsync';
|
||||
import { catalogApiRef } from '@backstage/plugin-catalog-react';
|
||||
|
||||
import { Filters, FiltersButton, FiltersState } from './Filters';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
|
||||
import {
|
||||
EmptyState,
|
||||
@@ -156,7 +156,7 @@ export const SearchResult = ({ searchQuery }: SearchResultProps) => {
|
||||
: undefined,
|
||||
url: `/catalog/${
|
||||
entity.metadata.namespace?.toLocaleLowerCase('en-US') ||
|
||||
ENTITY_DEFAULT_NAMESPACE
|
||||
DEFAULT_NAMESPACE
|
||||
}/${entity.kind.toLocaleLowerCase('en-US')}/${entity.metadata.name}`,
|
||||
}));
|
||||
}, []);
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
import {
|
||||
Entity,
|
||||
ENTITY_DEFAULT_NAMESPACE,
|
||||
DEFAULT_NAMESPACE,
|
||||
stringifyEntityRef,
|
||||
} from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
@@ -111,8 +111,7 @@ export class DocsBuilder {
|
||||
try {
|
||||
storedEtag = (
|
||||
await this.publisher.fetchTechDocsMetadata({
|
||||
namespace:
|
||||
this.entity.metadata.namespace ?? ENTITY_DEFAULT_NAMESPACE,
|
||||
namespace: this.entity.metadata.namespace ?? DEFAULT_NAMESPACE,
|
||||
kind: this.entity.kind,
|
||||
name: this.entity.metadata.name,
|
||||
})
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
import { PluginEndpointDiscovery } from '@backstage/backend-common';
|
||||
import { Entity, ENTITY_DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Entity, DEFAULT_NAMESPACE } from '@backstage/catalog-model';
|
||||
import { Config } from '@backstage/config';
|
||||
import { assertError, NotFoundError } from '@backstage/errors';
|
||||
import { ScmIntegrationRegistry } from '@backstage/integration';
|
||||
@@ -177,7 +177,7 @@ export class DocsSynchronizer {
|
||||
|
||||
// Fetch techdocs_metadata.json from the publisher and from cache.
|
||||
const baseUrl = await discovery.getBaseUrl('techdocs');
|
||||
const namespace = entity.metadata?.namespace || ENTITY_DEFAULT_NAMESPACE;
|
||||
const namespace = entity.metadata?.namespace || DEFAULT_NAMESPACE;
|
||||
const kind = entity.kind;
|
||||
const name = entity.metadata.name;
|
||||
const legacyPathCasing =
|
||||
|
||||
Reference in New Issue
Block a user