@backstage/plugin-scaffolder 1.12.0-next.2 → 1.13.0-next.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 +79 -0
- package/alpha/package.json +1 -1
- package/dist/alpha.d.ts +32 -21
- package/dist/alpha.esm.js +13 -21
- package/dist/alpha.esm.js.map +1 -1
- package/dist/esm/alpha/{ListTasksPage-2e8f4176.esm.js → ListTasksPage-a9fab591.esm.js} +2 -2
- package/dist/esm/alpha/{ListTasksPage-2e8f4176.esm.js.map → ListTasksPage-a9fab591.esm.js.map} +1 -1
- package/dist/esm/alpha/{Router-2826a2b8.esm.js → Router-ea3122d2.esm.js} +24 -9
- package/dist/esm/alpha/Router-ea3122d2.esm.js.map +1 -0
- package/dist/esm/alpha/{alpha-714dad1b.esm.js → alpha-0764fae7.esm.js} +243 -255
- package/dist/esm/alpha/alpha-0764fae7.esm.js.map +1 -0
- package/dist/esm/alpha/{index-2131f4a0.esm.js → index-d45f106a.esm.js} +79 -142
- package/dist/esm/alpha/index-d45f106a.esm.js.map +1 -0
- package/dist/esm/index/ListTasksPage-64779a2d.esm.js +1310 -0
- package/dist/esm/index/ListTasksPage-64779a2d.esm.js.map +1 -0
- package/dist/esm/index/{Router-6fd61bff.esm.js → Router-f32000f9.esm.js} +42 -33
- package/dist/esm/index/Router-f32000f9.esm.js.map +1 -0
- package/dist/esm/index/index-8321766a.esm.js +1741 -0
- package/dist/esm/index/index-8321766a.esm.js.map +1 -0
- package/dist/esm/index/index-e3edaa49.esm.js +991 -0
- package/dist/esm/index/index-e3edaa49.esm.js.map +1 -0
- package/dist/index.d.ts +25 -5
- package/dist/index.esm.js +9 -59
- package/dist/index.esm.js.map +1 -1
- package/package.json +23 -23
- package/dist/esm/alpha/Router-2826a2b8.esm.js.map +0 -1
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index-2131f4a0.esm.js","sources":["../../../src/next/TemplateListPage/CategoryPicker.tsx","../../../src/next/TemplateListPage/RegisterExistingButton.tsx","../../../src/next/TemplateListPage/TemplateGroups.tsx","../../../src/next/TemplateListPage/TemplateListPage.tsx","../../../src/next/TemplateWizardPage/TemplateWizardPage.tsx","../../../src/next/TemplateEditorPage/TemplateEditorPage.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/alpha';\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 */\nimport React, { useCallback } from 'react';\n\nimport {\n Entity,\n parseEntityRef,\n stringifyEntityRef,\n} from '@backstage/catalog-model';\nimport { useEntityList } from '@backstage/plugin-catalog-react';\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { Progress, Link, DocsIcon } from '@backstage/core-components';\nimport { Typography } from '@material-ui/core';\nimport {\n errorApiRef,\n useApi,\n useApp,\n useRouteRef,\n} from '@backstage/core-plugin-api';\nimport { TemplateGroup } from '@backstage/plugin-scaffolder-react/alpha';\nimport { viewTechDocRouteRef } from '../../routes';\nimport { nextSelectedTemplateRouteRef } from '../routes';\nimport { useNavigate } from 'react-router-dom';\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 const app = useApp();\n const viewTechDocsLink = useRouteRef(viewTechDocRouteRef);\n const templateRoute = useRouteRef(nextSelectedTemplateRouteRef);\n const navigate = useNavigate();\n const onSelected = useCallback(\n (template: TemplateEntityV1beta3) => {\n const { namespace, name } = parseEntityRef(stringifyEntityRef(template));\n navigate(templateRoute({ namespace, templateName: name }));\n },\n [navigate, templateRoute],\n );\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 const templates = entities\n .filter((e): e is TemplateEntityV1beta3 => filter(e))\n .map(template => {\n const { kind, namespace, name } = parseEntityRef(\n stringifyEntityRef(template),\n );\n const additionalLinks =\n template.metadata.annotations?.['backstage.io/techdocs-ref'] &&\n viewTechDocsLink\n ? [\n {\n icon: app.getSystemIcon('docs') ?? DocsIcon,\n text: 'View TechDocs',\n url: viewTechDocsLink({ kind, namespace, name }),\n },\n ]\n : [];\n\n return {\n template,\n additionalLinks,\n };\n });\n\n return (\n <TemplateGroup\n key={index}\n templates={templates}\n title={title}\n components={{ CardComponent: TemplateCardComponent }}\n onSelected={onSelected}\n />\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 { TemplateGroupFilter, TemplateGroups } from './TemplateGroups';\nimport { registerComponentRouteRef } from '../../routes';\nimport { ContextMenu } from './ContextMenu';\n\nexport type TemplateListPageProps = {\n TemplateCardComponent?: React.ComponentType<{\n template: TemplateEntityV1beta3;\n }>;\n groups?: TemplateGroupFilter[];\n contextMenu?: {\n editor?: boolean;\n actions?: boolean;\n tasks?: boolean;\n };\n};\n\nconst defaultGroup: TemplateGroupFilter = {\n title: 'Templates',\n filter: () => true,\n};\n\nconst createGroupsWithOther = (\n groups: TemplateGroupFilter[],\n): TemplateGroupFilter[] => [\n ...groups,\n {\n title: 'Other Templates',\n filter: e => ![...groups].some(({ filter }) => filter(e)),\n },\n];\n\nexport const TemplateListPage = (props: TemplateListPageProps) => {\n const registerComponentLink = useRouteRef(registerComponentRouteRef);\n const { TemplateCardComponent, groups: givenGroups = [] } = props;\n\n const groups = givenGroups.length\n ? createGroupsWithOther(givenGroups)\n : [defaultGroup];\n\n return (\n <EntityListProvider>\n <Page themeId=\"website\">\n <Header\n pageTitleOverride=\"Create a new component\"\n title=\"Create a new component\"\n subtitle=\"Create new software components using standard templates in your organization\"\n >\n <ContextMenu {...props.contextMenu} />\n </Header>\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 from 'react';\nimport { Navigate, useNavigate } from 'react-router-dom';\nimport { stringifyEntityRef } from '@backstage/catalog-model';\nimport {\n AnalyticsContext,\n useApi,\n useRouteRef,\n useRouteRefParams,\n} from '@backstage/core-plugin-api';\nimport {\n scaffolderApiRef,\n useTemplateSecrets,\n type LayoutOptions,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n FormProps,\n Workflow,\n NextFieldExtensionOptions,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { JsonValue } from '@backstage/types';\nimport { Header, Page } from '@backstage/core-components';\nimport {\n nextRouteRef,\n nextScaffolderTaskRouteRef,\n nextSelectedTemplateRouteRef,\n} from '../routes';\n\nexport type TemplateWizardPageProps = {\n customFieldExtensions: NextFieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n FormProps?: FormProps;\n};\n\nexport const TemplateWizardPage = (props: TemplateWizardPageProps) => {\n const rootRef = useRouteRef(nextRouteRef);\n const taskRoute = useRouteRef(nextScaffolderTaskRouteRef);\n const { secrets } = useTemplateSecrets();\n const scaffolderApi = useApi(scaffolderApiRef);\n const navigate = useNavigate();\n const { templateName, namespace } = useRouteRefParams(\n nextSelectedTemplateRouteRef,\n );\n\n const templateRef = stringifyEntityRef({\n kind: 'Template',\n namespace,\n name: templateName,\n });\n\n const onCreate = async (values: Record<string, JsonValue>) => {\n const { taskId } = await scaffolderApi.scaffold({\n templateRef,\n values,\n secrets,\n });\n\n navigate(taskRoute({ taskId }));\n };\n\n const onError = () => <Navigate to={rootRef()} />;\n\n return (\n <AnalyticsContext attributes={{ entityRef: templateRef }}>\n <Page themeId=\"website\">\n <Header\n pageTitleOverride=\"Create a new component\"\n title=\"Create a new component\"\n subtitle=\"Create new software components using standard templates in your organization\"\n />\n <Workflow\n namespace={namespace}\n templateName={templateName}\n onCreate={onCreate}\n onError={onError}\n extensions={props.customFieldExtensions}\n FormProps={props.FormProps}\n layouts={props.layouts}\n />\n </Page>\n </AnalyticsContext>\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, { useState } from 'react';\nimport { Content, Header, Page } from '@backstage/core-components';\nimport {\n TemplateDirectoryAccess,\n WebFileSystemAccess,\n} from '../../lib/filesystem';\nimport { CustomFieldExplorer } from './CustomFieldExplorer';\nimport { TemplateEditor } from './TemplateEditor';\nimport { TemplateFormPreviewer } from './TemplateFormPreviewer';\nimport { type LayoutOptions } from '@backstage/plugin-scaffolder-react';\nimport { NextFieldExtensionOptions } from '@backstage/plugin-scaffolder-react/alpha';\nimport { TemplateEditorIntro } from '../../components/TemplateEditorPage/TemplateEditorIntro';\n\ntype Selection =\n | {\n type: 'local';\n directory: TemplateDirectoryAccess;\n }\n | {\n type: 'form';\n }\n | {\n type: 'field-explorer';\n };\n\ninterface TemplateEditorPageProps {\n defaultPreviewTemplate?: string;\n customFieldExtensions?: NextFieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n}\n\nexport function TemplateEditorPage(props: TemplateEditorPageProps) {\n const [selection, setSelection] = useState<Selection>();\n\n let content: JSX.Element | null = null;\n if (selection?.type === 'local') {\n content = (\n <TemplateEditor\n directory={selection.directory}\n fieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n layouts={props.layouts}\n />\n );\n } else if (selection?.type === 'form') {\n content = (\n <TemplateFormPreviewer\n defaultPreviewTemplate={props.defaultPreviewTemplate}\n customFieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n layouts={props.layouts}\n />\n );\n } else if (selection?.type === 'field-explorer') {\n content = (\n <CustomFieldExplorer\n customFieldExtensions={props.customFieldExtensions}\n onClose={() => setSelection(undefined)}\n />\n );\n } else {\n content = (\n <Content>\n <TemplateEditorIntro\n onSelect={option => {\n if (option === 'local') {\n WebFileSystemAccess.requestDirectoryAccess()\n .then(directory => setSelection({ type: 'local', directory }))\n .catch(() => {});\n } else if (option === 'form') {\n setSelection({ type: 'form' });\n } else if (option === 'field-explorer') {\n setSelection({ type: 'field-explorer' });\n }\n }}\n />\n </Content>\n );\n }\n\n return (\n <Page themeId=\"home\">\n <Header\n title=\"Template Editor\"\n subtitle=\"Edit, preview, and try out templates and template forms\"\n />\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 React, { PropsWithChildren } from 'react';\nimport { Routes, Route, useOutlet } from 'react-router-dom';\nimport { TemplateListPage } from '../TemplateListPage';\nimport { TemplateWizardPage } from '../TemplateWizardPage';\nimport {\n NextFieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport {\n ScaffolderTaskOutput,\n SecretsContextProvider,\n useCustomFieldExtensions,\n useCustomLayouts,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { TemplateEntityV1beta3 } from '@backstage/plugin-scaffolder-common';\nimport { TemplateGroupFilter } from '../TemplateListPage/TemplateGroups';\nimport { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS } from '../../extensions/default';\n\nimport {\n nextActionsRouteRef,\n nextEditRouteRef,\n nextScaffolderListTaskRouteRef,\n nextScaffolderTaskRouteRef,\n nextSelectedTemplateRouteRef,\n} from '../routes';\nimport { ErrorPage } from '@backstage/core-components';\nimport { OngoingTask } from '../OngoingTask';\nimport { ActionsPage } from '../../components/ActionsPage';\nimport { ListTasksPage } from '../../components/ListTasksPage';\nimport { TemplateEditorPage } from '../TemplateEditorPage';\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 TemplateOutputsComponent?: React.ComponentType<{\n output?: ScaffolderTaskOutput;\n }>;\n };\n groups?: TemplateGroupFilter[];\n // todo(blam): rename this to formProps\n FormProps?: FormProps;\n contextMenu?: {\n /** Whether to show a link to the template editor */\n editor?: boolean;\n /** Whether to show a link to the actions documentation */\n actions?: boolean;\n /** Whether to show a link to the tasks page */\n tasks?: boolean;\n };\n};\n\n/**\n * The Scaffolder Router\n *\n * @alpha\n */\nexport const Router = (props: PropsWithChildren<NextRouterProps>) => {\n const {\n components: {\n TemplateCardComponent,\n TemplateOutputsComponent,\n TaskPageComponent = OngoingTask,\n } = {},\n } = props;\n const outlet = useOutlet() || props.children;\n const customFieldExtensions =\n useCustomFieldExtensions<NextFieldExtensionOptions>(outlet);\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 ] as NextFieldExtensionOptions[];\n\n const customLayouts = useCustomLayouts(outlet);\n\n return (\n <Routes>\n <Route\n path=\"/\"\n element={\n <TemplateListPage\n TemplateCardComponent={TemplateCardComponent}\n contextMenu={props.contextMenu}\n groups={props.groups}\n />\n }\n />\n <Route\n path={nextSelectedTemplateRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateWizardPage\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n FormProps={props.FormProps}\n />\n </SecretsContextProvider>\n }\n />\n <Route\n path={nextScaffolderTaskRouteRef.path}\n element={\n <TaskPageComponent\n TemplateOutputsComponent={TemplateOutputsComponent}\n />\n }\n />\n <Route\n path={nextEditRouteRef.path}\n element={\n <SecretsContextProvider>\n <TemplateEditorPage\n customFieldExtensions={fieldExtensions}\n layouts={customLayouts}\n />\n </SecretsContextProvider>\n }\n />\n\n <Route path={nextActionsRouteRef.path} element={<ActionsPage />} />\n <Route\n path={nextScaffolderListTaskRouteRef.path}\n element={<ListTasksPage />}\n />\n <Route\n path=\"*\"\n element={<ErrorPage status=\"404\" statusMessage=\"Page not found\" />}\n />\n </Routes>\n );\n};\n"],"names":["RouterLink","Link"],"mappings":";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EpE,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
import { E as EntityPicker, n as EntityPickerSchema, o as EntityNamePicker, p as entityNamePickerValidation, q as EntityNamePickerSchema, t as EntityTagsPicker, w as EntityTagsPickerSchema, R as RepoUrlPicker, x as repoPickerValidation, y as RepoUrlPickerSchema, O as OwnerPicker, z as OwnerPickerSchema, B as OwnedEntityPicker, C as OwnedEntityPickerSchema, d as rootRouteRef, F as OwnerListPicker } from './index-0b6cdf44.esm.js';
|
|
2
|
-
import { StatusError, StatusOK, StatusPending, Page, Header, Lifecycle, Content, Progress, ErrorPanel, EmptyState, Table, Link } from '@backstage/core-components';
|
|
3
|
-
import { useApi, useRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import { catalogApiRef, EntityRefLink, CatalogFilterLayout } from '@backstage/plugin-catalog-react';
|
|
5
|
-
import useAsync from 'react-use/lib/useAsync';
|
|
6
|
-
import React, { useState } from 'react';
|
|
7
|
-
import { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';
|
|
8
|
-
import { DateTime, Interval } from 'luxon';
|
|
9
|
-
import humanizeDuration from 'humanize-duration';
|
|
10
|
-
import Typography from '@material-ui/core/Typography';
|
|
11
|
-
import { parseEntityRef } from '@backstage/catalog-model';
|
|
12
|
-
|
|
13
|
-
const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [
|
|
14
|
-
{
|
|
15
|
-
component: EntityPicker,
|
|
16
|
-
name: "EntityPicker",
|
|
17
|
-
schema: EntityPickerSchema
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
component: EntityNamePicker,
|
|
21
|
-
name: "EntityNamePicker",
|
|
22
|
-
validation: entityNamePickerValidation,
|
|
23
|
-
schema: EntityNamePickerSchema
|
|
24
|
-
},
|
|
25
|
-
{
|
|
26
|
-
component: EntityTagsPicker,
|
|
27
|
-
name: "EntityTagsPicker",
|
|
28
|
-
schema: EntityTagsPickerSchema
|
|
29
|
-
},
|
|
30
|
-
{
|
|
31
|
-
component: RepoUrlPicker,
|
|
32
|
-
name: "RepoUrlPicker",
|
|
33
|
-
validation: repoPickerValidation,
|
|
34
|
-
schema: RepoUrlPickerSchema
|
|
35
|
-
},
|
|
36
|
-
{
|
|
37
|
-
component: OwnerPicker,
|
|
38
|
-
name: "OwnerPicker",
|
|
39
|
-
schema: OwnerPickerSchema
|
|
40
|
-
},
|
|
41
|
-
{
|
|
42
|
-
component: OwnedEntityPicker,
|
|
43
|
-
name: "OwnedEntityPicker",
|
|
44
|
-
schema: OwnedEntityPickerSchema
|
|
45
|
-
}
|
|
46
|
-
];
|
|
47
|
-
|
|
48
|
-
const CreatedAtColumn = ({ createdAt }) => {
|
|
49
|
-
const createdAtTime = DateTime.fromISO(createdAt);
|
|
50
|
-
const formatted = Interval.fromDateTimes(createdAtTime, DateTime.local()).toDuration().valueOf();
|
|
51
|
-
return /* @__PURE__ */ React.createElement(Typography, { paragraph: true }, humanizeDuration(formatted, { round: true }), " ago");
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
const OwnerEntityColumn = ({ entityRef }) => {
|
|
55
|
-
var _a, _b, _c;
|
|
56
|
-
const catalogApi = useApi(catalogApiRef);
|
|
57
|
-
const { value, loading, error } = useAsync(
|
|
58
|
-
() => catalogApi.getEntityByRef(entityRef || ""),
|
|
59
|
-
[catalogApi, entityRef]
|
|
60
|
-
);
|
|
61
|
-
if (!entityRef) {
|
|
62
|
-
return /* @__PURE__ */ React.createElement(Typography, { paragraph: true }, "Unknown");
|
|
63
|
-
}
|
|
64
|
-
if (loading || error) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
return /* @__PURE__ */ React.createElement(
|
|
68
|
-
EntityRefLink,
|
|
69
|
-
{
|
|
70
|
-
entityRef: parseEntityRef(entityRef),
|
|
71
|
-
title: (_c = (_b = (_a = value == null ? void 0 : value.spec) == null ? void 0 : _a.profile) == null ? void 0 : _b.displayName) != null ? _c : value == null ? void 0 : value.metadata.name
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const TaskStatusColumn = ({ status }) => {
|
|
77
|
-
switch (status) {
|
|
78
|
-
case "processing":
|
|
79
|
-
return /* @__PURE__ */ React.createElement(StatusPending, null, status);
|
|
80
|
-
case "completed":
|
|
81
|
-
return /* @__PURE__ */ React.createElement(StatusOK, null, status);
|
|
82
|
-
case "error":
|
|
83
|
-
default:
|
|
84
|
-
return /* @__PURE__ */ React.createElement(StatusError, null, status);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const TemplateTitleColumn = ({ entityRef }) => {
|
|
89
|
-
const scaffolder = useApi(scaffolderApiRef);
|
|
90
|
-
const { value, loading, error } = useAsync(
|
|
91
|
-
() => scaffolder.getTemplateParameterSchema(entityRef || ""),
|
|
92
|
-
[scaffolder, entityRef]
|
|
93
|
-
);
|
|
94
|
-
if (loading || error || !entityRef) {
|
|
95
|
-
return null;
|
|
96
|
-
}
|
|
97
|
-
return /* @__PURE__ */ React.createElement(EntityRefLink, { entityRef: parseEntityRef(entityRef), title: value == null ? void 0 : value.title });
|
|
98
|
-
};
|
|
99
|
-
|
|
100
|
-
const ListTaskPageContent = (props) => {
|
|
101
|
-
var _a;
|
|
102
|
-
const { initiallySelectedFilter = "owned" } = props;
|
|
103
|
-
const scaffolderApi = useApi(scaffolderApiRef);
|
|
104
|
-
const rootLink = useRouteRef(rootRouteRef);
|
|
105
|
-
const [ownerFilter, setOwnerFilter] = useState(initiallySelectedFilter);
|
|
106
|
-
const { value, loading, error } = useAsync(() => {
|
|
107
|
-
var _a2;
|
|
108
|
-
if (scaffolderApi.listTasks) {
|
|
109
|
-
return (_a2 = scaffolderApi.listTasks) == null ? void 0 : _a2.call(scaffolderApi, { filterByOwnership: ownerFilter });
|
|
110
|
-
}
|
|
111
|
-
console.warn(
|
|
112
|
-
"listTasks is not implemented in the scaffolderApi, please make sure to implement this method."
|
|
113
|
-
);
|
|
114
|
-
return Promise.resolve({ tasks: [] });
|
|
115
|
-
}, [scaffolderApi, ownerFilter]);
|
|
116
|
-
if (loading) {
|
|
117
|
-
return /* @__PURE__ */ React.createElement(Progress, null);
|
|
118
|
-
}
|
|
119
|
-
if (error) {
|
|
120
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(ErrorPanel, { error }), /* @__PURE__ */ React.createElement(
|
|
121
|
-
EmptyState,
|
|
122
|
-
{
|
|
123
|
-
missing: "info",
|
|
124
|
-
title: "No information to display",
|
|
125
|
-
description: "There is no Tasks or there was an issue communicating with backend."
|
|
126
|
-
}
|
|
127
|
-
));
|
|
128
|
-
}
|
|
129
|
-
return /* @__PURE__ */ React.createElement(CatalogFilterLayout, null, /* @__PURE__ */ React.createElement(CatalogFilterLayout.Filters, null, /* @__PURE__ */ React.createElement(
|
|
130
|
-
OwnerListPicker,
|
|
131
|
-
{
|
|
132
|
-
filter: ownerFilter,
|
|
133
|
-
onSelectOwner: (id) => setOwnerFilter(id)
|
|
134
|
-
}
|
|
135
|
-
)), /* @__PURE__ */ React.createElement(CatalogFilterLayout.Content, null, /* @__PURE__ */ React.createElement(
|
|
136
|
-
Table,
|
|
137
|
-
{
|
|
138
|
-
data: (_a = value == null ? void 0 : value.tasks) != null ? _a : [],
|
|
139
|
-
title: "Tasks",
|
|
140
|
-
columns: [
|
|
141
|
-
{
|
|
142
|
-
title: "Task ID",
|
|
143
|
-
field: "id",
|
|
144
|
-
render: (row) => /* @__PURE__ */ React.createElement(Link, { to: `${rootLink()}/tasks/${row.id}` }, row.id)
|
|
145
|
-
},
|
|
146
|
-
{
|
|
147
|
-
title: "Template",
|
|
148
|
-
render: (row) => {
|
|
149
|
-
var _a2;
|
|
150
|
-
return /* @__PURE__ */ React.createElement(
|
|
151
|
-
TemplateTitleColumn,
|
|
152
|
-
{
|
|
153
|
-
entityRef: (_a2 = row.spec.templateInfo) == null ? void 0 : _a2.entityRef
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
},
|
|
158
|
-
{
|
|
159
|
-
title: "Created",
|
|
160
|
-
field: "createdAt",
|
|
161
|
-
render: (row) => /* @__PURE__ */ React.createElement(CreatedAtColumn, { createdAt: row.createdAt })
|
|
162
|
-
},
|
|
163
|
-
{
|
|
164
|
-
title: "Owner",
|
|
165
|
-
field: "createdBy",
|
|
166
|
-
render: (row) => {
|
|
167
|
-
var _a2, _b;
|
|
168
|
-
return /* @__PURE__ */ React.createElement(OwnerEntityColumn, { entityRef: (_b = (_a2 = row.spec) == null ? void 0 : _a2.user) == null ? void 0 : _b.ref });
|
|
169
|
-
}
|
|
170
|
-
},
|
|
171
|
-
{
|
|
172
|
-
title: "Status",
|
|
173
|
-
field: "status",
|
|
174
|
-
render: (row) => /* @__PURE__ */ React.createElement(TaskStatusColumn, { status: row.status })
|
|
175
|
-
}
|
|
176
|
-
]
|
|
177
|
-
}
|
|
178
|
-
)));
|
|
179
|
-
};
|
|
180
|
-
const ListTasksPage = (props) => {
|
|
181
|
-
return /* @__PURE__ */ React.createElement(Page, { themeId: "home" }, /* @__PURE__ */ React.createElement(
|
|
182
|
-
Header,
|
|
183
|
-
{
|
|
184
|
-
pageTitleOverride: "Templates Tasks",
|
|
185
|
-
title: /* @__PURE__ */ React.createElement(React.Fragment, null, "List template tasks ", /* @__PURE__ */ React.createElement(Lifecycle, { shorthand: true, alpha: true })),
|
|
186
|
-
subtitle: "All tasks that have been started"
|
|
187
|
-
}
|
|
188
|
-
), /* @__PURE__ */ React.createElement(Content, null, /* @__PURE__ */ React.createElement(ListTaskPageContent, { ...props })));
|
|
189
|
-
};
|
|
190
|
-
|
|
191
|
-
export { DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS as D, ListTasksPage as L };
|
|
192
|
-
//# sourceMappingURL=ListTasksPage-fa403ee3.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListTasksPage-fa403ee3.esm.js","sources":["../../../src/extensions/default.ts","../../../src/components/ListTasksPage/columns/CreatedAtColumn.tsx","../../../src/components/ListTasksPage/columns/OwnerEntityColumn.tsx","../../../src/components/ListTasksPage/columns/TaskStatusColumn.tsx","../../../src/components/ListTasksPage/columns/TemplateTitleColumn.tsx","../../../src/components/ListTasksPage/ListTasksPage.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 */\nimport {\n EntityPicker,\n EntityPickerSchema,\n} from '../components/fields/EntityPicker/EntityPicker';\nimport {\n EntityNamePicker,\n EntityNamePickerSchema,\n} from '../components/fields/EntityNamePicker/EntityNamePicker';\nimport { entityNamePickerValidation } from '../components/fields/EntityNamePicker/validation';\nimport {\n EntityTagsPicker,\n EntityTagsPickerSchema,\n} from '../components/fields/EntityTagsPicker/EntityTagsPicker';\nimport {\n OwnerPicker,\n OwnerPickerSchema,\n} from '../components/fields/OwnerPicker/OwnerPicker';\nimport {\n RepoUrlPicker,\n RepoUrlPickerSchema,\n} from '../components/fields/RepoUrlPicker/RepoUrlPicker';\nimport { repoPickerValidation } from '../components/fields/RepoUrlPicker/validation';\nimport {\n OwnedEntityPicker,\n OwnedEntityPickerSchema,\n} from '../components/fields/OwnedEntityPicker/OwnedEntityPicker';\n\nexport const DEFAULT_SCAFFOLDER_FIELD_EXTENSIONS = [\n {\n component: EntityPicker,\n name: 'EntityPicker',\n schema: EntityPickerSchema,\n },\n {\n component: EntityNamePicker,\n name: 'EntityNamePicker',\n validation: entityNamePickerValidation,\n schema: EntityNamePickerSchema,\n },\n {\n component: EntityTagsPicker,\n name: 'EntityTagsPicker',\n schema: EntityTagsPickerSchema,\n },\n {\n component: RepoUrlPicker,\n name: 'RepoUrlPicker',\n validation: repoPickerValidation,\n schema: RepoUrlPickerSchema,\n },\n {\n component: OwnerPicker,\n name: 'OwnerPicker',\n schema: OwnerPickerSchema,\n },\n {\n component: OwnedEntityPicker,\n name: 'OwnedEntityPicker',\n schema: OwnedEntityPickerSchema,\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 { DateTime, Interval } from 'luxon';\nimport humanizeDuration from 'humanize-duration';\nimport React from 'react';\nimport Typography from '@material-ui/core/Typography';\n\nexport const CreatedAtColumn = ({ createdAt }: { createdAt: string }) => {\n const createdAtTime = DateTime.fromISO(createdAt);\n const formatted = Interval.fromDateTimes(createdAtTime, DateTime.local())\n .toDuration()\n .valueOf();\n\n return (\n <Typography paragraph>\n {humanizeDuration(formatted, { round: true })} ago\n </Typography>\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 { useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\n\nimport useAsync from 'react-use/lib/useAsync';\n\nimport { catalogApiRef, EntityRefLink } from '@backstage/plugin-catalog-react';\nimport { parseEntityRef, UserEntity } from '@backstage/catalog-model';\nimport Typography from '@material-ui/core/Typography';\n\nexport const OwnerEntityColumn = ({ entityRef }: { entityRef?: string }) => {\n const catalogApi = useApi(catalogApiRef);\n\n const { value, loading, error } = useAsync(\n () => catalogApi.getEntityByRef(entityRef || ''),\n [catalogApi, entityRef],\n );\n\n if (!entityRef) {\n return <Typography paragraph>Unknown</Typography>;\n }\n\n if (loading || error) {\n return null;\n }\n\n return (\n <EntityRefLink\n entityRef={parseEntityRef(entityRef)}\n title={\n (value as UserEntity)?.spec?.profile?.displayName ??\n value?.metadata.name\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 */\nimport {\n StatusError,\n StatusOK,\n StatusPending,\n} from '@backstage/core-components';\nimport React from 'react';\n\nexport const TaskStatusColumn = ({ status }: { status: string }) => {\n switch (status) {\n case 'processing':\n return <StatusPending>{status}</StatusPending>;\n case 'completed':\n return <StatusOK>{status}</StatusOK>;\n case 'error':\n default:\n return <StatusError>{status}</StatusError>;\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 { useApi } from '@backstage/core-plugin-api';\nimport React from 'react';\nimport { scaffolderApiRef } from '@backstage/plugin-scaffolder-react';\nimport useAsync from 'react-use/lib/useAsync';\nimport { parseEntityRef } from '@backstage/catalog-model';\nimport { EntityRefLink } from '@backstage/plugin-catalog-react';\n\nexport const TemplateTitleColumn = ({ entityRef }: { entityRef?: string }) => {\n const scaffolder = useApi(scaffolderApiRef);\n const { value, loading, error } = useAsync(\n () => scaffolder.getTemplateParameterSchema(entityRef || ''),\n [scaffolder, entityRef],\n );\n\n if (loading || error || !entityRef) {\n return null;\n }\n\n return (\n <EntityRefLink entityRef={parseEntityRef(entityRef)} title={value?.title} />\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 {\n Content,\n EmptyState,\n ErrorPanel,\n Header,\n Lifecycle,\n Link,\n Page,\n Progress,\n Table,\n} from '@backstage/core-components';\nimport { useApi, useRouteRef } from '@backstage/core-plugin-api';\nimport { CatalogFilterLayout } from '@backstage/plugin-catalog-react';\nimport useAsync from 'react-use/lib/useAsync';\nimport React, { useState } from 'react';\nimport {\n ScaffolderTask,\n scaffolderApiRef,\n} from '@backstage/plugin-scaffolder-react';\nimport { OwnerListPicker } from './OwnerListPicker';\nimport {\n CreatedAtColumn,\n OwnerEntityColumn,\n TaskStatusColumn,\n TemplateTitleColumn,\n} from './columns';\nimport { rootRouteRef } from '../../routes';\n\nexport interface MyTaskPageProps {\n initiallySelectedFilter?: 'owned' | 'all';\n}\n\nconst ListTaskPageContent = (props: MyTaskPageProps) => {\n const { initiallySelectedFilter = 'owned' } = props;\n\n const scaffolderApi = useApi(scaffolderApiRef);\n const rootLink = useRouteRef(rootRouteRef);\n\n const [ownerFilter, setOwnerFilter] = useState(initiallySelectedFilter);\n const { value, loading, error } = useAsync(() => {\n if (scaffolderApi.listTasks) {\n return scaffolderApi.listTasks?.({ filterByOwnership: ownerFilter });\n }\n\n // eslint-disable-next-line no-console\n console.warn(\n 'listTasks is not implemented in the scaffolderApi, please make sure to implement this method.',\n );\n\n return Promise.resolve({ tasks: [] });\n }, [scaffolderApi, ownerFilter]);\n\n if (loading) {\n return <Progress />;\n }\n\n if (error) {\n return (\n <>\n <ErrorPanel error={error} />\n <EmptyState\n missing=\"info\"\n title=\"No information to display\"\n description=\"There is no Tasks or there was an issue communicating with backend.\"\n />\n </>\n );\n }\n\n return (\n <CatalogFilterLayout>\n <CatalogFilterLayout.Filters>\n <OwnerListPicker\n filter={ownerFilter}\n onSelectOwner={id => setOwnerFilter(id)}\n />\n </CatalogFilterLayout.Filters>\n <CatalogFilterLayout.Content>\n <Table<ScaffolderTask>\n data={value?.tasks ?? []}\n title=\"Tasks\"\n columns={[\n {\n title: 'Task ID',\n field: 'id',\n render: row => (\n <Link to={`${rootLink()}/tasks/${row.id}`}>{row.id}</Link>\n ),\n },\n {\n title: 'Template',\n render: row => (\n <TemplateTitleColumn\n entityRef={row.spec.templateInfo?.entityRef}\n />\n ),\n },\n {\n title: 'Created',\n field: 'createdAt',\n render: row => <CreatedAtColumn createdAt={row.createdAt} />,\n },\n {\n title: 'Owner',\n field: 'createdBy',\n render: row => (\n <OwnerEntityColumn entityRef={row.spec?.user?.ref} />\n ),\n },\n {\n title: 'Status',\n field: 'status',\n render: row => <TaskStatusColumn status={row.status} />,\n },\n ]}\n />\n </CatalogFilterLayout.Content>\n </CatalogFilterLayout>\n );\n};\n\nexport const ListTasksPage = (props: MyTaskPageProps) => {\n return (\n <Page themeId=\"home\">\n <Header\n pageTitleOverride=\"Templates Tasks\"\n title={\n <>\n List template tasks <Lifecycle shorthand alpha />\n </>\n }\n subtitle=\"All tasks that have been started\"\n />\n <Content>\n <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