From 46b84f79f83ded5c8f1b711195b5f416ef08e38a Mon Sep 17 00:00:00 2001 From: Colton Padden Date: Tue, 14 Dec 2021 14:27:41 -0500 Subject: [PATCH] release-2021-06-01 packages/core-plugin-api/src/routing/RouteRef.ts:118,120,122 Signed-off-by: Colton Padden --- .../core-plugin-api/src/routing/RouteRef.ts | 51 ++----------------- packages/core-plugin-api/src/routing/types.ts | 9 ---- packages/dev-utils/src/devApp/render.tsx | 2 +- 3 files changed, 4 insertions(+), 58 deletions(-) diff --git a/packages/core-plugin-api/src/routing/RouteRef.ts b/packages/core-plugin-api/src/routing/RouteRef.ts index 37d79f3b83..abb05c54c5 100644 --- a/packages/core-plugin-api/src/routing/RouteRef.ts +++ b/packages/core-plugin-api/src/routing/RouteRef.ts @@ -36,48 +36,10 @@ export class RouteRefImpl constructor( private readonly id: string, readonly params: ParamKeys, - private readonly config: { - /** @deprecated */ - path?: string; - /** @deprecated */ - icon?: OldIconComponent; - /** @deprecated */ - title?: string; - }, - ) { - if (config.path) { - // eslint-disable-next-line no-console - console.warn( - `DEPRECATION WARNING: Passing a path to createRouteRef is deprecated, please remove the path for ${this}.`, - ); - } - - if (config.icon) { - // eslint-disable-next-line no-console - console.warn( - `DEPRECATION WARNING: Passing an icon to createRouteRef is deprecated, please remove the icon for ${this}.`, - ); - } - - if (config.title) { - // eslint-disable-next-line no-console - console.warn( - `DEPRECATION WARNING: Passing a title to createRouteRef is deprecated, please remove the title for ${this}.`, - ); - } - } - - /** @deprecated use `useRouteRef` instead */ - get path() { - return this.config.path ?? ''; - } - - get icon() { - return this.config.icon; - } + ) {} get title() { - return this.config.title ?? this.id; + return this.id; } toString() { @@ -104,20 +66,13 @@ export function createRouteRef< id?: string; /** A list of parameter names that the path that this route ref is bound to must contain */ params?: ParamKey[]; - /** @deprecated Route refs no longer decide their own path */ - path?: string; - /** @deprecated Route refs no longer decide their own icon */ - icon?: OldIconComponent; - /** @deprecated Route refs no longer decide their own title */ - title?: string; }): RouteRef> { - const id = config.id || config.title; + const id = config.id; if (!id) { throw new Error('RouteRef must be provided a non-empty id'); } return new RouteRefImpl( id, (config.params ?? []) as ParamKeys>, - config, ); } diff --git a/packages/core-plugin-api/src/routing/types.ts b/packages/core-plugin-api/src/routing/types.ts index 6232810e56..80653518bb 100644 --- a/packages/core-plugin-api/src/routing/types.ts +++ b/packages/core-plugin-api/src/routing/types.ts @@ -14,7 +14,6 @@ * limitations under the License. */ -import { OldIconComponent } from '../icons/types'; import { getOrCreateGlobalSingleton } from '@backstage/version-bridge'; /** @@ -85,14 +84,6 @@ export type RouteRef = { $$routeRefType: 'absolute'; // See routeRefType above params: ParamKeys; - - // TODO(Rugvip): Remove all of these once plugins don't rely on the path - /** @deprecated paths are no longer accessed directly from RouteRefs, use useRouteRef instead */ - path: string; - /** @deprecated icons are no longer accessed via RouteRefs */ - icon?: OldIconComponent; - /** @deprecated titles are no longer accessed via RouteRefs */ - title?: string; }; /** diff --git a/packages/dev-utils/src/devApp/render.tsx b/packages/dev-utils/src/devApp/render.tsx index adea9e14f2..36d6abcfd1 100644 --- a/packages/dev-utils/src/devApp/render.tsx +++ b/packages/dev-utils/src/devApp/render.tsx @@ -159,7 +159,7 @@ export class DevAppBuilder { * Build a DevApp component using the resources registered so far */ build(): ComponentType<{}> { - const dummyRouteRef = createRouteRef({ title: 'Page of another plugin' }); + const dummyRouteRef = createRouteRef({ id: 'dummy' }); const DummyPage = () => Page belonging to another plugin.; attachComponentData(DummyPage, 'core.mountPoint', dummyRouteRef);