Merge pull request #9338 from backstage/freben/ea-no-more

Bunch of random api cleanup
This commit is contained in:
Fredrik Adelöw
2022-02-07 10:45:37 +01:00
committed by GitHub
45 changed files with 670 additions and 327 deletions
+8
View File
@@ -0,0 +1,8 @@
---
'@backstage/plugin-catalog-backend-module-msgraph': patch
'@backstage/plugin-catalog-graph': patch
'@backstage/plugin-catalog-import': patch
'@backstage/plugin-catalog-react': patch
---
Minor API cleanups
@@ -33,6 +33,15 @@ export function defaultUserTransformer(
userPhoto?: string,
): Promise<UserEntity | undefined>;
// @public
export type GroupMember =
| (MicrosoftGraph.Group & {
'@odata.type': '#microsoft.graph.user';
})
| (MicrosoftGraph.User & {
'@odata.type': '#microsoft.graph.group';
});
// @public
export type GroupTransformer = (
group: MicrosoftGraph.Group,
@@ -54,7 +63,6 @@ export const MICROSOFT_GRAPH_USER_ID_ANNOTATION = 'graph.microsoft.com/user-id';
export class MicrosoftGraphClient {
constructor(baseUrl: string, pca: msal.ConfidentialClientApplication);
static create(config: MicrosoftGraphProviderConfig): MicrosoftGraphClient;
// Warning: (ae-forgotten-export) The symbol "GroupMember" needs to be exported by the entry point index.d.ts
getGroupMembers(groupId: string): AsyncIterable<GroupMember>;
// (undocumented)
getGroupPhoto(groupId: string, sizeId?: string): Promise<string | undefined>;
@@ -13,8 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { MicrosoftGraphClient } from './client';
export type { ODataQuery } from './client';
export type { GroupMember, ODataQuery } from './client';
export { readMicrosoftGraphConfig } from './config';
export type { MicrosoftGraphProviderConfig } from './config';
export {
-4
View File
@@ -95,8 +95,6 @@ export const EntityCatalogGraphCard: ({
// @public
export type EntityEdge = DependencyGraphTypes.DependencyEdge<EntityEdgeData>;
// Warning: (ae-missing-release-tag) "EntityEdgeData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type EntityEdgeData = {
relations: string[];
@@ -106,8 +104,6 @@ export type EntityEdgeData = {
// @public
export type EntityNode = DependencyGraphTypes.DependencyNode<EntityNodeData>;
// Warning: (ae-missing-release-tag) "EntityNodeData" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export type EntityNodeData = {
name: string;
@@ -13,11 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { DependencyGraphTypes } from '@backstage/core-components';
import { MouseEventHandler } from 'react';
/**
* Additional Data for entities
* Additional Data for entities.
*
* @public
*/
export type EntityEdgeData = {
/**
@@ -40,6 +43,8 @@ export type EntityEdge = DependencyGraphTypes.DependencyEdge<EntityEdgeData>;
/**
* Additional data for Entity Node
*
* @public
*/
export type EntityNodeData = {
/**
+242 -126
View File
@@ -26,9 +26,7 @@ import { UnpackNestedValue } from 'react-hook-form';
import { UseFormProps } from 'react-hook-form';
import { UseFormReturn } from 'react-hook-form';
// Warning: (ae-missing-release-tag) "AnalyzeResult" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type AnalyzeResult =
| {
type: 'locations';
@@ -45,26 +43,36 @@ export type AnalyzeResult =
generatedEntities: PartialEntity[];
};
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "AutocompleteTextField" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const AutocompleteTextField: <TFieldValue extends string>({
name,
options,
required,
errors,
rules,
loading,
loadingText,
helperText,
errorHelperText,
textFieldProps,
}: Props_5<TFieldValue>) => JSX.Element;
// @public
export const AutocompleteTextField: <TFieldValue extends string>(
props: AutocompleteTextFieldProps<TFieldValue>,
) => JSX.Element;
// Warning: (ae-missing-release-tag) "CatalogImportApi" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export interface AutocompleteTextFieldProps<TFieldValue extends string> {
// (undocumented)
errorHelperText?: string;
// (undocumented)
errors?: FieldErrors;
// (undocumented)
helperText?: React_2.ReactNode;
// (undocumented)
loading?: boolean;
// (undocumented)
loadingText?: string;
// (undocumented)
name: TFieldValue;
// (undocumented)
options: string[];
// (undocumented)
required?: boolean;
// (undocumented)
rules?: React_2.ComponentProps<typeof Controller>['rules'];
// (undocumented)
textFieldProps?: Omit<TextFieldProps, 'required' | 'fullWidth'>;
}
// @public
export interface CatalogImportApi {
// (undocumented)
analyzeUrl(url: string): Promise<AnalyzeResult>;
@@ -85,14 +93,10 @@ export interface CatalogImportApi {
}>;
}
// Warning: (ae-missing-release-tag) "catalogImportApiRef" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const catalogImportApiRef: ApiRef<CatalogImportApi>;
// Warning: (ae-missing-release-tag) "CatalogImportClient" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export class CatalogImportClient implements CatalogImportApi {
constructor(options: {
discoveryApi: DiscoveryApi;
@@ -110,12 +114,7 @@ export class CatalogImportClient implements CatalogImportApi {
body: string;
}>;
// (undocumented)
submitPullRequest({
repositoryUrl,
fileContent,
title,
body,
}: {
submitPullRequest(options: {
repositoryUrl: string;
fileContent: string;
title: string;
@@ -126,14 +125,10 @@ export class CatalogImportClient implements CatalogImportApi {
}>;
}
// Warning: (ae-missing-release-tag) "CatalogImportPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const CatalogImportPage: () => JSX.Element;
// Warning: (ae-missing-release-tag) "catalogImportPlugin" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
const catalogImportPlugin: BackstagePlugin<
{
importPage: RouteRef<undefined>;
@@ -143,9 +138,7 @@ const catalogImportPlugin: BackstagePlugin<
export { catalogImportPlugin };
export { catalogImportPlugin as plugin };
// Warning: (ae-forgotten-export) The symbol "ImportFlows" needs to be exported by the entry point index.d.ts
// Warning: (ae-forgotten-export) The symbol "StepperProvider" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "defaultGenerateStepper" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export function defaultGenerateStepper(
@@ -153,98 +146,221 @@ export function defaultGenerateStepper(
defaults: StepperProvider,
): StepperProvider;
// Warning: (ae-missing-release-tag) "DefaultImportPage" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const DefaultImportPage: () => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityListComponent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityListComponent: ({
locations,
collapsed,
locationListItemIcon,
onItemClick,
firstListItem,
withLinks,
}: Props) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "ImportInfoCard" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ImportInfoCard: ({
exampleLocationUrl,
exampleRepositoryUrl,
}: Props_2) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "ImportStepper" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const ImportStepper: ({
initialUrl,
generateStepper,
variant,
}: Props_3) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "PreparePullRequestForm" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const PreparePullRequestForm: <
export const EntityListComponent: (
props: EntityListComponentProps,
) => JSX.Element;
// @public
export interface EntityListComponentProps {
// (undocumented)
collapsed?: boolean;
// (undocumented)
firstListItem?: React_2.ReactElement;
// (undocumented)
locationListItemIcon: (target: string) => React_2.ReactElement;
// (undocumented)
locations: Array<{
target: string;
entities: (Entity | EntityName)[];
}>;
// (undocumented)
onItemClick?: (target: string) => void;
// (undocumented)
withLinks?: boolean;
}
// @public
export type ImportFlows =
| 'unknown'
| 'single-location'
| 'multiple-locations'
| 'no-location';
// @public
export const ImportInfoCard: (props: ImportInfoCardProps) => JSX.Element;
// @public
export interface ImportInfoCardProps {
// (undocumented)
exampleLocationUrl?: string;
// (undocumented)
exampleRepositoryUrl?: string;
}
// Warning: (ae-forgotten-export) The symbol "State" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "ImportState" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type ImportState = State & {
activeFlow: ImportFlows;
activeStepNumber: number;
analysisUrl?: string;
onGoBack?: () => void;
onReset: () => void;
};
// @public
export const ImportStepper: (props: ImportStepperProps) => JSX.Element;
// @public
export interface ImportStepperProps {
// (undocumented)
generateStepper?: (
flow: ImportFlows,
defaults: StepperProvider,
) => StepperProvider;
// (undocumented)
initialUrl?: string;
// (undocumented)
variant?: InfoCardVariants;
}
// @public
export const PreparePullRequestForm: <TFieldValues extends Record<string, any>>(
props: PreparePullRequestFormProps<TFieldValues>,
) => JSX.Element;
// @public
export type PreparePullRequestFormProps<
TFieldValues extends Record<string, any>,
>({
defaultValues,
onSubmit,
render,
}: Props_6<TFieldValues>) => JSX.Element;
> = Pick<UseFormProps<TFieldValues>, 'defaultValues'> & {
onSubmit: SubmitHandler<TFieldValues>;
render: (
props: Pick<
UseFormReturn<TFieldValues>,
'formState' | 'register' | 'control' | 'setValue'
> & {
values: UnpackNestedValue<TFieldValues>;
},
) => React_2.ReactNode;
};
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "PreviewCatalogInfoComponent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const PreviewCatalogInfoComponent: ({
repositoryUrl,
entities,
classes,
}: Props_7) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "PreviewPullRequestComponent" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const PreviewPullRequestComponent: ({
title,
description,
classes,
}: Props_8) => JSX.Element;
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "StepInitAnalyzeUrl" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const StepInitAnalyzeUrl: ({
onAnalysis,
analysisUrl,
disablePullRequest,
exampleLocationUrl,
}: Props_4) => JSX.Element;
export type PrepareResult =
| {
type: 'locations';
locations: Array<{
exists?: boolean;
target: string;
entities: EntityName[];
}>;
}
| {
type: 'repository';
url: string;
integrationType: string;
pullRequest: {
url: string;
};
locations: Array<{
target: string;
entities: EntityName[];
}>;
};
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "StepPrepareCreatePullRequest" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const StepPrepareCreatePullRequest: ({
analyzeResult,
onPrepare,
onGoBack,
renderFormFields,
}: Props_9) => JSX.Element;
// @public
export const PreviewCatalogInfoComponent: (
props: PreviewCatalogInfoComponentProps,
) => JSX.Element;
// @public
export interface PreviewCatalogInfoComponentProps {
// (undocumented)
classes?: {
card?: string;
cardContent?: string;
};
// (undocumented)
entities: Entity[];
// (undocumented)
repositoryUrl: string;
}
// @public
export const PreviewPullRequestComponent: (
props: PreviewPullRequestComponentProps,
) => JSX.Element;
// @public
export interface PreviewPullRequestComponentProps {
// (undocumented)
classes?: {
card?: string;
cardContent?: string;
};
// (undocumented)
description: string;
// (undocumented)
title: string;
}
// @public
export const StepInitAnalyzeUrl: (
props: StepInitAnalyzeUrlProps,
) => JSX.Element;
// @public
export interface StepInitAnalyzeUrlProps {
// (undocumented)
analysisUrl?: string;
// (undocumented)
disablePullRequest?: boolean;
// (undocumented)
exampleLocationUrl?: string;
// (undocumented)
onAnalysis: (
flow: ImportFlows,
url: string,
result: AnalyzeResult,
opts?: {
prepareResult?: PrepareResult;
},
) => void;
}
// @public
export const StepPrepareCreatePullRequest: (
props: StepPrepareCreatePullRequestProps,
) => JSX.Element;
// @public
export interface StepPrepareCreatePullRequestProps {
// (undocumented)
analyzeResult: Extract<
AnalyzeResult,
{
type: 'repository';
}
>;
// (undocumented)
onGoBack?: () => void;
// (undocumented)
onPrepare: (
result: PrepareResult,
opts?: {
notRepeatable?: boolean;
},
) => void;
// Warning: (ae-forgotten-export) The symbol "FormData" needs to be exported by the entry point index.d.ts
//
// (undocumented)
renderFormFields: (
props: Pick<
UseFormReturn<FormData_2>,
'register' | 'setValue' | 'formState'
> & {
values: UnpackNestedValue<FormData_2>;
groups: string[];
groupsLoading: boolean;
},
) => React_2.ReactNode;
}
// Warnings were encountered during analysis:
//
// src/api/CatalogImportApi.d.ts:15:5 - (ae-forgotten-export) The symbol "PartialEntity" needs to be exported by the entry point index.d.ts
// src/api/CatalogImportApi.d.ts:25:5 - (ae-forgotten-export) The symbol "PartialEntity" needs to be exported by the entry point index.d.ts
```
@@ -18,11 +18,20 @@ import { EntityName } from '@backstage/catalog-model';
import { createApiRef } from '@backstage/core-plugin-api';
import { PartialEntity } from '../types';
/**
* Utility API reference for the {@link CatalogImportApi}.
*
* @public
*/
export const catalogImportApiRef = createApiRef<CatalogImportApi>({
id: 'plugin.catalog-import.service',
});
// result of the analyze state
/**
* Result of the analysis.
*
* @public
*/
export type AnalyzeResult =
| {
type: 'locations';
@@ -39,6 +48,11 @@ export type AnalyzeResult =
generatedEntities: PartialEntity[];
};
/**
* API for driving catalog imports.
*
* @public
*/
export interface CatalogImportApi {
analyzeUrl(url: string): Promise<AnalyzeResult>;
@@ -46,6 +60,7 @@ export interface CatalogImportApi {
title: string;
body: string;
}>;
submitPullRequest(options: {
repositoryUrl: string;
fileContent: string;
@@ -34,6 +34,11 @@ import { getGithubIntegrationConfig } from './GitHub';
import { trimEnd } from 'lodash';
import { getBranchName, getCatalogFilename } from '../components/helpers';
/**
* The default implementation of the {@link CatalogImportApi}.
*
* @public
*/
export class CatalogImportClient implements CatalogImportApi {
private readonly discoveryApi: DiscoveryApi;
private readonly identityApi: IdentityApi;
@@ -142,17 +147,14 @@ the component will become available.\n\nFor more information, read an \
};
}
async submitPullRequest({
repositoryUrl,
fileContent,
title,
body,
}: {
async submitPullRequest(options: {
repositoryUrl: string;
fileContent: string;
title: string;
body: string;
}): Promise<{ link: string; location: string }> {
const { repositoryUrl, fileContent, title, body } = options;
const ghConfig = getGithubIntegrationConfig(
this.scmIntegrationsApi,
repositoryUrl,
@@ -172,9 +174,7 @@ the component will become available.\n\nFor more information, read an \
}
// TODO: this could be part of the catalog api
private async generateEntityDefinitions({
repo,
}: {
private async generateEntityDefinitions(options: {
repo: string;
}): Promise<PartialEntity[]> {
const { token } = await this.identityApi.getCredentials();
@@ -187,7 +187,7 @@ the component will become available.\n\nFor more information, read an \
},
method: 'POST',
body: JSON.stringify({
location: { type: 'url', target: repo },
location: { type: 'url', target: options.repo },
}),
},
).catch(e => {
@@ -204,12 +204,7 @@ the component will become available.\n\nFor more information, read an \
}
// TODO: this response should better be part of the analyze-locations response and scm-independent / implemented per scm
private async checkGitHubForExistingCatalogInfo({
url,
owner,
repo,
githubIntegrationConfig,
}: {
private async checkGitHubForExistingCatalogInfo(options: {
url: string;
owner: string;
repo: string;
@@ -220,6 +215,8 @@ the component will become available.\n\nFor more information, read an \
entities: EntityName[];
}>
> {
const { url, owner, repo, githubIntegrationConfig } = options;
const { token } = await this.scmAuthApi.getCredentials({ url });
const octo = new Octokit({
auth: token,
@@ -269,15 +266,7 @@ the component will become available.\n\nFor more information, read an \
}
// TODO: extract this function and implement for non-github
private async submitGitHubPrToRepo({
owner,
repo,
title,
body,
fileContent,
repositoryUrl,
githubIntegrationConfig,
}: {
private async submitGitHubPrToRepo(options: {
owner: string;
repo: string;
title: string;
@@ -286,6 +275,16 @@ the component will become available.\n\nFor more information, read an \
repositoryUrl: string;
githubIntegrationConfig: GitHubIntegrationConfig;
}): Promise<{ link: string; location: string }> {
const {
owner,
repo,
title,
body,
fileContent,
repositoryUrl,
githubIntegrationConfig,
} = options;
const { token } = await this.scmAuthApi.getCredentials({
url: repositoryUrl,
additionalScope: {
@@ -27,6 +27,11 @@ import React from 'react';
import { ImportInfoCard } from '../ImportInfoCard';
import { ImportStepper } from '../ImportStepper';
/**
* The default catalog import page.
*
* @public
*/
export const DefaultImportPage = () => {
const configApi = useApi(configApiRef);
const appTitle = configApi.getOptional('app.title') || 'Backstage';
@@ -47,23 +47,35 @@ function sortEntities(entities: Array<EntityName | Entity>) {
);
}
type Props = {
/**
* Props for {@link EntityListComponent}.
*
* @public
*/
export interface EntityListComponentProps {
locations: Array<{ target: string; entities: (Entity | EntityName)[] }>;
locationListItemIcon: (target: string) => React.ReactElement;
collapsed?: boolean;
firstListItem?: React.ReactElement;
onItemClick?: (target: string) => void;
withLinks?: boolean;
};
}
/**
* Shows a result list of entities.
*
* @public
*/
export const EntityListComponent = (props: EntityListComponentProps) => {
const {
locations,
collapsed = false,
locationListItemIcon,
onItemClick,
firstListItem,
withLinks = false,
} = props;
export const EntityListComponent = ({
locations,
collapsed = false,
locationListItemIcon,
onItemClick,
firstListItem,
withLinks = false,
}: Props) => {
const app = useApp();
const classes = useStyles();
@@ -15,3 +15,4 @@
*/
export { EntityListComponent } from './EntityListComponent';
export type { EntityListComponentProps } from './EntityListComponent';
@@ -21,15 +21,27 @@ import React from 'react';
import { catalogImportApiRef } from '../../api';
import { useCatalogFilename } from '../../hooks';
type Props = {
/**
* Props for {@link ImportInfoCard}.
*
* @public
*/
export interface ImportInfoCardProps {
exampleLocationUrl?: string;
exampleRepositoryUrl?: string;
};
}
/**
* Shows information about the import process.
*
* @public
*/
export const ImportInfoCard = (props: ImportInfoCardProps) => {
const {
exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',
exampleRepositoryUrl = 'https://github.com/backstage/backstage',
} = props;
export const ImportInfoCard = ({
exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',
exampleRepositoryUrl = 'https://github.com/backstage/backstage',
}: Props) => {
const configApi = useApi(configApiRef);
const appTitle = configApi.getOptional('app.title') || 'Backstage';
const catalogImportApi = useApi(catalogImportApiRef);
@@ -15,3 +15,4 @@
*/
export { ImportInfoCard } from './ImportInfoCard';
export type { ImportInfoCardProps } from './ImportInfoCard';
@@ -18,6 +18,11 @@ import React from 'react';
import { useOutlet } from 'react-router';
import { DefaultImportPage } from '../DefaultImportPage';
/**
* The whole catalog import page.
*
* @public
*/
export const ImportPage = () => {
const outlet = useOutlet();
@@ -34,20 +34,32 @@ const useStyles = makeStyles(() => ({
},
}));
type Props = {
/**
* Props for {@link ImportStepper}.
*
* @public
*/
export interface ImportStepperProps {
initialUrl?: string;
generateStepper?: (
flow: ImportFlows,
defaults: StepperProvider,
) => StepperProvider;
variant?: InfoCardVariants;
};
}
/**
* The stepper that holds the different import stages.
*
* @public
*/
export const ImportStepper = (props: ImportStepperProps) => {
const {
initialUrl,
generateStepper = defaultGenerateStepper,
variant,
} = props;
export const ImportStepper = ({
initialUrl,
generateStepper = defaultGenerateStepper,
variant,
}: Props) => {
const catalogImportApi = useApi(catalogImportApiRef);
const classes = useStyles();
const state = useImportState({ initialUrl });
@@ -42,7 +42,12 @@ export type StepConfiguration = {
content: React.ReactElement;
};
export type StepperProvider = {
/**
* Defines the details of the stepper.
*
* @public
*/
export interface StepperProvider {
analyze: (
s: Extract<ImportState, { activeState: 'analyze' }>,
opts: { apis: StepperApis },
@@ -59,7 +64,7 @@ export type StepperProvider = {
s: Extract<ImportState, { activeState: 'finish' }>,
opts: { apis: StepperApis },
) => StepConfiguration;
};
}
/**
* The default stepper generation function.
@@ -69,6 +74,7 @@ export type StepperProvider = {
*
* @param flow - the name of the active flow
* @param defaults - the default steps
* @public
*/
export function defaultGenerateStepper(
flow: ImportFlows,
@@ -15,4 +15,5 @@
*/
export { ImportStepper } from './ImportStepper';
export type { ImportStepperProps } from './ImportStepper';
export { defaultGenerateStepper } from './defaults';
@@ -27,7 +27,12 @@ type FormData = {
url: string;
};
type Props = {
/**
* Props for {@link StepInitAnalyzeUrl}.
*
* @public
*/
export interface StepInitAnalyzeUrlProps {
onAnalysis: (
flow: ImportFlows,
url: string,
@@ -37,7 +42,7 @@ type Props = {
disablePullRequest?: boolean;
analysisUrl?: string;
exampleLocationUrl?: string;
};
}
/**
* A form that lets the user input a url and analyze it for existing locations or potential entities.
@@ -45,13 +50,16 @@ type Props = {
* @param onAnalysis - is called when the analysis was successful
* @param analysisUrl - a url that can be used as a default value
* @param disablePullRequest - if true, repositories without entities will abort the wizard
* @public
*/
export const StepInitAnalyzeUrl = ({
onAnalysis,
analysisUrl = '',
disablePullRequest = false,
exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',
}: Props) => {
export const StepInitAnalyzeUrl = (props: StepInitAnalyzeUrlProps) => {
const {
onAnalysis,
analysisUrl = '',
disablePullRequest = false,
exampleLocationUrl = 'https://github.com/backstage/backstage/blob/master/catalog-info.yaml',
} = props;
const errorApi = useApi(errorApiRef);
const catalogImportApi = useApi(catalogImportApiRef);
@@ -15,3 +15,4 @@
*/
export { StepInitAnalyzeUrl } from './StepInitAnalyzeUrl';
export type { StepInitAnalyzeUrlProps } from './StepInitAnalyzeUrl';
@@ -20,7 +20,12 @@ import { Autocomplete } from '@material-ui/lab';
import React from 'react';
import { Controller, FieldErrors } from 'react-hook-form';
type Props<TFieldValue extends string> = {
/**
* Props for {@link AutocompleteTextField}.
*
* @public
*/
export interface AutocompleteTextFieldProps<TFieldValue extends string> {
name: TFieldValue;
options: string[];
required?: boolean;
@@ -35,20 +40,29 @@ type Props<TFieldValue extends string> = {
errorHelperText?: string;
textFieldProps?: Omit<TextFieldProps, 'required' | 'fullWidth'>;
};
}
/**
* An autocompletion text field for the catalog import flows.
*
* @public
*/
export const AutocompleteTextField = <TFieldValue extends string>(
props: AutocompleteTextFieldProps<TFieldValue>,
) => {
const {
name,
options,
required,
errors,
rules,
loading = false,
loadingText,
helperText,
errorHelperText,
textFieldProps = {},
} = props;
export const AutocompleteTextField = <TFieldValue extends string>({
name,
options,
required,
errors,
rules,
loading = false,
loadingText,
helperText,
errorHelperText,
textFieldProps = {},
}: Props<TFieldValue>) => {
return (
<Controller
name={name}
@@ -24,10 +24,14 @@ import {
UseFormReturn,
} from 'react-hook-form';
type Props<TFieldValues extends Record<string, any>> = Pick<
UseFormProps<TFieldValues>,
'defaultValues'
> & {
/**
* Props for {@link PreparePullRequestForm}.
*
* @public
*/
export type PreparePullRequestFormProps<
TFieldValues extends Record<string, any>,
> = Pick<UseFormProps<TFieldValues>, 'defaultValues'> & {
onSubmit: SubmitHandler<TFieldValues>;
render: (
@@ -48,14 +52,15 @@ type Props<TFieldValues extends Record<string, any>> = Pick<
* @param onSubmit - a callback that is executed when the form is submitted
* (initiated by a button of type="submit")
* @param render - render the form elements
* @public
*/
export const PreparePullRequestForm = <
TFieldValues extends Record<string, any>,
>({
defaultValues,
onSubmit,
render,
}: Props<TFieldValues>) => {
>(
props: PreparePullRequestFormProps<TFieldValues>,
) => {
const { defaultValues, onSubmit, render } = props;
const methods = useForm<TFieldValues>({ mode: 'onTouched', defaultValues });
const { handleSubmit, watch, control, register, formState, setValue } =
methods;
@@ -22,17 +22,26 @@ import { CodeSnippet } from '@backstage/core-components';
import { trimEnd } from 'lodash';
import { useCatalogFilename } from '../../hooks';
type Props = {
/**
* Props for {@link PreviewCatalogInfoComponent}.
*
* @public
*/
export interface PreviewCatalogInfoComponentProps {
repositoryUrl: string;
entities: Entity[];
classes?: { card?: string; cardContent?: string };
};
}
export const PreviewCatalogInfoComponent = ({
repositoryUrl,
entities,
classes,
}: Props) => {
/**
* Previews information about an entity to create.
*
* @public
*/
export const PreviewCatalogInfoComponent = (
props: PreviewCatalogInfoComponentProps,
) => {
const { repositoryUrl, entities, classes } = props;
const catalogFilename = useCatalogFilename();
return (
@@ -18,17 +18,26 @@ import { Card, CardContent, CardHeader } from '@material-ui/core';
import React from 'react';
import { MarkdownContent } from '@backstage/core-components';
type Props = {
/**
* Props for {@link PreviewPullRequestComponent}.
*
* @public
*/
export interface PreviewPullRequestComponentProps {
title: string;
description: string;
classes?: { card?: string; cardContent?: string };
};
}
export const PreviewPullRequestComponent = ({
title,
description,
classes,
}: Props) => {
/**
* Previews a pull request.
*
* @public
*/
export const PreviewPullRequestComponent = (
props: PreviewPullRequestComponentProps,
) => {
const { title, description, classes } = props;
return (
<Card variant="outlined" className={classes?.card}>
<CardHeader title={title} subheader="Create a new Pull Request" />
@@ -53,7 +53,12 @@ type FormData = {
useCodeowners: boolean;
};
type Props = {
/**
* Props for {@link StepPrepareCreatePullRequest}.
*
* @public
*/
export interface StepPrepareCreatePullRequestProps {
analyzeResult: Extract<AnalyzeResult, { type: 'repository' }>;
onPrepare: (
result: PrepareResult,
@@ -71,7 +76,7 @@ type Props = {
groupsLoading: boolean;
},
) => React.ReactNode;
};
}
export function generateEntities(
entities: PartialEntity[],
@@ -93,12 +98,16 @@ export function generateEntities(
}));
}
export const StepPrepareCreatePullRequest = ({
analyzeResult,
onPrepare,
onGoBack,
renderFormFields,
}: Props) => {
/**
* Prepares a pull request.
*
* @public
*/
export const StepPrepareCreatePullRequest = (
props: StepPrepareCreatePullRequestProps,
) => {
const { analyzeResult, onPrepare, onGoBack, renderFormFields } = props;
const classes = useStyles();
const catalogApi = useApi(catalogApiRef);
const catalogImportApi = useApi(catalogImportApiRef);
@@ -15,7 +15,12 @@
*/
export { AutocompleteTextField } from './AutocompleteTextField';
export type { AutocompleteTextFieldProps } from './AutocompleteTextField';
export { PreparePullRequestForm } from './PreparePullRequestForm';
export type { PreparePullRequestFormProps } from './PreparePullRequestForm';
export { PreviewCatalogInfoComponent } from './PreviewCatalogInfoComponent';
export type { PreviewCatalogInfoComponentProps } from './PreviewCatalogInfoComponent';
export { PreviewPullRequestComponent } from './PreviewPullRequestComponent';
export type { PreviewPullRequestComponentProps } from './PreviewPullRequestComponent';
export { StepPrepareCreatePullRequest } from './StepPrepareCreatePullRequest';
export type { StepPrepareCreatePullRequestProps } from './StepPrepareCreatePullRequest';
@@ -20,3 +20,4 @@ export * from './ImportInfoCard';
export * from './ImportStepper';
export * from './StepInitAnalyzeUrl';
export * from './StepPrepareCreatePullRequest';
export type { ImportFlows, ImportState, PrepareResult } from './useImportState';
@@ -18,7 +18,11 @@ import { Entity, EntityName } from '@backstage/catalog-model';
import { useReducer } from 'react';
import { AnalyzeResult } from '../api';
// the configuration of the stepper
/**
* The configuration of the stepper.
*
* @public
*/
export type ImportFlows =
| 'unknown'
| 'single-location'
@@ -28,7 +32,11 @@ export type ImportFlows =
// the available states of the stepper
type ImportStateTypes = 'analyze' | 'prepare' | 'review' | 'finish';
// result of the prepare state
/**
* Result of the prepare state.
*
* @public
*/
export type PrepareResult =
| {
type: 'locations';
+11
View File
@@ -34,6 +34,12 @@ export const rootRouteRef = createRouteRef({
id: 'catalog-import',
});
/**
* A plugin that helps the user in importing projects and YAML files into the
* catalog.
*
* @public
*/
export const catalogImportPlugin = createPlugin({
id: 'catalog-import',
apis: [
@@ -70,6 +76,11 @@ export const catalogImportPlugin = createPlugin({
},
});
/**
* The page for importing projects and YAML files into the catalog.
*
* @public
*/
export const CatalogImportPage = catalogImportPlugin.provide(
createRoutableExtension({
name: 'CatalogImportPage',
+59 -65
View File
@@ -105,22 +105,14 @@ export type CatalogReactUserListPickerClassKey =
// @public @deprecated (undocumented)
export const catalogRouteRef: RouteRef<undefined>;
// Warning: (ae-missing-release-tag) "createDomainColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createDomainColumn<T extends Entity>(): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createEntityRefColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createEntityRefColumn<T extends Entity>({
defaultKind,
}: {
function createEntityRefColumn<T extends Entity>(options: {
defaultKind?: string;
}): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createEntityRelationColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createEntityRelationColumn<T extends Entity>({
title,
@@ -136,28 +128,18 @@ function createEntityRelationColumn<T extends Entity>({
};
}): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createMetadataDescriptionColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createMetadataDescriptionColumn<T extends Entity>(): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createOwnerColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createOwnerColumn<T extends Entity>(): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createSpecLifecycleColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createSpecLifecycleColumn<T extends Entity>(): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createSpecTypeColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createSpecTypeColumn<T extends Entity>(): TableColumn<T>;
// Warning: (ae-missing-release-tag) "createSystemColumn" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
function createSystemColumn<T extends Entity>(): TableColumn<T>;
@@ -215,14 +197,18 @@ export class EntityKindFilter implements EntityFilter {
readonly value: string;
}
// Warning: (ae-forgotten-export) The symbol "EntityKindFilterProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityKindPicker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityKindPicker: ({
initialFilter,
hidden,
}: EntityKindFilterProps) => JSX.Element | null;
export const EntityKindPicker: (
props: EntityKindPickerProps,
) => JSX.Element | null;
// @public
export interface EntityKindPickerProps {
// (undocumented)
hidden: boolean;
// (undocumented)
initialFilter?: string;
}
// Warning: (ae-missing-release-tag) "EntityLifecycleFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -237,8 +223,6 @@ export class EntityLifecycleFilter implements EntityFilter {
readonly values: string[];
}
// Warning: (ae-missing-release-tag) "EntityLifecyclePicker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityLifecyclePicker: () => JSX.Element | null;
@@ -270,8 +254,6 @@ export class EntityOwnerFilter implements EntityFilter {
readonly values: string[];
}
// Warning: (ae-missing-release-tag) "EntityOwnerPicker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityOwnerPicker: () => JSX.Element | null;
@@ -289,10 +271,7 @@ export interface EntityProviderProps {
entity?: Entity;
}
// Warning: (ae-forgotten-export) The symbol "EntityRefLinkProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityRefLink" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export const EntityRefLink: React_2.ForwardRefExoticComponent<
Pick<
EntityRefLinkProps,
@@ -581,16 +560,27 @@ export const EntityRefLink: React_2.ForwardRefExoticComponent<
React_2.RefAttributes<any>
>;
// Warning: (ae-forgotten-export) The symbol "EntityRefLinksProps" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityRefLinks" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
// @public
export type EntityRefLinkProps = {
entityRef: Entity | EntityName;
defaultKind?: string;
title?: string;
children?: React_2.ReactNode;
} & Omit<LinkProps, 'to'>;
// @public
export const EntityRefLinks: ({
entityRefs,
defaultKind,
...linkProps
}: EntityRefLinksProps) => JSX.Element;
// @public
export type EntityRefLinksProps = {
entityRefs: (Entity | EntityName)[];
defaultKind?: string;
} & Omit<LinkProps, 'to'>;
// Warning: (ae-missing-release-tag) "entityRoute" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public @deprecated (undocumented)
@@ -618,8 +608,6 @@ export const entityRouteRef: RouteRef<{
namespace: string;
}>;
// Warning: (ae-missing-release-tag) "EntitySearchBar" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntitySearchBar: () => JSX.Element;
@@ -631,18 +619,12 @@ export type EntitySourceLocation = {
integrationType?: string;
};
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "EntityTable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
// Warning: (ae-missing-release-tag) "EntityTable" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export function EntityTable<T extends Entity>({
entities,
title,
emptyContent,
variant,
columns,
}: Props<T>): JSX.Element;
// @public
export function EntityTable<T extends Entity>(
props: EntityTableProps<T>,
): JSX.Element;
// @public (undocumented)
export namespace EntityTable {
@@ -656,6 +638,22 @@ export namespace EntityTable {
componentEntityColumns: TableColumn<ComponentEntity>[];
}
// Warning: (ae-unresolved-link) The @link reference could not be resolved: The reference is ambiguous because "EntityTable" has more than one declaration; you need to add a TSDoc member reference selector
//
// @public
export interface EntityTableProps<T extends Entity> {
// (undocumented)
columns: TableColumn<T>[];
// (undocumented)
emptyContent?: ReactNode;
// (undocumented)
entities: T[];
// (undocumented)
title: string;
// (undocumented)
variant?: 'gridItem';
}
// Warning: (ae-missing-release-tag) "EntityTagFilter" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
@@ -669,8 +667,6 @@ export class EntityTagFilter implements EntityFilter {
readonly values: string[];
}
// Warning: (ae-missing-release-tag) "EntityTagPicker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityTagPicker: () => JSX.Element | null;
@@ -700,26 +696,24 @@ export class EntityTypeFilter implements EntityFilter {
readonly value: string | string[];
}
// Warning: (ae-missing-release-tag) "EntityTypeFilterProps" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type EntityTypeFilterProps = {
initialFilter?: string;
hidden?: boolean;
};
// Warning: (ae-missing-release-tag) "EntityTypePicker" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export const EntityTypePicker: (
props: EntityTypeFilterProps,
props: EntityTypePickerProps,
) => JSX.Element | null;
// @public
export interface EntityTypePickerProps {
// (undocumented)
hidden?: boolean;
// (undocumented)
initialFilter?: string;
}
// Warning: (ae-forgotten-export) The symbol "Props" needs to be exported by the entry point index.d.ts
// Warning: (ae-missing-release-tag) "FavoriteEntity" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public
export const FavoriteEntity: (props: Props_2) => JSX.Element;
export const FavoriteEntity: (props: Props) => JSX.Element;
// Warning: (ae-missing-release-tag) "favoriteEntityIcon" is exported by the package, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
@@ -835,7 +829,7 @@ export const UnregisterEntityDialog: ({
onConfirm,
onClose,
entity,
}: Props_3) => JSX.Element;
}: Props_2) => JSX.Element;
// @public
export function useEntity<T extends Entity = Entity>(): {
@@ -19,15 +19,20 @@ import { Alert } from '@material-ui/lab';
import { useEntityListProvider } from '../../hooks';
import { EntityKindFilter } from '../../filters';
type EntityKindFilterProps = {
/**
* Props for {@link EntityKindPicker}.
*
* @public
*/
export interface EntityKindPickerProps {
initialFilter?: string;
hidden: boolean;
};
}
/** @public */
export const EntityKindPicker = (props: EntityKindPickerProps) => {
const { initialFilter, hidden } = props;
export const EntityKindPicker = ({
initialFilter,
hidden,
}: EntityKindFilterProps) => {
const { updateFilters, queryParameters } = useEntityListProvider();
const [selectedKind] = useState(
[queryParameters.kind].flat()[0] ?? initialFilter,
@@ -15,3 +15,4 @@
*/
export { EntityKindPicker } from './EntityKindPicker';
export type { EntityKindPickerProps } from './EntityKindPicker';
@@ -46,6 +46,7 @@ const useStyles = makeStyles(
const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
const checkedIcon = <CheckBoxIcon fontSize="small" />;
/** @public */
export const EntityLifecyclePicker = () => {
const classes = useStyles();
const { updateFilters, backendEntities, filters, queryParameters } =
@@ -48,6 +48,7 @@ const useStyles = makeStyles(
const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
const checkedIcon = <CheckBoxIcon fontSize="small" />;
/** @public */
export const EntityOwnerPicker = () => {
const classes = useStyles();
const { updateFilters, backendEntities, filters, queryParameters } =
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import {
Entity,
EntityName,
@@ -25,6 +26,11 @@ import { Link, LinkProps } from '@backstage/core-components';
import { useRouteRef } from '@backstage/core-plugin-api';
import { Tooltip } from '@material-ui/core';
/**
* Props for {@link EntityRefLink}.
*
* @public
*/
export type EntityRefLinkProps = {
entityRef: Entity | EntityName;
defaultKind?: string;
@@ -32,6 +38,11 @@ export type EntityRefLinkProps = {
children?: React.ReactNode;
} & Omit<LinkProps, 'to'>;
/**
* Shows a clickable link to an entity.
*
* @public
*/
export const EntityRefLink = forwardRef<any, EntityRefLinkProps>(
(props, ref) => {
const { entityRef, defaultKind, title, children, ...linkProps } = props;
@@ -13,16 +13,27 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import { Entity, EntityName } from '@backstage/catalog-model';
import React from 'react';
import { EntityRefLink } from './EntityRefLink';
import { LinkProps } from '@backstage/core-components';
/**
* Props for {@link EntityRefLink}.
*
* @public
*/
export type EntityRefLinksProps = {
entityRefs: (Entity | EntityName)[];
defaultKind?: string;
} & Omit<LinkProps, 'to'>;
/**
* Shows a list of clickable links to entities.
*
* @public
*/
export const EntityRefLinks = ({
entityRefs,
defaultKind,
@@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { EntityRefLink } from './EntityRefLink';
export type { EntityRefLinkProps } from './EntityRefLink';
export { EntityRefLinks } from './EntityRefLinks';
export type { EntityRefLinksProps } from './EntityRefLinks';
export { formatEntityRefTitle } from './format';
@@ -45,6 +45,7 @@ const useStyles = makeStyles(
},
);
/** @public */
export const EntitySearchBar = () => {
const classes = useStyles();
@@ -21,13 +21,18 @@ import * as columnFactories from './columns';
import { componentEntityColumns, systemEntityColumns } from './presets';
import { Table, TableColumn } from '@backstage/core-components';
type Props<T extends Entity> = {
/**
* Props for {@link EntityTable}.
*
* @public
*/
export interface EntityTableProps<T extends Entity> {
title: string;
variant?: 'gridItem';
entities: T[];
emptyContent?: ReactNode;
columns: TableColumn<T>[];
};
}
const useStyles = makeStyles(theme => ({
empty: {
@@ -37,13 +42,21 @@ const useStyles = makeStyles(theme => ({
},
}));
export function EntityTable<T extends Entity>({
entities,
title,
emptyContent,
variant = 'gridItem',
columns,
}: Props<T>) {
/**
* A general entity table component, that can be used for composing more
* specific entity tables.
*
* @public
*/
export function EntityTable<T extends Entity>(props: EntityTableProps<T>) {
const {
entities,
title,
emptyContent,
variant = 'gridItem',
columns,
} = props;
const classes = useStyles();
const tableStyle: React.CSSProperties = {
minWidth: '0',
@@ -29,11 +29,11 @@ import {
formatEntityRefTitle,
} from '../EntityRefLink';
export function createEntityRefColumn<T extends Entity>({
defaultKind,
}: {
/** @public */
export function createEntityRefColumn<T extends Entity>(options: {
defaultKind?: string;
}): TableColumn<T> {
const { defaultKind } = options;
function formatContent(entity: T): string {
return (
entity.metadata?.title ||
@@ -49,7 +49,7 @@ export function createEntityRefColumn<T extends Entity>({
customFilterAndSearch(filter, entity) {
// TODO: We could implement this more efficiently, like searching over
// each field that is displayed individually (kind, namespace, name).
// but that migth confuse the user as it will behave different than a
// but that might confuse the user as it will behave different than a
// simple text search.
// Another alternative would be to cache the values. But writing them
// into the entity feels bad too.
@@ -70,6 +70,7 @@ export function createEntityRefColumn<T extends Entity>({
};
}
/** @public */
export function createEntityRelationColumn<T extends Entity>({
title,
relation,
@@ -110,6 +111,7 @@ export function createEntityRelationColumn<T extends Entity>({
};
}
/** @public */
export function createOwnerColumn<T extends Entity>(): TableColumn<T> {
return createEntityRelationColumn({
title: 'Owner',
@@ -118,6 +120,7 @@ export function createOwnerColumn<T extends Entity>(): TableColumn<T> {
});
}
/** @public */
export function createDomainColumn<T extends Entity>(): TableColumn<T> {
return createEntityRelationColumn({
title: 'Domain',
@@ -129,6 +132,7 @@ export function createDomainColumn<T extends Entity>(): TableColumn<T> {
});
}
/** @public */
export function createSystemColumn<T extends Entity>(): TableColumn<T> {
return createEntityRelationColumn({
title: 'System',
@@ -140,6 +144,7 @@ export function createSystemColumn<T extends Entity>(): TableColumn<T> {
});
}
/** @public */
export function createMetadataDescriptionColumn<
T extends Entity,
>(): TableColumn<T> {
@@ -157,6 +162,7 @@ export function createMetadataDescriptionColumn<
};
}
/** @public */
export function createSpecLifecycleColumn<T extends Entity>(): TableColumn<T> {
return {
title: 'Lifecycle',
@@ -164,6 +170,7 @@ export function createSpecLifecycleColumn<T extends Entity>(): TableColumn<T> {
};
}
/** @public */
export function createSpecTypeColumn<T extends Entity>(): TableColumn<T> {
return {
title: 'Type',
@@ -13,4 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export { EntityTable } from './EntityTable';
export type { EntityTableProps } from './EntityTable';
@@ -46,6 +46,7 @@ const useStyles = makeStyles(
const icon = <CheckBoxOutlineBlankIcon fontSize="small" />;
const checkedIcon = <CheckBoxIcon fontSize="small" />;
/** @public */
export const EntityTagPicker = () => {
const classes = useStyles();
const { updateFilters, backendEntities, filters, queryParameters } =
@@ -22,12 +22,18 @@ import { useEntityTypeFilter } from '../../hooks/useEntityTypeFilter';
import { alertApiRef, useApi } from '@backstage/core-plugin-api';
import { Select } from '@backstage/core-components';
export type EntityTypeFilterProps = {
/**
* Props for {@link EntityTypePicker}.
*
* @public
*/
export interface EntityTypePickerProps {
initialFilter?: string;
hidden?: boolean;
};
}
export const EntityTypePicker = (props: EntityTypeFilterProps) => {
/** @public */
export const EntityTypePicker = (props: EntityTypePickerProps) => {
const { hidden, initialFilter } = props;
const alertApi = useApi(alertApiRef);
const { error, availableTypes, selectedTypes, setSelectedTypes } =
@@ -15,4 +15,4 @@
*/
export { EntityTypePicker } from './EntityTypePicker';
export type { EntityTypeFilterProps } from './EntityTypePicker';
export type { EntityTypePickerProps } from './EntityTypePicker';
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from './EntityKindPicker';
export * from './EntityLifecyclePicker';
export * from './EntityOwnerPicker';
+2
View File
@@ -218,7 +218,9 @@ const NO_WARNING_PACKAGES = [
'packages/types',
'packages/version-bridge',
'plugins/catalog-backend-module-ldap',
'plugins/catalog-backend-module-msgraph',
'plugins/catalog-common',
'plugins/catalog-graph',
'plugins/permission-backend',
'plugins/permission-common',
'plugins/permission-node',