remove old ScaffolderTaskOutput link outputs
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-scaffolder': minor
|
||||
---
|
||||
|
||||
**BREAKING**: Removed `ScaffolderTaskOutput.entityRef` and `ScaffolderTaskOutput.remoteUrl`, which both have been deprecated for over a year. Please use the `links` output instead.
|
||||
@@ -314,6 +314,14 @@ export interface ScaffolderGetIntegrationsListResponse {
|
||||
}[];
|
||||
}
|
||||
|
||||
// @public (undocumented)
|
||||
export type ScaffolderOutputLink = {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
url?: string;
|
||||
entityRef?: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ScaffolderPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
@@ -372,12 +380,8 @@ export type ScaffolderTask = {
|
||||
createdAt: string;
|
||||
};
|
||||
|
||||
// Warning: (ae-missing-release-tag) "ScaffolderTaskOutput" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
|
||||
//
|
||||
// @public (undocumented)
|
||||
export type ScaffolderTaskOutput = {
|
||||
entityRef?: string;
|
||||
remoteUrl?: string;
|
||||
links?: ScaffolderOutputLink[];
|
||||
} & {
|
||||
[key: string]: unknown;
|
||||
@@ -451,8 +455,4 @@ export const TemplateTypePicker: () => JSX.Element | null;
|
||||
|
||||
// @public
|
||||
export const useTemplateSecrets: () => ScaffolderUseTemplateSecrets;
|
||||
|
||||
// Warnings were encountered during analysis:
|
||||
//
|
||||
// src/types.d.ts:32:5 - (ae-forgotten-export) The symbol "ScaffolderOutputLink" needs to be exported by the entry point index.d.ts
|
||||
```
|
||||
|
||||
@@ -217,12 +217,8 @@ export const TaskStatusStepper = memo(
|
||||
},
|
||||
);
|
||||
|
||||
const hasLinks = ({
|
||||
entityRef,
|
||||
remoteUrl,
|
||||
links = [],
|
||||
}: ScaffolderTaskOutput): boolean =>
|
||||
!!(entityRef || remoteUrl || links.length > 0);
|
||||
const hasLinks = ({ links = [] }: ScaffolderTaskOutput): boolean =>
|
||||
links.length > 0;
|
||||
|
||||
/**
|
||||
* TaskPageProps for constructing a TaskPage
|
||||
|
||||
@@ -26,43 +26,6 @@ describe('TaskPageLinks', () => {
|
||||
jest.resetAllMocks();
|
||||
});
|
||||
|
||||
it('renders the entityRef link', async () => {
|
||||
const output = { entityRef: 'Component:default/my-app' };
|
||||
const { findByText } = await renderInTestApp(
|
||||
<TaskPageLinks output={output} />,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/catalog/:namespace/:kind/:name/*': entityRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const element = await findByText('Open in catalog');
|
||||
|
||||
expect(element).toBeInTheDocument();
|
||||
expect(element).toHaveAttribute(
|
||||
'href',
|
||||
'/catalog/default/Component/my-app',
|
||||
);
|
||||
});
|
||||
|
||||
it('renders the remoteUrl link', async () => {
|
||||
const output = { remoteUrl: 'https://remote.url' };
|
||||
const { findByText } = await renderInTestApp(
|
||||
<TaskPageLinks output={output} />,
|
||||
{
|
||||
mountedRoutes: {
|
||||
'/catalog/:namespace/:kind/:name/*': entityRouteRef,
|
||||
},
|
||||
},
|
||||
);
|
||||
|
||||
const element = await findByText('Repo');
|
||||
|
||||
expect(element).toBeInTheDocument();
|
||||
expect(element).toHaveAttribute('href', 'https://remote.url');
|
||||
});
|
||||
|
||||
it('renders further links', async () => {
|
||||
const output = {
|
||||
links: [
|
||||
|
||||
@@ -28,29 +28,13 @@ type TaskPageLinksProps = {
|
||||
};
|
||||
|
||||
export const TaskPageLinks = ({ output }: TaskPageLinksProps) => {
|
||||
const { entityRef: entityRefOutput, remoteUrl } = output;
|
||||
let { links = [] } = output;
|
||||
const { links = [] } = output;
|
||||
const app = useApp();
|
||||
const entityRoute = useRouteRef(entityRouteRef);
|
||||
|
||||
const iconResolver = (key?: string): IconComponent =>
|
||||
key ? app.getSystemIcon(key) ?? LanguageIcon : LanguageIcon;
|
||||
|
||||
if (remoteUrl) {
|
||||
links = [{ url: remoteUrl, title: 'Repo' }, ...links];
|
||||
}
|
||||
|
||||
if (entityRefOutput) {
|
||||
links = [
|
||||
{
|
||||
entityRef: entityRefOutput,
|
||||
title: 'Open in catalog',
|
||||
icon: 'catalog',
|
||||
},
|
||||
...links,
|
||||
];
|
||||
}
|
||||
|
||||
return (
|
||||
<Box px={3} pb={3}>
|
||||
{links
|
||||
|
||||
@@ -28,6 +28,7 @@ export type {
|
||||
ScaffolderApi,
|
||||
ScaffolderGetIntegrationsListOptions,
|
||||
ScaffolderGetIntegrationsListResponse,
|
||||
ScaffolderOutputLink,
|
||||
ScaffolderScaffoldOptions,
|
||||
ScaffolderScaffoldResponse,
|
||||
ScaffolderStreamLogsOptions,
|
||||
|
||||
@@ -43,18 +43,16 @@ export type ListActionsResponse = Array<{
|
||||
};
|
||||
}>;
|
||||
|
||||
type ScaffolderOutputLink = {
|
||||
/** @public */
|
||||
export type ScaffolderOutputLink = {
|
||||
title?: string;
|
||||
icon?: string;
|
||||
url?: string;
|
||||
entityRef?: string;
|
||||
};
|
||||
|
||||
/** @public */
|
||||
export type ScaffolderTaskOutput = {
|
||||
/** @deprecated use the `links` property to link out to relevant resources */
|
||||
entityRef?: string;
|
||||
/** @deprecated use the `links` property to link out to relevant resources */
|
||||
remoteUrl?: string;
|
||||
links?: ScaffolderOutputLink[];
|
||||
} & {
|
||||
[key: string]: unknown;
|
||||
|
||||
Reference in New Issue
Block a user