@backstage/plugin-scaffolder 1.12.0 → 1.13.0-next.1
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 +67 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +12 -59
- package/dist/alpha.esm.js +27 -33
- package/dist/alpha.esm.js.map +1 -1
- package/dist/esm/{alpha/ListTasksPage-2e8f4176.esm.js → ListTasksPage-ca799894.esm.js} +3 -2
- package/dist/esm/ListTasksPage-ca799894.esm.js.map +1 -0
- package/dist/esm/{index/Router-6fd61bff.esm.js → Router-1b71c4f0.esm.js} +39 -28
- package/dist/esm/Router-1b71c4f0.esm.js.map +1 -0
- package/dist/esm/TaskPage-589238dc.esm.js +1684 -0
- package/dist/esm/TaskPage-589238dc.esm.js.map +1 -0
- package/dist/esm/TemplateEditorIntro-644bad26.esm.js +1128 -0
- package/dist/esm/TemplateEditorIntro-644bad26.esm.js.map +1 -0
- package/dist/esm/TemplateFormPreviewer-32c3dcf3.esm.js +630 -0
- package/dist/esm/TemplateFormPreviewer-32c3dcf3.esm.js.map +1 -0
- package/dist/esm/TemplateTypePicker-4f07b216.esm.js +58 -0
- package/dist/esm/TemplateTypePicker-4f07b216.esm.js.map +1 -0
- package/dist/esm/{alpha/index-2131f4a0.esm.js → index-bce9c23d.esm.js} +95 -156
- package/dist/esm/index-bce9c23d.esm.js.map +1 -0
- package/dist/index.d.ts +28 -167
- package/dist/index.esm.js +27 -65
- package/dist/index.esm.js.map +1 -1
- package/dist/types/plugin.d-bc532f9e.d.ts +232 -0
- package/package.json +24 -22
- package/dist/esm/alpha/ListTasksPage-2e8f4176.esm.js.map +0 -1
- package/dist/esm/alpha/Router-2826a2b8.esm.js +0 -1566
- package/dist/esm/alpha/Router-2826a2b8.esm.js.map +0 -1
- package/dist/esm/alpha/alpha-714dad1b.esm.js +0 -3422
- package/dist/esm/alpha/alpha-714dad1b.esm.js.map +0 -1
- package/dist/esm/alpha/index-2131f4a0.esm.js.map +0 -1
- package/dist/esm/index/ListTasksPage-fa403ee3.esm.js +0 -192
- package/dist/esm/index/ListTasksPage-fa403ee3.esm.js.map +0 -1
- package/dist/esm/index/Router-6fd61bff.esm.js.map +0 -1
- package/dist/esm/index/index-0b6cdf44.esm.js +0 -3475
- package/dist/esm/index/index-0b6cdf44.esm.js.map +0 -1
- package/dist/esm/index/index-f404fb0b.esm.js +0 -449
- package/dist/esm/index/index-f404fb0b.esm.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateFormPreviewer-32c3dcf3.esm.js","sources":["../../src/next/OngoingTask/ContextMenu.tsx","../../src/next/OngoingTask/OngoingTask.tsx","../../src/next/TemplateEditorPage/TemplateEditorForm.tsx","../../src/next/TemplateEditorPage/CustomFieldExplorer.tsx","../../src/next/TemplateEditorPage/TemplateEditor.tsx","../../src/next/TemplateEditorPage/TemplateFormPreviewer.tsx"],"sourcesContent":["/*\n * Copyright 2023 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 { BackstageTheme } from '@backstage/theme';\nimport {\n IconButton,\n ListItemIcon,\n ListItemText,\n makeStyles,\n MenuItem,\n MenuList,\n Popover,\n} from '@material-ui/core';\nimport { useAsync } from '@react-hookz/web';\nimport Cancel from '@material-ui/icons/Cancel';\nimport Retry from '@material-ui/icons/Repeat';\nimport Toc from '@material-ui/icons/Toc';\nimport MoreVert from '@material-ui/icons/MoreVert';\nimport React, { useState } from 'react';\nimport { useApi } from '@backstage/core-plugin-api';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\n\ntype ContextMenuProps = {\n cancelEnabled?: boolean;\n logsVisible?: boolean;\n onStartOver?: () => void;\n onToggleLogs?: (state: boolean) => void;\n taskId?: string;\n};\n\nconst useStyles = makeStyles((theme: BackstageTheme) => ({\n button: {\n color: theme.palette.common.white,\n },\n}));\n\nexport const ContextMenu = (props: ContextMenuProps) => {\n const { cancelEnabled, logsVisible, onStartOver, onToggleLogs, taskId } =\n props;\n const classes = useStyles();\n const scaffolderApi = useApi(scaffolderApiRef);\n const [anchorEl, setAnchorEl] = useState<HTMLButtonElement>();\n\n const [{ status: cancelStatus }, { execute: cancel }] = useAsync(async () => {\n if (taskId) {\n await scaffolderApi.cancelTask(taskId);\n }\n });\n\n return (\n <>\n <IconButton\n aria-label=\"more\"\n aria-controls=\"long-menu\"\n aria-haspopup=\"true\"\n onClick={(event: React.SyntheticEvent<HTMLButtonElement>) => {\n setAnchorEl(event.currentTarget);\n }}\n data-testid=\"menu-button\"\n color=\"inherit\"\n className={classes.button}\n >\n <MoreVert />\n </IconButton>\n <Popover\n open={Boolean(anchorEl)}\n onClose={() => setAnchorEl(undefined)}\n anchorEl={anchorEl}\n anchorOrigin={{ vertical: 'bottom', horizontal: 'right' }}\n transformOrigin={{ vertical: 'top', horizontal: 'right' }}\n >\n <MenuList>\n <MenuItem onClick={() => onToggleLogs?.(!logsVisible)}>\n <ListItemIcon>\n <Toc fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary={logsVisible ? 'Hide Logs' : 'Show Logs'} />\n </MenuItem>\n <MenuItem onClick={onStartOver}>\n <ListItemIcon>\n <Retry fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Start Over\" />\n </MenuItem>\n <MenuItem\n onClick={cancel}\n disabled={!cancelEnabled || cancelStatus !== 'not-executed'}\n data-testid=\"cancel-task\"\n >\n <ListItemIcon>\n <Cancel fontSize=\"small\" />\n </ListItemIcon>\n <ListItemText primary=\"Cancel\" />\n </MenuItem>\n </MenuList>\n </Popover>\n </>\n );\n};\n","/*\n * Copyright 2023 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, { useCallback, useEffect, useMemo, useState } from 'react';\nimport { Content, ErrorPanel, Header, Page } from '@backstage/core-components';\nimport { useNavigate, useParams } from 'react-router-dom';\nimport { Box, makeStyles, Paper } from '@material-ui/core';\nimport {\n ScaffolderTaskOutput,\n useTaskEventStream,\n} from '@backstage/plugin-scaffolder-react';\nimport { selectedTemplateRouteRef } from '../../routes';\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport qs from 'qs';\nimport { ContextMenu } from './ContextMenu';\nimport {\n DefaultTemplateOutputs,\n TaskLogStream,\n TaskSteps,\n} from '@backstage/plugin-scaffolder-react/alpha';\n\nconst useStyles = makeStyles({\n contentWrapper: {\n display: 'flex',\n flexDirection: 'column',\n },\n});\n\nexport const OngoingTask = (props: {\n TemplateOutputsComponent?: React.ComponentType<{\n output?: ScaffolderTaskOutput;\n }>;\n}) => {\n // todo(blam): check that task Id actually exists, and that it's valid. otherwise redirect to something more useful.\n const { taskId } = useParams();\n const templateRouteRef = useRouteRef(selectedTemplateRouteRef);\n const navigate = useNavigate();\n const taskStream = useTaskEventStream(taskId!);\n const classes = useStyles();\n const steps = useMemo(\n () =>\n taskStream.task?.spec.steps.map(step => ({\n ...step,\n ...taskStream?.steps?.[step.id],\n })) ?? [],\n [taskStream],\n );\n\n const [logsVisible, setLogVisibleState] = useState(false);\n\n useEffect(() => {\n if (taskStream.error) {\n setLogVisibleState(true);\n }\n }, [taskStream.error]);\n\n const activeStep = useMemo(() => {\n for (let i = steps.length - 1; i >= 0; i--) {\n if (steps[i].status !== 'open') {\n return i;\n }\n }\n\n return 0;\n }, [steps]);\n\n const startOver = useCallback(() => {\n const { namespace, name } =\n taskStream.task?.spec.templateInfo?.entity?.metadata ?? {};\n\n const formData = taskStream.task?.spec.parameters ?? {};\n\n if (!namespace || !name) {\n return;\n }\n\n navigate({\n pathname: templateRouteRef({\n namespace,\n templateName: name,\n }),\n search: `?${qs.stringify({ formData: JSON.stringify(formData) })}`,\n });\n }, [\n navigate,\n taskStream.task?.spec.parameters,\n taskStream.task?.spec.templateInfo?.entity?.metadata,\n templateRouteRef,\n ]);\n\n const Outputs = props.TemplateOutputsComponent ?? DefaultTemplateOutputs;\n\n const templateName =\n taskStream.task?.spec.templateInfo?.entity?.metadata.name;\n\n const cancelEnabled = !(taskStream.cancelled || taskStream.completed);\n\n return (\n <Page themeId=\"website\">\n <Header\n pageTitleOverride={`Run of ${templateName}`}\n title={\n <div>\n Run of <code>{templateName}</code>\n </div>\n }\n subtitle={`Task ${taskId}`}\n >\n <ContextMenu\n cancelEnabled={cancelEnabled}\n logsVisible={logsVisible}\n onStartOver={startOver}\n onToggleLogs={setLogVisibleState}\n taskId={taskId}\n />\n </Header>\n <Content className={classes.contentWrapper}>\n {taskStream.error ? (\n <Box paddingBottom={2}>\n <ErrorPanel\n error={taskStream.error}\n title={taskStream.error.message}\n />\n </Box>\n ) : null}\n\n <Box paddingBottom={2}>\n <TaskSteps\n steps={steps}\n activeStep={activeStep}\n isComplete={taskStream.completed}\n isError={Boolean(taskStream.error)}\n />\n </Box>\n\n <Outputs output={taskStream.output} />\n\n {logsVisible ? (\n <Box paddingBottom={2} height=\"100%\">\n <Paper style={{ height: '100%' }}>\n <Box padding={2} height=\"100%\">\n <TaskLogStream logs={taskStream.stepLogs} />\n </Box>\n </Paper>\n </Box>\n ) : null}\n </Content>\n </Page>\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 { useApiHolder } from '@backstage/core-plugin-api';\nimport { JsonObject, JsonValue } from '@backstage/types';\nimport { makeStyles } from '@material-ui/core/styles';\nimport React, { Component, ReactNode, useState } from 'react';\nimport useDebounce from 'react-use/lib/useDebounce';\nimport yaml from 'yaml';\nimport {\n LayoutOptions,\n TemplateParameterSchema,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n NextFieldExtensionOptions,\n Stepper,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { useDryRun } from '../../components/TemplateEditorPage/DryRunContext';\nimport { useDirectoryEditor } from '../../components/TemplateEditorPage/DirectoryEditorContext';\n\nconst useStyles = makeStyles({\n containerWrapper: {\n position: 'relative',\n width: '100%',\n height: '100%',\n },\n container: {\n position: 'absolute',\n top: 0,\n bottom: 0,\n left: 0,\n right: 0,\n overflow: 'auto',\n },\n});\n\ninterface ErrorBoundaryProps {\n invalidator: unknown;\n setErrorText(errorText: string | undefined): void;\n children: ReactNode;\n}\n\ninterface ErrorBoundaryState {\n shouldRender: boolean;\n}\n\nclass ErrorBoundary extends Component<ErrorBoundaryProps, ErrorBoundaryState> {\n state = {\n shouldRender: true,\n };\n\n componentDidUpdate(prevProps: { invalidator: unknown }) {\n if (prevProps.invalidator !== this.props.invalidator) {\n this.setState({ shouldRender: true });\n }\n }\n\n componentDidCatch(error: Error) {\n this.props.setErrorText(error.message);\n this.setState({ shouldRender: false });\n }\n\n render() {\n return this.state.shouldRender ? this.props.children : null;\n }\n}\n\ninterface TemplateEditorFormProps {\n content?: string;\n /** Setting this to true will cause the content to be parsed as if it is the template entity spec */\n contentIsSpec?: boolean;\n setErrorText: (errorText?: string) => void;\n onDryRun?: (data: JsonObject) => Promise<void>;\n fieldExtensions?: NextFieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n}\n\nfunction isJsonObject(value: JsonValue | undefined): value is JsonObject {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/** Shows the a template form that is parsed from the provided content */\nexport function TemplateEditorForm(props: TemplateEditorFormProps) {\n const {\n content,\n contentIsSpec,\n onDryRun,\n setErrorText,\n fieldExtensions = [],\n layouts = [],\n } = props;\n const classes = useStyles();\n const apiHolder = useApiHolder();\n\n const [steps, setSteps] = useState<TemplateParameterSchema['steps']>();\n\n useDebounce(\n () => {\n try {\n if (!content) {\n setSteps(undefined);\n return;\n }\n const parsed: JsonValue = yaml.parse(content);\n\n if (!isJsonObject(parsed)) {\n setSteps(undefined);\n return;\n }\n\n let rootObj = parsed;\n if (!contentIsSpec) {\n const isTemplate =\n String(parsed.kind).toLocaleLowerCase('en-US') === 'template';\n if (!isTemplate) {\n setSteps(undefined);\n return;\n }\n\n rootObj = isJsonObject(parsed.spec) ? parsed.spec : {};\n }\n\n const { parameters } = rootObj;\n\n if (!Array.isArray(parameters)) {\n setErrorText('Template parameters must be an array');\n setSteps(undefined);\n return;\n }\n\n setErrorText();\n setSteps(\n parameters.flatMap(param =>\n isJsonObject(param)\n ? [\n {\n title: String(param.title),\n schema: param,\n },\n ]\n : [],\n ),\n );\n } catch (e) {\n setErrorText(e.message);\n }\n },\n 250,\n [contentIsSpec, content, apiHolder],\n );\n\n if (!steps) {\n return null;\n }\n\n return (\n <div className={classes.containerWrapper}>\n <div className={classes.container}>\n <ErrorBoundary invalidator={steps} setErrorText={setErrorText}>\n <Stepper\n manifest={{ steps, title: 'Template Editor' }}\n extensions={fieldExtensions}\n onCreate={async data => {\n await onDryRun?.(data);\n }}\n layouts={layouts}\n components={{ createButtonText: onDryRun && 'Try It' }}\n />\n </ErrorBoundary>\n </div>\n </div>\n );\n}\n\n/** A version of the TemplateEditorForm that is connected to the DirectoryEditor and DryRun contexts */\nexport function TemplateEditorFormDirectoryEditorDryRun(\n props: Pick<\n TemplateEditorFormProps,\n 'setErrorText' | 'fieldExtensions' | 'layouts'\n >,\n) {\n const { setErrorText, fieldExtensions = [], layouts } = props;\n const dryRun = useDryRun();\n\n const directoryEditor = useDirectoryEditor();\n const { selectedFile } = directoryEditor;\n\n const handleDryRun = async (values: JsonObject) => {\n if (!selectedFile) {\n return;\n }\n\n try {\n await dryRun.execute({\n templateContent: selectedFile.content,\n values,\n files: directoryEditor.files,\n });\n setErrorText();\n } catch (e) {\n setErrorText(String(e.cause || e));\n throw e;\n }\n };\n\n const content =\n selectedFile && selectedFile.path.match(/\\.ya?ml$/)\n ? selectedFile.content\n : undefined;\n\n return (\n <TemplateEditorForm\n onDryRun={handleDryRun}\n fieldExtensions={fieldExtensions}\n setErrorText={setErrorText}\n content={content}\n layouts={layouts}\n />\n );\n}\n\nTemplateEditorForm.DirectoryEditorDryRun =\n TemplateEditorFormDirectoryEditorDryRun;\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 { StreamLanguage } from '@codemirror/language';\nimport { yaml as yamlSupport } from '@codemirror/legacy-modes/mode/yaml';\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n FormControl,\n IconButton,\n InputLabel,\n makeStyles,\n MenuItem,\n Select,\n} from '@material-ui/core';\nimport CloseIcon from '@material-ui/icons/Close';\nimport CodeMirror from '@uiw/react-codemirror';\nimport React, { useCallback, useMemo, useState } from 'react';\nimport yaml from 'yaml';\nimport {\n NextFieldExtensionOptions,\n Form,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport validator from '@rjsf/validator-ajv8';\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"fieldForm preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n fieldForm: {\n gridArea: 'fieldForm',\n },\n preview: {\n gridArea: 'preview',\n },\n}));\n\nexport const CustomFieldExplorer = ({\n customFieldExtensions = [],\n onClose,\n}: {\n customFieldExtensions?: NextFieldExtensionOptions<any, any>[];\n onClose?: () => void;\n}) => {\n const classes = useStyles();\n const fieldOptions = customFieldExtensions.filter(field => !!field.schema);\n const [selectedField, setSelectedField] = useState(fieldOptions[0]);\n const [fieldFormState, setFieldFormState] = useState({});\n const [refreshKey, setRefreshKey] = useState(Date.now());\n const sampleFieldTemplate = useMemo(\n () =>\n yaml.stringify({\n parameters: [\n {\n title: `${selectedField.name} Example`,\n properties: {\n [selectedField.name]: {\n type: selectedField.schema?.returnValue?.type,\n 'ui:field': selectedField.name,\n 'ui:options': fieldFormState,\n },\n },\n },\n ],\n }),\n [fieldFormState, selectedField],\n );\n\n const fieldComponents = useMemo(() => {\n return Object.fromEntries(\n customFieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [customFieldExtensions]);\n\n const handleSelectionChange = useCallback(\n selection => {\n setSelectedField(selection);\n setFieldFormState({});\n },\n [setFieldFormState, setSelectedField],\n );\n\n const handleFieldConfigChange = useCallback(\n state => {\n setFieldFormState(state);\n // Force TemplateEditorForm to re-render since some fields\n // may not be responsive to ui:option changes\n setRefreshKey(Date.now());\n },\n [setFieldFormState, setRefreshKey],\n );\n\n return (\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-field-label\">\n Choose Custom Field Extension\n </InputLabel>\n <Select\n value={selectedField}\n label=\"Choose Custom Field Extension\"\n labelId=\"select-field-label\"\n onChange={e => handleSelectionChange(e.target.value)}\n >\n {fieldOptions.map((option, idx) => (\n <MenuItem key={idx} value={option as any}>\n {option.name}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose}>\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.fieldForm}>\n <Card>\n <CardHeader title=\"Field Options\" />\n <CardContent>\n <Form\n showErrorList={false}\n fields={{ ...fieldComponents }}\n noHtml5Validate\n formData={fieldFormState}\n formContext={{ fieldFormState }}\n onSubmit={e => handleFieldConfigChange(e.formData)}\n validator={validator}\n schema={selectedField.schema?.uiOptions || {}}\n >\n <Button\n variant=\"contained\"\n color=\"primary\"\n type=\"submit\"\n disabled={!selectedField.schema?.uiOptions}\n >\n Apply\n </Button>\n </Form>\n </CardContent>\n </Card>\n </div>\n <div className={classes.preview}>\n <Card>\n <CardHeader title=\"Example Template Spec\" />\n <CardContent>\n <CodeMirror\n readOnly\n theme=\"dark\"\n height=\"100%\"\n extensions={[StreamLanguage.define(yamlSupport)]}\n value={sampleFieldTemplate}\n />\n </CardContent>\n </Card>\n <TemplateEditorForm\n key={refreshKey}\n content={sampleFieldTemplate}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={() => null}\n />\n </div>\n </main>\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 { makeStyles } from '@material-ui/core';\nimport React, { useState } from 'react';\nimport type { LayoutOptions } from '@backstage/plugin-scaffolder-react';\nimport { NextFieldExtensionOptions } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateDirectoryAccess } from '../../lib/filesystem';\nimport { DirectoryEditorProvider } from '../../components/TemplateEditorPage/DirectoryEditorContext';\nimport { DryRunProvider } from '../../components/TemplateEditorPage/DryRunContext';\nimport { DryRunResults } from '../../components/TemplateEditorPage/DryRunResults';\nimport { TemplateEditorBrowser } from '../../components/TemplateEditorPage/TemplateEditorBrowser';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { TemplateEditorTextArea } from '../../components/TemplateEditorPage/TemplateEditorTextArea';\n\nconst useStyles = makeStyles({\n // Reset and fix sizing to make sure scrolling behaves correctly\n root: {\n gridArea: 'pageContent',\n\n display: 'grid',\n gridTemplateAreas: `\n \"browser editor preview\"\n \"results results results\"\n `,\n gridTemplateColumns: '1fr 3fr 2fr',\n gridTemplateRows: '1fr auto',\n },\n browser: {\n gridArea: 'browser',\n overflow: 'auto',\n },\n editor: {\n gridArea: 'editor',\n overflow: 'auto',\n },\n preview: {\n gridArea: 'preview',\n overflow: 'auto',\n },\n results: {\n gridArea: 'results',\n },\n});\n\nexport const TemplateEditor = (props: {\n directory: TemplateDirectoryAccess;\n fieldExtensions?: NextFieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n onClose?: () => void;\n}) => {\n const classes = useStyles();\n\n const [errorText, setErrorText] = useState<string>();\n\n return (\n <DirectoryEditorProvider directory={props.directory}>\n <DryRunProvider>\n <main className={classes.root}>\n <section className={classes.browser}>\n <TemplateEditorBrowser onClose={props.onClose} />\n </section>\n <section className={classes.editor}>\n <TemplateEditorTextArea.DirectoryEditor errorText={errorText} />\n </section>\n <section className={classes.preview}>\n <TemplateEditorForm.DirectoryEditorDryRun\n setErrorText={setErrorText}\n fieldExtensions={props.fieldExtensions}\n layouts={props.layouts}\n />\n </section>\n <section className={classes.results}>\n <DryRunResults />\n </section>\n </main>\n </DryRunProvider>\n </DirectoryEditorProvider>\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 { Entity } from '@backstage/catalog-model';\nimport { alertApiRef, useApi } from '@backstage/core-plugin-api';\nimport {\n catalogApiRef,\n humanizeEntityRef,\n} from '@backstage/plugin-catalog-react';\nimport {\n FormControl,\n IconButton,\n InputLabel,\n LinearProgress,\n makeStyles,\n MenuItem,\n Select,\n} from '@material-ui/core';\nimport CloseIcon from '@material-ui/icons/Close';\nimport React, { useCallback, useState } from 'react';\nimport useAsync from 'react-use/lib/useAsync';\nimport yaml from 'yaml';\nimport { type LayoutOptions } from '@backstage/plugin-scaffolder-react';\nimport { NextFieldExtensionOptions } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { TemplateEditorTextArea } from '../../components/TemplateEditorPage/TemplateEditorTextArea';\n\nconst EXAMPLE_TEMPLATE_PARAMS_YAML = `# Edit the template parameters below to see how they will render in the scaffolder form UI\nparameters:\n - title: Fill in some steps\n required:\n - name\n properties:\n name:\n title: Name\n type: string\n description: Unique name of the component\n owner:\n title: Owner\n type: string\n description: Owner of the component\n ui:field: OwnerPicker\n ui:options:\n catalogFilter:\n kind: Group\n - title: Choose a location\n required:\n - repoUrl\n properties:\n repoUrl:\n title: Repository Location\n type: string\n ui:field: RepoUrlPicker\n ui:options:\n allowedHosts:\n - github.com\nsteps:\n - id: fetch-base\n name: Fetch Base\n action: fetch:template\n input:\n url: ./template\n values:\n name: \\${{parameters.name}}\n`;\n\ntype TemplateOption = {\n label: string;\n value: Entity;\n};\n\nconst useStyles = makeStyles(theme => ({\n root: {\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"controls controls\"\n \"textArea preview\"\n `,\n gridTemplateRows: 'auto 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n controls: {\n gridArea: 'controls',\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n margin: theme.spacing(1),\n },\n textArea: {\n gridArea: 'textArea',\n },\n preview: {\n gridArea: 'preview',\n },\n}));\n\nexport const TemplateFormPreviewer = ({\n defaultPreviewTemplate = EXAMPLE_TEMPLATE_PARAMS_YAML,\n customFieldExtensions = [],\n onClose,\n layouts = [],\n}: {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: NextFieldExtensionOptions<any, any>[];\n onClose?: () => void;\n layouts?: LayoutOptions[];\n}) => {\n const classes = useStyles();\n const alertApi = useApi(alertApiRef);\n const catalogApi = useApi(catalogApiRef);\n const [selectedTemplate, setSelectedTemplate] = useState('');\n const [errorText, setErrorText] = useState<string>();\n const [templateOptions, setTemplateOptions] = useState<TemplateOption[]>([]);\n const [templateYaml, setTemplateYaml] = useState(defaultPreviewTemplate);\n\n const { loading } = useAsync(\n () =>\n catalogApi\n .getEntities({\n filter: { kind: 'template' },\n fields: [\n 'kind',\n 'metadata.namespace',\n 'metadata.name',\n 'metadata.title',\n 'spec.parameters',\n 'spec.steps',\n 'spec.output',\n ],\n })\n .then(({ items }) =>\n setTemplateOptions(\n items.map(template => ({\n label:\n template.metadata.title ??\n humanizeEntityRef(template, { defaultKind: 'template' }),\n value: template,\n })),\n ),\n )\n .catch(e =>\n alertApi.post({\n message: `Error loading exisiting templates: ${e.message}`,\n severity: 'error',\n }),\n ),\n [catalogApi],\n );\n\n const handleSelectChange = useCallback(\n selected => {\n setSelectedTemplate(selected);\n setTemplateYaml(yaml.stringify(selected.spec));\n },\n [setTemplateYaml],\n );\n\n return (\n <>\n {loading && <LinearProgress />}\n <main className={classes.root}>\n <div className={classes.controls}>\n <FormControl variant=\"outlined\" size=\"small\" fullWidth>\n <InputLabel id=\"select-template-label\">\n Load Existing Template\n </InputLabel>\n <Select\n value={selectedTemplate}\n label=\"Load Existing Template\"\n labelId=\"select-template-label\"\n onChange={e => handleSelectChange(e.target.value)}\n >\n {templateOptions.map((option, idx) => (\n <MenuItem key={idx} value={option.value as any}>\n {option.label}\n </MenuItem>\n ))}\n </Select>\n </FormControl>\n\n <IconButton size=\"medium\" onClick={onClose}>\n <CloseIcon />\n </IconButton>\n </div>\n <div className={classes.textArea}>\n <TemplateEditorTextArea\n content={templateYaml}\n onUpdate={setTemplateYaml}\n errorText={errorText}\n />\n </div>\n <div className={classes.preview}>\n <TemplateEditorForm\n content={templateYaml}\n contentIsSpec\n fieldExtensions={customFieldExtensions}\n setErrorText={setErrorText}\n layouts={layouts}\n />\n </div>\n </main>\n </>\n );\n};\n"],"names":["useStyles","_a","_b","_c","_d","_e","_f","makeStyles","yamlSupport","useAsync"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AA0CA,MAAMA,WAAA,GAAY,UAAW,CAAA,CAAC,KAA2B,MAAA;AAAA,EACvD,MAAQ,EAAA;AAAA,IACN,KAAA,EAAO,KAAM,CAAA,OAAA,CAAQ,MAAO,CAAA,KAAA;AAAA,GAC9B;AACF,CAAE,CAAA,CAAA,CAAA;AAEW,MAAA,WAAA,GAAc,CAAC,KAA4B,KAAA;AACtD,EAAA,MAAM,EAAE,aAAe,EAAA,WAAA,EAAa,WAAa,EAAA,YAAA,EAAc,QAC7D,GAAA,KAAA,CAAA;AACF,EAAA,MAAM,UAAUA,WAAU,EAAA,CAAA;AAC1B,EAAM,MAAA,aAAA,GAAgB,OAAO,gBAAgB,CAAA,CAAA;AAC7C,EAAA,MAAM,CAAC,QAAA,EAAU,WAAW,CAAA,GAAI,QAA4B,EAAA,CAAA;AAE5D,EAAM,MAAA,CAAC,EAAE,MAAA,EAAQ,YAAa,EAAA,EAAG,EAAE,OAAA,EAAS,MAAO,EAAC,CAAI,G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,EAAA,SAAA,EAAW,QAAQ,QACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,sBAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,QAAU,EAAA,eAAA;AAAA,MACV,SAAA;AAAA,KAAA;AAAA,GAEJ,CACA,kBAAA,KAAA,CAAA,aAAA,CAAC,KAAI,EAAA,EAAA,SAAA,EAAW,QAAQ,OACtB,EAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,OAAS,EAAA,YAAA;AAAA,MACT,aAAa,EAAA,IAAA;AAAA,MACb,eAAiB,EAAA,qBAAA;AAAA,MACjB,YAAA;AAAA,MACA,OAAA;AAAA,KAAA;AAAA,GAEJ,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import capitalize from 'lodash/capitalize';
|
|
3
|
+
import { Progress } from '@backstage/core-components';
|
|
4
|
+
import { Box, Typography, FormControlLabel, Checkbox, TextField } from '@material-ui/core';
|
|
5
|
+
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
6
|
+
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
|
|
7
|
+
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
8
|
+
import { Autocomplete } from '@material-ui/lab';
|
|
9
|
+
import { useEntityTypeFilter } from '@backstage/plugin-catalog-react';
|
|
10
|
+
import { useApi, alertApiRef } from '@backstage/core-plugin-api';
|
|
11
|
+
|
|
12
|
+
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
13
|
+
const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
|
|
14
|
+
const TemplateTypePicker = () => {
|
|
15
|
+
const alertApi = useApi(alertApiRef);
|
|
16
|
+
const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter();
|
|
17
|
+
if (loading)
|
|
18
|
+
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
19
|
+
if (!availableTypes)
|
|
20
|
+
return null;
|
|
21
|
+
if (error) {
|
|
22
|
+
alertApi.post({
|
|
23
|
+
message: `Failed to load entity types`,
|
|
24
|
+
severity: "error"
|
|
25
|
+
});
|
|
26
|
+
return null;
|
|
27
|
+
}
|
|
28
|
+
return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Categories"), /* @__PURE__ */ React.createElement(
|
|
29
|
+
Autocomplete,
|
|
30
|
+
{
|
|
31
|
+
multiple: true,
|
|
32
|
+
"aria-label": "Categories",
|
|
33
|
+
options: availableTypes,
|
|
34
|
+
value: selectedTypes,
|
|
35
|
+
onChange: (_, value) => setSelectedTypes(value),
|
|
36
|
+
renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(
|
|
37
|
+
FormControlLabel,
|
|
38
|
+
{
|
|
39
|
+
control: /* @__PURE__ */ React.createElement(
|
|
40
|
+
Checkbox,
|
|
41
|
+
{
|
|
42
|
+
icon,
|
|
43
|
+
checkedIcon,
|
|
44
|
+
checked: selected
|
|
45
|
+
}
|
|
46
|
+
),
|
|
47
|
+
label: capitalize(option)
|
|
48
|
+
}
|
|
49
|
+
),
|
|
50
|
+
size: "small",
|
|
51
|
+
popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, { "data-testid": "categories-picker-expand" }),
|
|
52
|
+
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
|
|
53
|
+
}
|
|
54
|
+
));
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export { TemplateTypePicker as T };
|
|
58
|
+
//# sourceMappingURL=TemplateTypePicker-4f07b216.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateTypePicker-4f07b216.esm.js","sources":["../../src/components/TemplateTypePicker/TemplateTypePicker.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 component to select the `type` of `Template` that you will see in the table.\n *\n * @public\n */\nexport const TemplateTypePicker = () => {\n const alertApi = useApi(alertApiRef);\n const { error, loading, availableTypes, selectedTypes, setSelectedTypes } =\n useEntityTypeFilter();\n\n if (loading) return <Progress />;\n\n if (!availableTypes) return null;\n\n if (error) {\n alertApi.post({\n message: `Failed to load entity types`,\n severity: 'error',\n });\n return null;\n }\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 data-testid=\"categories-picker-expand\" />}\n renderInput={params => <TextField {...params} variant=\"outlined\" />}\n />\n </Box>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAiCA,MAAM,IAAO,mBAAA,KAAA,CAAA,aAAA,CAAC,wBAAyB,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA,CAAA;AACxD,MAAM,WAAc,mBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,QAAA,EAAS,OAAQ,EAAA,CAAA,CAAA;AAO5C,MAAM,qBAAqB,MAAM;AACtC,EAAM,MAAA,QAAA,GAAW,OAAO,WAAW,CAAA,CAAA;AACnC,EAAA,MAAM,EAAE,KAAO,EAAA,OAAA,EAAS,gBAAgB,aAAe,EAAA,gBAAA,KACrD,mBAAoB,EAAA,CAAA;AAEtB,EAAI,IAAA,OAAA;AAAS,IAAA,2CAAQ,QAAS,EAAA,IAAA,CAAA,CAAA;AAE9B,EAAA,IAAI,CAAC,cAAA;AAAgB,IAAO,OAAA,IAAA,CAAA;AAE5B,EAAA,IAAI,KAAO,EAAA;AACT,IAAA,QAAA,CAAS,IAAK,CAAA;AAAA,MACZ,OAAS,EAAA,CAAA,2BAAA,CAAA;AAAA,MACT,QAAU,EAAA,OAAA;AAAA,KACX,CAAA,CAAA;AACD,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA,CAAC,GAAI,EAAA,EAAA,EAAA,EAAI,CAAG,EAAA,EAAA,EAAI,CACd,EAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,UAAW,EAAA,EAAA,OAAA,EAAQ,QAAS,EAAA,EAAA,YAAU,CACvC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,YAAA;AAAA,IAAA;AAAA,MACC,QAAQ,EAAA,IAAA;AAAA,MACR,YAAW,EAAA,YAAA;AAAA,MACX,OAAS,EAAA,cAAA;AAAA,MACT,KAAO,EAAA,aAAA;AAAA,MACP,QAAU,EAAA,CAAC,CAAW,EAAA,KAAA,KAAoB,iBAAiB,KAAK,CAAA;AAAA,MAChE,YAAc,EAAA,CAAC,MAAQ,EAAA,EAAE,UACvB,qBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,gBAAA;AAAA,QAAA;AAAA,UACC,OACE,kBAAA,KAAA,CAAA,aAAA;AAAA,YAAC,QAAA;AAAA,YAAA;AAAA,cACC,IAAA;AAAA,cACA,WAAA;AAAA,cACA,OAAS,EAAA,QAAA;AAAA,aAAA;AAAA,WACX;AAAA,UAEF,KAAA,EAAO,WAAW,MAAM,CAAA;AAAA,SAAA;AAAA,OAC1B;AAAA,MAEF,IAAK,EAAA,OAAA;AAAA,MACL,SAAW,kBAAA,KAAA,CAAA,aAAA,CAAC,cAAe,EAAA,EAAA,aAAA,EAAY,0BAA2B,EAAA,CAAA;AAAA,MAClE,aAAa,CAAU,MAAA,qBAAA,KAAA,CAAA,aAAA,CAAC,aAAW,GAAG,MAAA,EAAQ,SAAQ,UAAW,EAAA,CAAA;AAAA,KAAA;AAAA,GAErE,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,29 +1,27 @@
|
|
|
1
1
|
import React, { useCallback, useState } from 'react';
|
|
2
2
|
import { Link, useNavigate, Navigate, useOutlet, Routes, Route } from 'react-router-dom';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import CheckBoxIcon from '@material-ui/icons/CheckBox';
|
|
8
|
-
import CheckBoxOutlineBlankIcon from '@material-ui/icons/CheckBoxOutlineBlank';
|
|
9
|
-
import ExpandMoreIcon from '@material-ui/icons/ExpandMore';
|
|
10
|
-
import { Autocomplete } from '@material-ui/lab';
|
|
11
|
-
import { useApi, alertApiRef, errorApiRef, useApp, useRouteRef, useRouteRefParams, AnalyticsContext } from '@backstage/core-plugin-api';
|
|
3
|
+
import { useRouteRef, useApp, useApi, useRouteRefParams, AnalyticsContext } from '@backstage/core-plugin-api';
|
|
4
|
+
import { DocsIcon, Page, Header, Content, ContentHeader, SupportButton, ErrorPage } from '@backstage/core-components';
|
|
5
|
+
import { EntityListProvider, CatalogFilterLayout, EntitySearchBar, EntityKindPicker, UserListPicker, EntityTagPicker } from '@backstage/plugin-catalog-react';
|
|
6
|
+
import { ScaffolderPageContextMenu, TemplateCategoryPicker, TemplateGroups, Workflow } from '@backstage/plugin-scaffolder-react/alpha';
|
|
12
7
|
import Button from '@material-ui/core/Button';
|
|
13
8
|
import IconButton from '@material-ui/core/IconButton';
|
|
14
9
|
import useMediaQuery from '@material-ui/core/useMediaQuery';
|
|
15
10
|
import AddCircleOutline from '@material-ui/icons/AddCircleOutline';
|
|
16
11
|
import { catalogEntityCreatePermission } from '@backstage/plugin-catalog-common/alpha';
|
|
17
12
|
import { usePermission } from '@backstage/plugin-permission-react';
|
|
13
|
+
import { t as registerComponentRouteRef, o as editRouteRef, p as actionsRouteRef, q as scaffolderListTaskRouteRef, v as viewTechDocRouteRef, k as selectedTemplateRouteRef, r as rootRouteRef, u as scaffolderTaskRouteRef } from './TaskPage-589238dc.esm.js';
|
|
18
14
|
import { parseEntityRef, stringifyEntityRef } from '@backstage/catalog-model';
|
|
19
|
-
import { TemplateGroup, Workflow } from '@backstage/plugin-scaffolder-react/alpha';
|
|
20
|
-
import { v as viewTechDocRouteRef, F as nextSelectedTemplateRouteRef, r as registerComponentRouteRef, G as ContextMenu, H as nextRouteRef, I as nextScaffolderTaskRouteRef, J as TemplateEditor, K as TemplateFormPreviewer, L as CustomFieldExplorer, j as TemplateEditorIntro, W as WebFileSystemAccess, M as nextEditRouteRef, N as nextActionsRouteRef, A as ActionsPage, P as nextScaffolderListTaskRouteRef, Q as OngoingTask } from './alpha-714dad1b.esm.js';
|
|
21
15
|
import { useTemplateSecrets, scaffolderApiRef, useCustomFieldExtensions, useCustomLayouts, SecretsContextProvider } from '@backstage/plugin-scaffolder-react';
|
|
22
|
-
import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS, L as ListTasksPage } from './ListTasksPage-
|
|
16
|
+
import { D as DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS, L as ListTasksPage } from './ListTasksPage-ca799894.esm.js';
|
|
17
|
+
import { T as TemplateEditor, a as TemplateFormPreviewer, C as CustomFieldExplorer, O as OngoingTask } from './TemplateFormPreviewer-32c3dcf3.esm.js';
|
|
18
|
+
import { e as TemplateEditorIntro, W as WebFileSystemAccess, A as ActionsPage } from './TemplateEditorIntro-644bad26.esm.js';
|
|
23
19
|
import '@backstage/integration-react';
|
|
24
20
|
import '@backstage/errors';
|
|
25
21
|
import 'qs';
|
|
26
22
|
import 'zen-observable';
|
|
23
|
+
import '@backstage/catalog-client';
|
|
24
|
+
import '@material-ui/core';
|
|
27
25
|
import '@material-ui/core/FormControl';
|
|
28
26
|
import '@material-ui/lab/Autocomplete';
|
|
29
27
|
import 'react-use/lib/useAsync';
|
|
@@ -34,31 +32,34 @@ import '@material-ui/core/Input';
|
|
|
34
32
|
import '@material-ui/core/InputLabel';
|
|
35
33
|
import 'react-use/lib/useDebounce';
|
|
36
34
|
import 'react-use/lib/useEffectOnce';
|
|
37
|
-
import '@material-ui/
|
|
38
|
-
import '@material-ui/core/
|
|
39
|
-
import '@material-ui/core/
|
|
40
|
-
import '@material-ui/core/
|
|
41
|
-
import '@material-ui/core/
|
|
35
|
+
import '@material-ui/lab';
|
|
36
|
+
import '@material-ui/core/Grid';
|
|
37
|
+
import '@material-ui/core/Step';
|
|
38
|
+
import '@material-ui/core/StepLabel';
|
|
39
|
+
import '@material-ui/core/Stepper';
|
|
42
40
|
import '@material-ui/core/styles';
|
|
43
|
-
import '@material-ui/
|
|
44
|
-
import '@material-ui/icons/
|
|
45
|
-
import '@material-ui/icons/
|
|
46
|
-
import '@material-ui/icons/
|
|
47
|
-
import '@material-ui/icons/Repeat';
|
|
48
|
-
import '@material-ui/icons/Toc';
|
|
41
|
+
import '@material-ui/core/Typography';
|
|
42
|
+
import '@material-ui/icons/Cancel';
|
|
43
|
+
import '@material-ui/icons/Check';
|
|
44
|
+
import '@material-ui/icons/FiberManualRecord';
|
|
49
45
|
import 'classnames';
|
|
50
|
-
import '@material-ui/icons/Settings';
|
|
51
|
-
import '@material-ui/icons/FontDownload';
|
|
52
46
|
import 'luxon';
|
|
47
|
+
import 'react-use/lib/useInterval';
|
|
48
|
+
import '@material-ui/icons/Language';
|
|
53
49
|
import 'humanize-duration';
|
|
54
|
-
import '@
|
|
50
|
+
import '@react-hookz/web';
|
|
51
|
+
import '@material-ui/icons/Repeat';
|
|
52
|
+
import '@material-ui/icons/Toc';
|
|
53
|
+
import '@material-ui/icons/MoreVert';
|
|
55
54
|
import '@codemirror/language';
|
|
56
55
|
import '@codemirror/legacy-modes/mode/yaml';
|
|
57
56
|
import '@material-ui/icons/Close';
|
|
58
57
|
import '@uiw/react-codemirror';
|
|
59
58
|
import 'yaml';
|
|
60
|
-
import '@react-hookz/web';
|
|
61
59
|
import '@rjsf/validator-ajv8';
|
|
60
|
+
import '@material-ui/icons/ExpandMore';
|
|
61
|
+
import '@material-ui/icons/Settings';
|
|
62
|
+
import '@material-ui/icons/FontDownload';
|
|
62
63
|
import '@material-ui/core/Accordion';
|
|
63
64
|
import '@material-ui/core/AccordionDetails';
|
|
64
65
|
import '@material-ui/core/AccordionSummary';
|
|
@@ -66,25 +67,18 @@ import '@material-ui/core/Divider';
|
|
|
66
67
|
import '@material-ui/icons/ExpandLess';
|
|
67
68
|
import '@material-ui/core/List';
|
|
68
69
|
import '@material-ui/core/ListItem';
|
|
70
|
+
import '@material-ui/core/ListItemIcon';
|
|
69
71
|
import '@material-ui/core/ListItemSecondaryAction';
|
|
70
|
-
import '@material-ui/
|
|
71
|
-
import '@material-ui/icons/Check';
|
|
72
|
+
import '@material-ui/core/ListItemText';
|
|
72
73
|
import '@material-ui/icons/Delete';
|
|
73
74
|
import '@material-ui/core/Box';
|
|
74
75
|
import '@material-ui/core/Tab';
|
|
75
76
|
import '@material-ui/core/Tabs';
|
|
76
|
-
import '@material-ui/
|
|
77
|
-
import '@material-ui/
|
|
78
|
-
import '@material-ui/core/StepLabel';
|
|
79
|
-
import '@material-ui/core/Stepper';
|
|
80
|
-
import '@material-ui/icons/FiberManualRecord';
|
|
81
|
-
import 'react-use/lib/useInterval';
|
|
82
|
-
import '@material-ui/icons/Language';
|
|
77
|
+
import '@material-ui/icons/Refresh';
|
|
78
|
+
import '@material-ui/icons/Save';
|
|
83
79
|
import '@material-ui/lab/TreeView';
|
|
84
80
|
import '@material-ui/icons/ChevronRight';
|
|
85
81
|
import '@material-ui/lab/TreeItem';
|
|
86
|
-
import '@material-ui/icons/Refresh';
|
|
87
|
-
import '@material-ui/icons/Save';
|
|
88
82
|
import '@codemirror/view';
|
|
89
83
|
import '@material-ui/core/Card';
|
|
90
84
|
import '@material-ui/core/CardActionArea';
|
|
@@ -92,51 +86,6 @@ import '@material-ui/core/CardContent';
|
|
|
92
86
|
import '@material-ui/core/Tooltip';
|
|
93
87
|
import '@material-ui/icons/InfoOutlined';
|
|
94
88
|
|
|
95
|
-
const icon = /* @__PURE__ */ React.createElement(CheckBoxOutlineBlankIcon, { fontSize: "small" });
|
|
96
|
-
const checkedIcon = /* @__PURE__ */ React.createElement(CheckBoxIcon, { fontSize: "small" });
|
|
97
|
-
const CategoryPicker = () => {
|
|
98
|
-
const alertApi = useApi(alertApiRef);
|
|
99
|
-
const { error, loading, availableTypes, selectedTypes, setSelectedTypes } = useEntityTypeFilter();
|
|
100
|
-
if (loading)
|
|
101
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
102
|
-
if (error) {
|
|
103
|
-
alertApi.post({
|
|
104
|
-
message: `Failed to load entity types with error: ${error}`,
|
|
105
|
-
severity: "error"
|
|
106
|
-
});
|
|
107
|
-
return null;
|
|
108
|
-
}
|
|
109
|
-
if (!availableTypes)
|
|
110
|
-
return null;
|
|
111
|
-
return /* @__PURE__ */ React.createElement(Box, { pb: 1, pt: 1 }, /* @__PURE__ */ React.createElement(Typography, { variant: "button" }, "Categories"), /* @__PURE__ */ React.createElement(
|
|
112
|
-
Autocomplete,
|
|
113
|
-
{
|
|
114
|
-
multiple: true,
|
|
115
|
-
"aria-label": "Categories",
|
|
116
|
-
options: availableTypes,
|
|
117
|
-
value: selectedTypes,
|
|
118
|
-
onChange: (_, value) => setSelectedTypes(value),
|
|
119
|
-
renderOption: (option, { selected }) => /* @__PURE__ */ React.createElement(
|
|
120
|
-
FormControlLabel,
|
|
121
|
-
{
|
|
122
|
-
control: /* @__PURE__ */ React.createElement(
|
|
123
|
-
Checkbox,
|
|
124
|
-
{
|
|
125
|
-
icon,
|
|
126
|
-
checkedIcon,
|
|
127
|
-
checked: selected
|
|
128
|
-
}
|
|
129
|
-
),
|
|
130
|
-
label: capitalize(option)
|
|
131
|
-
}
|
|
132
|
-
),
|
|
133
|
-
size: "small",
|
|
134
|
-
popupIcon: /* @__PURE__ */ React.createElement(ExpandMoreIcon, null),
|
|
135
|
-
renderInput: (params) => /* @__PURE__ */ React.createElement(TextField, { ...params, variant: "outlined" })
|
|
136
|
-
}
|
|
137
|
-
));
|
|
138
|
-
};
|
|
139
|
-
|
|
140
89
|
const RegisterExistingButton = (props) => {
|
|
141
90
|
const { title, to } = props;
|
|
142
91
|
const { allowed } = usePermission({
|
|
@@ -161,62 +110,6 @@ const RegisterExistingButton = (props) => {
|
|
|
161
110
|
) : /* @__PURE__ */ React.createElement(Button, { component: Link, variant: "contained", color: "primary", to }, title);
|
|
162
111
|
};
|
|
163
112
|
|
|
164
|
-
const TemplateGroups = (props) => {
|
|
165
|
-
const { loading, error, entities } = useEntityList();
|
|
166
|
-
const { groups, TemplateCardComponent } = props;
|
|
167
|
-
const errorApi = useApi(errorApiRef);
|
|
168
|
-
const app = useApp();
|
|
169
|
-
const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);
|
|
170
|
-
const templateRoute = useRouteRef(nextSelectedTemplateRouteRef);
|
|
171
|
-
const navigate = useNavigate();
|
|
172
|
-
const onSelected = useCallback(
|
|
173
|
-
(template) => {
|
|
174
|
-
const { namespace, name } = parseEntityRef(stringifyEntityRef(template));
|
|
175
|
-
navigate(templateRoute({ namespace, templateName: name }));
|
|
176
|
-
},
|
|
177
|
-
[navigate, templateRoute]
|
|
178
|
-
);
|
|
179
|
-
if (loading) {
|
|
180
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
181
|
-
}
|
|
182
|
-
if (error) {
|
|
183
|
-
errorApi.post(error);
|
|
184
|
-
return null;
|
|
185
|
-
}
|
|
186
|
-
if (!entities || !entities.length) {
|
|
187
|
-
return /* @__PURE__ */ React.createElement(Typography, { variant: "body2" }, "No templates found that match your filter. Learn more about", " ", /* @__PURE__ */ React.createElement(Link$1, { to: "https://backstage.io/docs/features/software-templates/adding-templates" }, "adding templates"), ".");
|
|
188
|
-
}
|
|
189
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, groups.map(({ title, filter }, index) => {
|
|
190
|
-
const templates = entities.filter((e) => filter(e)).map((template) => {
|
|
191
|
-
var _a, _b;
|
|
192
|
-
const { kind, namespace, name } = parseEntityRef(
|
|
193
|
-
stringifyEntityRef(template)
|
|
194
|
-
);
|
|
195
|
-
const additionalLinks = ((_a = template.metadata.annotations) == null ? void 0 : _a["backstage.io/techdocs-ref"]) && viewTechDocsLink ? [
|
|
196
|
-
{
|
|
197
|
-
icon: (_b = app.getSystemIcon("docs")) != null ? _b : DocsIcon,
|
|
198
|
-
text: "View TechDocs",
|
|
199
|
-
url: viewTechDocsLink({ kind, namespace, name })
|
|
200
|
-
}
|
|
201
|
-
] : [];
|
|
202
|
-
return {
|
|
203
|
-
template,
|
|
204
|
-
additionalLinks
|
|
205
|
-
};
|
|
206
|
-
});
|
|
207
|
-
return /* @__PURE__ */ React.createElement(
|
|
208
|
-
TemplateGroup,
|
|
209
|
-
{
|
|
210
|
-
key: index,
|
|
211
|
-
templates,
|
|
212
|
-
title,
|
|
213
|
-
components: { CardComponent: TemplateCardComponent },
|
|
214
|
-
onSelected
|
|
215
|
-
}
|
|
216
|
-
);
|
|
217
|
-
}));
|
|
218
|
-
};
|
|
219
|
-
|
|
220
113
|
const defaultGroup = {
|
|
221
114
|
title: "Templates",
|
|
222
115
|
filter: () => true
|
|
@@ -229,9 +122,49 @@ const createGroupsWithOther = (groups) => [
|
|
|
229
122
|
}
|
|
230
123
|
];
|
|
231
124
|
const TemplateListPage = (props) => {
|
|
125
|
+
var _a, _b, _c;
|
|
232
126
|
const registerComponentLink = useRouteRef(registerComponentRouteRef);
|
|
233
|
-
const {
|
|
127
|
+
const {
|
|
128
|
+
TemplateCardComponent,
|
|
129
|
+
groups: givenGroups = [],
|
|
130
|
+
templateFilter
|
|
131
|
+
} = props;
|
|
132
|
+
const navigate = useNavigate();
|
|
133
|
+
const editorLink = useRouteRef(editRouteRef);
|
|
134
|
+
const actionsLink = useRouteRef(actionsRouteRef);
|
|
135
|
+
const tasksLink = useRouteRef(scaffolderListTaskRouteRef);
|
|
136
|
+
const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);
|
|
137
|
+
const templateRoute = useRouteRef(selectedTemplateRouteRef);
|
|
138
|
+
const app = useApp();
|
|
234
139
|
const groups = givenGroups.length ? createGroupsWithOther(givenGroups) : [defaultGroup];
|
|
140
|
+
const scaffolderPageContextMenuProps = {
|
|
141
|
+
onEditorClicked: ((_a = props == null ? void 0 : props.contextMenu) == null ? void 0 : _a.editor) !== false ? () => navigate(editorLink()) : void 0,
|
|
142
|
+
onActionsClicked: ((_b = props == null ? void 0 : props.contextMenu) == null ? void 0 : _b.actions) !== false ? () => navigate(actionsLink()) : void 0,
|
|
143
|
+
onTasksClicked: ((_c = props == null ? void 0 : props.contextMenu) == null ? void 0 : _c.tasks) !== false ? () => navigate(tasksLink()) : void 0
|
|
144
|
+
};
|
|
145
|
+
const additionalLinksForEntity = useCallback(
|
|
146
|
+
(template) => {
|
|
147
|
+
var _a2, _b2;
|
|
148
|
+
const { kind, namespace, name } = parseEntityRef(
|
|
149
|
+
stringifyEntityRef(template)
|
|
150
|
+
);
|
|
151
|
+
return ((_a2 = template.metadata.annotations) == null ? void 0 : _a2["backstage.io/techdocs-ref"]) && viewTechDocsLink ? [
|
|
152
|
+
{
|
|
153
|
+
icon: (_b2 = app.getSystemIcon("docs")) != null ? _b2 : DocsIcon,
|
|
154
|
+
text: "View TechDocs",
|
|
155
|
+
url: viewTechDocsLink({ kind, namespace, name })
|
|
156
|
+
}
|
|
157
|
+
] : [];
|
|
158
|
+
},
|
|
159
|
+
[app, viewTechDocsLink]
|
|
160
|
+
);
|
|
161
|
+
const onTemplateSelected = useCallback(
|
|
162
|
+
(template) => {
|
|
163
|
+
const { namespace, name } = parseEntityRef(stringifyEntityRef(template));
|
|
164
|
+
navigate(templateRoute({ namespace, templateName: name }));
|
|
165
|
+
},
|
|
166
|
+
[navigate, templateRoute]
|
|
167
|
+
);
|
|
235
168
|
return /* @__PURE__ */ React.createElement(EntityListProvider, null, /* @__PURE__ */ React.createElement(Page, { themeId: "website" }, /* @__PURE__ */ React.createElement(
|
|
236
169
|
Header,
|
|
237
170
|
{
|
|
@@ -239,7 +172,7 @@ const TemplateListPage = (props) => {
|
|
|
239
172
|
title: "Create a new component",
|
|
240
173
|
subtitle: "Create new software components using standard templates in your organization"
|
|
241
174
|
},
|
|
242
|
-
/* @__PURE__ */ React.createElement(
|
|
175
|
+
/* @__PURE__ */ React.createElement(ScaffolderPageContextMenu, { ...scaffolderPageContextMenuProps })
|
|
243
176
|
), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ContentHeader, { title: "Available Templates" }, /* @__PURE__ */ React.createElement(
|
|
244
177
|
RegisterExistingButton,
|
|
245
178
|
{
|
|
@@ -252,23 +185,26 @@ const TemplateListPage = (props) => {
|
|
|
252
185
|
initialFilter: "all",
|
|
253
186
|
availableFilters: ["all", "starred"]
|
|
254
187
|
}
|
|
255
|
-
), /* @__PURE__ */ React.createElement(
|
|
188
|
+
), /* @__PURE__ */ React.createElement(TemplateCategoryPicker, null), /* @__PURE__ */ React.createElement(EntityTagPicker, null)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
|
|
256
189
|
TemplateGroups,
|
|
257
190
|
{
|
|
258
191
|
groups,
|
|
259
|
-
|
|
192
|
+
templateFilter,
|
|
193
|
+
TemplateCardComponent,
|
|
194
|
+
onTemplateSelected,
|
|
195
|
+
additionalLinksForEntity
|
|
260
196
|
}
|
|
261
197
|
))))));
|
|
262
198
|
};
|
|
263
199
|
|
|
264
200
|
const TemplateWizardPage = (props) => {
|
|
265
|
-
const rootRef = useRouteRef(
|
|
266
|
-
const taskRoute = useRouteRef(
|
|
201
|
+
const rootRef = useRouteRef(rootRouteRef);
|
|
202
|
+
const taskRoute = useRouteRef(scaffolderTaskRouteRef);
|
|
267
203
|
const { secrets } = useTemplateSecrets();
|
|
268
204
|
const scaffolderApi = useApi(scaffolderApiRef);
|
|
269
205
|
const navigate = useNavigate();
|
|
270
206
|
const { templateName, namespace } = useRouteRefParams(
|
|
271
|
-
|
|
207
|
+
selectedTemplateRouteRef
|
|
272
208
|
);
|
|
273
209
|
const templateRef = stringifyEntityRef({
|
|
274
210
|
kind: "Template",
|
|
@@ -367,7 +303,9 @@ const Router = (props) => {
|
|
|
367
303
|
components: {
|
|
368
304
|
TemplateCardComponent,
|
|
369
305
|
TemplateOutputsComponent,
|
|
370
|
-
TaskPageComponent = OngoingTask
|
|
306
|
+
TaskPageComponent = OngoingTask,
|
|
307
|
+
TemplateListPageComponent = TemplateListPage,
|
|
308
|
+
TemplateWizardPageComponent = TemplateWizardPage
|
|
371
309
|
} = {}
|
|
372
310
|
} = props;
|
|
373
311
|
const outlet = useOutlet() || props.children;
|
|
@@ -386,20 +324,21 @@ const Router = (props) => {
|
|
|
386
324
|
{
|
|
387
325
|
path: "/",
|
|
388
326
|
element: /* @__PURE__ */ React.createElement(
|
|
389
|
-
|
|
327
|
+
TemplateListPageComponent,
|
|
390
328
|
{
|
|
391
329
|
TemplateCardComponent,
|
|
392
330
|
contextMenu: props.contextMenu,
|
|
393
|
-
groups: props.groups
|
|
331
|
+
groups: props.groups,
|
|
332
|
+
templateFilter: props.templateFilter
|
|
394
333
|
}
|
|
395
334
|
)
|
|
396
335
|
}
|
|
397
336
|
), /* @__PURE__ */ React.createElement(
|
|
398
337
|
Route,
|
|
399
338
|
{
|
|
400
|
-
path:
|
|
339
|
+
path: selectedTemplateRouteRef.path,
|
|
401
340
|
element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(
|
|
402
|
-
|
|
341
|
+
TemplateWizardPageComponent,
|
|
403
342
|
{
|
|
404
343
|
customFieldExtensions: fieldExtensions,
|
|
405
344
|
layouts: customLayouts,
|
|
@@ -410,7 +349,7 @@ const Router = (props) => {
|
|
|
410
349
|
), /* @__PURE__ */ React.createElement(
|
|
411
350
|
Route,
|
|
412
351
|
{
|
|
413
|
-
path:
|
|
352
|
+
path: scaffolderTaskRouteRef.path,
|
|
414
353
|
element: /* @__PURE__ */ React.createElement(
|
|
415
354
|
TaskPageComponent,
|
|
416
355
|
{
|
|
@@ -421,7 +360,7 @@ const Router = (props) => {
|
|
|
421
360
|
), /* @__PURE__ */ React.createElement(
|
|
422
361
|
Route,
|
|
423
362
|
{
|
|
424
|
-
path:
|
|
363
|
+
path: editRouteRef.path,
|
|
425
364
|
element: /* @__PURE__ */ React.createElement(SecretsContextProvider, null, /* @__PURE__ */ React.createElement(
|
|
426
365
|
TemplateEditorPage,
|
|
427
366
|
{
|
|
@@ -430,10 +369,10 @@ const Router = (props) => {
|
|
|
430
369
|
}
|
|
431
370
|
))
|
|
432
371
|
}
|
|
433
|
-
), /* @__PURE__ */ React.createElement(Route, { path:
|
|
372
|
+
), /* @__PURE__ */ React.createElement(Route, { path: actionsRouteRef.path, element: /* @__PURE__ */ React.createElement(ActionsPage, null) }), /* @__PURE__ */ React.createElement(
|
|
434
373
|
Route,
|
|
435
374
|
{
|
|
436
|
-
path:
|
|
375
|
+
path: scaffolderListTaskRouteRef.path,
|
|
437
376
|
element: /* @__PURE__ */ React.createElement(ListTasksPage, null)
|
|
438
377
|
}
|
|
439
378
|
), /* @__PURE__ */ React.createElement(
|
|
@@ -446,4 +385,4 @@ const Router = (props) => {
|
|
|
446
385
|
};
|
|
447
386
|
|
|
448
387
|
export { Router };
|
|
449
|
-
//# sourceMappingURL=index-
|
|
388
|
+
//# sourceMappingURL=index-bce9c23d.esm.js.map
|