@backstage/plugin-scaffolder 1.26.0-next.1 → 1.26.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 +83 -0
- package/alpha/package.json +1 -1
- package/dist/alpha/components/TemplateEditorPage/CustomFieldExplorer.esm.js +61 -29
- package/dist/alpha/components/TemplateEditorPage/CustomFieldExplorer.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/CustomFieldPlaygroud.esm.js +36 -13
- package/dist/alpha/components/TemplateEditorPage/CustomFieldPlaygroud.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/CustomFieldsPage.esm.js +6 -15
- package/dist/alpha/components/TemplateEditorPage/CustomFieldsPage.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/DirectoryEditorContext.esm.js +4 -3
- package/dist/alpha/components/TemplateEditorPage/DirectoryEditorContext.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditor.esm.js +35 -80
- package/dist/alpha/components/TemplateEditorPage/TemplateEditor.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorBrowser.esm.js +9 -6
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorBrowser.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorForm.esm.js +5 -2
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorForm.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js +17 -16
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorIntro.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorLayout.esm.js +94 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorLayout.esm.js.map +1 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js +22 -34
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorPage.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorTextArea.esm.js +10 -20
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorTextArea.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbar.esm.js +42 -14
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbar.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarFileMenu.esm.js +73 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarFileMenu.esm.js.map +1 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarTemplatesMenu.esm.js +84 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateEditorToolbarTemplatesMenu.esm.js.map +1 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateFormPage.esm.js +3 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateFormPage.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateFormPreviewer.esm.js +58 -95
- package/dist/alpha/components/TemplateEditorPage/TemplateFormPreviewer.esm.js.map +1 -1
- package/dist/alpha/components/TemplateEditorPage/TemplateIntroPage.esm.js +54 -0
- package/dist/alpha/components/TemplateEditorPage/TemplateIntroPage.esm.js.map +1 -0
- package/dist/alpha/components/TemplateEditorPage/useTemplateDirectory.esm.js +33 -0
- package/dist/alpha/components/TemplateEditorPage/useTemplateDirectory.esm.js.map +1 -0
- package/dist/alpha.d.ts +25 -6
- package/dist/components/ActionsPage/ActionsPage.esm.js +42 -8
- package/dist/components/ActionsPage/ActionsPage.esm.js.map +1 -1
- package/dist/components/Router/Router.esm.js +9 -7
- package/dist/components/Router/Router.esm.js.map +1 -1
- package/dist/components/fields/EntityPicker/EntityPicker.esm.js +3 -3
- package/dist/components/fields/EntityPicker/EntityPicker.esm.js.map +1 -1
- package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js +3 -3
- package/dist/components/fields/MultiEntityPicker/MultiEntityPicker.esm.js.map +1 -1
- package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js +3 -3
- package/dist/components/fields/MyGroupsPicker/MyGroupsPicker.esm.js.map +1 -1
- package/dist/lib/filesystem/WebFileSystemAccess.esm.js +1 -13
- package/dist/lib/filesystem/WebFileSystemAccess.esm.js.map +1 -1
- package/dist/lib/filesystem/WebFileSystemStore.esm.js +15 -0
- package/dist/lib/filesystem/WebFileSystemStore.esm.js.map +1 -0
- package/dist/lib/filesystem/createExampleTemplate.esm.js +1 -0
- package/dist/lib/filesystem/createExampleTemplate.esm.js.map +1 -1
- package/dist/translation.esm.js +40 -5
- package/dist/translation.esm.js.map +1 -1
- package/package.json +27 -27
- package/dist/alpha/components/TemplateEditorPage/TemplatePage.esm.js +0 -52
- package/dist/alpha/components/TemplateEditorPage/TemplatePage.esm.js.map +0 -1
|
@@ -1,93 +1,48 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
1
|
+
import React, { useState, useCallback } from 'react';
|
|
2
|
+
import { useNavigate } from 'react-router-dom';
|
|
3
|
+
import { useRouteRef } from '@backstage/core-plugin-api';
|
|
4
|
+
import { editRouteRef } from '../../../routes.esm.js';
|
|
5
|
+
import { useTemplateDirectory } from './useTemplateDirectory.esm.js';
|
|
4
6
|
import { DirectoryEditorProvider } from './DirectoryEditorContext.esm.js';
|
|
7
|
+
import { TemplateEditorLayout, TemplateEditorLayoutToolbar, TemplateEditorLayoutBrowser, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview, TemplateEditorLayoutConsole } from './TemplateEditorLayout.esm.js';
|
|
5
8
|
import { TemplateEditorToolbar } from './TemplateEditorToolbar.esm.js';
|
|
9
|
+
import { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu.esm.js';
|
|
6
10
|
import { TemplateEditorBrowser } from './TemplateEditorBrowser.esm.js';
|
|
7
|
-
import { DryRunProvider } from './DryRunContext.esm.js';
|
|
8
11
|
import { TemplateEditorTextArea } from './TemplateEditorTextArea.esm.js';
|
|
9
12
|
import { TemplateEditorForm } from './TemplateEditorForm.esm.js';
|
|
13
|
+
import { DryRunProvider } from './DryRunContext.esm.js';
|
|
10
14
|
import { DryRunResults } from './DryRunResults/DryRunResults.esm.js';
|
|
11
15
|
|
|
12
|
-
const useStyles = makeStyles(
|
|
13
|
-
(theme) => ({
|
|
14
|
-
// Reset and fix sizing to make sure scrolling behaves correctly
|
|
15
|
-
root: {
|
|
16
|
-
height: "100%",
|
|
17
|
-
gridArea: "pageContent",
|
|
18
|
-
display: "grid",
|
|
19
|
-
gridTemplateAreas: `
|
|
20
|
-
"toolbar toolbar toolbar"
|
|
21
|
-
"browser editor preview"
|
|
22
|
-
"results results results"
|
|
23
|
-
`,
|
|
24
|
-
gridTemplateColumns: "1fr 3fr 2fr",
|
|
25
|
-
gridTemplateRows: "auto 1fr auto"
|
|
26
|
-
},
|
|
27
|
-
toolbar: {
|
|
28
|
-
gridArea: "toolbar"
|
|
29
|
-
},
|
|
30
|
-
browser: {
|
|
31
|
-
gridArea: "browser",
|
|
32
|
-
overflow: "auto"
|
|
33
|
-
},
|
|
34
|
-
editor: {
|
|
35
|
-
gridArea: "editor",
|
|
36
|
-
overflow: "auto",
|
|
37
|
-
borderLeft: `1px solid ${theme.palette.divider}`
|
|
38
|
-
},
|
|
39
|
-
preview: {
|
|
40
|
-
gridArea: "preview",
|
|
41
|
-
position: "relative",
|
|
42
|
-
borderLeft: `1px solid ${theme.palette.divider}`,
|
|
43
|
-
backgroundColor: theme.palette.background.default
|
|
44
|
-
},
|
|
45
|
-
scroll: {
|
|
46
|
-
position: "absolute",
|
|
47
|
-
top: 0,
|
|
48
|
-
left: 0,
|
|
49
|
-
right: 0,
|
|
50
|
-
bottom: 0,
|
|
51
|
-
padding: theme.spacing(1),
|
|
52
|
-
overflow: "auto"
|
|
53
|
-
},
|
|
54
|
-
results: {
|
|
55
|
-
gridArea: "results"
|
|
56
|
-
}
|
|
57
|
-
}),
|
|
58
|
-
{ name: "ScaffolderTemplateEditor" }
|
|
59
|
-
);
|
|
60
16
|
const TemplateEditor = (props) => {
|
|
61
|
-
const
|
|
17
|
+
const { layouts, formProps, fieldExtensions } = props;
|
|
62
18
|
const [errorText, setErrorText] = useState();
|
|
63
|
-
|
|
64
|
-
|
|
19
|
+
const navigate = useNavigate();
|
|
20
|
+
const editLink = useRouteRef(editRouteRef);
|
|
21
|
+
const {
|
|
22
|
+
directory,
|
|
23
|
+
openDirectory: handleOpenDirectory,
|
|
24
|
+
createDirectory: handleCreateDirectory,
|
|
25
|
+
closeDirectory
|
|
26
|
+
} = useTemplateDirectory();
|
|
27
|
+
const handleCloseDirectory = useCallback(() => {
|
|
28
|
+
closeDirectory().then(() => navigate(editLink()));
|
|
29
|
+
}, [closeDirectory, navigate, editLink]);
|
|
30
|
+
return /* @__PURE__ */ React.createElement(DirectoryEditorProvider, { directory }, /* @__PURE__ */ React.createElement(DryRunProvider, null, /* @__PURE__ */ React.createElement(TemplateEditorLayout, null, /* @__PURE__ */ React.createElement(TemplateEditorLayoutToolbar, null, /* @__PURE__ */ React.createElement(TemplateEditorToolbar, { fieldExtensions }, /* @__PURE__ */ React.createElement(
|
|
31
|
+
TemplateEditorToolbarFileMenu,
|
|
65
32
|
{
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
)),
|
|
80
|
-
/* @__PURE__ */ React.createElement("section", { className: classes.preview }, /* @__PURE__ */ React.createElement("div", { className: classes.scroll }, /* @__PURE__ */ React.createElement(
|
|
81
|
-
TemplateEditorForm.DirectoryEditorDryRun,
|
|
82
|
-
{
|
|
83
|
-
setErrorText,
|
|
84
|
-
fieldExtensions: props.fieldExtensions,
|
|
85
|
-
layouts: props.layouts,
|
|
86
|
-
formProps: props.formProps
|
|
87
|
-
}
|
|
88
|
-
))),
|
|
89
|
-
/* @__PURE__ */ React.createElement("section", { className: classes.results }, /* @__PURE__ */ React.createElement(DryRunResults, null))
|
|
90
|
-
)));
|
|
33
|
+
onOpenDirectory: handleOpenDirectory,
|
|
34
|
+
onCreateDirectory: handleCreateDirectory,
|
|
35
|
+
onCloseDirectory: handleCloseDirectory
|
|
36
|
+
}
|
|
37
|
+
))), /* @__PURE__ */ React.createElement(TemplateEditorLayoutBrowser, null, /* @__PURE__ */ React.createElement(TemplateEditorBrowser, { onClose: closeDirectory })), /* @__PURE__ */ React.createElement(TemplateEditorLayoutFiles, null, /* @__PURE__ */ React.createElement(TemplateEditorTextArea.DirectoryEditor, { errorText })), /* @__PURE__ */ React.createElement(TemplateEditorLayoutPreview, null, /* @__PURE__ */ React.createElement(
|
|
38
|
+
TemplateEditorForm.DirectoryEditorDryRun,
|
|
39
|
+
{
|
|
40
|
+
setErrorText,
|
|
41
|
+
fieldExtensions,
|
|
42
|
+
layouts,
|
|
43
|
+
formProps
|
|
44
|
+
}
|
|
45
|
+
)), /* @__PURE__ */ React.createElement(TemplateEditorLayoutConsole, null, /* @__PURE__ */ React.createElement(DryRunResults, null)))));
|
|
91
46
|
};
|
|
92
47
|
|
|
93
48
|
export { TemplateEditor };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditor.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditor.tsx"],"sourcesContent":["/*\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 {
|
|
1
|
+
{"version":3,"file":"TemplateEditor.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditor.tsx"],"sourcesContent":["/*\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, useState } from 'react';\nimport { useNavigate } from 'react-router-dom';\n\nimport { useRouteRef } from '@backstage/core-plugin-api';\nimport type {\n FormProps,\n LayoutOptions,\n FieldExtensionOptions,\n} from '@backstage/plugin-scaffolder-react';\n\nimport { editRouteRef } from '../../../routes';\n\nimport { useTemplateDirectory } from './useTemplateDirectory';\nimport { DirectoryEditorProvider } from './DirectoryEditorContext';\nimport {\n TemplateEditorLayout,\n TemplateEditorLayoutToolbar,\n TemplateEditorLayoutBrowser,\n TemplateEditorLayoutFiles,\n TemplateEditorLayoutPreview,\n TemplateEditorLayoutConsole,\n} from './TemplateEditorLayout';\nimport { TemplateEditorToolbar } from './TemplateEditorToolbar';\nimport { TemplateEditorToolbarFileMenu } from './TemplateEditorToolbarFileMenu';\nimport { TemplateEditorBrowser } from './TemplateEditorBrowser';\nimport { TemplateEditorTextArea } from './TemplateEditorTextArea';\nimport { TemplateEditorForm } from './TemplateEditorForm';\nimport { DryRunProvider } from './DryRunContext';\nimport { DryRunResults } from './DryRunResults';\n\n/** @public */\nexport type ScaffolderTemplateEditorClassKey =\n | 'root'\n | 'toolbar'\n | 'browser'\n | 'editor'\n | 'preview'\n | 'results';\n\nexport const TemplateEditor = (props: {\n layouts?: LayoutOptions[];\n formProps?: FormProps;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n}) => {\n const { layouts, formProps, fieldExtensions } = props;\n const [errorText, setErrorText] = useState<string>();\n const navigate = useNavigate();\n const editLink = useRouteRef(editRouteRef);\n const {\n directory,\n openDirectory: handleOpenDirectory,\n createDirectory: handleCreateDirectory,\n closeDirectory,\n } = useTemplateDirectory();\n\n const handleCloseDirectory = useCallback(() => {\n closeDirectory().then(() => navigate(editLink()));\n }, [closeDirectory, navigate, editLink]);\n\n return (\n <DirectoryEditorProvider directory={directory}>\n <DryRunProvider>\n <TemplateEditorLayout>\n <TemplateEditorLayoutToolbar>\n <TemplateEditorToolbar fieldExtensions={fieldExtensions}>\n <TemplateEditorToolbarFileMenu\n onOpenDirectory={handleOpenDirectory}\n onCreateDirectory={handleCreateDirectory}\n onCloseDirectory={handleCloseDirectory}\n />\n </TemplateEditorToolbar>\n </TemplateEditorLayoutToolbar>\n <TemplateEditorLayoutBrowser>\n <TemplateEditorBrowser onClose={closeDirectory} />\n </TemplateEditorLayoutBrowser>\n <TemplateEditorLayoutFiles>\n <TemplateEditorTextArea.DirectoryEditor errorText={errorText} />\n </TemplateEditorLayoutFiles>\n <TemplateEditorLayoutPreview>\n <TemplateEditorForm.DirectoryEditorDryRun\n setErrorText={setErrorText}\n fieldExtensions={fieldExtensions}\n layouts={layouts}\n formProps={formProps}\n />\n </TemplateEditorLayoutPreview>\n <TemplateEditorLayoutConsole>\n <DryRunResults />\n </TemplateEditorLayoutConsole>\n </TemplateEditorLayout>\n </DryRunProvider>\n </DirectoryEditorProvider>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAsDa,MAAA,cAAA,GAAiB,CAAC,KAIzB,KAAA;AACJ,EAAA,MAAM,EAAE,OAAA,EAAS,SAAW,EAAA,eAAA,EAAoB,GAAA,KAAA,CAAA;AAChD,EAAA,MAAM,CAAC,SAAA,EAAW,YAAY,CAAA,GAAI,QAAiB,EAAA,CAAA;AACnD,EAAA,MAAM,WAAW,WAAY,EAAA,CAAA;AAC7B,EAAM,MAAA,QAAA,GAAW,YAAY,YAAY,CAAA,CAAA;AACzC,EAAM,MAAA;AAAA,IACJ,SAAA;AAAA,IACA,aAAe,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aAAA,CAAA,2BAAA,EAAA,IAAA,sCACE,aAAc,EAAA,IAAA,CACjB,CACF,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -44,6 +44,9 @@ function TemplateEditorBrowser(props) {
|
|
|
44
44
|
}
|
|
45
45
|
props.onClose();
|
|
46
46
|
};
|
|
47
|
+
if (!directoryEditor) {
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
47
50
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement(Grid, { className: classes.grid, container: true, spacing: 0, alignItems: "center" }, /* @__PURE__ */ React.createElement(
|
|
48
51
|
Tooltip,
|
|
49
52
|
{
|
|
@@ -53,8 +56,8 @@ function TemplateEditorBrowser(props) {
|
|
|
53
56
|
IconButton,
|
|
54
57
|
{
|
|
55
58
|
size: "small",
|
|
56
|
-
disabled: directoryEditor
|
|
57
|
-
onClick: () => directoryEditor
|
|
59
|
+
disabled: directoryEditor.files.every((file) => !file.dirty),
|
|
60
|
+
onClick: () => directoryEditor.save()
|
|
58
61
|
},
|
|
59
62
|
/* @__PURE__ */ React.createElement(SaveIcon, null)
|
|
60
63
|
)
|
|
@@ -65,7 +68,7 @@ function TemplateEditorBrowser(props) {
|
|
|
65
68
|
"templateEditorPage.templateEditorBrowser.reloadIconTooltip"
|
|
66
69
|
)
|
|
67
70
|
},
|
|
68
|
-
/* @__PURE__ */ React.createElement(IconButton, { size: "small", onClick: () => directoryEditor
|
|
71
|
+
/* @__PURE__ */ React.createElement(IconButton, { size: "small", onClick: () => directoryEditor.reload() }, /* @__PURE__ */ React.createElement(RefreshIcon, null))
|
|
69
72
|
), /* @__PURE__ */ React.createElement(
|
|
70
73
|
Tooltip,
|
|
71
74
|
{
|
|
@@ -83,9 +86,9 @@ function TemplateEditorBrowser(props) {
|
|
|
83
86
|
)), /* @__PURE__ */ React.createElement(Divider, null), /* @__PURE__ */ React.createElement(
|
|
84
87
|
FileBrowser,
|
|
85
88
|
{
|
|
86
|
-
selected: directoryEditor
|
|
87
|
-
onSelect: directoryEditor
|
|
88
|
-
filePaths: directoryEditor
|
|
89
|
+
selected: directoryEditor.selectedFile?.path ?? "",
|
|
90
|
+
onSelect: directoryEditor.setSelectedFile,
|
|
91
|
+
filePaths: directoryEditor.files.map((file) => file.path) ?? []
|
|
89
92
|
}
|
|
90
93
|
));
|
|
91
94
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorBrowser.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorBrowser.tsx"],"sourcesContent":["/*\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 Grid from '@material-ui/core/Grid';\nimport Divider from '@material-ui/core/Divider';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport RefreshIcon from '@material-ui/icons/Refresh';\nimport SaveIcon from '@material-ui/icons/Save';\nimport React from 'react';\nimport { useDirectoryEditor } from './DirectoryEditorContext';\nimport { FileBrowser } from '../../../components/FileBrowser';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(\n theme => ({\n grid: {\n '& svg': {\n margin: theme.spacing(1),\n },\n },\n closeButton: {\n marginLeft: 'auto',\n },\n }),\n { name: 'ScaffolderTemplateEditorBrowser' },\n);\n\n/** The local file browser for the template editor */\nexport function TemplateEditorBrowser(props: { onClose?: () => void }) {\n const classes = useStyles();\n const directoryEditor = useDirectoryEditor();\n const changedFiles = directoryEditor?.files.filter(file => file.dirty);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const handleClose = () => {\n if (!props.onClose) {\n return;\n }\n if (changedFiles?.length) {\n // eslint-disable-next-line no-alert\n const accepted = window.confirm(\n t('templateEditorPage.templateEditorBrowser.closeConfirmMessage'),\n );\n if (!accepted) {\n return;\n }\n }\n props.onClose();\n };\n\n return (\n <>\n <Grid className={classes.grid} container spacing={0} alignItems=\"center\">\n <Tooltip\n title={t('templateEditorPage.templateEditorBrowser.saveIconTooltip')}\n >\n <IconButton\n size=\"small\"\n disabled={directoryEditor
|
|
1
|
+
{"version":3,"file":"TemplateEditorBrowser.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorBrowser.tsx"],"sourcesContent":["/*\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 Grid from '@material-ui/core/Grid';\nimport Divider from '@material-ui/core/Divider';\nimport IconButton from '@material-ui/core/IconButton';\nimport Tooltip from '@material-ui/core/Tooltip';\nimport { makeStyles } from '@material-ui/core/styles';\nimport CloseIcon from '@material-ui/icons/Close';\nimport RefreshIcon from '@material-ui/icons/Refresh';\nimport SaveIcon from '@material-ui/icons/Save';\nimport React from 'react';\nimport { useDirectoryEditor } from './DirectoryEditorContext';\nimport { FileBrowser } from '../../../components/FileBrowser';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles(\n theme => ({\n grid: {\n '& svg': {\n margin: theme.spacing(1),\n },\n },\n closeButton: {\n marginLeft: 'auto',\n },\n }),\n { name: 'ScaffolderTemplateEditorBrowser' },\n);\n\n/** The local file browser for the template editor */\nexport function TemplateEditorBrowser(props: { onClose?: () => void }) {\n const classes = useStyles();\n const directoryEditor = useDirectoryEditor();\n const changedFiles = directoryEditor?.files.filter(file => file.dirty);\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const handleClose = () => {\n if (!props.onClose) {\n return;\n }\n if (changedFiles?.length) {\n // eslint-disable-next-line no-alert\n const accepted = window.confirm(\n t('templateEditorPage.templateEditorBrowser.closeConfirmMessage'),\n );\n if (!accepted) {\n return;\n }\n }\n props.onClose();\n };\n\n if (!directoryEditor) {\n return null;\n }\n\n return (\n <>\n <Grid className={classes.grid} container spacing={0} alignItems=\"center\">\n <Tooltip\n title={t('templateEditorPage.templateEditorBrowser.saveIconTooltip')}\n >\n <IconButton\n size=\"small\"\n disabled={directoryEditor.files.every(file => !file.dirty)}\n onClick={() => directoryEditor.save()}\n >\n <SaveIcon />\n </IconButton>\n </Tooltip>\n <Tooltip\n title={t(\n 'templateEditorPage.templateEditorBrowser.reloadIconTooltip',\n )}\n >\n <IconButton size=\"small\" onClick={() => directoryEditor.reload()}>\n <RefreshIcon />\n </IconButton>\n </Tooltip>\n <Tooltip\n title={t('templateEditorPage.templateEditorBrowser.closeIconTooltip')}\n >\n <IconButton\n size=\"small\"\n className={classes.closeButton}\n onClick={handleClose}\n >\n <CloseIcon />\n </IconButton>\n </Tooltip>\n </Grid>\n <Divider />\n <FileBrowser\n selected={directoryEditor.selectedFile?.path ?? ''}\n onSelect={directoryEditor.setSelectedFile}\n filePaths={directoryEditor.files.map(file => file.path) ?? []}\n />\n </>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;AA6BA,MAAM,SAAY,GAAA,UAAA;AAAA,EAChB,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,OAAS,EAAA;AAAA,QACP,MAAA,EAAQ,KAAM,CAA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B,CAAA,eAAA;AAAA,MAC1B,SAAA,EAAW,gBAAgB,KAAM,CAAA,GAAA,CAAI,UAAQ,IAAK,CAAA,IAAI,KAAK,EAAC;AAAA,KAAA;AAAA,GAEhE,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -141,7 +141,10 @@ function TemplateEditorFormDirectoryEditorDryRun(props) {
|
|
|
141
141
|
}
|
|
142
142
|
};
|
|
143
143
|
const content = selectedFile && selectedFile.path.match(/\.ya?ml$/) ? selectedFile.content : void 0;
|
|
144
|
-
|
|
144
|
+
if (!directoryEditor) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
return /* @__PURE__ */ React.createElement(
|
|
145
148
|
TemplateEditorForm,
|
|
146
149
|
{
|
|
147
150
|
onDryRun: handleDryRun,
|
|
@@ -151,7 +154,7 @@ function TemplateEditorFormDirectoryEditorDryRun(props) {
|
|
|
151
154
|
layouts,
|
|
152
155
|
formProps: props.formProps
|
|
153
156
|
}
|
|
154
|
-
)
|
|
157
|
+
);
|
|
155
158
|
}
|
|
156
159
|
TemplateEditorForm.DirectoryEditorDryRun = TemplateEditorFormDirectoryEditorDryRun;
|
|
157
160
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorForm.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorForm.tsx"],"sourcesContent":["/*\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 Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\nimport React, { Component, ReactNode, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport yaml from 'yaml';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n LayoutOptions,\n TemplateParameterSchema,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n Stepper,\n createAsyncValidators,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { useDryRun } from './DryRunContext';\nimport { useDirectoryEditor } from './DirectoryEditorContext';\n\nimport { scaffolderTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles({\n containerWrapper: {\n width: '100%',\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\n onDryRun?: (data: JsonObject) => Promise<void>;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n formProps?: FormProps;\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 const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const [steps, setSteps] = useState<TemplateParameterSchema['steps']>();\n\n const fields = useMemo(() => {\n return Object.fromEntries(\n fieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [fieldExtensions]);\n\n useDebounce(\n () => {\n try {\n if (!content) {\n setSteps(undefined);\n return;\n }\n const parsed: JsonValue = yaml\n .parseAllDocuments(content)\n .filter(c => c)\n .map(c => c.toJSON())[0];\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 const fieldValidators = Object.fromEntries(\n fieldExtensions.map(({ name, validation }) => [name, validation]),\n );\n\n setErrorText();\n setSteps(\n parameters.flatMap(param =>\n isJsonObject(param)\n ? [\n {\n title: String(param.title),\n schema: param,\n validate: createAsyncValidators(param, fieldValidators, {\n apiHolder,\n }),\n },\n ]\n : [],\n ),\n );\n } catch (e) {\n setErrorText(e.message);\n }\n },\n 250,\n [contentIsSpec, content, apiHolder],\n );\n\n return (\n <div className={classes.containerWrapper}>\n {steps ? (\n <Paper variant=\"outlined\">\n <ErrorBoundary invalidator={steps} setErrorText={setErrorText}>\n <Stepper\n manifest={{ steps, title: 'Template Editor' }}\n extensions={fieldExtensions}\n components={fields}\n onCreate={async options => {\n await onDryRun?.(options);\n }}\n layouts={layouts}\n formProps={props.formProps}\n />\n </ErrorBoundary>\n </Paper>\n ) : (\n <Typography variant=\"body1\" color=\"textSecondary\">\n {t('templateEditorForm.stepper.emptyText')}\n </Typography>\n )}\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' | 'formProps'\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 (data: JsonObject) => {\n if (!selectedFile) {\n return;\n }\n\n try {\n await dryRun.execute({\n templateContent: selectedFile.content,\n values: data,\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 directoryEditor ? (\n <TemplateEditorForm\n onDryRun={handleDryRun}\n fieldExtensions={fieldExtensions}\n setErrorText={setErrorText}\n content={content}\n layouts={layouts}\n formProps={props.formProps}\n />\n ) : null;\n}\n\nTemplateEditorForm.DirectoryEditorDryRun =\n TemplateEditorFormDirectoryEditorDryRun;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,gBAAkB,EAAA;AAAA,IAChB,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAC,CAAA,CAAA;AAYD,MAAM,sBAAsB,SAAkD,CAAA;AAAA,EAC5E,KAAQ,GAAA;AAAA,IACN,YAAc,EAAA,IAAA;AAAA,GAChB,CAAA;AAAA,EAEA,mBAAmB,SAAqC,EAAA;AACtD,IAAA,IAAI,SAAU,CAAA,WAAA,KAAgB,IAAK,CAAA,KAAA,CAAM,WAAa,EAAA;AACpD,MAAA,IAAA,CAAK,QAAS,CAAA,EAAE,YAAc,EAAA,IAAA,EAAM,CAAA,CAAA;AAAA,KACtC;AAAA,GACF;AAAA,EAEA,kBAAkB,KAAc,EAAA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,CAAA,SAAA;AAAA,KAAA;AAAA,GAEjB,GAAA,IAAA,CAAA;AACN,CAAA;AAEA,kBAAA,CAAmB,qBACjB,GAAA,uCAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateEditorForm.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorForm.tsx"],"sourcesContent":["/*\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 Paper from '@material-ui/core/Paper';\nimport Typography from '@material-ui/core/Typography';\nimport React, { Component, ReactNode, useMemo, useState } from 'react';\nimport useDebounce from 'react-use/esm/useDebounce';\nimport yaml from 'yaml';\nimport { useTranslationRef } from '@backstage/frontend-plugin-api';\nimport {\n LayoutOptions,\n TemplateParameterSchema,\n FieldExtensionOptions,\n FormProps,\n} from '@backstage/plugin-scaffolder-react';\nimport {\n Stepper,\n createAsyncValidators,\n} from '@backstage/plugin-scaffolder-react/alpha';\nimport { useDryRun } from './DryRunContext';\nimport { useDirectoryEditor } from './DirectoryEditorContext';\n\nimport { scaffolderTranslationRef } from '../../../translation';\n\nconst useStyles = makeStyles({\n containerWrapper: {\n width: '100%',\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\n onDryRun?: (data: JsonObject) => Promise<void>;\n fieldExtensions?: FieldExtensionOptions<any, any>[];\n layouts?: LayoutOptions[];\n formProps?: FormProps;\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 const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const [steps, setSteps] = useState<TemplateParameterSchema['steps']>();\n\n const fields = useMemo(() => {\n return Object.fromEntries(\n fieldExtensions.map(({ name, component }) => [name, component]),\n );\n }, [fieldExtensions]);\n\n useDebounce(\n () => {\n try {\n if (!content) {\n setSteps(undefined);\n return;\n }\n const parsed: JsonValue = yaml\n .parseAllDocuments(content)\n .filter(c => c)\n .map(c => c.toJSON())[0];\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 const fieldValidators = Object.fromEntries(\n fieldExtensions.map(({ name, validation }) => [name, validation]),\n );\n\n setErrorText();\n setSteps(\n parameters.flatMap(param =>\n isJsonObject(param)\n ? [\n {\n title: String(param.title),\n schema: param,\n validate: createAsyncValidators(param, fieldValidators, {\n apiHolder,\n }),\n },\n ]\n : [],\n ),\n );\n } catch (e) {\n setErrorText(e.message);\n }\n },\n 250,\n [contentIsSpec, content, apiHolder],\n );\n\n return (\n <div className={classes.containerWrapper}>\n {steps ? (\n <Paper variant=\"outlined\">\n <ErrorBoundary invalidator={steps} setErrorText={setErrorText}>\n <Stepper\n manifest={{ steps, title: 'Template Editor' }}\n extensions={fieldExtensions}\n components={fields}\n onCreate={async options => {\n await onDryRun?.(options);\n }}\n layouts={layouts}\n formProps={props.formProps}\n />\n </ErrorBoundary>\n </Paper>\n ) : (\n <Typography variant=\"body1\" color=\"textSecondary\">\n {t('templateEditorForm.stepper.emptyText')}\n </Typography>\n )}\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' | 'formProps'\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 (data: JsonObject) => {\n if (!selectedFile) {\n return;\n }\n\n try {\n await dryRun.execute({\n templateContent: selectedFile.content,\n values: data,\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 if (!directoryEditor) {\n return null;\n }\n\n return (\n <TemplateEditorForm\n onDryRun={handleDryRun}\n fieldExtensions={fieldExtensions}\n setErrorText={setErrorText}\n content={content}\n layouts={layouts}\n formProps={props.formProps}\n />\n );\n}\n\nTemplateEditorForm.DirectoryEditorDryRun =\n TemplateEditorFormDirectoryEditorDryRun;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAuCA,MAAM,YAAY,UAAW,CAAA;AAAA,EAC3B,gBAAkB,EAAA;AAAA,IAChB,KAAO,EAAA,MAAA;AAAA,GACT;AACF,CAAC,CAAA,CAAA;AAYD,MAAM,sBAAsB,SAAkD,CAAA;AAAA,EAC5E,KAAQ,GAAA;AAAA,IACN,YAAc,EAAA,IAAA;AAAA,GAChB,CAAA;AAAA,EAEA,mBAAmB,SAAqC,EAAA;AACtD,IAAA,IAAI,SAAU,CAAA,WAAA,KAAgB,IAAK,CAAA,KAAA,CAAM,WAAa,EAAA;AACpD,MAAA,IAAA,CAAK,QAAS,CAAA,EAAE,YAAc,EAAA,IAAA,EAAM,CAAA,CAAA;AAAA,KACtC;AAAA,GACF;AAAA,EAEA,kBAAkB,KAAc,EAAA;AAC9B,IAAK,IAAA,CAAA,KAAA,CAAM,YAAa,CAAA,KAAA,CAAM,OAAO,CAAA,CAAA;AACrC,IAAA,IAAA,CAAK,QAAS,CAAA,EAAE,YAAc,EAAA,KAAA,EAAO,CAAA,CAAA;AAAA,GACvC;AAAA,EAEA,MAAS,GAAA;AACP,IAAA,OAAO,IAAK,CAAA,KAAA,CAAM,YAAe,GAAA,IAAA,CAAK,MAAM,QAAW,GAAA,IAAA,CAAA;AAAA,GACzD;AACF,CAAA;AAcA,SAAS,aAAa,KAAmD,EAAA;AACvE,EAAO,OAAA,OAAO,UAAU,QAAY,IAAA,KAAA,KAAU,QAAQ,CAAC,KAAA,CAAM,QAAQ,KAAK,CAAA,CAAA;AAC5E,CAAA;AAGO,SAAS,mBAAmB,KAAgC,EAAA;AACjE,EAAM,MAAA;AAAA,IACJ,OAAA;AAAA,IACA,aAAA;AAAA,IACA,QAAA;AAAA,IACA,YAAA;AAAA,IACA,kBAAkB,EAAC;AAAA,IACnB,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B,MAAQ,EAAA,IAAA;AAAA,QACR,KAAA,EAAO,eAAiB,EAAA,KAAA,IAAS,EAAC;AAAA,OACnC,CAAA,CAAA;AACD,MAAa,YAAA,EAAA,CAAA;AAAA,aACN,CAAG,EAAA;AACV,MAAA,YAAA,CAAa,MAAO,CAAA,CAAA,CAAE,KAAS,IAAA,CAAC,CAAC,CAAA,CAAA;AACjC,MAAM,MAAA,CAAA,CAAA;AAAA,KACR;AAAA,GACF,CAAA;AAEA,EAAM,MAAA,OAAA,GACJ,gBAAgB,YAAa,CAAA,IAAA,CAAK,MAAM,UAAU,CAAA,GAC9C,aAAa,OACb,GAAA,KAAA,CAAA,CAAA;AAEN,EAAA,IAAI,CAAC,eAAiB,EAAA;AACpB,IAAO,OAAA,IAAA,CAAA;AAAA,GACT;AAEA,EACE,uBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACC,QAAU,EAAA,YAAA;AAAA,MACV,eAAA;AAAA,MACA,YAAA;AAAA,MACA,OAAA;AAAA,MACA,OAAA;AAAA,MACA,WAAW,KAAM,CAAA,SAAA;AAAA,KAAA;AAAA,GACnB,CAAA;AAEJ,CAAA;AAEA,kBAAA,CAAmB,qBACjB,GAAA,uCAAA;;;;"}
|
|
@@ -4,6 +4,7 @@ import CardActionArea from '@material-ui/core/CardActionArea';
|
|
|
4
4
|
import CardContent from '@material-ui/core/CardContent';
|
|
5
5
|
import Typography from '@material-ui/core/Typography';
|
|
6
6
|
import { makeStyles } from '@material-ui/core/styles';
|
|
7
|
+
import 'idb-keyval';
|
|
7
8
|
import { WebFileSystemAccess } from '../../../lib/filesystem/WebFileSystemAccess.esm.js';
|
|
8
9
|
import { useTranslationRef } from '@backstage/core-plugin-api/alpha';
|
|
9
10
|
import { scaffolderTranslationRef } from '../../../translation.esm.js';
|
|
@@ -23,13 +24,13 @@ const useStyles = makeStyles((theme) => ({
|
|
|
23
24
|
justifyContent: "center"
|
|
24
25
|
},
|
|
25
26
|
cardGrid: {
|
|
26
|
-
display: "grid",
|
|
27
27
|
maxWidth: 1e3,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
[theme.breakpoints.
|
|
32
|
-
|
|
28
|
+
display: "grid",
|
|
29
|
+
gridGap: theme.spacing(2),
|
|
30
|
+
gridAutoFlow: "row",
|
|
31
|
+
[theme.breakpoints.up("md")]: {
|
|
32
|
+
gridTemplateRows: "1fr 1fr",
|
|
33
|
+
gridTemplateColumns: "1fr 1fr"
|
|
33
34
|
}
|
|
34
35
|
},
|
|
35
36
|
card: {
|
|
@@ -120,24 +121,24 @@ function TemplateEditorIntro(props) {
|
|
|
120
121
|
), /* @__PURE__ */ React.createElement(
|
|
121
122
|
ActionCard,
|
|
122
123
|
{
|
|
123
|
-
title: t(
|
|
124
|
-
"templateEditorPage.templateEditorIntro.fieldExplorer.title"
|
|
125
|
-
),
|
|
124
|
+
title: t("templateEditorPage.templateEditorIntro.formEditor.title"),
|
|
126
125
|
description: t(
|
|
127
|
-
"templateEditorPage.templateEditorIntro.
|
|
126
|
+
"templateEditorPage.templateEditorIntro.formEditor.description"
|
|
128
127
|
),
|
|
129
|
-
Icon:
|
|
130
|
-
action: () => props.onSelect?.("
|
|
128
|
+
Icon: ListAltIcon,
|
|
129
|
+
action: () => props.onSelect?.("form")
|
|
131
130
|
}
|
|
132
131
|
), /* @__PURE__ */ React.createElement(
|
|
133
132
|
ActionCard,
|
|
134
133
|
{
|
|
135
|
-
title: t(
|
|
134
|
+
title: t(
|
|
135
|
+
"templateEditorPage.templateEditorIntro.fieldExplorer.title"
|
|
136
|
+
),
|
|
136
137
|
description: t(
|
|
137
|
-
"templateEditorPage.templateEditorIntro.
|
|
138
|
+
"templateEditorPage.templateEditorIntro.fieldExplorer.description"
|
|
138
139
|
),
|
|
139
|
-
Icon:
|
|
140
|
-
action: () => props.onSelect?.("
|
|
140
|
+
Icon: FormatListBulletedIcon,
|
|
141
|
+
action: () => props.onSelect?.("field-explorer")
|
|
141
142
|
}
|
|
142
143
|
))));
|
|
143
144
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TemplateEditorIntro.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorIntro.tsx"],"sourcesContent":["/*\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 Card from '@material-ui/core/Card';\nimport CardActionArea from '@material-ui/core/CardActionArea';\nimport CardContent from '@material-ui/core/CardContent';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { WebFileSystemAccess } from '../../../lib/filesystem';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport CreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';\nimport ListAltIcon from '@material-ui/icons/ListAlt';\nimport FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted';\nimport InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport PublishIcon from '@material-ui/icons/Publish';\nimport SvgIcon from '@material-ui/core/SvgIcon';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst useStyles = makeStyles(theme => ({\n gridRoot: {\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n cardGrid: {\n display: 'grid',\n maxWidth: 1000,\n gridTemplateColumns: '1fr 1fr',\n gridAutoRows: '1fr 1fr',\n gap: '1rem',\n [theme.breakpoints.down('sm')]: {\n gridAutoFlow: 'row',\n },\n },\n card: {\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n gridTemplateRows: '1fr',\n alignItems: 'center',\n margin: theme.spacing(0, 1),\n marginTop: theme.spacing(2),\n padding: theme.spacing(2),\n },\n icon: {\n justifySelf: 'center',\n paddingTop: theme.spacing(1),\n fontSize: 48,\n },\n introText: {\n textAlign: 'center',\n marginTop: theme.spacing(2),\n },\n infoIcon: {\n position: 'absolute',\n top: theme.spacing(1),\n right: theme.spacing(1),\n },\n cardContent: {\n padding: theme.spacing(1),\n },\n}));\n\ninterface EditorIntroProps {\n style?: JSX.IntrinsicElements['div']['style'];\n onSelect?: (\n option: 'create-template' | 'local' | 'form' | 'field-explorer',\n ) => void;\n}\n\nfunction ActionCard(props: {\n title: string;\n description: string;\n Icon: typeof SvgIcon;\n action?: React.MouseEventHandler;\n requireLoad?: boolean;\n}) {\n const supportsLoad = props.requireLoad\n ? WebFileSystemAccess.isSupported()\n : true;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const classes = useStyles();\n const { Icon, title, description, action } = props;\n return (\n <Card className={classes.card}>\n {!supportsLoad && (\n <Tooltip\n placement=\"top\"\n title={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.unsupportedTooltip',\n )}\n >\n <InfoOutlinedIcon />\n </Tooltip>\n )}\n\n <CardActionArea onClick={action}>\n <CardMedia>\n <Icon\n className={classes.icon}\n color={supportsLoad ? undefined : 'disabled'}\n />\n </CardMedia>\n <CardContent className={classes.cardContent}>\n <Typography\n gutterBottom\n variant=\"h5\"\n component=\"h2\"\n color={supportsLoad ? undefined : 'textSecondary'}\n >\n {title}\n </Typography>\n <Typography variant=\"body2\" color=\"textSecondary\" component=\"p\">\n {description}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n );\n}\nexport function TemplateEditorIntro(props: EditorIntroProps) {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n return (\n <div style={props.style}>\n <Typography variant=\"h4\" component=\"h2\" className={classes.introText}>\n {t('templateEditorPage.templateEditorIntro.title')}\n </Typography>\n <div className={classes.gridRoot}>\n <div className={classes.cardGrid}>\n <ActionCard\n title={t('templateEditorPage.templateEditorIntro.loadLocal.title')}\n description={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.description',\n )}\n requireLoad\n Icon={PublishIcon}\n action={() => props.onSelect?.('local')}\n />\n <ActionCard\n title={t(\n 'templateEditorPage.templateEditorIntro.createLocal.title',\n )}\n description={t(\n 'templateEditorPage.templateEditorIntro.createLocal.description',\n )}\n requireLoad\n action={() => props.onSelect?.('create-template')}\n Icon={CreateNewFolderIcon}\n />\n\n <ActionCard\n title={t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.title',\n )}\n description={t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.description',\n )}\n Icon={FormatListBulletedIcon}\n action={() => props.onSelect?.('field-explorer')}\n />\n\n <ActionCard\n title={t('templateEditorPage.templateEditorIntro.formEditor.title')}\n description={t(\n 'templateEditorPage.templateEditorIntro.formEditor.description',\n )}\n Icon={ListAltIcon}\n action={() => props.onSelect?.('form')}\n />\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,IAAM,EAAA,CAAA;AAAA,IACN,UAAY,EAAA,QAAA;AAAA,IACZ,cAAgB,EAAA,QAAA;AAAA,GAClB;AAAA,EACA,QAAU,EAAA;AAAA,IACR,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,GAAA;AAAA,IACV,mBAAqB,EAAA,SAAA;AAAA,IACrB,YAAc,EAAA,SAAA;AAAA,IACd,GAAK,EAAA,MAAA;AAAA,IACL,CAAC,KAAM,CAAA,WAAA,CAAY,IAAK,CAAA,IAAI,CAAC,GAAG;AAAA,MAC9B,YAAc,EAAA,KAAA;AAAA,KAChB;AAAA,GAC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a,EAAA,CAAA;AAAA,QACX,kEAAA;AAAA,OACF;AAAA,MACA,IAAM,EAAA,sBAAA;AAAA,MACN,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,gBAAgB,CAAA;AAAA,KAAA;AAAA,GAGjD,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,yDAAyD,CAAA;AAAA,MAClE,WAAa,EAAA,CAAA;AAAA,QACX,+DAAA;AAAA,OACF;AAAA,MACA,IAAM,EAAA,WAAA;AAAA,MACN,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,MAAM,CAAA;AAAA,KAAA;AAAA,GAEzC,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"TemplateEditorIntro.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorIntro.tsx"],"sourcesContent":["/*\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 Card from '@material-ui/core/Card';\nimport CardActionArea from '@material-ui/core/CardActionArea';\nimport CardContent from '@material-ui/core/CardContent';\nimport Typography from '@material-ui/core/Typography';\nimport { makeStyles } from '@material-ui/core/styles';\nimport { WebFileSystemAccess } from '../../../lib/filesystem';\nimport { useTranslationRef } from '@backstage/core-plugin-api/alpha';\nimport { scaffolderTranslationRef } from '../../../translation';\nimport CreateNewFolderIcon from '@material-ui/icons/CreateNewFolder';\nimport ListAltIcon from '@material-ui/icons/ListAlt';\nimport FormatListBulletedIcon from '@material-ui/icons/FormatListBulleted';\nimport InfoOutlinedIcon from '@material-ui/icons/InfoOutlined';\nimport CardMedia from '@material-ui/core/CardMedia';\nimport PublishIcon from '@material-ui/icons/Publish';\nimport SvgIcon from '@material-ui/core/SvgIcon';\nimport Tooltip from '@material-ui/core/Tooltip';\n\nconst useStyles = makeStyles(theme => ({\n gridRoot: {\n display: 'flex',\n flex: 1,\n alignItems: 'center',\n justifyContent: 'center',\n },\n cardGrid: {\n maxWidth: 1000,\n display: 'grid',\n gridGap: theme.spacing(2),\n gridAutoFlow: 'row',\n [theme.breakpoints.up('md')]: {\n gridTemplateRows: '1fr 1fr',\n gridTemplateColumns: '1fr 1fr',\n },\n },\n card: {\n display: 'grid',\n gridTemplateColumns: 'auto 1fr',\n gridTemplateRows: '1fr',\n alignItems: 'center',\n margin: theme.spacing(0, 1),\n marginTop: theme.spacing(2),\n padding: theme.spacing(2),\n },\n icon: {\n justifySelf: 'center',\n paddingTop: theme.spacing(1),\n fontSize: 48,\n },\n introText: {\n textAlign: 'center',\n marginTop: theme.spacing(2),\n },\n infoIcon: {\n position: 'absolute',\n top: theme.spacing(1),\n right: theme.spacing(1),\n },\n cardContent: {\n padding: theme.spacing(1),\n },\n}));\n\ninterface EditorIntroProps {\n style?: JSX.IntrinsicElements['div']['style'];\n onSelect?: (\n option: 'create-template' | 'local' | 'form' | 'field-explorer',\n ) => void;\n}\n\nfunction ActionCard(props: {\n title: string;\n description: string;\n Icon: typeof SvgIcon;\n action?: React.MouseEventHandler;\n requireLoad?: boolean;\n}) {\n const supportsLoad = props.requireLoad\n ? WebFileSystemAccess.isSupported()\n : true;\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n const classes = useStyles();\n const { Icon, title, description, action } = props;\n return (\n <Card className={classes.card}>\n {!supportsLoad && (\n <Tooltip\n placement=\"top\"\n title={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.unsupportedTooltip',\n )}\n >\n <InfoOutlinedIcon />\n </Tooltip>\n )}\n\n <CardActionArea onClick={action}>\n <CardMedia>\n <Icon\n className={classes.icon}\n color={supportsLoad ? undefined : 'disabled'}\n />\n </CardMedia>\n <CardContent className={classes.cardContent}>\n <Typography\n gutterBottom\n variant=\"h5\"\n component=\"h2\"\n color={supportsLoad ? undefined : 'textSecondary'}\n >\n {title}\n </Typography>\n <Typography variant=\"body2\" color=\"textSecondary\" component=\"p\">\n {description}\n </Typography>\n </CardContent>\n </CardActionArea>\n </Card>\n );\n}\nexport function TemplateEditorIntro(props: EditorIntroProps) {\n const classes = useStyles();\n const { t } = useTranslationRef(scaffolderTranslationRef);\n\n return (\n <div style={props.style}>\n <Typography variant=\"h4\" component=\"h2\" className={classes.introText}>\n {t('templateEditorPage.templateEditorIntro.title')}\n </Typography>\n <div className={classes.gridRoot}>\n <div className={classes.cardGrid}>\n <ActionCard\n title={t('templateEditorPage.templateEditorIntro.loadLocal.title')}\n description={t(\n 'templateEditorPage.templateEditorIntro.loadLocal.description',\n )}\n requireLoad\n Icon={PublishIcon}\n action={() => props.onSelect?.('local')}\n />\n <ActionCard\n title={t(\n 'templateEditorPage.templateEditorIntro.createLocal.title',\n )}\n description={t(\n 'templateEditorPage.templateEditorIntro.createLocal.description',\n )}\n requireLoad\n action={() => props.onSelect?.('create-template')}\n Icon={CreateNewFolderIcon}\n />\n\n <ActionCard\n title={t('templateEditorPage.templateEditorIntro.formEditor.title')}\n description={t(\n 'templateEditorPage.templateEditorIntro.formEditor.description',\n )}\n Icon={ListAltIcon}\n action={() => props.onSelect?.('form')}\n />\n\n <ActionCard\n title={t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.title',\n )}\n description={t(\n 'templateEditorPage.templateEditorIntro.fieldExplorer.description',\n )}\n Icon={FormatListBulletedIcon}\n action={() => props.onSelect?.('field-explorer')}\n />\n </div>\n </div>\n </div>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAkCA,MAAM,SAAA,GAAY,WAAW,CAAU,KAAA,MAAA;AAAA,EACrC,QAAU,EAAA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A,GAExC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,CAAA;AAAA,QACL,0DAAA;AAAA,OACF;AAAA,MACA,WAAa,EAAA,CAAA;AAAA,QACX,gEAAA;AAAA,OACF;AAAA,MACA,WAAW,EAAA,IAAA;AAAA,MACX,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,iBAAiB,CAAA;AAAA,MAChD,IAAM,EAAA,mBAAA;AAAA,KAAA;AAAA,GAGR,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAA,EAAO,EAAE,yDAAyD,CAAA;AAAA,MAClE,WAAa,EAAA,CAAA;AAAA,QACX,+DAAA;AAAA,OACF;AAAA,MACA,IAAM,EAAA,WAAA;AAAA,MACN,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,MAAM,CAAA;AAAA,KAAA;AAAA,GAGvC,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,UAAA;AAAA,IAAA;AAAA,MACC,KAAO,EAAA,CAAA;AAAA,QACL,4DAAA;AAAA,OACF;AAAA,MACA,WAAa,EAAA,CAAA;AAAA,QACX,kEAAA;AAAA,OACF;AAAA,MACA,IAAM,EAAA,sBAAA;AAAA,MACN,MAAQ,EAAA,MAAM,KAAM,CAAA,QAAA,GAAW,gBAAgB,CAAA;AAAA,KAAA;AAAA,GAEnD,CACF,CACF,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { withStyles } from '@material-ui/core/styles';
|
|
3
|
+
|
|
4
|
+
const TemplateEditorLayout = withStyles(
|
|
5
|
+
(theme) => ({
|
|
6
|
+
root: {
|
|
7
|
+
height: "100%",
|
|
8
|
+
gridArea: "pageContent",
|
|
9
|
+
display: "grid",
|
|
10
|
+
gridTemplateAreas: `
|
|
11
|
+
"toolbar"
|
|
12
|
+
"browser"
|
|
13
|
+
"editor"
|
|
14
|
+
"preview"
|
|
15
|
+
"results"
|
|
16
|
+
`,
|
|
17
|
+
[theme.breakpoints.up("md")]: {
|
|
18
|
+
gridTemplateAreas: `
|
|
19
|
+
"toolbar toolbar toolbar"
|
|
20
|
+
"browser editor preview"
|
|
21
|
+
"results results results"
|
|
22
|
+
`,
|
|
23
|
+
gridTemplateColumns: "1fr 3fr 2fr",
|
|
24
|
+
gridTemplateRows: "auto 1fr auto"
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
}),
|
|
28
|
+
{ name: "ScaffolderTemplateEditorLayout" }
|
|
29
|
+
)(({ children, classes }) => /* @__PURE__ */ React.createElement("main", { className: classes.root }, children));
|
|
30
|
+
const TemplateEditorLayoutToolbar = withStyles(
|
|
31
|
+
{
|
|
32
|
+
root: {
|
|
33
|
+
gridArea: "toolbar"
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
{ name: "ScaffolderTemplateEditorLayoutToolbar" }
|
|
37
|
+
)(({ children, classes }) => /* @__PURE__ */ React.createElement("section", { className: classes.root }, children));
|
|
38
|
+
const TemplateEditorLayoutBrowser = withStyles(
|
|
39
|
+
(theme) => ({
|
|
40
|
+
root: {
|
|
41
|
+
gridArea: "browser",
|
|
42
|
+
overflow: "auto",
|
|
43
|
+
[theme.breakpoints.up("md")]: {
|
|
44
|
+
borderRight: `1px solid ${theme.palette.divider}`
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}),
|
|
48
|
+
{ name: "ScaffolderTemplateEditorLayoutBrowser" }
|
|
49
|
+
)(({ children, classes }) => /* @__PURE__ */ React.createElement("section", { className: classes.root }, children));
|
|
50
|
+
const TemplateEditorLayoutFiles = withStyles(
|
|
51
|
+
{
|
|
52
|
+
root: {
|
|
53
|
+
gridArea: "editor",
|
|
54
|
+
overflow: "auto"
|
|
55
|
+
}
|
|
56
|
+
},
|
|
57
|
+
{ name: "ScaffolderTemplateEditorLayoutFiles" }
|
|
58
|
+
)(({ children, classes }) => /* @__PURE__ */ React.createElement("section", { className: classes.root }, children));
|
|
59
|
+
const TemplateEditorLayoutPreview = withStyles(
|
|
60
|
+
(theme) => ({
|
|
61
|
+
root: {
|
|
62
|
+
gridArea: "preview",
|
|
63
|
+
position: "relative",
|
|
64
|
+
backgroundColor: theme.palette.background.default,
|
|
65
|
+
[theme.breakpoints.up("md")]: {
|
|
66
|
+
borderLeft: `1px solid ${theme.palette.divider}`
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
scroll: {
|
|
70
|
+
height: "100%",
|
|
71
|
+
padding: theme.spacing(1),
|
|
72
|
+
[theme.breakpoints.up("md")]: {
|
|
73
|
+
position: "absolute",
|
|
74
|
+
top: 0,
|
|
75
|
+
left: 0,
|
|
76
|
+
right: 0,
|
|
77
|
+
bottom: 0,
|
|
78
|
+
overflow: "auto"
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}),
|
|
82
|
+
{ name: "ScaffolderTemplateEditorLayoutPreview" }
|
|
83
|
+
)(({ children, classes }) => /* @__PURE__ */ React.createElement("section", { className: classes.root }, /* @__PURE__ */ React.createElement("div", { className: classes.scroll }, children)));
|
|
84
|
+
const TemplateEditorLayoutConsole = withStyles(
|
|
85
|
+
{
|
|
86
|
+
root: {
|
|
87
|
+
gridArea: "results"
|
|
88
|
+
}
|
|
89
|
+
},
|
|
90
|
+
{ name: "ScaffolderTemplateEditorLayoutConsole" }
|
|
91
|
+
)(({ children, classes }) => /* @__PURE__ */ React.createElement("section", { className: classes.root }, children));
|
|
92
|
+
|
|
93
|
+
export { TemplateEditorLayout, TemplateEditorLayoutBrowser, TemplateEditorLayoutConsole, TemplateEditorLayoutFiles, TemplateEditorLayoutPreview, TemplateEditorLayoutToolbar };
|
|
94
|
+
//# sourceMappingURL=TemplateEditorLayout.esm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TemplateEditorLayout.esm.js","sources":["../../../../src/alpha/components/TemplateEditorPage/TemplateEditorLayout.tsx"],"sourcesContent":["/*\n * Copyright 2024 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, { PropsWithChildren } from 'react';\nimport { WithStyles, withStyles } from '@material-ui/core/styles';\n\nexport const TemplateEditorLayout = withStyles(\n theme => ({\n root: {\n height: '100%',\n gridArea: 'pageContent',\n display: 'grid',\n gridTemplateAreas: `\n \"toolbar\"\n \"browser\"\n \"editor\"\n \"preview\"\n \"results\"\n `,\n [theme.breakpoints.up('md')]: {\n gridTemplateAreas: `\n \"toolbar toolbar toolbar\"\n \"browser editor preview\"\n \"results results results\"\n `,\n gridTemplateColumns: '1fr 3fr 2fr',\n gridTemplateRows: 'auto 1fr auto',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayout' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <main className={classes.root}>{children}</main>\n));\n\nexport const TemplateEditorLayoutToolbar = withStyles(\n {\n root: {\n gridArea: 'toolbar',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutToolbar' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutBrowser = withStyles(\n theme => ({\n root: {\n gridArea: 'browser',\n overflow: 'auto',\n [theme.breakpoints.up('md')]: {\n borderRight: `1px solid ${theme.palette.divider}`,\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutBrowser' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutFiles = withStyles(\n {\n root: {\n gridArea: 'editor',\n overflow: 'auto',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutFiles' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n\nexport const TemplateEditorLayoutPreview = withStyles(\n theme => ({\n root: {\n gridArea: 'preview',\n position: 'relative',\n backgroundColor: theme.palette.background.default,\n [theme.breakpoints.up('md')]: {\n borderLeft: `1px solid ${theme.palette.divider}`,\n },\n },\n scroll: {\n height: '100%',\n padding: theme.spacing(1),\n [theme.breakpoints.up('md')]: {\n position: 'absolute',\n top: 0,\n left: 0,\n right: 0,\n bottom: 0,\n overflow: 'auto',\n },\n },\n }),\n { name: 'ScaffolderTemplateEditorLayoutPreview' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>\n <div className={classes.scroll}>{children}</div>\n </section>\n));\n\nexport const TemplateEditorLayoutConsole = withStyles(\n {\n root: {\n gridArea: 'results',\n },\n },\n { name: 'ScaffolderTemplateEditorLayoutConsole' },\n)(({ children, classes }: PropsWithChildren<WithStyles>) => (\n <section className={classes.root}>{children}</section>\n));\n"],"names":[],"mappings":";;;AAmBO,MAAM,oBAAuB,GAAA,UAAA;AAAA,EAClC,CAAU,KAAA,MAAA;AAAA,IACR,IAAM,EAAA;AAAA,MACJ,MAAQ,EAAA,MAAA;AAAA,MACR,QAAU,EAAA,aAAA;AAAA,MACV,OAAS,EAAA,MAAA;AAAA,MACT,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,MAOnB,CAAC,KAAM,CAAA,WAAA,CAAY,EAAG,CAAA,IAAI,CAAC,GAAG;AAAA,QAC5B,iBAAmB,EAAA,CAAA;AAAA;AAAA;AAAA;AAAA,IAAA,CAAA;AAAA,QAKnB,mBAAqB,EAAA,aAAA;AAAA,QACrB,gBAAkB,EAAA,eAAA;AAAA,OACpB;AAAA,KACF;AAAA,GACF,CAAA;AAAA,EAC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