Skip to content

Commit

Permalink
Merge pull request backstage#10058 from backstage/blam/scaffolder-fro…
Browse files Browse the repository at this point in the history
…ntend-removals

🧹 some final removals for scaffolder plugin and cleanup `api-report`
  • Loading branch information
benjdlambert committed Mar 8, 2022
2 parents 0b22233 + a610a4e commit 96a9541
Show file tree
Hide file tree
Showing 15 changed files with 200 additions and 150 deletions.
13 changes: 13 additions & 0 deletions .changeset/nine-frogs-yell.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
'@backstage/plugin-scaffolder': minor
---

Removed the following previously deprecated exports:

- **BREAKING**: Removed the deprecated `TemplateList` component and the `TemplateListProps` type. Please use the `TemplateCard` to create your own list component instead to render these lists.

- **BREAKING**: Removed the deprecated `setSecret` method, please use `setSecrets` instead.

- **BREAKING**: Removed the deprecated `TemplateCardComponent` and `TaskPageComponent` props from the `ScaffolderPage` component. These are now provided using the `components` prop with the shape `{{ TemplateCardComponent: () => JSX.Element, TaskPageComponent: () => JSX.Element }}`

- **BREAKING**: Removed `JobStatus` as this type was actually a legacy type used in `v1alpha` templates and the workflow engine and should no longer be used or depended on.
137 changes: 25 additions & 112 deletions plugins/scaffolder/api-report.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,19 @@ export type CustomFieldValidator<TFieldReturnValue> = (
},
) => void;

// Warning: (ae-missing-release-tag) "EntityNamePickerFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const EntityNamePickerFieldExtension: FieldExtensionComponent<
string,
{}
>;

// Warning: (ae-missing-release-tag) "EntityPickerFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const EntityPickerFieldExtension: FieldExtensionComponent<
string,
EntityPickerUiOptions
>;

// Warning: (ae-missing-release-tag) "EntityPickerUiOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface EntityPickerUiOptions {
// (undocumented)
allowArbitraryValues?: boolean;
Expand All @@ -77,9 +71,7 @@ export const EntityTagsPickerFieldExtension: FieldExtensionComponent<
EntityTagsPickerUiOptions
>;

// Warning: (ae-missing-release-tag) "EntityTagsPickerUiOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface EntityTagsPickerUiOptions {
// (undocumented)
kinds?: string[];
Expand Down Expand Up @@ -111,14 +103,7 @@ export type FieldExtensionOptions<
validation?: CustomFieldValidator<TFieldReturnValue>;
};

// Warning: (ae-missing-release-tag) "JobStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type JobStatus = 'PENDING' | 'STARTED' | 'COMPLETED' | 'FAILED';

// Warning: (ae-missing-release-tag) "ListActionsResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type ListActionsResponse = Array<{
id: string;
description?: string;
Expand All @@ -128,9 +113,7 @@ export type ListActionsResponse = Array<{
};
}>;

// Warning: (ae-missing-release-tag) "LogEvent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type LogEvent = {
type: 'log' | 'completion';
body: {
Expand All @@ -143,43 +126,33 @@ export type LogEvent = {
taskId: string;
};

// Warning: (ae-missing-release-tag) "OwnedEntityPickerFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const OwnedEntityPickerFieldExtension: FieldExtensionComponent<
string,
OwnedEntityPickerUiOptions
>;

// Warning: (ae-missing-release-tag) "OwnedEntityPickerUiOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface OwnedEntityPickerUiOptions {
// (undocumented)
allowedKinds?: string[];
// (undocumented)
defaultKind?: string;
}

// Warning: (ae-missing-release-tag) "OwnerPickerFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const OwnerPickerFieldExtension: FieldExtensionComponent<
string,
OwnerPickerUiOptions
>;

// Warning: (ae-missing-release-tag) "OwnerPickerUiOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface OwnerPickerUiOptions {
// (undocumented)
allowedKinds?: string[];
}

// Warning: (ae-missing-release-tag) "repoPickerValidation" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const repoPickerValidation: (
value: string,
validation: FieldValidation,
Expand All @@ -188,17 +161,13 @@ export const repoPickerValidation: (
},
) => void;

// Warning: (ae-missing-release-tag) "RepoUrlPickerFieldExtension" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const RepoUrlPickerFieldExtension: FieldExtensionComponent<
string,
RepoUrlPickerUiOptions
>;

// Warning: (ae-missing-release-tag) "RepoUrlPickerUiOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface RepoUrlPickerUiOptions {
// (undocumented)
allowedHosts?: string[];
Expand All @@ -216,16 +185,8 @@ export interface RepoUrlPickerUiOptions {
};
}

// Warning: (ae-missing-release-tag) "RouterProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type RouterProps = {
TemplateCardComponent?:
| ComponentType<{
template: TemplateEntityV1beta3;
}>
| undefined;
TaskPageComponent?: ComponentType<{}>;
components?: {
TemplateCardComponent?:
| ComponentType<{
Expand Down Expand Up @@ -294,17 +255,13 @@ export class ScaffolderClient implements ScaffolderApi {
// @public
export const ScaffolderFieldExtensions: React_2.ComponentType;

// Warning: (ae-missing-release-tag) "ScaffolderGetIntegrationsListOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface ScaffolderGetIntegrationsListOptions {
// (undocumented)
allowedHosts: string[];
}

// Warning: (ae-missing-release-tag) "ScaffolderGetIntegrationsListResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface ScaffolderGetIntegrationsListResponse {
// (undocumented)
integrations: {
Expand All @@ -322,14 +279,10 @@ export type ScaffolderOutputLink = {
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)
// @public
export const ScaffolderPage: (props: RouterProps) => JSX.Element;

// Warning: (ae-missing-release-tag) "scaffolderPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const scaffolderPlugin: BackstagePlugin<
{
root: RouteRef<undefined>;
Expand All @@ -339,9 +292,7 @@ export const scaffolderPlugin: BackstagePlugin<
}
>;

// Warning: (ae-missing-release-tag) "ScaffolderScaffoldOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface ScaffolderScaffoldOptions {
// (undocumented)
secrets?: Record<string, string>;
Expand All @@ -351,27 +302,21 @@ export interface ScaffolderScaffoldOptions {
values: Record<string, JsonValue>;
}

// Warning: (ae-missing-release-tag) "ScaffolderScaffoldResponse" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface ScaffolderScaffoldResponse {
// (undocumented)
taskId: string;
}

// Warning: (ae-missing-release-tag) "ScaffolderStreamLogsOptions" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface ScaffolderStreamLogsOptions {
// (undocumented)
after?: number;
// (undocumented)
taskId: string;
}

// Warning: (ae-missing-release-tag) "ScaffolderTask" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type ScaffolderTask = {
id: string;
spec: TaskSpec;
Expand All @@ -387,9 +332,7 @@ export type ScaffolderTaskOutput = {
[key: string]: unknown;
};

// Warning: (ae-missing-release-tag) "ScaffolderTaskStatus" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type ScaffolderTaskStatus =
| 'open'
| 'processing'
Expand All @@ -399,8 +342,6 @@ export type ScaffolderTaskStatus =

// @public
export interface ScaffolderUseTemplateSecrets {
// @deprecated (undocumented)
setSecret: (input: Record<string, string>) => void;
// (undocumented)
setSecrets: (input: Record<string, string>) => void;
}
Expand All @@ -413,33 +354,7 @@ export type TaskPageProps = {
loadingText?: string;
};

// Warning: (ae-missing-release-tag) "TemplateList" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export const TemplateList: ({
TemplateCardComponent,
group,
}: TemplateListProps) => JSX.Element | null;

// Warning: (ae-missing-release-tag) "TemplateListProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
export type TemplateListProps = {
TemplateCardComponent?:
| ComponentType<{
template: TemplateEntityV1beta3;
}>
| undefined;
group?: {
title?: React_2.ReactNode;
titleComponent?: React_2.ReactNode;
filter: (entity: Entity) => boolean;
};
};

// Warning: (ae-missing-release-tag) "TemplateParameterSchema" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type TemplateParameterSchema = {
title: string;
steps: Array<{
Expand All @@ -448,9 +363,7 @@ export type TemplateParameterSchema = {
}>;
};

// Warning: (ae-missing-release-tag) "TemplateTypePicker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const TemplateTypePicker: () => JSX.Element | null;

// @public
Expand Down
37 changes: 12 additions & 25 deletions plugins/scaffolder/src/components/Router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,14 +32,11 @@ import {
} from '../extensions';
import { useElementFilter } from '@backstage/core-plugin-api';

/**
* The props for the entrypoint `ScaffolderPage` component the plugin.
* @public
*/
export type RouterProps = {
/** @deprecated use components.TemplateCardComponent instead */
TemplateCardComponent?:
| ComponentType<{ template: TemplateEntityV1beta3 }>
| undefined;
/** @deprecated use component.TaskPageComponent instead */
TaskPageComponent?: ComponentType<{}>;

components?: {
TemplateCardComponent?:
| ComponentType<{ template: TemplateEntityV1beta3 }>
Expand All @@ -53,26 +50,18 @@ export type RouterProps = {
}>;
};

/**
* The main entrypoint `Router` for the `ScaffolderPlugin`.
*
* @public
*/
export const Router = (props: RouterProps) => {
const {
TemplateCardComponent: legacyTemplateCardComponent,
TaskPageComponent: legacyTaskPageComponent,
groups,
components = {},
} = props;

if (legacyTemplateCardComponent || legacyTaskPageComponent) {
// eslint-disable-next-line no-console
console.warn(
"DEPRECATION: 'TemplateCardComponent' and 'TaskPageComponent' are deprecated when calling the 'ScaffolderPage'. Use 'components' prop to pass these component overrides instead.",
);
}
const { groups, components = {} } = props;

const { TemplateCardComponent, TaskPageComponent } = components;

const outlet = useOutlet();
const TaskPageElement =
TaskPageComponent ?? legacyTaskPageComponent ?? TaskPage;
const TaskPageElement = TaskPageComponent ?? TaskPage;

const customFieldExtensions = useElementFilter(outlet, elements =>
elements
Expand Down Expand Up @@ -101,9 +90,7 @@ export const Router = (props: RouterProps) => {
element={
<ScaffolderPage
groups={groups}
TemplateCardComponent={
TemplateCardComponent ?? legacyTemplateCardComponent
}
TemplateCardComponent={TemplateCardComponent}
/>
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ import { alertApiRef, useApi } from '@backstage/core-plugin-api';
const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
const checkedIcon = <CheckBoxIcon fontSize="small" />;

/**
* The component to select the `type` of `Template` that you will see in the table.
*
* @public
*/
export const TemplateTypePicker = () => {
const alertApi = useApi(alertApiRef);
const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =
Expand Down
Loading

0 comments on commit 96a9541

Please sign in to comment.