@backstage/plugin-scaffolder 1.4.0-next.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -6
- package/alpha/package.json +1 -1
- package/dist/esm/{Router-a85c58bd.esm.js → Router-e14e5f4e.esm.js} +7 -5
- package/dist/esm/Router-e14e5f4e.esm.js.map +1 -0
- package/dist/esm/{default-a3df1f11.esm.js → default-ffab2851.esm.js} +2 -2
- package/dist/esm/{default-a3df1f11.esm.js.map → default-ffab2851.esm.js.map} +1 -1
- package/dist/esm/{index-eff50288.esm.js → index-8dd91f94.esm.js} +3 -3
- package/dist/esm/{index-eff50288.esm.js.map → index-8dd91f94.esm.js.map} +1 -1
- package/dist/esm/{index-470abc37.esm.js → index-a298f509.esm.js} +80 -76
- package/dist/esm/index-a298f509.esm.js.map +1 -0
- package/dist/index.alpha.d.ts +3 -0
- package/dist/index.beta.d.ts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.esm.js +1 -1
- package/package.json +24 -24
- package/dist/esm/Router-a85c58bd.esm.js.map +0 -1
- package/dist/esm/index-470abc37.esm.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index-eff50288.esm.js","sources":["../../src/next/TemplateListPage/CategoryPicker.tsx","../../src/next/TemplateListPage/RegisterExistingButton.tsx","../../src/next/TemplateListPage/TemplateCard/CardHeader.tsx","../../src/next/TemplateListPage/TemplateCard/TemplateCard.tsx","../../src/next/TemplateListPage/TemplateGroup.tsx","../../src/next/TemplateListPage/TemplateGroups.tsx","../../src/next/TemplateListPage/TemplateListPage.tsx","../../src/next/TemplateWizardPage/SecretsContext/SecretsContext.tsx","../../src/next/TemplateWizardPage/TemplateWizardPage.tsx","../../src/next/Router/Router.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport capitalize from 'lodash/capitalize';\nimport { Progress } from '@backstage/core-components';\nimport {\n Box,\n Checkbox,\n FormControlLabel,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { Autocomplete } from '@material-ui/lab';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n */\nexport const CategoryPicker = () => {\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">Categories</Typography>\n <Autocomplete\n multiple\n aria-label=\"Categories\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackstageTheme } from '@backstage/theme';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport React from 'react';\nimport { Link as RouterLink, LinkProps } from 'react-router-dom';\nimport AddCircleOutline from '@material-ui/icons/AddCircleOutline';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';\nimport { usePermission } from '@backstage/plugin-permission-react';\n\n/**\n * Properties for {@link RegisterExistingButton}\n *\n * @alpha\n */\nexport type RegisterExistingButtonProps = {\n title: string;\n} & Partial<Pick<LinkProps, 'to'>>;\n\n/**\n * A button that helps users to register an existing component.\n * @alpha\n */\nexport const RegisterExistingButton = (props: RegisterExistingButtonProps) => {\n const { title, to } = props;\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const isXSScreen = useMediaQuery<BackstageTheme>(theme =>\n theme.breakpoints.down('xs'),\n );\n\n if (!to || !allowed) {\n return null;\n }\n\n return isXSScreen ? (\n <IconButton\n component={RouterLink}\n color=\"primary\"\n title={title}\n size=\"small\"\n to={to}\n >\n <AddCircleOutline />\n </IconButton>\n ) : (\n <Button component={RouterLink} variant=\"contained\" color=\"primary\" to={to}>\n {title}\n </Button>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles, useTheme } from '@material-ui/core';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { BackstageTheme } from '@backstage/theme';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\n\nconst useStyles = makeStyles<BackstageTheme, { cardBackgroundImage: string }>(\n () => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n }),\n);\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme<BackstageTheme>();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <FavoriteEntity entity={props.template} style={{ padding: 0 }} />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport {\n Box,\n Card,\n CardActions,\n CardContent,\n Chip,\n Divider,\n makeStyles,\n} from '@material-ui/core';\nimport { CardHeader } from './CardHeader';\nimport { MarkdownContent, UserIcon, Button } from '@backstage/core-components';\nimport {\n parseEntityRef,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { selectedTemplateRouteRef } from '../../../routes';\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n /** to make the styles for React Markdown not leak into the description */\n '& p:first-child': {\n marginTop: 0,\n marginBottom: theme.spacing(2),\n },\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n lineHeight: 1,\n fontSize: '0.75rem',\n },\n margin: {\n marginBottom: theme.spacing(2),\n },\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n}));\n\n/**\n * The Props for the Template Card component\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n deprecated?: boolean;\n}\n\n/**\n * The Template Card component that is rendered in a list for each template\n * @alpha\n */\nexport const TemplateCard = (props: TemplateCardProps) => {\n const { template } = props;\n const styles = useStyles();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const { name, namespace } = parseEntityRef(stringifyEntityRef(template));\n const href = templateRoute({ templateName: name, namespace: namespace });\n\n return (\n <Card>\n <CardHeader template={template} />\n <CardContent>\n <Box className={styles.box}>\n <MarkdownContent\n content={template.metadata.description ?? 'No description'}\n />\n </Box>\n {(template.metadata.tags?.length ?? 0) > 0 && (\n <>\n <Divider className={styles.margin} />\n <Box>\n {template.metadata.tags?.map(tag => (\n <Chip size=\"small\" label={tag} key={tag} />\n ))}\n </Box>\n </>\n )}\n </CardContent>\n <CardActions>\n <div className={styles.footer}>\n <div className={styles.ownedBy}>\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon />\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n />\n </>\n )}\n </div>\n <Button size=\"small\" variant=\"outlined\" color=\"primary\" to={href}>\n Choose\n </Button>\n </div>\n </CardActions>\n </Card>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport React from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n Link,\n} from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { TemplateCard, TemplateCardProps } from './TemplateCard';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\nexport interface TemplateGroupProps {\n templates: TemplateEntityV1beta3[];\n title: React.ReactNode;\n components?: {\n CardComponent?: React.ComponentType<TemplateCardProps>;\n };\n}\n\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const { templates, title, components: { CardComponent } = {} } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return (\n <Content>\n {titleComponent}\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n </Content>\n );\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(template => (\n <Card key={stringifyEntityRef(template)} template={template} />\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { TemplateGroup } from './TemplateGroup';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { Progress, Link } from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\n\n/**\n * @alpha\n */\nexport type TemplateGroupFilter = {\n title?: React.ReactNode;\n filter: (entity: Entity) => boolean;\n};\n\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n}\n\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, TemplateCardComponent } = props;\n const errorApi = useApi(errorApiRef);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n errorApi.post(error);\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => (\n <TemplateGroup\n key={index}\n templates={entities.filter((e): e is TemplateEntityV1beta3 =>\n filter(e),\n )}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n />\n ))}\n </>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\n\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport { CategoryPicker } from './CategoryPicker';\nimport { RegisterExistingButton } from './RegisterExistingButton';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { registerComponentRouteRef } from '../../routes';\nimport { TemplateGroupFilter, TemplateGroups } from './TemplateGroups';\n\nexport type TemplateListPageProps = {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n groups?: TemplateGroupFilter[];\n};\n\nconst defaultGroup: TemplateGroupFilter = {\n title: 'All Templates',\n filter: () => true,\n};\n\nexport const TemplateListPage = (props: TemplateListPageProps) => {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { TemplateCardComponent, groups = [defaultGroup] } = props;\n\n return (\n <EntityListProvider>\n <Page themeId=\"home\">\n <Header\n pageTitleOverride=\"Create a New Component\"\n title=\"Create a New Component\"\n subtitle=\"Create new software components using standard templates\"\n />\n <Content>\n <ContentHeader title=\"Available Templates\">\n <RegisterExistingButton\n title=\"Register Existing Component\"\n to={registerComponentLink && registerComponentLink()}\n />\n <SupportButton>\n Create new software components using standard templates. Different\n templates create different kinds of components (services,\n websites, documentation, ...).\n </SupportButton>\n </ContentHeader>\n\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntitySearchBar />\n <EntityKindPicker initialFilter=\"template\" hidden />\n <UserListPicker\n initialFilter=\"all\"\n availableFilters={['all', 'starred']}\n />\n <CategoryPicker />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <TemplateGroups\n groups={groups}\n TemplateCardComponent={TemplateCardComponent}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </Page>\n </EntityListProvider>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {\n useState,\n useCallback,\n useContext,\n createContext,\n PropsWithChildren,\n} from 'react';\n\ntype SecretsContextContents = {\n secrets: Record<string, string>;\n setSecrets: React.Dispatch<React.SetStateAction<Record<string, string>>>;\n};\n\n/**\n * The actual context object.\n */\nexport const SecretsContext = createContext<SecretsContextContents | undefined>(\n undefined,\n);\n\n/**\n * The Context Provider that holds the state for the secrets.\n *\n * @alpha\n */\nexport const SecretsContextProvider = ({ children }: PropsWithChildren<{}>) => {\n const [secrets, setSecrets] = useState<Record<string, string>>({});\n\n return (\n <SecretsContext.Provider value={{ secrets, setSecrets }}>\n {children}\n </SecretsContext.Provider>\n );\n};\n\n/**\n * Hook to access the secrets context.\n * @alpha\n */\nexport const useTemplateSecrets = () => {\n const value = useContext(SecretsContext);\n if (!value) {\n throw new Error(\n 'useTemplateSecrets must be used within a SecretsContextProvider',\n );\n }\n\n const { setSecrets } = value;\n\n const setSecret = useCallback(\n (input: Record<string, string>) => {\n setSecrets(currentSecrets => ({ ...currentSecrets, ...input }));\n },\n [setSecrets],\n );\n\n return { setSecret };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldExtensionOptions } from '../../extensions';\n\nexport interface TemplateWizardPageProps {\n customFieldExtensions: FieldExtensionOptions<any, any>[];\n}\n\nexport const TemplateWizardPage = (_props: TemplateWizardPageProps) => {\n return null;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren } from 'react';\nimport { Routes, Route, useOutlet } from 'react-router';\nimport { TemplateListPage } from '../TemplateListPage';\nimport { SecretsContextProvider } from '../TemplateWizardPage/SecretsContext';\nimport { TemplateWizardPage } from '../TemplateWizardPage';\nimport {\n FieldExtensionOptions,\n FIELD_EXTENSION_WRAPPER_KEY,\n FIELD_EXTENSION_KEY,\n DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS,\n} from '../../extensions';\n\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '../TemplateListPage/TemplateGroups';\nimport { selectedTemplateRouteRef } from '../../routes';\n\n/**\n * The Props for the Scaffolder Router\n *\n * @alpha\n */\nexport type NextRouterProps = {\n components?: {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n TaskPageComponent?: React.ComponentType<{}>;\n };\n groups?: TemplateGroupFilter[];\n};\n\n/**\n * The Scaffolder Router\n *\n * @alpha\n */\nexport const Router = (props: PropsWithChildren<NextRouterProps>) => {\n const { components: { TemplateCardComponent } = {} } = props;\n\n const outlet = useOutlet() || props.children;\n\n const customFieldExtensions = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<FieldExtensionOptions>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n customFieldExtension => customFieldExtension.name === name,\n ),\n ),\n ];\n\n return (\n <Routes>\n <Route\n element={\n <TemplateListPage\n TemplateCardComponent={TemplateCardComponent}\n groups={props.groups}\n />\n }\n />\n\n <Route\n path={selectedTemplateRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateWizardPage customFieldExtensions={fieldExtensions} />\n </SecretsContextProvider>\n }\n />\n </Routes>\n );\n};\n"],"names":["RouterLink","useStyles","Button","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,IAAI,mBAAmB,KAAK,CAAC,aAAa,CAAC,wBAAwB,EAAE;AAC3E,EAAE,QAAQ,EAAE,OAAO;AACnB,C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BAAkB,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;AACvI,MAAM,qBAAqB,EAAE,eAAe;AAC5C,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
1
|
+
{"version":3,"file":"index-8dd91f94.esm.js","sources":["../../src/next/TemplateListPage/CategoryPicker.tsx","../../src/next/TemplateListPage/RegisterExistingButton.tsx","../../src/next/TemplateListPage/TemplateCard/CardHeader.tsx","../../src/next/TemplateListPage/TemplateCard/TemplateCard.tsx","../../src/next/TemplateListPage/TemplateGroup.tsx","../../src/next/TemplateListPage/TemplateGroups.tsx","../../src/next/TemplateListPage/TemplateListPage.tsx","../../src/next/TemplateWizardPage/SecretsContext/SecretsContext.tsx","../../src/next/TemplateWizardPage/TemplateWizardPage.tsx","../../src/next/Router/Router.tsx"],"sourcesContent":["/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport capitalize from 'lodash/capitalize';\nimport { Progress } from '@backstage/core-components';\nimport {\n Box,\n Checkbox,\n FormControlLabel,\n TextField,\n Typography,\n} from '@material-ui/core';\nimport CheckBoxIcon from '@material-ui/icons/CheckBox';\nimport CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';\nimport ExpandMoreIcon from '@material-ui/icons/ExpandMore';\nimport { Autocomplete } from '@material-ui/lab';\nimport { useEntityTypeFilter } from '@backstage/plugin-catalog-react';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\n\nconst icon = <CheckBoxOutlineBlankIcon fontSize=\"small\" />;\nconst checkedIcon = <CheckBoxIcon fontSize=\"small\" />;\n\n/**\n * The Category Picker that is rendered on the left side for picking\n * categories and filtering the template list.\n */\nexport const CategoryPicker = () => {\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types with error: ${error}`,\n severity: 'error',\n });\n return null;\n }\n\n if (!availableTypes) return null;\n\n return (\n <Box pb={1} pt={1}>\n <Typography variant=\"button\">Categories</Typography>\n <Autocomplete\n multiple\n aria-label=\"Categories\"\n options={availableTypes}\n value={selectedTypes}\n onChange={(_: object, value: string[]) => setSelectedTypes(value)}\n renderOption={(option, { selected }) => (\n <FormControlLabel\n control={\n <Checkbox\n icon={icon}\n checkedIcon={checkedIcon}\n checked={selected}\n />\n }\n label={capitalize(option)}\n />\n )}\n size=\"small\"\n popupIcon={<ExpandMoreIcon />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n","/*\n * Copyright 2021 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { BackstageTheme } from '@backstage/theme';\nimport Button from '@material-ui/core/Button';\nimport IconButton from '@material-ui/core/IconButton';\nimport useMediaQuery from '@material-ui/core/useMediaQuery';\nimport React from 'react';\nimport { Link as RouterLink, LinkProps } from 'react-router-dom';\nimport AddCircleOutline from '@material-ui/icons/AddCircleOutline';\nimport { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common';\nimport { usePermission } from '@backstage/plugin-permission-react';\n\n/**\n * Properties for {@link RegisterExistingButton}\n *\n * @alpha\n */\nexport type RegisterExistingButtonProps = {\n title: string;\n} & Partial<Pick<LinkProps, 'to'>>;\n\n/**\n * A button that helps users to register an existing component.\n * @alpha\n */\nexport const RegisterExistingButton = (props: RegisterExistingButtonProps) => {\n const { title, to } = props;\n const { allowed } = usePermission({\n permission: catalogEntityCreatePermission,\n });\n const isXSScreen = useMediaQuery<BackstageTheme>(theme =>\n theme.breakpoints.down('xs'),\n );\n\n if (!to || !allowed) {\n return null;\n }\n\n return isXSScreen ? (\n <IconButton\n component={RouterLink}\n color=\"primary\"\n title={title}\n size=\"small\"\n to={to}\n >\n <AddCircleOutline />\n </IconButton>\n ) : (\n <Button component={RouterLink} variant=\"contained\" color=\"primary\" to={to}>\n {title}\n </Button>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { makeStyles, useTheme } from '@material-ui/core';\nimport { ItemCardHeader } from '@backstage/core-components';\nimport { BackstageTheme } from '@backstage/theme';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { FavoriteEntity } from '@backstage/plugin-catalog-react';\n\nconst useStyles = makeStyles<BackstageTheme, { cardBackgroundImage: string }>(\n () => ({\n header: {\n backgroundImage: ({ cardBackgroundImage }) => cardBackgroundImage,\n },\n subtitleWrapper: {\n display: 'flex',\n justifyContent: 'space-between',\n },\n }),\n);\n\n/**\n * Props for the CardHeader component\n */\nexport interface CardHeaderProps {\n template: TemplateEntityV1beta3;\n}\n\n/**\n * The Card Header with the background for the TemplateCard.\n */\nexport const CardHeader = (props: CardHeaderProps) => {\n const {\n template: {\n metadata: { title, name },\n spec: { type },\n },\n } = props;\n const { getPageTheme } = useTheme<BackstageTheme>();\n const themeForType = getPageTheme({ themeId: type });\n\n const styles = useStyles({\n cardBackgroundImage: themeForType.backgroundImage,\n });\n\n const SubtitleComponent = (\n <div className={styles.subtitleWrapper}>\n <div>{type}</div>\n <div>\n <FavoriteEntity entity={props.template} style={{ padding: 0 }} />\n </div>\n </div>\n );\n\n return (\n <ItemCardHeader\n title={title ?? name}\n subtitle={SubtitleComponent}\n classes={{ root: styles.header }}\n />\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport {\n Box,\n Card,\n CardActions,\n CardContent,\n Chip,\n Divider,\n makeStyles,\n} from '@material-ui/core';\nimport { CardHeader } from './CardHeader';\nimport { MarkdownContent, UserIcon, Button } from '@backstage/core-components';\nimport {\n parseEntityRef,\n RELATION_OWNED_BY,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport {\n EntityRefLinks,\n getEntityRelations,\n} from '@backstage/plugin-catalog-react';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { selectedTemplateRouteRef } from '../../../routes';\nimport { BackstageTheme } from '@backstage/theme';\n\nconst useStyles = makeStyles<BackstageTheme>(theme => ({\n box: {\n overflow: 'hidden',\n textOverflow: 'ellipsis',\n display: '-webkit-box',\n '-webkit-line-clamp': 10,\n '-webkit-box-orient': 'vertical',\n /** to make the styles for React Markdown not leak into the description */\n '& p:first-child': {\n marginTop: 0,\n marginBottom: theme.spacing(2),\n },\n },\n label: {\n color: theme.palette.text.secondary,\n textTransform: 'uppercase',\n fontWeight: 'bold',\n letterSpacing: 0.5,\n lineHeight: 1,\n fontSize: '0.75rem',\n },\n margin: {\n marginBottom: theme.spacing(2),\n },\n footer: {\n display: 'flex',\n justifyContent: 'space-between',\n flex: 1,\n alignItems: 'center',\n },\n ownedBy: {\n display: 'flex',\n alignItems: 'center',\n flex: 1,\n color: theme.palette.link,\n },\n}));\n\n/**\n * The Props for the Template Card component\n * @alpha\n */\nexport interface TemplateCardProps {\n template: TemplateEntityV1beta3;\n deprecated?: boolean;\n}\n\n/**\n * The Template Card component that is rendered in a list for each template\n * @alpha\n */\nexport const TemplateCard = (props: TemplateCardProps) => {\n const { template } = props;\n const styles = useStyles();\n const ownedByRelations = getEntityRelations(template, RELATION_OWNED_BY);\n const templateRoute = useRouteRef(selectedTemplateRouteRef);\n const { name, namespace } = parseEntityRef(stringifyEntityRef(template));\n const href = templateRoute({ templateName: name, namespace: namespace });\n\n return (\n <Card>\n <CardHeader template={template} />\n <CardContent>\n <Box className={styles.box}>\n <MarkdownContent\n content={template.metadata.description ?? 'No description'}\n />\n </Box>\n {(template.metadata.tags?.length ?? 0) > 0 && (\n <>\n <Divider className={styles.margin} />\n <Box>\n {template.metadata.tags?.map(tag => (\n <Chip size=\"small\" label={tag} key={tag} />\n ))}\n </Box>\n </>\n )}\n </CardContent>\n <CardActions>\n <div className={styles.footer}>\n <div className={styles.ownedBy}>\n {ownedByRelations.length > 0 && (\n <>\n <UserIcon />\n <EntityRefLinks\n entityRefs={ownedByRelations}\n defaultKind=\"Group\"\n />\n </>\n )}\n </div>\n <Button size=\"small\" variant=\"outlined\" color=\"primary\" to={href}>\n Choose\n </Button>\n </div>\n </CardActions>\n </Card>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport React from 'react';\nimport {\n Content,\n ContentHeader,\n ItemCardGrid,\n Link,\n} from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { TemplateCard, TemplateCardProps } from './TemplateCard';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\n\nexport interface TemplateGroupProps {\n templates: TemplateEntityV1beta3[];\n title: React.ReactNode;\n components?: {\n CardComponent?: React.ComponentType<TemplateCardProps>;\n };\n}\n\nexport const TemplateGroup = (props: TemplateGroupProps) => {\n const { templates, title, components: { CardComponent } = {} } = props;\n const titleComponent =\n typeof title === 'string' ? <ContentHeader title={title} /> : title;\n\n if (templates.length === 0) {\n return (\n <Content>\n {titleComponent}\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n </Content>\n );\n }\n\n const Card = CardComponent || TemplateCard;\n\n return (\n <Content>\n {titleComponent}\n <ItemCardGrid>\n {templates.map(template => (\n <Card key={stringifyEntityRef(template)} template={template} />\n ))}\n </ItemCardGrid>\n </Content>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React from 'react';\nimport { TemplateGroup } from './TemplateGroup';\nimport { Entity } from '@backstage/catalog-model';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { Progress, Link } from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport { errorApiRef, useApi } from '@backstage/core-plugin-api';\n\n/**\n * @alpha\n */\nexport type TemplateGroupFilter = {\n title?: React.ReactNode;\n filter: (entity: Entity) => boolean;\n};\n\nexport interface TemplateGroupsProps {\n groups: TemplateGroupFilter[];\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n}\n\nexport const TemplateGroups = (props: TemplateGroupsProps) => {\n const { loading, error, entities } = useEntityList();\n const { groups, TemplateCardComponent } = props;\n const errorApi = useApi(errorApiRef);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n errorApi.post(error);\n return null;\n }\n\n if (!entities || !entities.length) {\n return (\n <Typography variant=\"body2\">\n No templates found that match your filter. Learn more about{' '}\n <Link to=\"https://backstage.io/docs/features/software-templates/adding-templates\">\n adding templates\n </Link>\n .\n </Typography>\n );\n }\n\n return (\n <>\n {groups.map(({ title, filter }, index) => (\n <TemplateGroup\n key={index}\n templates={entities.filter((e): e is TemplateEntityV1beta3 =>\n filter(e),\n )}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n />\n ))}\n </>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React from 'react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\n\nimport {\n Content,\n ContentHeader,\n Header,\n Page,\n SupportButton,\n} from '@backstage/core-components';\nimport {\n EntityKindPicker,\n EntityListProvider,\n EntitySearchBar,\n EntityTagPicker,\n CatalogFilterLayout,\n UserListPicker,\n} from '@backstage/plugin-catalog-react';\nimport { CategoryPicker } from './CategoryPicker';\nimport { RegisterExistingButton } from './RegisterExistingButton';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport { registerComponentRouteRef } from '../../routes';\nimport { TemplateGroupFilter, TemplateGroups } from './TemplateGroups';\n\nexport type TemplateListPageProps = {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n groups?: TemplateGroupFilter[];\n};\n\nconst defaultGroup: TemplateGroupFilter = {\n title: 'All Templates',\n filter: () => true,\n};\n\nexport const TemplateListPage = (props: TemplateListPageProps) => {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { TemplateCardComponent, groups = [defaultGroup] } = props;\n\n return (\n <EntityListProvider>\n <Page themeId=\"home\">\n <Header\n pageTitleOverride=\"Create a New Component\"\n title=\"Create a New Component\"\n subtitle=\"Create new software components using standard templates\"\n />\n <Content>\n <ContentHeader title=\"Available Templates\">\n <RegisterExistingButton\n title=\"Register Existing Component\"\n to={registerComponentLink && registerComponentLink()}\n />\n <SupportButton>\n Create new software components using standard templates. Different\n templates create different kinds of components (services,\n websites, documentation, ...).\n </SupportButton>\n </ContentHeader>\n\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <EntitySearchBar />\n <EntityKindPicker initialFilter=\"template\" hidden />\n <UserListPicker\n initialFilter=\"all\"\n availableFilters={['all', 'starred']}\n />\n <CategoryPicker />\n <EntityTagPicker />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <TemplateGroups\n groups={groups}\n TemplateCardComponent={TemplateCardComponent}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n </Content>\n </Page>\n </EntityListProvider>\n );\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, {\n useState,\n useCallback,\n useContext,\n createContext,\n PropsWithChildren,\n} from 'react';\n\ntype SecretsContextContents = {\n secrets: Record<string, string>;\n setSecrets: React.Dispatch<React.SetStateAction<Record<string, string>>>;\n};\n\n/**\n * The actual context object.\n */\nexport const SecretsContext = createContext<SecretsContextContents | undefined>(\n undefined,\n);\n\n/**\n * The Context Provider that holds the state for the secrets.\n *\n * @alpha\n */\nexport const SecretsContextProvider = ({ children }: PropsWithChildren<{}>) => {\n const [secrets, setSecrets] = useState<Record<string, string>>({});\n\n return (\n <SecretsContext.Provider value={{ secrets, setSecrets }}>\n {children}\n </SecretsContext.Provider>\n );\n};\n\n/**\n * Hook to access the secrets context.\n * @alpha\n */\nexport const useTemplateSecrets = () => {\n const value = useContext(SecretsContext);\n if (!value) {\n throw new Error(\n 'useTemplateSecrets must be used within a SecretsContextProvider',\n );\n }\n\n const { setSecrets } = value;\n\n const setSecret = useCallback(\n (input: Record<string, string>) => {\n setSecrets(currentSecrets => ({ ...currentSecrets, ...input }));\n },\n [setSecrets],\n );\n\n return { setSecret };\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { FieldExtensionOptions } from '../../extensions';\n\nexport interface TemplateWizardPageProps {\n customFieldExtensions: FieldExtensionOptions<any, any>[];\n}\n\nexport const TemplateWizardPage = (_props: TemplateWizardPageProps) => {\n return null;\n};\n","/*\n * Copyright 2022 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nimport React, { PropsWithChildren } from 'react';\nimport { Routes, Route, useOutlet } from 'react-router';\nimport { TemplateListPage } from '../TemplateListPage';\nimport { SecretsContextProvider } from '../TemplateWizardPage/SecretsContext';\nimport { TemplateWizardPage } from '../TemplateWizardPage';\nimport {\n FieldExtensionOptions,\n FIELD_EXTENSION_WRAPPER_KEY,\n FIELD_EXTENSION_KEY,\n DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS,\n} from '../../extensions';\n\nimport { useElementFilter } from '@backstage/core-plugin-api';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '../TemplateListPage/TemplateGroups';\nimport { selectedTemplateRouteRef } from '../../routes';\n\n/**\n * The Props for the Scaffolder Router\n *\n * @alpha\n */\nexport type NextRouterProps = {\n components?: {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n TaskPageComponent?: React.ComponentType<{}>;\n };\n groups?: TemplateGroupFilter[];\n};\n\n/**\n * The Scaffolder Router\n *\n * @alpha\n */\nexport const Router = (props: PropsWithChildren<NextRouterProps>) => {\n const { components: { TemplateCardComponent } = {} } = props;\n\n const outlet = useOutlet() || props.children;\n\n const customFieldExtensions = useElementFilter(outlet, elements =>\n elements\n .selectByComponentData({\n key: FIELD_EXTENSION_WRAPPER_KEY,\n })\n .findComponentData<FieldExtensionOptions>({\n key: FIELD_EXTENSION_KEY,\n }),\n );\n\n const fieldExtensions = [\n ...customFieldExtensions,\n ...DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS.filter(\n ({ name }) =>\n !customFieldExtensions.some(\n customFieldExtension => customFieldExtension.name === name,\n ),\n ),\n ];\n\n return (\n <Routes>\n <Route\n element={\n <TemplateListPage\n TemplateCardComponent={TemplateCardComponent}\n groups={props.groups}\n />\n }\n />\n\n <Route\n path={selectedTemplateRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateWizardPage customFieldExtensions={fieldExtensions} />\n </SecretsContextProvider>\n }\n />\n </Routes>\n );\n};\n"],"names":["RouterLink","useStyles","Button","Link"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAgBA,MAAM,IAAI,mBAAmB,KAAK,CAAC,aAAa,CAAC,wBAAwB,EAAE;AAC3E,EAAE,QAAQ,EAAE,OAAO;AACnB,CAAC,CAAC,CAAC;AACH,MAAM,WAAW,mBAAmB,KAAK,CAAC,aAAa,CAAC,YAAY,EAAE;AACtE,EAAE,QAAQ,EAAE,OAAO;AACnB,CAAC,CAAC,CAAC;AACI,MAAM,cAAc,GAAG,MAAM;AACpC,EAAE,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AACvC,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,gBAAgB,EAAE,GAAG,mBAAmB,EAAE,CAAC;AACpG,EAAE,IAAI,OAAO;AACb,IAAI,uBAAuB,KAAK,CAAC,aAAa,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAC;AAC/D,EAAE,IAAI,KAAK,EAAE;AACb,IAAI,QAAQ,CAAC,IAAI,CAAC;AAClB,MAAM,OAAO,EAAE,CAAC,wCAAwC,EAAE,KAAK,CAAC,CAAC;AACjE,MAAM,QAAQ,EAAE,OAAO;AACvB,KAAK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AC5B,IAAI,GAAG,mCAAmC,CAAC,MAAM,CAAC,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC,oBAAoB,KAAK,oBAAoB,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;AAC1J,GAAG,CAAC;AACJ,EAAE,uBAAuB,KAAK,CAAC,aAAa,CAAC,MAAM,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACtG,IAAI,OAAO,kBAAkB,KAAK,CAAC,aAAa,CAAC,gBAAgB,EAAE;AACnE,MAAM,qBAAqB;AAC3B,MAAM,MAAM,EAAE,KAAK,CAAC,MAAM;AAC1B,KAAK,CAAC;AACN,GAAG,CAAC,kBAAkB,KAAK,CAAC,aAAa,CAAC,KAAK,EAAE;AACjD,IAAI,IAAI,EAAE,wBAAwB,CAAC,IAAI;AACvC,IAAI,OAAO,kBAAkB,KAAK,CAAC,aAAa,CAAC,sBAAsB,EAAE,IAAI,kBAAkB,KAAK,CAAC,aAAa,CAAC,kBAAkB,EAAE;AACvI,MAAM,qBAAqB,EAAE,eAAe;AAC5C,KAAK,CAAC,CAAC;AACP,GAAG,CAAC,CAAC,CAAC;AACN;;;;"}
|
|
@@ -363,7 +363,7 @@ const EntityTagsPicker = (props) => {
|
|
|
363
363
|
};
|
|
364
364
|
|
|
365
365
|
const OwnerPicker = (props) => {
|
|
366
|
-
var _a;
|
|
366
|
+
var _a, _b, _c;
|
|
367
367
|
const {
|
|
368
368
|
schema: { title = "Owner", description = "The owner of the component" },
|
|
369
369
|
uiSchema,
|
|
@@ -376,7 +376,8 @@ const OwnerPicker = (props) => {
|
|
|
376
376
|
"Group",
|
|
377
377
|
"User"
|
|
378
378
|
],
|
|
379
|
-
defaultKind: "Group"
|
|
379
|
+
defaultKind: "Group",
|
|
380
|
+
allowArbitraryValues: (_c = (_b = uiSchema["ui:options"]) == null ? void 0 : _b.allowArbitraryValues) != null ? _c : true
|
|
380
381
|
}
|
|
381
382
|
};
|
|
382
383
|
return /* @__PURE__ */ React.createElement(EntityPicker, {
|
|
@@ -389,7 +390,7 @@ const OwnerPicker = (props) => {
|
|
|
389
390
|
const GithubRepoPicker = (props) => {
|
|
390
391
|
const { allowedOwners = [], rawErrors, state, onChange } = props;
|
|
391
392
|
const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
|
|
392
|
-
const { owner
|
|
393
|
+
const { owner } = state;
|
|
393
394
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
394
395
|
margin: "normal",
|
|
395
396
|
required: true,
|
|
@@ -407,23 +408,13 @@ const GithubRepoPicker = (props) => {
|
|
|
407
408
|
id: "ownerInput",
|
|
408
409
|
onChange: (e) => onChange({ owner: e.target.value }),
|
|
409
410
|
value: owner
|
|
410
|
-
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to"))
|
|
411
|
-
margin: "normal",
|
|
412
|
-
required: true,
|
|
413
|
-
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
414
|
-
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
415
|
-
htmlFor: "repoNameInput"
|
|
416
|
-
}, "Repository"), /* @__PURE__ */ React.createElement(Input, {
|
|
417
|
-
id: "repoNameInput",
|
|
418
|
-
onChange: (e) => onChange({ repoName: e.target.value }),
|
|
419
|
-
value: repoName
|
|
420
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
|
|
411
|
+
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, user or project that this repo will belong to")));
|
|
421
412
|
};
|
|
422
413
|
|
|
423
414
|
const GitlabRepoPicker = (props) => {
|
|
424
|
-
const { allowedOwners = [],
|
|
415
|
+
const { allowedOwners = [], state, onChange, rawErrors } = props;
|
|
425
416
|
const ownerItems = allowedOwners ? allowedOwners.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
|
|
426
|
-
const { owner
|
|
417
|
+
const { owner } = state;
|
|
427
418
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
428
419
|
margin: "normal",
|
|
429
420
|
required: true,
|
|
@@ -443,22 +434,12 @@ const GitlabRepoPicker = (props) => {
|
|
|
443
434
|
id: "ownerInput",
|
|
444
435
|
onChange: (e) => onChange({ owner: e.target.value }),
|
|
445
436
|
value: owner
|
|
446
|
-
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, groups, subgroups, user, project (also known as namespaces in gitlab), that this repo will belong to"))
|
|
447
|
-
margin: "normal",
|
|
448
|
-
required: true,
|
|
449
|
-
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
450
|
-
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
451
|
-
htmlFor: "repoNameInput"
|
|
452
|
-
}, "Repository"), /* @__PURE__ */ React.createElement(Input, {
|
|
453
|
-
id: "repoNameInput",
|
|
454
|
-
onChange: (e) => onChange({ repoName: e.target.value }),
|
|
455
|
-
value: repoName
|
|
456
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
|
|
437
|
+
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The organization, groups, subgroups, user, project (also known as namespaces in gitlab), that this repo will belong to")));
|
|
457
438
|
};
|
|
458
439
|
|
|
459
440
|
const AzureRepoPicker = (props) => {
|
|
460
441
|
const { rawErrors, state, onChange } = props;
|
|
461
|
-
const { organization,
|
|
442
|
+
const { organization, owner } = state;
|
|
462
443
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
463
444
|
margin: "normal",
|
|
464
445
|
required: true,
|
|
@@ -479,33 +460,31 @@ const AzureRepoPicker = (props) => {
|
|
|
479
460
|
id: "ownerInput",
|
|
480
461
|
onChange: (e) => onChange({ owner: e.target.value }),
|
|
481
462
|
value: owner
|
|
482
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Owner that this repo will belong to"))
|
|
483
|
-
margin: "normal",
|
|
484
|
-
required: true,
|
|
485
|
-
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
486
|
-
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
487
|
-
htmlFor: "repoNameInput"
|
|
488
|
-
}, "Repository"), /* @__PURE__ */ React.createElement(Input, {
|
|
489
|
-
id: "repoNameInput",
|
|
490
|
-
onChange: (e) => onChange({ repoName: e.target.value }),
|
|
491
|
-
value: repoName
|
|
492
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
|
|
463
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Owner that this repo will belong to")));
|
|
493
464
|
};
|
|
494
465
|
|
|
495
466
|
const BitbucketRepoPicker = (props) => {
|
|
496
|
-
const { onChange, rawErrors, state } = props;
|
|
497
|
-
const { host, workspace, project
|
|
467
|
+
const { allowedOwners = [], onChange, rawErrors, state } = props;
|
|
468
|
+
const { host, workspace, project } = state;
|
|
469
|
+
const ownerItems = allowedOwners ? allowedOwners == null ? void 0 : allowedOwners.map((i) => ({ label: i, value: i })) : [];
|
|
498
470
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, host === "bitbucket.org" && /* @__PURE__ */ React.createElement(FormControl, {
|
|
499
471
|
margin: "normal",
|
|
500
472
|
required: true,
|
|
501
473
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
|
|
502
|
-
}, /* @__PURE__ */ React.createElement(
|
|
474
|
+
}, (allowedOwners == null ? void 0 : allowedOwners.length) ? /* @__PURE__ */ React.createElement(Select, {
|
|
475
|
+
native: true,
|
|
476
|
+
label: "Allowed Workspaces",
|
|
477
|
+
onChange: (s) => onChange({ workspace: String(Array.isArray(s) ? s[0] : s) }),
|
|
478
|
+
disabled: allowedOwners.length === 1,
|
|
479
|
+
selected: workspace,
|
|
480
|
+
items: ownerItems
|
|
481
|
+
}) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
503
482
|
htmlFor: "workspaceInput"
|
|
504
483
|
}, "Workspace"), /* @__PURE__ */ React.createElement(Input, {
|
|
505
484
|
id: "workspaceInput",
|
|
506
485
|
onChange: (e) => onChange({ workspace: e.target.value }),
|
|
507
486
|
value: workspace
|
|
508
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Organization that this repo will belong to")), /* @__PURE__ */ React.createElement(FormControl, {
|
|
487
|
+
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Organization that this repo will belong to")), /* @__PURE__ */ React.createElement(FormControl, {
|
|
509
488
|
margin: "normal",
|
|
510
489
|
required: true,
|
|
511
490
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !project
|
|
@@ -515,25 +494,14 @@ const BitbucketRepoPicker = (props) => {
|
|
|
515
494
|
id: "projectInput",
|
|
516
495
|
onChange: (e) => onChange({ project: e.target.value }),
|
|
517
496
|
value: project
|
|
518
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Project that this repo will belong to"))
|
|
519
|
-
margin: "normal",
|
|
520
|
-
required: true,
|
|
521
|
-
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
522
|
-
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
523
|
-
htmlFor: "repoNameInput"
|
|
524
|
-
}, "Repository"), /* @__PURE__ */ React.createElement(Input, {
|
|
525
|
-
id: "repoNameInput",
|
|
526
|
-
onChange: (e) => onChange({ repoName: e.target.value }),
|
|
527
|
-
value: repoName
|
|
528
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
|
|
497
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The Project that this repo will belong to")));
|
|
529
498
|
};
|
|
530
499
|
|
|
531
500
|
const GerritRepoPicker = (props) => {
|
|
532
501
|
const { onChange, rawErrors, state } = props;
|
|
533
|
-
const { workspace,
|
|
502
|
+
const { workspace, owner } = state;
|
|
534
503
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
535
504
|
margin: "normal",
|
|
536
|
-
required: true,
|
|
537
505
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
|
|
538
506
|
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
539
507
|
htmlFor: "ownerInput"
|
|
@@ -541,7 +509,7 @@ const GerritRepoPicker = (props) => {
|
|
|
541
509
|
id: "ownerInput",
|
|
542
510
|
onChange: (e) => onChange({ owner: e.target.value }),
|
|
543
511
|
value: owner
|
|
544
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The owner of the project")), /* @__PURE__ */ React.createElement(FormControl, {
|
|
512
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The owner of the project (optional)")), /* @__PURE__ */ React.createElement(FormControl, {
|
|
545
513
|
margin: "normal",
|
|
546
514
|
required: true,
|
|
547
515
|
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !workspace
|
|
@@ -551,17 +519,7 @@ const GerritRepoPicker = (props) => {
|
|
|
551
519
|
id: "parentInput",
|
|
552
520
|
onChange: (e) => onChange({ workspace: e.target.value }),
|
|
553
521
|
value: workspace
|
|
554
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The project parent that the repo will belong to"))
|
|
555
|
-
margin: "normal",
|
|
556
|
-
required: true,
|
|
557
|
-
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
558
|
-
}, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
559
|
-
htmlFor: "repoNameInput"
|
|
560
|
-
}, "Repository"), /* @__PURE__ */ React.createElement(Input, {
|
|
561
|
-
id: "repoNameInput",
|
|
562
|
-
onChange: (e) => onChange({ repoName: e.target.value }),
|
|
563
|
-
value: repoName
|
|
564
|
-
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
|
|
522
|
+
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The project parent that the repo will belong to")));
|
|
565
523
|
};
|
|
566
524
|
|
|
567
525
|
const RepoUrlPickerHost = (props) => {
|
|
@@ -600,6 +558,36 @@ const RepoUrlPickerHost = (props) => {
|
|
|
600
558
|
}), /* @__PURE__ */ React.createElement(FormHelperText, null, "The host where the repository will be created")));
|
|
601
559
|
};
|
|
602
560
|
|
|
561
|
+
const RepoUrlPickerRepoName = (props) => {
|
|
562
|
+
const { repoName, allowedRepos, onChange, rawErrors } = props;
|
|
563
|
+
useEffect(() => {
|
|
564
|
+
if (!repoName) {
|
|
565
|
+
if (allowedRepos == null ? void 0 : allowedRepos.length) {
|
|
566
|
+
onChange(allowedRepos[0]);
|
|
567
|
+
}
|
|
568
|
+
}
|
|
569
|
+
}, [allowedRepos, repoName, onChange]);
|
|
570
|
+
const repoItems = allowedRepos ? allowedRepos.map((i) => ({ label: i, value: i })) : [{ label: "Loading...", value: "loading" }];
|
|
571
|
+
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(FormControl, {
|
|
572
|
+
margin: "normal",
|
|
573
|
+
required: true,
|
|
574
|
+
error: (rawErrors == null ? void 0 : rawErrors.length) > 0 && !repoName
|
|
575
|
+
}, (allowedRepos == null ? void 0 : allowedRepos.length) ? /* @__PURE__ */ React.createElement(Select, {
|
|
576
|
+
native: true,
|
|
577
|
+
label: "Repositories Available",
|
|
578
|
+
onChange: (selected) => String(Array.isArray(selected) ? selected[0] : selected),
|
|
579
|
+
disabled: allowedRepos.length === 1,
|
|
580
|
+
selected: repoName,
|
|
581
|
+
items: repoItems
|
|
582
|
+
}) : /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(InputLabel, {
|
|
583
|
+
htmlFor: "repoNameInput"
|
|
584
|
+
}, "Repository"), /* @__PURE__ */ React.createElement(Input, {
|
|
585
|
+
id: "repoNameInput",
|
|
586
|
+
onChange: (e) => onChange(String(e.target.value)),
|
|
587
|
+
value: repoName
|
|
588
|
+
})), /* @__PURE__ */ React.createElement(FormHelperText, null, "The name of the repository")));
|
|
589
|
+
};
|
|
590
|
+
|
|
603
591
|
function serializeRepoPickerUrl(data) {
|
|
604
592
|
if (!data.host) {
|
|
605
593
|
return void 0;
|
|
@@ -678,14 +666,23 @@ const RepoUrlPicker = (props) => {
|
|
|
678
666
|
var _a2, _b2;
|
|
679
667
|
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedOwners) != null ? _b2 : [];
|
|
680
668
|
}, [uiSchema]);
|
|
669
|
+
const allowedRepos = useMemo(() => {
|
|
670
|
+
var _a2, _b2;
|
|
671
|
+
return (_b2 = (_a2 = uiSchema == null ? void 0 : uiSchema["ui:options"]) == null ? void 0 : _a2.allowedRepos) != null ? _b2 : [];
|
|
672
|
+
}, [uiSchema]);
|
|
681
673
|
useEffect(() => {
|
|
682
674
|
onChange(serializeRepoPickerUrl(state));
|
|
683
675
|
}, [state, onChange]);
|
|
684
676
|
useEffect(() => {
|
|
685
|
-
if (allowedOwners.length
|
|
677
|
+
if (allowedOwners.length > 0) {
|
|
686
678
|
setState((prevState) => ({ ...prevState, owner: allowedOwners[0] }));
|
|
687
679
|
}
|
|
688
680
|
}, [setState, allowedOwners]);
|
|
681
|
+
useEffect(() => {
|
|
682
|
+
if (allowedRepos.length > 0) {
|
|
683
|
+
setState((prevState) => ({ ...prevState, repoName: allowedRepos[0] }));
|
|
684
|
+
}
|
|
685
|
+
}, [setState, allowedRepos]);
|
|
689
686
|
const updateLocalState = useCallback((newState) => {
|
|
690
687
|
setState((prevState) => ({ ...prevState, ...newState }));
|
|
691
688
|
}, [setState]);
|
|
@@ -726,6 +723,7 @@ const RepoUrlPicker = (props) => {
|
|
|
726
723
|
state,
|
|
727
724
|
onChange: updateLocalState
|
|
728
725
|
}), hostType === "bitbucket" && /* @__PURE__ */ React.createElement(BitbucketRepoPicker, {
|
|
726
|
+
allowedOwners,
|
|
729
727
|
rawErrors,
|
|
730
728
|
state,
|
|
731
729
|
onChange: updateLocalState
|
|
@@ -737,11 +735,16 @@ const RepoUrlPicker = (props) => {
|
|
|
737
735
|
rawErrors,
|
|
738
736
|
state,
|
|
739
737
|
onChange: updateLocalState
|
|
738
|
+
}), /* @__PURE__ */ React.createElement(RepoUrlPickerRepoName, {
|
|
739
|
+
repoName: state.repoName,
|
|
740
|
+
allowedRepos,
|
|
741
|
+
onChange: (repoName) => setState((prevState) => ({ ...prevState, repoName })),
|
|
742
|
+
rawErrors
|
|
740
743
|
}));
|
|
741
744
|
};
|
|
742
745
|
|
|
743
746
|
const repoPickerValidation = (value, validation, context) => {
|
|
744
|
-
var _a;
|
|
747
|
+
var _a, _b;
|
|
745
748
|
try {
|
|
746
749
|
const { host, searchParams } = new URL(`https://${value}`);
|
|
747
750
|
const integrationApi = context.apiHolder.get(scmIntegrationsApiRef);
|
|
@@ -755,7 +758,7 @@ const repoPickerValidation = (value, validation, context) => {
|
|
|
755
758
|
if (!searchParams.get("project")) {
|
|
756
759
|
validation.addError("Incomplete repository location provided, project not provided");
|
|
757
760
|
}
|
|
758
|
-
} else {
|
|
761
|
+
} else if (((_b = integrationApi == null ? void 0 : integrationApi.byHost(host)) == null ? void 0 : _b.type) !== "gerrit") {
|
|
759
762
|
if (!searchParams.get("owner")) {
|
|
760
763
|
validation.addError("Incomplete repository location provided, owner not provided");
|
|
761
764
|
}
|
|
@@ -770,7 +773,7 @@ const repoPickerValidation = (value, validation, context) => {
|
|
|
770
773
|
};
|
|
771
774
|
|
|
772
775
|
const OwnedEntityPicker = (props) => {
|
|
773
|
-
var _a, _b;
|
|
776
|
+
var _a, _b, _c, _d;
|
|
774
777
|
const {
|
|
775
778
|
onChange,
|
|
776
779
|
schema: { title = "Entity", description = "An entity from the catalog" },
|
|
@@ -782,6 +785,7 @@ const OwnedEntityPicker = (props) => {
|
|
|
782
785
|
} = props;
|
|
783
786
|
const allowedKinds = (_a = uiSchema["ui:options"]) == null ? void 0 : _a.allowedKinds;
|
|
784
787
|
const defaultKind = (_b = uiSchema["ui:options"]) == null ? void 0 : _b.defaultKind;
|
|
788
|
+
const allowArbitraryValues = (_d = (_c = uiSchema["ui:options"]) == null ? void 0 : _c.allowArbitraryValues) != null ? _d : true;
|
|
785
789
|
const { ownedEntities, loading } = useOwnedEntities(allowedKinds);
|
|
786
790
|
const entityRefs = ownedEntities == null ? void 0 : ownedEntities.items.map((e) => humanizeEntityRef(e, { defaultKind })).filter((n) => n);
|
|
787
791
|
const onSelect = (_, value) => {
|
|
@@ -798,7 +802,7 @@ const OwnedEntityPicker = (props) => {
|
|
|
798
802
|
onChange: onSelect,
|
|
799
803
|
options: entityRefs || [],
|
|
800
804
|
autoSelect: true,
|
|
801
|
-
freeSolo:
|
|
805
|
+
freeSolo: allowArbitraryValues,
|
|
802
806
|
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, {
|
|
803
807
|
...params,
|
|
804
808
|
label: title,
|
|
@@ -932,7 +936,7 @@ const OwnerPickerFieldExtension = scaffolderPlugin.provide(createScaffolderField
|
|
|
932
936
|
}));
|
|
933
937
|
const ScaffolderPage = scaffolderPlugin.provide(createRoutableExtension({
|
|
934
938
|
name: "ScaffolderPage",
|
|
935
|
-
component: () => import('./Router-
|
|
939
|
+
component: () => import('./Router-e14e5f4e.esm.js').then((m) => m.Router),
|
|
936
940
|
mountPoint: rootRouteRef
|
|
937
941
|
}));
|
|
938
942
|
const OwnedEntityPickerFieldExtension = scaffolderPlugin.provide(createScaffolderFieldExtension({
|
|
@@ -945,7 +949,7 @@ const EntityTagsPickerFieldExtension = scaffolderPlugin.provide(createScaffolder
|
|
|
945
949
|
}));
|
|
946
950
|
const NextScaffolderPage = scaffolderPlugin.provide(createRoutableExtension({
|
|
947
951
|
name: "NextScaffolderPage",
|
|
948
|
-
component: () => import('./index-
|
|
952
|
+
component: () => import('./index-8dd91f94.esm.js').then((m) => m.Router),
|
|
949
953
|
mountPoint: rootRouteRef
|
|
950
954
|
}));
|
|
951
955
|
|
|
@@ -1386,4 +1390,4 @@ const TaskPage = ({ loadingText }) => {
|
|
|
1386
1390
|
};
|
|
1387
1391
|
|
|
1388
1392
|
export { OwnedEntityPickerFieldExtension as A, RepoUrlPickerFieldExtension as B, ScaffolderPage as C, scaffolderPlugin as D, EntityPicker as E, FIELD_EXTENSION_WRAPPER_KEY as F, useTemplateSecrets as G, NextScaffolderPage as N, OwnerPicker as O, RepoUrlPicker as R, SecretsContext as S, TemplateTypePicker as T, actionsRouteRef as a, scaffolderListTaskRouteRef as b, scaffolderApiRef as c, scaffolderTaskRouteRef as d, editRouteRef as e, rootRouteRef as f, TaskStatusStepper as g, TaskPageLinks as h, FIELD_EXTENSION_KEY as i, SecretsContextProvider as j, TaskPage as k, legacySelectedTemplateRouteRef as l, EntityNamePicker as m, entityNamePickerValidation as n, EntityTagsPicker as o, repoPickerValidation as p, OwnedEntityPicker as q, registerComponentRouteRef as r, selectedTemplateRouteRef as s, ScaffolderClient as t, createScaffolderFieldExtension as u, ScaffolderFieldExtensions as v, EntityPickerFieldExtension as w, EntityNamePickerFieldExtension as x, EntityTagsPickerFieldExtension as y, OwnerPickerFieldExtension as z };
|
|
1389
|
-
//# sourceMappingURL=index-
|
|
1393
|
+
//# sourceMappingURL=index-a298f509.esm.js.map
|