@backstage/plugin-app 0.1.7 → 0.1.8-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/dist/extensions/App.esm.js +3 -2
- package/dist/extensions/App.esm.js.map +1 -1
- package/dist/extensions/AppLayout.esm.js +5 -2
- package/dist/extensions/AppLayout.esm.js.map +1 -1
- package/dist/extensions/AppNav.esm.js +20 -15
- package/dist/extensions/AppNav.esm.js.map +1 -1
- package/dist/extensions/AppRoot.esm.js +27 -18
- package/dist/extensions/AppRoot.esm.js.map +1 -1
- package/dist/extensions/AppRoutes.esm.js +3 -3
- package/dist/extensions/AppRoutes.esm.js.map +1 -1
- package/dist/extensions/AppThemeApi.esm.js +5 -5
- package/dist/extensions/AppThemeApi.esm.js.map +1 -1
- package/dist/extensions/DefaultSignInPage.esm.js +2 -2
- package/dist/extensions/DefaultSignInPage.esm.js.map +1 -1
- package/dist/extensions/DialogDisplay.esm.js +10 -9
- package/dist/extensions/DialogDisplay.esm.js.map +1 -1
- package/dist/extensions/IconsApi.esm.js +1 -1
- package/dist/extensions/components.esm.js +2 -2
- package/dist/extensions/components.esm.js.map +1 -1
- package/dist/extensions/elements.esm.js +3 -3
- package/dist/extensions/elements.esm.js.map +1 -1
- package/dist/packages/app/src/components/Root/LogoFull.esm.js +11 -11
- package/dist/packages/app/src/components/Root/LogoFull.esm.js.map +1 -1
- package/dist/packages/app/src/components/Root/LogoIcon.esm.js +11 -11
- package/dist/packages/app/src/components/Root/LogoIcon.esm.js.map +1 -1
- package/dist/packages/app-defaults/src/defaults/components.esm.js +9 -9
- package/dist/packages/app-defaults/src/defaults/components.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/apis/system/ApiProvider.esm.js +3 -2
- package/dist/packages/core-app-api/src/apis/system/ApiProvider.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/AppContext.esm.js +1 -1
- package/dist/packages/core-app-api/src/app/AppContext.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/AppRouter.esm.js +32 -19
- package/dist/packages/core-app-api/src/app/AppRouter.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/AppThemeProvider.esm.js +3 -2
- package/dist/packages/core-app-api/src/app/AppThemeProvider.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/app/isReactRouterBeta.esm.js +2 -2
- package/dist/packages/core-app-api/src/app/isReactRouterBeta.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/FeatureFlagged.esm.js +2 -2
- package/dist/packages/core-app-api/src/routing/FeatureFlagged.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/FlatRoutes.esm.js +3 -2
- package/dist/packages/core-app-api/src/routing/FlatRoutes.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/RouteTracker.esm.js +4 -3
- package/dist/packages/core-app-api/src/routing/RouteTracker.esm.js.map +1 -1
- package/dist/packages/core-app-api/src/routing/RoutingProvider.esm.js +1 -1
- package/dist/packages/core-app-api/src/routing/RoutingProvider.esm.js.map +1 -1
- package/dist/packages/frontend-app-api/src/routing/RouteTracker.esm.js +4 -3
- package/dist/packages/frontend-app-api/src/routing/RouteTracker.esm.js.map +1 -1
- package/package.json +18 -11
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,35 @@
|
|
|
1
1
|
# @backstage/plugin-app
|
|
2
2
|
|
|
3
|
+
## 0.1.8-next.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- a47fd39: Removes instances of default React imports, a necessary update for the upcoming React 19 migration.
|
|
8
|
+
|
|
9
|
+
<https://legacy.reactjs.org/blog/2020/09/22/introducing-the-new-jsx-transform.html>
|
|
10
|
+
|
|
11
|
+
- Updated dependencies
|
|
12
|
+
- @backstage/frontend-plugin-api@0.10.1-next.1
|
|
13
|
+
- @backstage/integration-react@1.2.6-next.1
|
|
14
|
+
- @backstage/core-components@0.17.1-next.1
|
|
15
|
+
- @backstage/core-plugin-api@1.10.6-next.0
|
|
16
|
+
- @backstage/plugin-permission-react@0.4.33-next.0
|
|
17
|
+
- @backstage/theme@0.6.5-next.0
|
|
18
|
+
- @backstage/types@1.2.1
|
|
19
|
+
|
|
20
|
+
## 0.1.8-next.0
|
|
21
|
+
|
|
22
|
+
### Patch Changes
|
|
23
|
+
|
|
24
|
+
- Updated dependencies
|
|
25
|
+
- @backstage/core-components@0.17.1-next.0
|
|
26
|
+
- @backstage/integration-react@1.2.6-next.0
|
|
27
|
+
- @backstage/frontend-plugin-api@0.10.1-next.0
|
|
28
|
+
- @backstage/core-plugin-api@1.10.5
|
|
29
|
+
- @backstage/theme@0.6.4
|
|
30
|
+
- @backstage/types@1.2.1
|
|
31
|
+
- @backstage/plugin-permission-react@0.4.32
|
|
32
|
+
|
|
3
33
|
## 0.1.7
|
|
4
34
|
|
|
5
35
|
### Patch Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createExtension, createExtensionInput, coreExtensionData, ExtensionBoundary } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { ApiProvider } from '../packages/core-app-api/src/apis/system/ApiProvider.esm.js';
|
|
4
4
|
import 'zen-observable';
|
|
@@ -6,6 +6,7 @@ import '@backstage/core-plugin-api';
|
|
|
6
6
|
import '../packages/core-app-api/src/apis/implementations/auth/saml/types.esm.js';
|
|
7
7
|
import '@backstage/config';
|
|
8
8
|
import '../packages/core-app-api/src/app/AppRouter.esm.js';
|
|
9
|
+
import 'react';
|
|
9
10
|
import 'react-use/esm/useAsync';
|
|
10
11
|
import '@backstage/core-plugin-api/alpha';
|
|
11
12
|
import '../packages/core-app-api/src/routing/FeatureFlagged.esm.js';
|
|
@@ -28,7 +29,7 @@ const App = createExtension({
|
|
|
28
29
|
factory: ({ node, apis, inputs }) => {
|
|
29
30
|
return [
|
|
30
31
|
coreExtensionData.reactElement(
|
|
31
|
-
/* @__PURE__ */
|
|
32
|
+
/* @__PURE__ */ jsx(ApiProvider, { apis, children: /* @__PURE__ */ jsx(AppThemeProvider, { children: /* @__PURE__ */ jsx(ExtensionBoundary, { node, children: inputs.root.get(coreExtensionData.reactElement) }) }) })
|
|
32
33
|
)
|
|
33
34
|
];
|
|
34
35
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"App.esm.js","sources":["../../src/extensions/App.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"App.esm.js","sources":["../../src/extensions/App.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ExtensionBoundary,\n coreExtensionData,\n createExtension,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { ApiProvider } from '../../../../packages/core-app-api/src';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppThemeProvider } from '../../../../packages/core-app-api/src/app/AppThemeProvider';\n\nexport const App = createExtension({\n attachTo: { id: 'root', input: 'app' },\n inputs: {\n root: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n },\n output: [coreExtensionData.reactElement],\n factory: ({ node, apis, inputs }) => {\n return [\n coreExtensionData.reactElement(\n <ApiProvider apis={apis}>\n <AppThemeProvider>\n <ExtensionBoundary node={node}>\n {inputs.root.get(coreExtensionData.reactElement)}\n </ExtensionBoundary>\n </AppThemeProvider>\n </ApiProvider>,\n ),\n ];\n },\n});\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AA2BO,MAAM,MAAM,eAAgB,CAAA;AAAA,EACjC,QAAU,EAAA,EAAE,EAAI,EAAA,MAAA,EAAQ,OAAO,KAAM,EAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,IAAM,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC3D,SAAW,EAAA;AAAA,KACZ;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,SAAS,CAAC,EAAE,IAAM,EAAA,IAAA,EAAM,QAAa,KAAA;AACnC,IAAO,OAAA;AAAA,MACL,iBAAkB,CAAA,YAAA;AAAA,wBACf,GAAA,CAAA,WAAA,EAAA,EAAY,IACX,EAAA,QAAA,kBAAA,GAAA,CAAC,oBACC,QAAC,kBAAA,GAAA,CAAA,iBAAA,EAAA,EAAkB,IAChB,EAAA,QAAA,EAAA,MAAA,CAAO,KAAK,GAAI,CAAA,iBAAA,CAAkB,YAAY,CAAA,EACjD,GACF,CACF,EAAA;AAAA;AACF,KACF;AAAA;AAEJ,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { createExtension, createExtensionInput, coreExtensionData } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { SidebarPage } from '@backstage/core-components';
|
|
4
4
|
|
|
@@ -16,7 +16,10 @@ const AppLayout = createExtension({
|
|
|
16
16
|
output: [coreExtensionData.reactElement],
|
|
17
17
|
factory: ({ inputs }) => [
|
|
18
18
|
coreExtensionData.reactElement(
|
|
19
|
-
/* @__PURE__ */
|
|
19
|
+
/* @__PURE__ */ jsxs(SidebarPage, { children: [
|
|
20
|
+
inputs.nav.get(coreExtensionData.reactElement),
|
|
21
|
+
inputs.content.get(coreExtensionData.reactElement)
|
|
22
|
+
] })
|
|
20
23
|
)
|
|
21
24
|
]
|
|
22
25
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppLayout.esm.js","sources":["../../src/extensions/AppLayout.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"AppLayout.esm.js","sources":["../../src/extensions/AppLayout.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport { SidebarPage } from '@backstage/core-components';\n\nexport const AppLayout = createExtension({\n name: 'layout',\n attachTo: { id: 'app/root', input: 'children' },\n inputs: {\n nav: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n content: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n },\n output: [coreExtensionData.reactElement],\n factory: ({ inputs }) => [\n coreExtensionData.reactElement(\n <SidebarPage>\n {inputs.nav.get(coreExtensionData.reactElement)}\n {inputs.content.get(coreExtensionData.reactElement)}\n </SidebarPage>,\n ),\n ],\n});\n"],"names":[],"mappings":";;;;AAuBO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,IAAM,EAAA,QAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,UAAA,EAAY,OAAO,UAAW,EAAA;AAAA,EAC9C,MAAQ,EAAA;AAAA,IACN,GAAK,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC1D,SAAW,EAAA;AAAA,KACZ,CAAA;AAAA,IACD,OAAS,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC9D,SAAW,EAAA;AAAA,KACZ;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,OAAS,EAAA,CAAC,EAAE,MAAA,EAAa,KAAA;AAAA,IACvB,iBAAkB,CAAA,YAAA;AAAA,2BACf,WACE,EAAA,EAAA,QAAA,EAAA;AAAA,QAAO,MAAA,CAAA,GAAA,CAAI,GAAI,CAAA,iBAAA,CAAkB,YAAY,CAAA;AAAA,QAC7C,MAAO,CAAA,OAAA,CAAQ,GAAI,CAAA,iBAAA,CAAkB,YAAY;AAAA,OACpD,EAAA;AAAA;AACF;AAEJ,CAAC;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { createElement } from 'react';
|
|
2
3
|
import { createExtension, createExtensionInput, NavItemBlueprint, NavLogoBlueprint, coreExtensionData, useRouteRef } from '@backstage/frontend-plugin-api';
|
|
3
4
|
import { makeStyles } from '@material-ui/core/styles';
|
|
4
5
|
import { sidebarConfig, Sidebar, SidebarDivider, useSidebarOpenState, Link, SidebarItem } from '@backstage/core-components';
|
|
@@ -22,7 +23,7 @@ const useSidebarLogoStyles = makeStyles({
|
|
|
22
23
|
const SidebarLogo = (props) => {
|
|
23
24
|
const classes = useSidebarLogoStyles();
|
|
24
25
|
const { isOpen } = useSidebarOpenState();
|
|
25
|
-
return /* @__PURE__ */
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: classes.root, children: /* @__PURE__ */ jsx(Link, { to: "/", underline: "none", className: classes.link, "aria-label": "Home", children: isOpen ? props?.logoFull ?? /* @__PURE__ */ jsx(LogoFull, {}) : props?.logoIcon ?? /* @__PURE__ */ jsx(LogoIcon, {}) }) });
|
|
26
27
|
};
|
|
27
28
|
const SidebarNavItem = (props) => {
|
|
28
29
|
const { icon: Icon, title, routeRef } = props;
|
|
@@ -30,7 +31,7 @@ const SidebarNavItem = (props) => {
|
|
|
30
31
|
if (!link) {
|
|
31
32
|
return null;
|
|
32
33
|
}
|
|
33
|
-
return /* @__PURE__ */
|
|
34
|
+
return /* @__PURE__ */ jsx(SidebarItem, { to: link(), icon: Icon, text: title });
|
|
34
35
|
};
|
|
35
36
|
const AppNav = createExtension({
|
|
36
37
|
name: "nav",
|
|
@@ -45,18 +46,22 @@ const AppNav = createExtension({
|
|
|
45
46
|
output: [coreExtensionData.reactElement],
|
|
46
47
|
factory: ({ inputs }) => [
|
|
47
48
|
coreExtensionData.reactElement(
|
|
48
|
-
/* @__PURE__ */
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
49
|
+
/* @__PURE__ */ jsxs(Sidebar, { children: [
|
|
50
|
+
/* @__PURE__ */ jsx(
|
|
51
|
+
SidebarLogo,
|
|
52
|
+
{
|
|
53
|
+
...inputs.logos?.get(NavLogoBlueprint.dataRefs.logoElements)
|
|
54
|
+
}
|
|
55
|
+
),
|
|
56
|
+
/* @__PURE__ */ jsx(SidebarDivider, {}),
|
|
57
|
+
inputs.items.map((item, index) => /* @__PURE__ */ createElement(
|
|
58
|
+
SidebarNavItem,
|
|
59
|
+
{
|
|
60
|
+
...item.get(NavItemBlueprint.dataRefs.target),
|
|
61
|
+
key: index
|
|
62
|
+
}
|
|
63
|
+
))
|
|
64
|
+
] })
|
|
60
65
|
)
|
|
61
66
|
]
|
|
62
67
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppNav.esm.js","sources":["../../src/extensions/AppNav.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"AppNav.esm.js","sources":["../../src/extensions/AppNav.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n useRouteRef,\n NavItemBlueprint,\n NavLogoBlueprint,\n} from '@backstage/frontend-plugin-api';\nimport { makeStyles } from '@material-ui/core/styles';\nimport {\n Sidebar,\n useSidebarOpenState,\n Link,\n sidebarConfig,\n SidebarDivider,\n SidebarItem,\n} from '@backstage/core-components';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport LogoIcon from '../../../../packages/app/src/components/Root/LogoIcon';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport LogoFull from '../../../../packages/app/src/components/Root/LogoFull';\n\nconst useSidebarLogoStyles = makeStyles({\n root: {\n width: sidebarConfig.drawerWidthClosed,\n height: 3 * sidebarConfig.logoHeight,\n display: 'flex',\n flexFlow: 'row nowrap',\n alignItems: 'center',\n marginBottom: -14,\n },\n link: {\n width: sidebarConfig.drawerWidthClosed,\n marginLeft: 24,\n },\n});\n\nconst SidebarLogo = (\n props: (typeof NavLogoBlueprint.dataRefs.logoElements)['T'],\n) => {\n const classes = useSidebarLogoStyles();\n const { isOpen } = useSidebarOpenState();\n\n return (\n <div className={classes.root}>\n <Link to=\"/\" underline=\"none\" className={classes.link} aria-label=\"Home\">\n {isOpen\n ? props?.logoFull ?? <LogoFull />\n : props?.logoIcon ?? <LogoIcon />}\n </Link>\n </div>\n );\n};\n\nconst SidebarNavItem = (\n props: (typeof NavItemBlueprint.dataRefs.target)['T'],\n) => {\n const { icon: Icon, title, routeRef } = props;\n const link = useRouteRef(routeRef);\n if (!link) {\n return null;\n }\n // TODO: Support opening modal, for example, the search one\n return <SidebarItem to={link()} icon={Icon} text={title} />;\n};\n\nexport const AppNav = createExtension({\n name: 'nav',\n attachTo: { id: 'app/layout', input: 'nav' },\n inputs: {\n items: createExtensionInput([NavItemBlueprint.dataRefs.target]),\n logos: createExtensionInput([NavLogoBlueprint.dataRefs.logoElements], {\n singleton: true,\n optional: true,\n }),\n },\n output: [coreExtensionData.reactElement],\n factory: ({ inputs }) => [\n coreExtensionData.reactElement(\n <Sidebar>\n <SidebarLogo\n {...inputs.logos?.get(NavLogoBlueprint.dataRefs.logoElements)}\n />\n <SidebarDivider />\n {inputs.items.map((item, index) => (\n <Sidebar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 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { useState } from 'react';
|
|
2
3
|
import { createExtension, createExtensionInput, RouterBlueprint, SignInPageBlueprint, coreExtensionData, AppRootWrapperBlueprint, discoveryApiRef, errorApiRef, fetchApiRef, routeResolutionApiRef } from '@backstage/frontend-plugin-api';
|
|
3
4
|
import { identityApiRef, useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
5
|
import { isProtectedApp } from '../packages/core-app-api/src/app/isProtectedApp.esm.js';
|
|
@@ -53,11 +54,11 @@ const AppRoot = createExtension({
|
|
|
53
54
|
);
|
|
54
55
|
for (const wrapper of inputs.wrappers) {
|
|
55
56
|
const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);
|
|
56
|
-
content = /* @__PURE__ */
|
|
57
|
+
content = /* @__PURE__ */ jsx(Component, { children: content });
|
|
57
58
|
}
|
|
58
59
|
return [
|
|
59
60
|
coreExtensionData.reactElement(
|
|
60
|
-
/* @__PURE__ */
|
|
61
|
+
/* @__PURE__ */ jsx(
|
|
61
62
|
AppRouter,
|
|
62
63
|
{
|
|
63
64
|
SignInPageComponent: inputs.signInPage?.get(
|
|
@@ -68,9 +69,9 @@ const AppRoot = createExtension({
|
|
|
68
69
|
),
|
|
69
70
|
extraElements: inputs.elements?.map(
|
|
70
71
|
(el) => el.get(coreExtensionData.reactElement)
|
|
71
|
-
)
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
),
|
|
73
|
+
children: content
|
|
74
|
+
}
|
|
74
75
|
)
|
|
75
76
|
)
|
|
76
77
|
];
|
|
@@ -85,12 +86,12 @@ function SignInPageWrapper({
|
|
|
85
86
|
const configApi = useApi(configApiRef);
|
|
86
87
|
const basePath = getBasePath(configApi);
|
|
87
88
|
if (!identityApi) {
|
|
88
|
-
return /* @__PURE__ */
|
|
89
|
+
return /* @__PURE__ */ jsx(Component, { onSignInSuccess: setIdentityApi });
|
|
89
90
|
}
|
|
90
91
|
appIdentityProxy.setTarget(identityApi, {
|
|
91
92
|
signOutTargetUrl: basePath || "/"
|
|
92
93
|
});
|
|
93
|
-
return /* @__PURE__ */
|
|
94
|
+
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
94
95
|
}
|
|
95
96
|
function toAppIdentityProxy(identityApi) {
|
|
96
97
|
if (!("enableCookieAuth" in identityApi)) {
|
|
@@ -101,7 +102,7 @@ function toAppIdentityProxy(identityApi) {
|
|
|
101
102
|
function DefaultRouter(props) {
|
|
102
103
|
const configApi = useApi(configApiRef);
|
|
103
104
|
const basePath = getBasePath(configApi);
|
|
104
|
-
return /* @__PURE__ */
|
|
105
|
+
return /* @__PURE__ */ jsx(BrowserRouter, { basename: basePath, children: props.children });
|
|
105
106
|
}
|
|
106
107
|
function AppRouter(props) {
|
|
107
108
|
const {
|
|
@@ -142,16 +143,24 @@ function AppRouter(props) {
|
|
|
142
143
|
},
|
|
143
144
|
{ signOutTargetUrl: basePath || "/" }
|
|
144
145
|
);
|
|
145
|
-
return /* @__PURE__ */
|
|
146
|
+
return /* @__PURE__ */ jsxs(RouterComponent, { children: [
|
|
147
|
+
...extraElements,
|
|
148
|
+
/* @__PURE__ */ jsx(RouteTracker, { routeObjects }),
|
|
149
|
+
children
|
|
150
|
+
] });
|
|
146
151
|
}
|
|
147
|
-
return /* @__PURE__ */
|
|
148
|
-
|
|
149
|
-
{
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
152
|
+
return /* @__PURE__ */ jsxs(RouterComponent, { children: [
|
|
153
|
+
...extraElements,
|
|
154
|
+
/* @__PURE__ */ jsx(RouteTracker, { routeObjects }),
|
|
155
|
+
/* @__PURE__ */ jsx(
|
|
156
|
+
SignInPageWrapper,
|
|
157
|
+
{
|
|
158
|
+
component: SignInPageComponent,
|
|
159
|
+
appIdentityProxy,
|
|
160
|
+
children
|
|
161
|
+
}
|
|
162
|
+
)
|
|
163
|
+
] });
|
|
155
164
|
}
|
|
156
165
|
|
|
157
166
|
export { AppRoot, AppRouter };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoot.esm.js","sources":["../../src/extensions/AppRoot.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport React, {\n ComponentType,\n PropsWithChildren,\n ReactNode,\n useState,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n discoveryApiRef,\n fetchApiRef,\n errorApiRef,\n createExtension,\n createExtensionInput,\n routeResolutionApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n ProfileInfo,\n SignInPageProps,\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isProtectedApp } from '../../../../packages/core-app-api/src/app/isProtectedApp';\nimport { BrowserRouter } from 'react-router-dom';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/RouteTracker';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath';\n\nexport const AppRoot = createExtension({\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput([RouterBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n children: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n elements: createExtensionInput([coreExtensionData.reactElement]),\n wrappers: createExtensionInput([\n AppRootWrapperBlueprint.dataRefs.component,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, apis }) {\n if (isProtectedApp()) {\n const identityApi = apis.get(identityApiRef);\n if (!identityApi) {\n throw new Error('App requires an Identity API implementation');\n }\n const appIdentityProxy = toAppIdentityProxy(identityApi);\n const discoveryApi = apis.get(discoveryApiRef);\n const errorApi = apis.get(errorApiRef);\n const fetchApi = apis.get(fetchApiRef);\n if (!discoveryApi || !errorApi || !fetchApi) {\n throw new Error(\n 'App is running in protected mode but missing required APIs',\n );\n }\n appIdentityProxy.enableCookieAuth({\n discoveryApi,\n errorApi,\n fetchApi,\n });\n }\n\n let content: React.ReactNode = inputs.children.get(\n coreExtensionData.reactElement,\n );\n\n for (const wrapper of inputs.wrappers) {\n const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);\n content = <Component>{content}</Component>;\n }\n\n return [\n coreExtensionData.reactElement(\n <AppRouter\n SignInPageComponent={inputs.signInPage?.get(\n SignInPageBlueprint.dataRefs.component,\n )}\n RouterComponent={inputs.router?.get(\n RouterBlueprint.dataRefs.component,\n )}\n extraElements={inputs.elements?.map(el =>\n el.get(coreExtensionData.reactElement),\n )}\n >\n {content}\n </AppRouter>,\n ),\n ];\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\ntype AppIdentityProxy = IdentityApi & {\n enableCookieAuth(ctx: {\n errorApi: ErrorApi;\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n }): void;\n setTarget(\n impl: IdentityApi & /* backwards compat stuff */ {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n },\n options: { signOutTargetUrl: string },\n ): void;\n};\n\nfunction toAppIdentityProxy(identityApi: IdentityApi): AppIdentityProxy {\n if (!('enableCookieAuth' in identityApi)) {\n throw new Error('Unexpected Identity API implementation');\n }\n return identityApi as AppIdentityProxy;\n}\n\ntype RouteResolverProxy = {\n getRouteObjects(): any[];\n};\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: ComponentType<PropsWithChildren<{}>>;\n extraElements?: Array<React.JSX.Element>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n extraElements = [],\n } = props;\n\n const configApi = useApi(configApiRef);\n const appIdentityProxy = toAppIdentityProxy(useApi(identityApiRef));\n const routeResolutionsApi = useApi(routeResolutionApiRef);\n const basePath = getBasePath(configApi);\n\n // TODO: Private access for now, probably replace with path -> node lookup method on the API\n if (!('getRouteObjects' in routeResolutionsApi)) {\n throw new Error('Unexpected route resolution API implementation');\n }\n const routeObjects = (\n routeResolutionsApi as RouteResolverProxy\n ).getRouteObjects();\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AAqDO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,MAAO,EAAA;AAAA,EACrC,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA,CAAC,eAAgB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAAA,MACjE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACX,CAAA;AAAA,IACD,YAAY,oBAAqB,CAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,SAAS,CAAG,EAAA;AAAA,MACzE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA;AAAA,KACX,CAAA;AAAA,IACD,QAAU,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC/D,SAAW,EAAA;AAAA,KACZ,CAAA;AAAA,IACD,QAAU,EAAA,o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AAC,oBAAoB;AAAA,SAC5C,CAAA;AAAA,QACA,cAAA,EAAgB,aAAa,EAAC,CAAA;AAAA,QAC9B,SAAS,YAAY;AAAA;AAAC,OACxB;AAAA,MACA,EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI;AAAA,KACtC;AAEA,IACE,uBAAA,KAAA,CAAA,aAAA,CAAC,uBACE,GAAG,aAAA,sCACH,YAAa,EAAA,EAAA,YAAA,EAA4B,GACzC,QACH,CAAA;AAAA;AAIJ,EAAA,2CACG,eACE,EAAA,IAAA,EAAA,GAAG,+BACH,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAa,cAA4B,CAC1C,kBAAA,KAAA,CAAA,aAAA;AAAA,IAAC,iBAAA;AAAA,IAAA;AAAA,MACC,SAAW,EAAA,mBAAA;AAAA,MACX;AAAA,KAAA;AAAA,IAEC;AAAA,GAEL,CAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"AppRoot.esm.js","sources":["../../src/extensions/AppRoot.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n ComponentType,\n PropsWithChildren,\n ReactNode,\n useState,\n JSX,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n discoveryApiRef,\n fetchApiRef,\n errorApiRef,\n createExtension,\n createExtensionInput,\n routeResolutionApiRef,\n} from '@backstage/frontend-plugin-api';\nimport {\n DiscoveryApi,\n ErrorApi,\n FetchApi,\n IdentityApi,\n ProfileInfo,\n SignInPageProps,\n configApiRef,\n identityApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { isProtectedApp } from '../../../../packages/core-app-api/src/app/isProtectedApp';\nimport { BrowserRouter } from 'react-router-dom';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { RouteTracker } from '../../../../packages/frontend-app-api/src/routing/RouteTracker';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { getBasePath } from '../../../../packages/frontend-app-api/src/routing/getBasePath';\n\nexport const AppRoot = createExtension({\n name: 'root',\n attachTo: { id: 'app', input: 'root' },\n inputs: {\n router: createExtensionInput([RouterBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {\n singleton: true,\n optional: true,\n }),\n children: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n elements: createExtensionInput([coreExtensionData.reactElement]),\n wrappers: createExtensionInput([\n AppRootWrapperBlueprint.dataRefs.component,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs, apis }) {\n if (isProtectedApp()) {\n const identityApi = apis.get(identityApiRef);\n if (!identityApi) {\n throw new Error('App requires an Identity API implementation');\n }\n const appIdentityProxy = toAppIdentityProxy(identityApi);\n const discoveryApi = apis.get(discoveryApiRef);\n const errorApi = apis.get(errorApiRef);\n const fetchApi = apis.get(fetchApiRef);\n if (!discoveryApi || !errorApi || !fetchApi) {\n throw new Error(\n 'App is running in protected mode but missing required APIs',\n );\n }\n appIdentityProxy.enableCookieAuth({\n discoveryApi,\n errorApi,\n fetchApi,\n });\n }\n\n let content: ReactNode = inputs.children.get(\n coreExtensionData.reactElement,\n );\n\n for (const wrapper of inputs.wrappers) {\n const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);\n content = <Component>{content}</Component>;\n }\n\n return [\n coreExtensionData.reactElement(\n <AppRouter\n SignInPageComponent={inputs.signInPage?.get(\n SignInPageBlueprint.dataRefs.component,\n )}\n RouterComponent={inputs.router?.get(\n RouterBlueprint.dataRefs.component,\n )}\n extraElements={inputs.elements?.map(el =>\n el.get(coreExtensionData.reactElement),\n )}\n >\n {content}\n </AppRouter>,\n ),\n ];\n },\n});\n\n// This wraps the sign-in page and waits for sign-in to be completed before rendering the app\nfunction SignInPageWrapper({\n component: Component,\n appIdentityProxy,\n children,\n}: {\n component: ComponentType<SignInPageProps>;\n appIdentityProxy: AppIdentityProxy;\n children: ReactNode;\n}) {\n const [identityApi, setIdentityApi] = useState<IdentityApi>();\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n\n if (!identityApi) {\n return <Component onSignInSuccess={setIdentityApi} />;\n }\n\n appIdentityProxy.setTarget(identityApi, {\n signOutTargetUrl: basePath || '/',\n });\n return <>{children}</>;\n}\n\ntype AppIdentityProxy = IdentityApi & {\n enableCookieAuth(ctx: {\n errorApi: ErrorApi;\n fetchApi: FetchApi;\n discoveryApi: DiscoveryApi;\n }): void;\n setTarget(\n impl: IdentityApi & /* backwards compat stuff */ {\n getUserId?(): string;\n getIdToken?(): Promise<string | undefined>;\n getProfile?(): ProfileInfo;\n },\n options: { signOutTargetUrl: string },\n ): void;\n};\n\nfunction toAppIdentityProxy(identityApi: IdentityApi): AppIdentityProxy {\n if (!('enableCookieAuth' in identityApi)) {\n throw new Error('Unexpected Identity API implementation');\n }\n return identityApi as AppIdentityProxy;\n}\n\ntype RouteResolverProxy = {\n getRouteObjects(): any[];\n};\n\n/**\n * Props for the {@link AppRouter} component.\n * @public\n */\nexport interface AppRouterProps {\n children?: ReactNode;\n SignInPageComponent?: ComponentType<SignInPageProps>;\n RouterComponent?: ComponentType<PropsWithChildren<{}>>;\n extraElements?: Array<JSX.Element>;\n}\n\nfunction DefaultRouter(props: PropsWithChildren<{}>) {\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n return <BrowserRouter basename={basePath}>{props.children}</BrowserRouter>;\n}\n\n/**\n * App router and sign-in page wrapper.\n *\n * @remarks\n *\n * The AppRouter provides the routing context and renders the sign-in page.\n * Until the user has successfully signed in, this component will render\n * the sign-in page. Once the user has signed-in, it will instead render\n * the app, while providing routing and route tracking for the app.\n */\nexport function AppRouter(props: AppRouterProps) {\n const {\n children,\n SignInPageComponent,\n RouterComponent = DefaultRouter,\n extraElements = [],\n } = props;\n\n const configApi = useApi(configApiRef);\n const appIdentityProxy = toAppIdentityProxy(useApi(identityApiRef));\n const routeResolutionsApi = useApi(routeResolutionApiRef);\n const basePath = getBasePath(configApi);\n\n // TODO: Private access for now, probably replace with path -> node lookup method on the API\n if (!('getRouteObjects' in routeResolutionsApi)) {\n throw new Error('Unexpected route resolution API implementation');\n }\n const routeObjects = (\n routeResolutionsApi as RouteResolverProxy\n ).getRouteObjects();\n\n // If the app hasn't configured a sign-in page, we just continue as guest.\n if (!SignInPageComponent) {\n appIdentityProxy.setTarget(\n {\n getUserId: () => 'guest',\n getIdToken: async () => undefined,\n getProfile: () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getProfileInfo: async () => ({\n email: 'guest@example.com',\n displayName: 'Guest',\n }),\n getBackstageIdentity: async () => ({\n type: 'user',\n userEntityRef: 'user:default/guest',\n ownershipEntityRefs: ['user:default/guest'],\n }),\n getCredentials: async () => ({}),\n signOut: async () => {},\n },\n { signOutTargetUrl: basePath || '/' },\n );\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n {...extraElements}\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;;AAsDO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,IAAM,EAAA,MAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,KAAA,EAAO,OAAO,MA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A,eAAgB,EAAA;AAGlB,EAAA,IAAI,CAAC,mBAAqB,EAAA;AACxB,IAAiB,gBAAA,CAAA,SAAA;AAAA,MACf;AAAA,QACE,WAAW,MAAM,OAAA;AAAA,QACjB,YAAY,YAAY,KAAA,CAAA;AAAA,QACxB,YAAY,OAAO;AAAA,UACjB,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACf,CAAA;AAAA,QACA,gBAAgB,aAAa;AAAA,UAC3B,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA;AAAA,SACf,CAAA;AAAA,QACA,sBAAsB,aAAa;AAAA,UACjC,IAAM,EAAA,MAAA;AAAA,UACN,aAAe,EAAA,oBAAA;AAAA,UACf,mBAAA,EAAqB,CAAC,oBAAoB;AAAA,SAC5C,CAAA;AAAA,QACA,cAAA,EAAgB,aAAa,EAAC,CAAA;AAAA,QAC9B,SAAS,YAAY;AAAA;AAAC,OACxB;AAAA,MACA,EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI;AAAA,KACtC;AAEA,IAAA,4BACG,eACE,EAAA,EAAA,QAAA,EAAA;AAAA,MAAG,GAAA,aAAA;AAAA,sBACJ,GAAA,CAAC,gBAAa,YAA4B,EAAA,CAAA;AAAA,MACzC;AAAA,KACH,EAAA,CAAA;AAAA;AAIJ,EAAA,4BACG,eACE,EAAA,EAAA,QAAA,EAAA;AAAA,IAAG,GAAA,aAAA;AAAA,oBACJ,GAAA,CAAC,gBAAa,YAA4B,EAAA,CAAA;AAAA,oBAC1C,GAAA;AAAA,MAAC,iBAAA;AAAA,MAAA;AAAA,QACC,SAAW,EAAA,mBAAA;AAAA,QACX,gBAAA;AAAA,QAEC;AAAA;AAAA;AACH,GACF,EAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { createExtension, createExtensionInput, coreExtensionData, useComponentRef, coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { useRoutes } from 'react-router-dom';
|
|
4
4
|
|
|
@@ -25,12 +25,12 @@ const AppRoutes = createExtension({
|
|
|
25
25
|
})),
|
|
26
26
|
{
|
|
27
27
|
path: "*",
|
|
28
|
-
element: /* @__PURE__ */
|
|
28
|
+
element: /* @__PURE__ */ jsx(NotFoundErrorPage, {})
|
|
29
29
|
}
|
|
30
30
|
]);
|
|
31
31
|
return element;
|
|
32
32
|
};
|
|
33
|
-
return [coreExtensionData.reactElement(/* @__PURE__ */
|
|
33
|
+
return [coreExtensionData.reactElement(/* @__PURE__ */ jsx(Routes, {}))];
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"AppRoutes.esm.js","sources":["../../src/extensions/AppRoutes.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n coreComponentRefs,\n useComponentRef,\n} from '@backstage/frontend-plugin-api';\nimport { useRoutes } from 'react-router-dom';\n\nexport const AppRoutes = createExtension({\n name: 'routes',\n attachTo: { id: 'app/layout', input: 'content' },\n inputs: {\n routes: createExtensionInput([\n coreExtensionData.routePath,\n coreExtensionData.routeRef.optional(),\n coreExtensionData.reactElement,\n ]),\n },\n output: [coreExtensionData.reactElement],\n factory({ inputs }) {\n const Routes = () => {\n const NotFoundErrorPage = useComponentRef(\n coreComponentRefs.notFoundErrorPage,\n );\n\n const element = useRoutes([\n ...inputs.routes.map(route => ({\n path: `${route.get(coreExtensionData.routePath)}/*`,\n element: route.get(coreExtensionData.reactElement),\n })),\n {\n path: '*',\n element: <NotFoundErrorPage />,\n },\n ]);\n\n return element;\n };\n\n return [coreExtensionData.reactElement(<Routes />)];\n },\n});\n"],"names":[],"mappings":";;;;AAyBO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,IAAM,EAAA,QAAA;AAAA,EACN,QAAU,EAAA,EAAE,EAAI,EAAA,YAAA,EAAc,OAAO,SAAU,EAAA;AAAA,EAC/C,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA;AAAA,MAC3B,iBAAkB,CAAA,SAAA;AAAA,MAClB,iBAAA,CAAkB,SAAS,QAAS,EAAA;AAAA,MACpC,iBAAkB,CAAA;AAAA,KACnB;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,OAAA,CAAQ,EAAE,MAAA,EAAU,EAAA;AAClB,IAAA,MAAM,SAAS,MAAM;AACnB,MAAA,MAAM,iBAAoB,GAAA,eAAA;AAAA,QACxB,iBAAkB,CAAA;AAAA,OACpB;AAEA,MAAA,MAAM,UAAU,SAAU,CAAA;AAAA,QACxB,GAAG,MAAA,CAAO,MAAO,CAAA,GAAA,CAAI,CAAU,KAAA,MAAA;AAAA,UAC7B,MAAM,CAAG,EAAA,KAAA,CAAM,GAAI,CAAA,iBAAA,CAAkB,SAAS,CAAC,CAAA,EAAA,CAAA;AAAA,UAC/C,OAAS,EAAA,KAAA,CAAM,GAAI,CAAA,iBAAA,CAAkB,YAAY;AAAA,SACjD,CAAA,CAAA;AAAA,QACF;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAA,sBAAU,iBAAkB,EAAA,EAAA;AAAA;AAC9B,OACD,CAAA;AAED,MAAO,OAAA,OAAA;AAAA,KACT;AAEA,IAAA,OAAO,CAAC,iBAAkB,CAAA,YAAA,iBAAc,GAAA,CAAA,MAAA,EAAA,EAAO,CAAE,CAAC,CAAA;AAAA;AAEtD,CAAC;;;;"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { UnifiedThemeProvider, themes } from '@backstage/theme';
|
|
3
3
|
import DarkIcon from '@material-ui/icons/Brightness2';
|
|
4
4
|
import LightIcon from '@material-ui/icons/WbSunny';
|
|
@@ -34,8 +34,8 @@ const LightTheme = ThemeBlueprint.make({
|
|
|
34
34
|
id: "light",
|
|
35
35
|
title: "Light Theme",
|
|
36
36
|
variant: "light",
|
|
37
|
-
icon: /* @__PURE__ */
|
|
38
|
-
Provider: ({ children }) => /* @__PURE__ */
|
|
37
|
+
icon: /* @__PURE__ */ jsx(LightIcon, {}),
|
|
38
|
+
Provider: ({ children }) => /* @__PURE__ */ jsx(UnifiedThemeProvider, { theme: themes.light, children })
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
});
|
|
@@ -46,8 +46,8 @@ const DarkTheme = ThemeBlueprint.make({
|
|
|
46
46
|
id: "dark",
|
|
47
47
|
title: "Dark Theme",
|
|
48
48
|
variant: "dark",
|
|
49
|
-
icon: /* @__PURE__ */
|
|
50
|
-
Provider: ({ children }) => /* @__PURE__ */
|
|
49
|
+
icon: /* @__PURE__ */ jsx(DarkIcon, {}),
|
|
50
|
+
Provider: ({ children }) => /* @__PURE__ */ jsx(UnifiedThemeProvider, { theme: themes.dark, children })
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AppThemeApi.esm.js","sources":["../../src/extensions/AppThemeApi.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
|
|
1
|
+
{"version":3,"file":"AppThemeApi.esm.js","sources":["../../src/extensions/AppThemeApi.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 {\n UnifiedThemeProvider,\n themes as builtinThemes,\n} from '@backstage/theme';\nimport DarkIcon from '@material-ui/icons/Brightness2';\nimport LightIcon from '@material-ui/icons/WbSunny';\nimport {\n createExtensionInput,\n ThemeBlueprint,\n ApiBlueprint,\n createApiFactory,\n appThemeApiRef,\n} from '@backstage/frontend-plugin-api';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppThemeSelector } from '../../../../packages/core-app-api/src/apis/implementations';\n\n/**\n * Contains the themes installed into the app.\n */\nexport const AppThemeApi = ApiBlueprint.makeWithOverrides({\n name: 'app-theme',\n inputs: {\n themes: createExtensionInput([ThemeBlueprint.dataRefs.theme], {\n replaces: [{ id: 'app', input: 'themes' }],\n }),\n },\n factory: (originalFactory, { inputs }) => {\n return originalFactory({\n factory: createApiFactory(\n appThemeApiRef,\n AppThemeSelector.createWithStorage(\n inputs.themes.map(i => i.get(ThemeBlueprint.dataRefs.theme)),\n ),\n ),\n });\n },\n});\n\nexport const LightTheme = ThemeBlueprint.make({\n name: 'light',\n params: {\n theme: {\n id: 'light',\n title: 'Light Theme',\n variant: 'light',\n icon: <LightIcon />,\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={builtinThemes.light} children={children} />\n ),\n },\n },\n});\n\nexport const DarkTheme = ThemeBlueprint.make({\n name: 'dark',\n params: {\n theme: {\n id: 'dark',\n title: 'Dark Theme',\n variant: 'dark',\n icon: <DarkIcon />,\n Provider: ({ children }) => (\n <UnifiedThemeProvider theme={builtinThemes.dark} children={children} />\n ),\n },\n },\n});\n"],"names":["builtinThemes"],"mappings":";;;;;;;;;;;AAmCa,MAAA,WAAA,GAAc,aAAa,iBAAkB,CAAA;AAAA,EACxD,IAAM,EAAA,WAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,QAAQ,oBAAqB,CAAA,CAAC,cAAe,CAAA,QAAA,CAAS,KAAK,CAAG,EAAA;AAAA,MAC5D,UAAU,CAAC,EAAE,IAAI,KAAO,EAAA,KAAA,EAAO,UAAU;AAAA,KAC1C;AAAA,GACH;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAS,EAAA,gBAAA;AAAA,QACP,cAAA;AAAA,QACA,gBAAiB,CAAA,iBAAA;AAAA,UACf,MAAA,CAAO,OAAO,GAAI,CAAA,CAAA,CAAA,KAAK,EAAE,GAAI,CAAA,cAAA,CAAe,QAAS,CAAA,KAAK,CAAC;AAAA;AAC7D;AACF,KACD,CAAA;AAAA;AAEL,CAAC;AAEY,MAAA,UAAA,GAAa,eAAe,IAAK,CAAA;AAAA,EAC5C,IAAM,EAAA,OAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,EAAI,EAAA,OAAA;AAAA,MACJ,KAAO,EAAA,aAAA;AAAA,MACP,OAAS,EAAA,OAAA;AAAA,MACT,IAAA,sBAAO,SAAU,EAAA,EAAA,CAAA;AAAA,MACjB,QAAA,EAAU,CAAC,EAAE,QAAS,EAAA,yBACnB,oBAAqB,EAAA,EAAA,KAAA,EAAOA,MAAc,CAAA,KAAA,EAAO,QAAoB,EAAA;AAAA;AAE1E;AAEJ,CAAC;AAEY,MAAA,SAAA,GAAY,eAAe,IAAK,CAAA;AAAA,EAC3C,IAAM,EAAA,MAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,KAAO,EAAA;AAAA,MACL,EAAI,EAAA,MAAA;AAAA,MACJ,KAAO,EAAA,YAAA;AAAA,MACP,OAAS,EAAA,MAAA;AAAA,MACT,IAAA,sBAAO,QAAS,EAAA,EAAA,CAAA;AAAA,MAChB,QAAA,EAAU,CAAC,EAAE,QAAS,EAAA,yBACnB,oBAAqB,EAAA,EAAA,KAAA,EAAOA,MAAc,CAAA,IAAA,EAAM,QAAoB,EAAA;AAAA;AAEzE;AAEJ,CAAC;;;;"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { SignInPageBlueprint } from '@backstage/frontend-plugin-api';
|
|
3
3
|
import { SignInPage } from '@backstage/core-components';
|
|
4
4
|
|
|
5
5
|
const DefaultSignInPage = SignInPageBlueprint.make({
|
|
6
6
|
params: {
|
|
7
|
-
loader: async () => (props) => /* @__PURE__ */
|
|
7
|
+
loader: async () => (props) => /* @__PURE__ */ jsx(SignInPage, { ...props, providers: ["guest"] })
|
|
8
8
|
}
|
|
9
9
|
});
|
|
10
10
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DefaultSignInPage.esm.js","sources":["../../src/extensions/DefaultSignInPage.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 */\nimport
|
|
1
|
+
{"version":3,"file":"DefaultSignInPage.esm.js","sources":["../../src/extensions/DefaultSignInPage.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 */\nimport { SignInPageBlueprint } from '@backstage/frontend-plugin-api';\nimport { SignInPage } from '@backstage/core-components';\n\nexport const DefaultSignInPage = SignInPageBlueprint.make({\n params: {\n loader: async () => props =>\n <SignInPage {...props} providers={['guest']} />,\n },\n});\n"],"names":[],"mappings":";;;;AAkBa,MAAA,iBAAA,GAAoB,oBAAoB,IAAK,CAAA;AAAA,EACxD,MAAQ,EAAA;AAAA,IACN,MAAA,EAAQ,YAAY,CAAA,KAAA,qBACjB,GAAA,CAAA,UAAA,EAAA,EAAY,GAAG,KAAO,EAAA,SAAA,EAAW,CAAC,OAAO,CAAG,EAAA;AAAA;AAEnD,CAAC;;;;"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
|
+
import { Fragment, useState, useEffect } from 'react';
|
|
2
3
|
import { AppRootElementBlueprint, dialogApiRef } from '@backstage/frontend-plugin-api';
|
|
3
4
|
import { createDeferred } from '@backstage/types';
|
|
4
5
|
import Dialog from '@material-ui/core/Dialog';
|
|
@@ -24,7 +25,7 @@ function DialogDisplay({
|
|
|
24
25
|
setDialogs((ds) => ds.filter((d) => d.dialog.id !== id));
|
|
25
26
|
},
|
|
26
27
|
update(ElementOrComponent) {
|
|
27
|
-
const element2 = typeof ElementOrComponent === "function" ? /* @__PURE__ */
|
|
28
|
+
const element2 = typeof ElementOrComponent === "function" ? /* @__PURE__ */ jsx(ElementOrComponent, { dialog }) : ElementOrComponent;
|
|
28
29
|
setDialogs(
|
|
29
30
|
(ds) => ds.map((d) => d.dialog.id === id ? { dialog, element: element2 } : d)
|
|
30
31
|
);
|
|
@@ -33,14 +34,14 @@ function DialogDisplay({
|
|
|
33
34
|
return deferred;
|
|
34
35
|
}
|
|
35
36
|
};
|
|
36
|
-
const element = /* @__PURE__ */
|
|
37
|
+
const element = /* @__PURE__ */ jsx(options.component, { dialog });
|
|
37
38
|
setDialogs((ds) => [...ds, { dialog, element }]);
|
|
38
39
|
return dialog;
|
|
39
40
|
});
|
|
40
41
|
}, [dialogApi]);
|
|
41
42
|
if (dialogs.length > 0) {
|
|
42
43
|
const lastDialog = dialogs[dialogs.length - 1];
|
|
43
|
-
return /* @__PURE__ */
|
|
44
|
+
return /* @__PURE__ */ jsx(
|
|
44
45
|
Dialog,
|
|
45
46
|
{
|
|
46
47
|
open: true,
|
|
@@ -48,9 +49,9 @@ function DialogDisplay({
|
|
|
48
49
|
if (!lastDialog.dialog.modal) {
|
|
49
50
|
lastDialog.dialog.close();
|
|
50
51
|
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
},
|
|
53
|
+
children: lastDialog.element
|
|
54
|
+
}
|
|
54
55
|
);
|
|
55
56
|
}
|
|
56
57
|
return null;
|
|
@@ -61,11 +62,11 @@ const dialogDisplayAppRootElement = AppRootElementBlueprint.makeWithOverrides({
|
|
|
61
62
|
const dialogApi = apis.get(dialogApiRef);
|
|
62
63
|
if (!isInternalDialogApi(dialogApi)) {
|
|
63
64
|
return originalFactory({
|
|
64
|
-
element: /* @__PURE__ */
|
|
65
|
+
element: /* @__PURE__ */ jsx(Fragment, {})
|
|
65
66
|
});
|
|
66
67
|
}
|
|
67
68
|
return originalFactory({
|
|
68
|
-
element: /* @__PURE__ */
|
|
69
|
+
element: /* @__PURE__ */ jsx(DialogDisplay, { dialogApi })
|
|
69
70
|
});
|
|
70
71
|
}
|
|
71
72
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DialogDisplay.esm.js","sources":["../../src/extensions/DialogDisplay.tsx"],"sourcesContent":["/*\n * Copyright 2025 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
|
|
1
|
+
{"version":3,"file":"DialogDisplay.esm.js","sources":["../../src/extensions/DialogDisplay.tsx"],"sourcesContent":["/*\n * Copyright 2025 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 { Fragment, useEffect, useState } from 'react';\nimport {\n AppRootElementBlueprint,\n DialogApi,\n DialogApiDialog,\n dialogApiRef,\n} from '@backstage/frontend-plugin-api';\nimport { createDeferred } from '@backstage/types';\nimport { OnShowDialog } from '../apis/DefaultDialogApi';\nimport Dialog from '@material-ui/core/Dialog';\n\nlet dialogId = 0;\nfunction getDialogId() {\n dialogId += 1;\n return dialogId.toString(36);\n}\n\ntype DialogState = DialogApiDialog & {\n id: string;\n modal: boolean;\n};\n\n/**\n * The other half of the default implementation of the {@link DialogApi}.\n *\n * This component is responsible for rendering the dialogs in the React tree and managing a stack of dialogs.\n * It expects the implementation of the {@link DialogApi} to be the `DefaultDialogApi`. If one is replaced the other must be too.\n * @internal\n */\nfunction DialogDisplay({\n dialogApi,\n}: {\n dialogApi: DialogApi & { connect(onShow: OnShowDialog): void };\n}) {\n const [dialogs, setDialogs] = useState<\n { dialog: DialogState; element: React.JSX.Element }[]\n >([]);\n\n useEffect(() => {\n dialogApi.connect(options => {\n const id = getDialogId();\n const deferred = createDeferred<unknown>();\n const dialog: DialogState = {\n id,\n modal: options.modal,\n close(result) {\n deferred.resolve(result);\n setDialogs(ds => ds.filter(d => d.dialog.id !== id));\n },\n update(ElementOrComponent) {\n const element =\n typeof ElementOrComponent === 'function' ? (\n <ElementOrComponent dialog={dialog} />\n ) : (\n ElementOrComponent\n );\n setDialogs(ds =>\n ds.map(d => (d.dialog.id === id ? { dialog, element } : d)),\n );\n },\n async result() {\n return deferred;\n },\n };\n const element = <options.component dialog={dialog} />;\n setDialogs(ds => [...ds, { dialog, element }]);\n return dialog;\n });\n }, [dialogApi]);\n\n if (dialogs.length > 0) {\n const lastDialog = dialogs[dialogs.length - 1];\n return (\n <Dialog\n open\n onClose={() => {\n if (!lastDialog.dialog.modal) {\n lastDialog.dialog.close();\n }\n }}\n >\n {lastDialog.element}\n </Dialog>\n );\n }\n\n return null;\n}\n\nexport const dialogDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n name: 'dialog-display',\n factory(originalFactory, { apis }) {\n const dialogApi = apis.get(dialogApiRef);\n if (!isInternalDialogApi(dialogApi)) {\n return originalFactory({\n element: <Fragment />,\n });\n }\n return originalFactory({\n element: <DialogDisplay dialogApi={dialogApi} />,\n });\n },\n });\n\nfunction isInternalDialogApi(\n dialogApi?: DialogApi,\n): dialogApi is DialogApi & { connect(onShow: OnShowDialog): void } {\n if (!dialogApi) {\n return false;\n }\n return 'connect' in dialogApi;\n}\n"],"names":["element"],"mappings":";;;;;;AA2BA,IAAI,QAAW,GAAA,CAAA;AACf,SAAS,WAAc,GAAA;AACrB,EAAY,QAAA,IAAA,CAAA;AACZ,EAAO,OAAA,QAAA,CAAS,SAAS,EAAE,CAAA;AAC7B;AAcA,SAAS,aAAc,CAAA;AAAA,EACrB;AACF,CAEG,EAAA;AACD,EAAA,MAAM,CAAC,OAAS,EAAA,UAAU,CAAI,GAAA,QAAA,CAE5B,EAAE,CAAA;AAEJ,EAAA,SAAA,CAAU,MAAM;AACd,IAAA,SAAA,CAAU,QAAQ,CAAW,OAAA,KAAA;AAC3B,MAAA,MAAM,KAAK,WAAY,EAAA;AACvB,MAAA,MAAM,WAAW,cAAwB,EAAA;AACzC,MAAA,MAAM,MAAsB,GAAA;AAAA,QAC1B,EAAA;AAAA,QACA,OAAO,OAAQ,CAAA,KAAA;AAAA,QACf,MAAM,MAAQ,EAAA;AACZ,UAAA,QAAA,CAAS,QAAQ,MAAM,CAAA;AACvB,UAAW,UAAA,CAAA,CAAA,EAAA,KAAM,GAAG,MAAO,CAAA,CAAA,CAAA,KAAK,EAAE,MAAO,CAAA,EAAA,KAAO,EAAE,CAAC,CAAA;AAAA,SACrD;AAAA,QACA,OAAO,kBAAoB,EAAA;AACzB,UAAA,MAAMA,WACJ,OAAO,kBAAA,KAAuB,6BAC3B,GAAA,CAAA,kBAAA,EAAA,EAAmB,QAAgB,CAEpC,GAAA,kBAAA;AAEJ,UAAA,UAAA;AAAA,YAAW,CACT,EAAA,KAAA,EAAA,CAAG,GAAI,CAAA,CAAA,CAAA,KAAM,CAAE,CAAA,MAAA,CAAO,EAAO,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A;AAAA,OACpB,CAAA;AAAA;AAEH,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAA,kBAAU,GAAA,CAAA,aAAA,EAAA,EAAc,SAAsB,EAAA;AAAA,KAC/C,CAAA;AAAA;AAEL,CAAC;AAEH,SAAS,oBACP,SACkE,EAAA;AAClE,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,OAAO,SAAa,IAAA,SAAA;AACtB;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ApiBlueprint, createExtensionInput, IconBundleBlueprint, createApiFactory, iconsApiRef } from '@backstage/frontend-plugin-api';
|
|
2
2
|
import { DefaultIconsApi } from '../packages/frontend-app-api/src/apis/implementations/IconsApi/DefaultIconsApi.esm.js';
|
|
3
3
|
import '../packages/app-defaults/src/defaults/apis.esm.js';
|
|
4
|
-
import 'react';
|
|
4
|
+
import 'react/jsx-runtime';
|
|
5
5
|
import '@material-ui/core/Button';
|
|
6
6
|
import '@backstage/core-components';
|
|
7
7
|
import 'react-router-dom';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { jsx } from 'react/jsx-runtime';
|
|
2
2
|
import Button from '@material-ui/core/Button';
|
|
3
3
|
import { createComponentExtension, coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
4
4
|
import { ErrorPanel } from '@backstage/core-components';
|
|
@@ -46,7 +46,7 @@ const DefaultErrorBoundaryComponent = createComponentExtension({
|
|
|
46
46
|
sync: () => (props) => {
|
|
47
47
|
const { plugin, error, resetError } = props;
|
|
48
48
|
const title = `Error in ${plugin?.id}`;
|
|
49
|
-
return /* @__PURE__ */
|
|
49
|
+
return /* @__PURE__ */ jsx(ErrorPanel, { title, error, defaultExpanded: true, children: /* @__PURE__ */ jsx(Button, { variant: "outlined", onClick: resetError, children: "Retry" }) });
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport
|
|
1
|
+
{"version":3,"file":"components.esm.js","sources":["../../src/extensions/components.tsx"],"sourcesContent":["/*\n * Copyright 2023 The Backstage Authors\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport Button from '@material-ui/core/Button';\n\nimport {\n createComponentExtension,\n coreComponentRefs,\n} from '@backstage/frontend-plugin-api';\nimport { ErrorPanel } from '@backstage/core-components';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { components as defaultComponents } from '../../../../packages/app-defaults/src/defaults';\n\nexport const DefaultProgressComponent = createComponentExtension({\n ref: coreComponentRefs.progress,\n loader: { sync: () => defaultComponents.Progress },\n});\n\nexport const DefaultNotFoundErrorPageComponent = createComponentExtension({\n ref: coreComponentRefs.notFoundErrorPage,\n loader: { sync: () => defaultComponents.NotFoundErrorPage },\n});\n\nexport const DefaultErrorBoundaryComponent = createComponentExtension({\n ref: coreComponentRefs.errorBoundaryFallback,\n loader: {\n sync: () => props => {\n const { plugin, error, resetError } = props;\n const title = `Error in ${plugin?.id}`;\n\n return (\n <ErrorPanel title={title} error={error} defaultExpanded>\n <Button variant=\"outlined\" onClick={resetError}>\n Retry\n </Button>\n </ErrorPanel>\n );\n },\n },\n});\n"],"names":["defaultComponents"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BO,MAAM,2BAA2B,wBAAyB,CAAA;AAAA,EAC/D,KAAK,iBAAkB,CAAA,QAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,QAAS;AACnD,CAAC;AAEM,MAAM,oCAAoC,wBAAyB,CAAA;AAAA,EACxE,KAAK,iBAAkB,CAAA,iBAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,iBAAkB;AAC5D,CAAC;AAEM,MAAM,gCAAgC,wBAAyB,CAAA;AAAA,EACpE,KAAK,iBAAkB,CAAA,qBAAA;AAAA,EACvB,MAAQ,EAAA;AAAA,IACN,IAAA,EAAM,MAAM,CAAS,KAAA,KAAA;AACnB,MAAA,MAAM,EAAE,MAAA,EAAQ,KAAO,EAAA,UAAA,EAAe,GAAA,KAAA;AACtC,MAAM,MAAA,KAAA,GAAQ,CAAY,SAAA,EAAA,MAAA,EAAQ,EAAE,CAAA,CAAA;AAEpC,MAAA,uBACG,GAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,KAAA,EAAc,eAAe,EAAA,IAAA,EACrD,QAAC,kBAAA,GAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,UAAA,EAAW,OAAS,EAAA,UAAA,EAAY,mBAEhD,CACF,EAAA,CAAA;AAAA;AAEJ;AAEJ,CAAC;;;;"}
|