@backstage/frontend-app-api 0.8.0 → 0.9.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +64 -0
- package/dist/core-app-api/src/apis/system/ApiRegistry.esm.js +50 -0
- package/dist/core-app-api/src/apis/system/ApiRegistry.esm.js.map +1 -0
- package/dist/extensions/Root.esm.js +18 -0
- package/dist/extensions/Root.esm.js.map +1 -0
- package/dist/frontend-plugin-api/src/wiring/createExtension.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/createExtensionOverrides.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/createFrontendModule.esm.js +25 -0
- package/dist/frontend-plugin-api/src/wiring/createFrontendModule.esm.js.map +1 -0
- package/dist/frontend-plugin-api/src/wiring/createFrontendPlugin.esm.js +10 -3
- package/dist/frontend-plugin-api/src/wiring/createFrontendPlugin.esm.js.map +1 -1
- package/dist/frontend-plugin-api/src/wiring/resolveExtensionDefinition.esm.js.map +1 -1
- package/dist/index.d.ts +22 -49
- package/dist/index.esm.js +1 -1
- package/dist/routing/collectRouteIds.esm.js +2 -1
- package/dist/routing/collectRouteIds.esm.js.map +1 -1
- package/dist/tree/instantiateAppNodeTree.esm.js +8 -5
- package/dist/tree/instantiateAppNodeTree.esm.js.map +1 -1
- package/dist/tree/resolveAppNodeSpecs.esm.js +42 -5
- package/dist/tree/resolveAppNodeSpecs.esm.js.map +1 -1
- package/dist/tree/resolveAppTree.esm.js +40 -20
- package/dist/tree/resolveAppTree.esm.js.map +1 -1
- package/dist/wiring/createSpecializedApp.esm.js +188 -0
- package/dist/wiring/createSpecializedApp.esm.js.map +1 -0
- package/package.json +6 -8
- package/dist/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js +0 -30
- package/dist/apis/implementations/ComponentsApi/DefaultComponentsApi.esm.js.map +0 -1
- package/dist/apis/implementations/IconsApi/DefaultIconsApi.esm.js +0 -15
- package/dist/apis/implementations/IconsApi/DefaultIconsApi.esm.js.map +0 -1
- package/dist/app/src/components/Root/LogoFull.esm.js +0 -33
- package/dist/app/src/components/Root/LogoFull.esm.js.map +0 -1
- package/dist/app/src/components/Root/LogoIcon.esm.js +0 -33
- package/dist/app/src/components/Root/LogoIcon.esm.js.map +0 -1
- package/dist/app-defaults/src/defaults/apis.esm.js +0 -221
- package/dist/app-defaults/src/defaults/apis.esm.js.map +0 -1
- package/dist/app-defaults/src/defaults/components.esm.js +0 -46
- package/dist/app-defaults/src/defaults/components.esm.js.map +0 -1
- package/dist/app-defaults/src/defaults/icons.esm.js +0 -51
- package/dist/app-defaults/src/defaults/icons.esm.js.map +0 -1
- package/dist/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.esm.js +0 -89
- package/dist/core-app-api/src/apis/implementations/AppLanguageApi/AppLanguageSelector.esm.js.map +0 -1
- package/dist/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.esm.js +0 -76
- package/dist/core-app-api/src/apis/implementations/FeatureFlagsApi/LocalStorageFeatureFlags.esm.js.map +0 -1
- package/dist/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi.esm.js +0 -234
- package/dist/core-app-api/src/apis/implementations/TranslationApi/I18nextTranslationApi.esm.js.map +0 -1
- package/dist/core-app-api/src/app/AppThemeProvider.esm.js +0 -60
- package/dist/core-app-api/src/app/AppThemeProvider.esm.js.map +0 -1
- package/dist/core-app-api/src/app/defaultConfigLoader.esm.js +0 -33
- package/dist/core-app-api/src/app/defaultConfigLoader.esm.js.map +0 -1
- package/dist/core-app-api/src/app/isProtectedApp.esm.js +0 -8
- package/dist/core-app-api/src/app/isProtectedApp.esm.js.map +0 -1
- package/dist/core-app-api/src/app/overrideBaseUrlConfigs.esm.js +0 -50
- package/dist/core-app-api/src/app/overrideBaseUrlConfigs.esm.js.map +0 -1
- package/dist/core-app-api/src/lib/subjects.esm.js +0 -69
- package/dist/core-app-api/src/lib/subjects.esm.js.map +0 -1
- package/dist/core-plugin-api/src/translation/TranslationRef.esm.js +0 -13
- package/dist/core-plugin-api/src/translation/TranslationRef.esm.js.map +0 -1
- package/dist/core-plugin-api/src/translation/TranslationResource.esm.js +0 -13
- package/dist/core-plugin-api/src/translation/TranslationResource.esm.js.map +0 -1
- package/dist/extensions/App.esm.js +0 -31
- package/dist/extensions/App.esm.js.map +0 -1
- package/dist/extensions/AppLayout.esm.js +0 -26
- package/dist/extensions/AppLayout.esm.js.map +0 -1
- package/dist/extensions/AppNav.esm.js +0 -66
- package/dist/extensions/AppNav.esm.js.map +0 -1
- package/dist/extensions/AppRoot.esm.js +0 -126
- package/dist/extensions/AppRoot.esm.js.map +0 -1
- package/dist/extensions/AppRoutes.esm.js +0 -39
- package/dist/extensions/AppRoutes.esm.js.map +0 -1
- package/dist/extensions/components.esm.js +0 -52
- package/dist/extensions/components.esm.js.map +0 -1
- package/dist/extensions/elements.esm.js +0 -32
- package/dist/extensions/elements.esm.js.map +0 -1
- package/dist/extensions/themes.esm.js +0 -33
- package/dist/extensions/themes.esm.js.map +0 -1
- package/dist/routing/RouteTracker.esm.js +0 -69
- package/dist/routing/RouteTracker.esm.js.map +0 -1
- package/dist/tree/createAppTree.esm.js +0 -21
- package/dist/tree/createAppTree.esm.js.map +0 -1
- package/dist/wiring/InternalAppContext.esm.js +0 -6
- package/dist/wiring/InternalAppContext.esm.js.map +0 -1
- package/dist/wiring/createApp.esm.js +0 -275
- package/dist/wiring/createApp.esm.js.map +0 -1
- package/dist/wiring/discovery.esm.js +0 -54
- package/dist/wiring/discovery.esm.js.map +0 -1
|
@@ -1 +0,0 @@
|
|
|
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 React from 'react';\nimport {\n ExtensionBoundary,\n coreExtensionData,\n createComponentExtension,\n createExtension,\n createExtensionInput,\n IconBundleBlueprint,\n ThemeBlueprint,\n ApiBlueprint,\n TranslationBlueprint,\n} from '@backstage/frontend-plugin-api';\n\nexport const App = createExtension({\n namespace: 'app',\n attachTo: { id: 'root', input: 'default' }, // ignored\n inputs: {\n apis: createExtensionInput([ApiBlueprint.dataRefs.factory]),\n themes: createExtensionInput([ThemeBlueprint.dataRefs.theme]),\n components: createExtensionInput([\n createComponentExtension.componentDataRef,\n ]),\n translations: createExtensionInput([\n TranslationBlueprint.dataRefs.translation,\n ]),\n icons: createExtensionInput([IconBundleBlueprint.dataRefs.icons]),\n root: createExtensionInput([coreExtensionData.reactElement], {\n singleton: true,\n }),\n },\n output: [coreExtensionData.reactElement],\n factory: ({ node, inputs }) => [\n coreExtensionData.reactElement(\n <ExtensionBoundary node={node}>\n {inputs.root.get(coreExtensionData.reactElement)}\n </ExtensionBoundary>,\n ),\n ],\n});\n"],"names":[],"mappings":";;;AA6BO,MAAM,MAAM,eAAgB,CAAA;AAAA,EACjC,SAAW,EAAA,KAAA;AAAA,EACX,QAAU,EAAA,EAAE,EAAI,EAAA,MAAA,EAAQ,OAAO,SAAU,EAAA;AAAA;AAAA,EACzC,MAAQ,EAAA;AAAA,IACN,MAAM,oBAAqB,CAAA,CAAC,YAAa,CAAA,QAAA,CAAS,OAAO,CAAC,CAAA;AAAA,IAC1D,QAAQ,oBAAqB,CAAA,CAAC,cAAe,CAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA,IAC5D,YAAY,oBAAqB,CAAA;AAAA,MAC/B,wBAAyB,CAAA,gBAAA;AAAA,KAC1B,CAAA;AAAA,IACD,cAAc,oBAAqB,CAAA;AAAA,MACjC,qBAAqB,QAAS,CAAA,WAAA;AAAA,KAC/B,CAAA;AAAA,IACD,OAAO,oBAAqB,CAAA,CAAC,mBAAoB,CAAA,QAAA,CAAS,KAAK,CAAC,CAAA;AAAA,IAChE,IAAM,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC3D,SAAW,EAAA,IAAA;AAAA,KACZ,CAAA;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,CAAkB,YAAY,CAAA;AAAA,EACvC,OAAS,EAAA,CAAC,EAAE,IAAA,EAAM,QAAa,KAAA;AAAA,IAC7B,iBAAkB,CAAA,YAAA;AAAA,sBAChB,KAAA,CAAA,aAAA,CAAC,qBAAkB,IAChB,EAAA,EAAA,MAAA,CAAO,KAAK,GAAI,CAAA,iBAAA,CAAkB,YAAY,CACjD,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, coreExtensionData } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { SidebarPage } from '@backstage/core-components';
|
|
4
|
-
|
|
5
|
-
const AppLayout = createExtension({
|
|
6
|
-
namespace: "app",
|
|
7
|
-
name: "layout",
|
|
8
|
-
attachTo: { id: "app/root", input: "children" },
|
|
9
|
-
inputs: {
|
|
10
|
-
nav: createExtensionInput([coreExtensionData.reactElement], {
|
|
11
|
-
singleton: true
|
|
12
|
-
}),
|
|
13
|
-
content: createExtensionInput([coreExtensionData.reactElement], {
|
|
14
|
-
singleton: true
|
|
15
|
-
})
|
|
16
|
-
},
|
|
17
|
-
output: [coreExtensionData.reactElement],
|
|
18
|
-
factory: ({ inputs }) => [
|
|
19
|
-
coreExtensionData.reactElement(
|
|
20
|
-
/* @__PURE__ */ React.createElement(SidebarPage, null, inputs.nav.get(coreExtensionData.reactElement), inputs.content.get(coreExtensionData.reactElement))
|
|
21
|
-
)
|
|
22
|
-
]
|
|
23
|
-
});
|
|
24
|
-
|
|
25
|
-
export { AppLayout };
|
|
26
|
-
//# sourceMappingURL=AppLayout.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 React from 'react';\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 namespace: 'app',\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":";;;;AAwBO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,SAAW,EAAA,KAAA;AAAA,EACX,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,IAAA;AAAA,KACZ,CAAA;AAAA,IACD,OAAS,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC9D,SAAW,EAAA,IAAA;AAAA,KACZ,CAAA;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,sBACf,KAAA,CAAA,aAAA,CAAA,WAAA,EAAA,IAAA,EACE,MAAO,CAAA,GAAA,CAAI,GAAI,CAAA,iBAAA,CAAkB,YAAY,CAAA,EAC7C,MAAO,CAAA,OAAA,CAAQ,GAAI,CAAA,iBAAA,CAAkB,YAAY,CACpD,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, createNavItemExtension, createNavLogoExtension, coreExtensionData, useRouteRef } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { makeStyles } from '@material-ui/core/styles';
|
|
4
|
-
import { sidebarConfig, Sidebar, SidebarDivider, useSidebarOpenState, Link, SidebarItem } from '@backstage/core-components';
|
|
5
|
-
import LogoIcon from '../app/src/components/Root/LogoIcon.esm.js';
|
|
6
|
-
import LogoFull from '../app/src/components/Root/LogoFull.esm.js';
|
|
7
|
-
|
|
8
|
-
const useSidebarLogoStyles = makeStyles({
|
|
9
|
-
root: {
|
|
10
|
-
width: sidebarConfig.drawerWidthClosed,
|
|
11
|
-
height: 3 * sidebarConfig.logoHeight,
|
|
12
|
-
display: "flex",
|
|
13
|
-
flexFlow: "row nowrap",
|
|
14
|
-
alignItems: "center",
|
|
15
|
-
marginBottom: -14
|
|
16
|
-
},
|
|
17
|
-
link: {
|
|
18
|
-
width: sidebarConfig.drawerWidthClosed,
|
|
19
|
-
marginLeft: 24
|
|
20
|
-
}
|
|
21
|
-
});
|
|
22
|
-
const SidebarLogo = (props) => {
|
|
23
|
-
const classes = useSidebarLogoStyles();
|
|
24
|
-
const { isOpen } = useSidebarOpenState();
|
|
25
|
-
return /* @__PURE__ */ React.createElement("div", { className: classes.root }, /* @__PURE__ */ React.createElement(Link, { to: "/", underline: "none", className: classes.link, "aria-label": "Home" }, isOpen ? props?.logoFull ?? /* @__PURE__ */ React.createElement(LogoFull, null) : props?.logoIcon ?? /* @__PURE__ */ React.createElement(LogoIcon, null)));
|
|
26
|
-
};
|
|
27
|
-
const SidebarNavItem = (props) => {
|
|
28
|
-
const { icon: Icon, title, routeRef } = props;
|
|
29
|
-
const link = useRouteRef(routeRef);
|
|
30
|
-
if (!link) {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
return /* @__PURE__ */ React.createElement(SidebarItem, { to: link(), icon: Icon, text: title });
|
|
34
|
-
};
|
|
35
|
-
const AppNav = createExtension({
|
|
36
|
-
namespace: "app",
|
|
37
|
-
name: "nav",
|
|
38
|
-
attachTo: { id: "app/layout", input: "nav" },
|
|
39
|
-
inputs: {
|
|
40
|
-
items: createExtensionInput([createNavItemExtension.targetDataRef]),
|
|
41
|
-
logos: createExtensionInput([createNavLogoExtension.logoElementsDataRef], {
|
|
42
|
-
singleton: true,
|
|
43
|
-
optional: true
|
|
44
|
-
})
|
|
45
|
-
},
|
|
46
|
-
output: [coreExtensionData.reactElement],
|
|
47
|
-
factory: ({ inputs }) => [
|
|
48
|
-
coreExtensionData.reactElement(
|
|
49
|
-
/* @__PURE__ */ React.createElement(Sidebar, null, /* @__PURE__ */ React.createElement(
|
|
50
|
-
SidebarLogo,
|
|
51
|
-
{
|
|
52
|
-
...inputs.logos?.get(createNavLogoExtension.logoElementsDataRef)
|
|
53
|
-
}
|
|
54
|
-
), /* @__PURE__ */ React.createElement(SidebarDivider, null), inputs.items.map((item, index) => /* @__PURE__ */ React.createElement(
|
|
55
|
-
SidebarNavItem,
|
|
56
|
-
{
|
|
57
|
-
...item.get(createNavItemExtension.targetDataRef),
|
|
58
|
-
key: index
|
|
59
|
-
}
|
|
60
|
-
)))
|
|
61
|
-
)
|
|
62
|
-
]
|
|
63
|
-
});
|
|
64
|
-
|
|
65
|
-
export { AppNav };
|
|
66
|
-
//# sourceMappingURL=AppNav.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 React from 'react';\nimport {\n createExtension,\n coreExtensionData,\n createExtensionInput,\n useRouteRef,\n createNavItemExtension,\n createNavLogoExtension,\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 '../../../app/src/components/Root/LogoIcon';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport LogoFull from '../../../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 createNavLogoExtension.logoElementsDataRef)['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 createNavItemExtension.targetDataRef)['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 namespace: 'app',\n name: 'nav',\n attachTo: { id: 'app/layout', input: 'nav' },\n inputs: {\n items: createExtensionInput([createNavItemExtension.targetDataRef]),\n logos: createExtensionInput([createNavLogoExtension.logoElementsDataRef], {\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(createNavLogoExtension.logoElementsDataRef)}\n />\n <SidebarDivider />\n {inputs.items.map((item, index) => (\n <SidebarNavItem\n {...item.get(createNavItemExtension.targetDataRef)}\n key={index}\n />\n ))}\n </Sidebar>,\n ),\n ],\n});\n"],"names":[],"mappings":";;;;;;;AAuCA,MAAM,uBAAuB,UAAW,CAAA;AAAA,EACtC,IAAM,EAAA;AAAA,IACJ,OAAO,aAAc,CAAA,iBAAA;AAAA,IACrB,MAAA,EAAQ,IAAI,aAAc,CAAA,UAAA;AAAA,IAC1B,OAAS,EAAA,MAAA;AAAA,IACT,QAAU,EAAA,YAAA;AAAA,IACV,UAAY,EAAA,QAAA;AAAA,IACZ,YAAc,EAAA,CAAA,EAAA;AAAA,GAChB;AAAA,EACA,IAAM,EAAA;AAAA,IACJ,OAAO,aAAc,CAAA,iBAAA;AAAA,IACrB,UAAY,EAAA,EAAA;AAAA,GACd;AACF,C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AAO,EAAA,oBAAA,CAAqB,CAAC,sBAAA,CAAuB,aAAa,CAAC,CAAA;AAAA,IAClE,KAAO,EAAA,oBAAA,CAAqB,CAAC,sBAAA,CAAuB,mBAAmB,CAAG,EAAA;AAAA,MACxE,SAAW,EAAA,IAAA;AAAA,MACX,QAAU,EAAA,IAAA;AAAA,KACX,CAAA;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,0CACf,OACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,WAAA;AAAA,QAAA;AAAA,UACE,GAAG,MAAA,CAAO,KAAO,EAAA,GAAA,CAAI,uBAAuB,mBAAmB,CAAA;AAAA,SAAA;AAAA,OAClE,sCACC,cAAe,EAAA,IAAA,CAAA,EACf,OAAO,KAAM,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,KACvB,qBAAA,KAAA,CAAA,aAAA;AAAA,QAAC,cAAA;AAAA,QAAA;AAAA,UACE,GAAG,IAAA,CAAK,GAAI,CAAA,sBAAA,CAAuB,aAAa,CAAA;AAAA,UACjD,GAAK,EAAA,KAAA;AAAA,SAAA;AAAA,OAER,CACH,CAAA;AAAA,KACF;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,126 +0,0 @@
|
|
|
1
|
-
import React, { Fragment, useContext, useState } from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, RouterBlueprint, SignInPageBlueprint, coreExtensionData, AppRootWrapperBlueprint } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { useApi, configApiRef } from '@backstage/core-plugin-api';
|
|
4
|
-
import { InternalAppContext } from '../wiring/InternalAppContext.esm.js';
|
|
5
|
-
import { BrowserRouter } from 'react-router-dom';
|
|
6
|
-
import { RouteTracker } from '../routing/RouteTracker.esm.js';
|
|
7
|
-
import { getBasePath } from '../routing/getBasePath.esm.js';
|
|
8
|
-
|
|
9
|
-
const AppRoot = createExtension({
|
|
10
|
-
namespace: "app",
|
|
11
|
-
name: "root",
|
|
12
|
-
attachTo: { id: "app", input: "root" },
|
|
13
|
-
inputs: {
|
|
14
|
-
router: createExtensionInput([RouterBlueprint.dataRefs.component], {
|
|
15
|
-
singleton: true,
|
|
16
|
-
optional: true
|
|
17
|
-
}),
|
|
18
|
-
signInPage: createExtensionInput([SignInPageBlueprint.dataRefs.component], {
|
|
19
|
-
singleton: true,
|
|
20
|
-
optional: true
|
|
21
|
-
}),
|
|
22
|
-
children: createExtensionInput([coreExtensionData.reactElement], {
|
|
23
|
-
singleton: true
|
|
24
|
-
}),
|
|
25
|
-
elements: createExtensionInput([coreExtensionData.reactElement]),
|
|
26
|
-
wrappers: createExtensionInput([
|
|
27
|
-
AppRootWrapperBlueprint.dataRefs.component
|
|
28
|
-
])
|
|
29
|
-
},
|
|
30
|
-
output: [coreExtensionData.reactElement],
|
|
31
|
-
factory({ inputs }) {
|
|
32
|
-
let content = /* @__PURE__ */ React.createElement(React.Fragment, null, inputs.elements.map((el) => /* @__PURE__ */ React.createElement(Fragment, { key: el.node.spec.id }, el.get(coreExtensionData.reactElement))), inputs.children.get(coreExtensionData.reactElement));
|
|
33
|
-
for (const wrapper of inputs.wrappers) {
|
|
34
|
-
const Component = wrapper.get(AppRootWrapperBlueprint.dataRefs.component);
|
|
35
|
-
content = /* @__PURE__ */ React.createElement(Component, null, content);
|
|
36
|
-
}
|
|
37
|
-
return [
|
|
38
|
-
coreExtensionData.reactElement(
|
|
39
|
-
/* @__PURE__ */ React.createElement(
|
|
40
|
-
AppRouter,
|
|
41
|
-
{
|
|
42
|
-
SignInPageComponent: inputs.signInPage?.get(
|
|
43
|
-
SignInPageBlueprint.dataRefs.component
|
|
44
|
-
),
|
|
45
|
-
RouterComponent: inputs.router?.get(
|
|
46
|
-
RouterBlueprint.dataRefs.component
|
|
47
|
-
)
|
|
48
|
-
},
|
|
49
|
-
content
|
|
50
|
-
)
|
|
51
|
-
)
|
|
52
|
-
];
|
|
53
|
-
}
|
|
54
|
-
});
|
|
55
|
-
function SignInPageWrapper({
|
|
56
|
-
component: Component,
|
|
57
|
-
appIdentityProxy,
|
|
58
|
-
children
|
|
59
|
-
}) {
|
|
60
|
-
const [identityApi, setIdentityApi] = useState();
|
|
61
|
-
const configApi = useApi(configApiRef);
|
|
62
|
-
const basePath = getBasePath(configApi);
|
|
63
|
-
if (!identityApi) {
|
|
64
|
-
return /* @__PURE__ */ React.createElement(Component, { onSignInSuccess: setIdentityApi });
|
|
65
|
-
}
|
|
66
|
-
appIdentityProxy.setTarget(identityApi, {
|
|
67
|
-
signOutTargetUrl: basePath || "/"
|
|
68
|
-
});
|
|
69
|
-
return /* @__PURE__ */ React.createElement(React.Fragment, null, children);
|
|
70
|
-
}
|
|
71
|
-
function DefaultRouter(props) {
|
|
72
|
-
const configApi = useApi(configApiRef);
|
|
73
|
-
const basePath = getBasePath(configApi);
|
|
74
|
-
return /* @__PURE__ */ React.createElement(BrowserRouter, { basename: basePath }, props.children);
|
|
75
|
-
}
|
|
76
|
-
function AppRouter(props) {
|
|
77
|
-
const {
|
|
78
|
-
children,
|
|
79
|
-
SignInPageComponent,
|
|
80
|
-
RouterComponent = DefaultRouter
|
|
81
|
-
} = props;
|
|
82
|
-
const configApi = useApi(configApiRef);
|
|
83
|
-
const basePath = getBasePath(configApi);
|
|
84
|
-
const internalAppContext = useContext(InternalAppContext);
|
|
85
|
-
if (!internalAppContext) {
|
|
86
|
-
throw new Error("AppRouter must be rendered within the AppProvider");
|
|
87
|
-
}
|
|
88
|
-
const { routeObjects, appIdentityProxy } = internalAppContext;
|
|
89
|
-
if (!SignInPageComponent) {
|
|
90
|
-
appIdentityProxy.setTarget(
|
|
91
|
-
{
|
|
92
|
-
getUserId: () => "guest",
|
|
93
|
-
getIdToken: async () => void 0,
|
|
94
|
-
getProfile: () => ({
|
|
95
|
-
email: "guest@example.com",
|
|
96
|
-
displayName: "Guest"
|
|
97
|
-
}),
|
|
98
|
-
getProfileInfo: async () => ({
|
|
99
|
-
email: "guest@example.com",
|
|
100
|
-
displayName: "Guest"
|
|
101
|
-
}),
|
|
102
|
-
getBackstageIdentity: async () => ({
|
|
103
|
-
type: "user",
|
|
104
|
-
userEntityRef: "user:default/guest",
|
|
105
|
-
ownershipEntityRefs: ["user:default/guest"]
|
|
106
|
-
}),
|
|
107
|
-
getCredentials: async () => ({}),
|
|
108
|
-
signOut: async () => {
|
|
109
|
-
}
|
|
110
|
-
},
|
|
111
|
-
{ signOutTargetUrl: basePath || "/" }
|
|
112
|
-
);
|
|
113
|
-
return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), children);
|
|
114
|
-
}
|
|
115
|
-
return /* @__PURE__ */ React.createElement(RouterComponent, null, /* @__PURE__ */ React.createElement(RouteTracker, { routeObjects }), /* @__PURE__ */ React.createElement(
|
|
116
|
-
SignInPageWrapper,
|
|
117
|
-
{
|
|
118
|
-
component: SignInPageComponent,
|
|
119
|
-
appIdentityProxy
|
|
120
|
-
},
|
|
121
|
-
children
|
|
122
|
-
));
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
export { AppRoot, AppRouter };
|
|
126
|
-
//# sourceMappingURL=AppRoot.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 Fragment,\n PropsWithChildren,\n ReactNode,\n useContext,\n useState,\n} from 'react';\nimport {\n AppRootWrapperBlueprint,\n RouterBlueprint,\n SignInPageBlueprint,\n coreExtensionData,\n createExtension,\n createExtensionInput,\n} from '@backstage/frontend-plugin-api';\nimport {\n IdentityApi,\n SignInPageProps,\n configApiRef,\n useApi,\n} from '@backstage/core-plugin-api';\nimport { InternalAppContext } from '../wiring/InternalAppContext';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppIdentityProxy } from '../../../core-app-api/src/apis/implementations/IdentityApi/AppIdentityProxy';\nimport { BrowserRouter } from 'react-router-dom';\nimport { RouteTracker } from '../routing/RouteTracker';\nimport { getBasePath } from '../routing/getBasePath';\n\nexport const AppRoot = createExtension({\n namespace: 'app',\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 }) {\n let content: React.ReactNode = (\n <>\n {inputs.elements.map(el => (\n <Fragment key={el.node.spec.id}>\n {el.get(coreExtensionData.reactElement)}\n </Fragment>\n ))}\n {inputs.children.get(coreExtensionData.reactElement)}\n </>\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 >\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\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}\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 } = props;\n\n const configApi = useApi(configApiRef);\n const basePath = getBasePath(configApi);\n const internalAppContext = useContext(InternalAppContext);\n if (!internalAppContext) {\n throw new Error('AppRouter must be rendered within the AppProvider');\n }\n const { routeObjects, appIdentityProxy } = internalAppContext;\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 <RouteTracker routeObjects={routeObjects} />\n {children}\n </RouterComponent>\n );\n }\n\n return (\n <RouterComponent>\n <RouteTracker routeObjects={routeObjects} />\n <SignInPageWrapper\n component={SignInPageComponent}\n appIdentityProxy={appIdentityProxy}\n >\n {children}\n </SignInPageWrapper>\n </RouterComponent>\n );\n}\n"],"names":[],"mappings":";;;;;;;;AA6CO,MAAM,UAAU,eAAgB,CAAA;AAAA,EACrC,SAAW,EAAA,KAAA;AAAA,EACX,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,IAAA;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,IAAA;AAAA,KACX,CAAA;AAAA,IACD,QAAU,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAG,EAAA;AAAA,MAC/D,SAAW,EAAA,IAAA;AAAA,KACZ,CAAA;AAAA,IACD,QAAU,EAAA,oBAAA,CAAqB,CAAC,iBAAA,CAAkB,YAAY,CAAC,CAAA;AAAA,IAC/D,UAAU,oBAAqB,CAAA;AAAA,MAC7B,wBAAwB,QAAS,CAAA,SAAA;AAAA,KAClC,CAAA;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,iBAAA,C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AqB,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,OAAA;AAAA,SACf,CAAA;AAAA,QACA,gBAAgB,aAAa;AAAA,UAC3B,KAAO,EAAA,mBAAA;AAAA,UACP,WAAa,EAAA,OAAA;AAAA,SACf,CAAA;AAAA,QACA,sBAAsB,aAAa;AAAA,UACjC,IAAM,EAAA,MAAA;AAAA,UACN,aAAe,EAAA,oBAAA;AAAA,UACf,mBAAA,EAAqB,CAAC,oBAAoB,CAAA;AAAA,SAC5C,CAAA;AAAA,QACA,cAAA,EAAgB,aAAa,EAAC,CAAA;AAAA,QAC9B,SAAS,YAAY;AAAA,SAAC;AAAA,OACxB;AAAA,MACA,EAAE,gBAAkB,EAAA,QAAA,IAAY,GAAI,EAAA;AAAA,KACtC,CAAA;AAEA,IAAA,2CACG,eACC,EAAA,IAAA,kBAAA,KAAA,CAAA,aAAA,CAAC,YAAa,EAAA,EAAA,YAAA,EAA4B,GACzC,QACH,CAAA,CAAA;AAAA,GAEJ;AAEA,EAAA,uBACG,KAAA,CAAA,aAAA,CAAA,eAAA,EAAA,IAAA,kBACE,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,gBAAA;AAAA,KAAA;AAAA,IAEC,QAAA;AAAA,GAEL,CAAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { createExtension, createExtensionInput, coreExtensionData, useComponentRef, coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import { useRoutes } from 'react-router-dom';
|
|
4
|
-
|
|
5
|
-
const AppRoutes = createExtension({
|
|
6
|
-
namespace: "app",
|
|
7
|
-
name: "routes",
|
|
8
|
-
attachTo: { id: "app/layout", input: "content" },
|
|
9
|
-
inputs: {
|
|
10
|
-
routes: createExtensionInput([
|
|
11
|
-
coreExtensionData.routePath,
|
|
12
|
-
coreExtensionData.routeRef.optional(),
|
|
13
|
-
coreExtensionData.reactElement
|
|
14
|
-
])
|
|
15
|
-
},
|
|
16
|
-
output: [coreExtensionData.reactElement],
|
|
17
|
-
factory({ inputs }) {
|
|
18
|
-
const Routes = () => {
|
|
19
|
-
const NotFoundErrorPage = useComponentRef(
|
|
20
|
-
coreComponentRefs.notFoundErrorPage
|
|
21
|
-
);
|
|
22
|
-
const element = useRoutes([
|
|
23
|
-
...inputs.routes.map((route) => ({
|
|
24
|
-
path: `${route.get(coreExtensionData.routePath)}/*`,
|
|
25
|
-
element: route.get(coreExtensionData.reactElement)
|
|
26
|
-
})),
|
|
27
|
-
{
|
|
28
|
-
path: "*",
|
|
29
|
-
element: /* @__PURE__ */ React.createElement(NotFoundErrorPage, null)
|
|
30
|
-
}
|
|
31
|
-
]);
|
|
32
|
-
return element;
|
|
33
|
-
};
|
|
34
|
-
return [coreExtensionData.reactElement(/* @__PURE__ */ React.createElement(Routes, null))];
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
export { AppRoutes };
|
|
39
|
-
//# sourceMappingURL=AppRoutes.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 React from 'react';\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 namespace: 'app',\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":";;;;AA0BO,MAAM,YAAY,eAAgB,CAAA;AAAA,EACvC,SAAW,EAAA,KAAA;AAAA,EACX,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,YAAA;AAAA,KACnB,CAAA;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,iBAAA;AAAA,OACpB,CAAA;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,CAAA;AAAA,SACjD,CAAA,CAAA;AAAA,QACF;AAAA,UACE,IAAM,EAAA,GAAA;AAAA,UACN,OAAA,sCAAU,iBAAkB,EAAA,IAAA,CAAA;AAAA,SAC9B;AAAA,OACD,CAAA,CAAA;AAED,MAAO,OAAA,OAAA,CAAA;AAAA,KACT,CAAA;AAEA,IAAA,OAAO,CAAC,iBAAkB,CAAA,YAAA,iBAAc,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,IAAO,CAAE,CAAC,CAAA,CAAA;AAAA,GACpD;AACF,CAAC;;;;"}
|
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from '@material-ui/core/Button';
|
|
3
|
-
import { createComponentExtension, coreComponentRefs } from '@backstage/frontend-plugin-api';
|
|
4
|
-
import { ErrorPanel } from '@backstage/core-components';
|
|
5
|
-
import '../app-defaults/src/defaults/apis.esm.js';
|
|
6
|
-
import { components } from '../app-defaults/src/defaults/components.esm.js';
|
|
7
|
-
import '@material-ui/icons/Apartment';
|
|
8
|
-
import '@material-ui/icons/BrokenImage';
|
|
9
|
-
import '@material-ui/icons/Category';
|
|
10
|
-
import '@material-ui/icons/CreateNewFolder';
|
|
11
|
-
import '@material-ui/icons/Subject';
|
|
12
|
-
import '@material-ui/icons/Search';
|
|
13
|
-
import '@material-ui/icons/Chat';
|
|
14
|
-
import '@material-ui/icons/Dashboard';
|
|
15
|
-
import '@material-ui/icons/Description';
|
|
16
|
-
import '@material-ui/icons/Email';
|
|
17
|
-
import '@material-ui/icons/Extension';
|
|
18
|
-
import '@material-ui/icons/GitHub';
|
|
19
|
-
import '@material-ui/icons/Help';
|
|
20
|
-
import '@material-ui/icons/LocationOn';
|
|
21
|
-
import '@material-ui/icons/Memory';
|
|
22
|
-
import '@material-ui/icons/MenuBook';
|
|
23
|
-
import '@material-ui/icons/People';
|
|
24
|
-
import '@material-ui/icons/Person';
|
|
25
|
-
import '@material-ui/icons/Warning';
|
|
26
|
-
import '@material-ui/icons/Storage';
|
|
27
|
-
import '@material-ui/icons/FeaturedPlayList';
|
|
28
|
-
import '@backstage/theme';
|
|
29
|
-
import '@material-ui/icons/Brightness2';
|
|
30
|
-
import '@material-ui/icons/WbSunny';
|
|
31
|
-
|
|
32
|
-
const DefaultProgressComponent = createComponentExtension({
|
|
33
|
-
ref: coreComponentRefs.progress,
|
|
34
|
-
loader: { sync: () => components.Progress }
|
|
35
|
-
});
|
|
36
|
-
const DefaultNotFoundErrorPageComponent = createComponentExtension({
|
|
37
|
-
ref: coreComponentRefs.notFoundErrorPage,
|
|
38
|
-
loader: { sync: () => components.NotFoundErrorPage }
|
|
39
|
-
});
|
|
40
|
-
const DefaultErrorBoundaryComponent = createComponentExtension({
|
|
41
|
-
ref: coreComponentRefs.errorBoundaryFallback,
|
|
42
|
-
loader: {
|
|
43
|
-
sync: () => (props) => {
|
|
44
|
-
const { plugin, error, resetError } = props;
|
|
45
|
-
const title = `Error in ${plugin?.id}`;
|
|
46
|
-
return /* @__PURE__ */ React.createElement(ErrorPanel, { title, error, defaultExpanded: true }, /* @__PURE__ */ React.createElement(Button, { variant: "outlined", onClick: resetError }, "Retry"));
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
});
|
|
50
|
-
|
|
51
|
-
export { DefaultErrorBoundaryComponent, DefaultNotFoundErrorPageComponent, DefaultProgressComponent };
|
|
52
|
-
//# sourceMappingURL=components.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
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 React from 'react';\n// TODO: Dependency on MUI should be removed from core packages\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 '../../../app-defaults/src/defaults';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6BO,MAAM,2BAA2B,wBAAyB,CAAA;AAAA,EAC/D,KAAK,iBAAkB,CAAA,QAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,QAAS,EAAA;AACnD,CAAC,EAAA;AAEM,MAAM,oCAAoC,wBAAyB,CAAA;AAAA,EACxE,KAAK,iBAAkB,CAAA,iBAAA;AAAA,EACvB,MAAQ,EAAA,EAAE,IAAM,EAAA,MAAMA,WAAkB,iBAAkB,EAAA;AAC5D,CAAC,EAAA;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,CAAA;AACtC,MAAM,MAAA,KAAA,GAAQ,CAAY,SAAA,EAAA,MAAA,EAAQ,EAAE,CAAA,CAAA,CAAA;AAEpC,MAAA,uBACG,KAAA,CAAA,aAAA,CAAA,UAAA,EAAA,EAAW,KAAc,EAAA,KAAA,EAAc,eAAe,EAAA,IAAA,EAAA,kBACpD,KAAA,CAAA,aAAA,CAAA,MAAA,EAAA,EAAO,OAAQ,EAAA,UAAA,EAAW,OAAS,EAAA,UAAA,EAAA,EAAY,OAEhD,CACF,CAAA,CAAA;AAAA,KAEJ;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { OAuthRequestDialog, AlertDisplay } from '@backstage/core-components';
|
|
2
|
-
import { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';
|
|
3
|
-
import React from 'react';
|
|
4
|
-
|
|
5
|
-
const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({
|
|
6
|
-
namespace: "app",
|
|
7
|
-
name: "oauth-request-dialog",
|
|
8
|
-
params: {
|
|
9
|
-
element: /* @__PURE__ */ React.createElement(OAuthRequestDialog, null)
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
const alertDisplayAppRootElement = AppRootElementBlueprint.makeWithOverrides({
|
|
13
|
-
namespace: "app",
|
|
14
|
-
name: "alert-display",
|
|
15
|
-
config: {
|
|
16
|
-
schema: {
|
|
17
|
-
transientTimeoutMs: (z) => z.number().default(5e3),
|
|
18
|
-
anchorOrigin: (z) => z.object({
|
|
19
|
-
vertical: z.enum(["top", "bottom"]).default("top"),
|
|
20
|
-
horizontal: z.enum(["left", "center", "right"]).default("center")
|
|
21
|
-
}).default({})
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
factory: (originalFactory, { config }) => {
|
|
25
|
-
return originalFactory({
|
|
26
|
-
element: () => /* @__PURE__ */ React.createElement(AlertDisplay, { ...config })
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
});
|
|
30
|
-
|
|
31
|
-
export { alertDisplayAppRootElement, oauthRequestDialogAppRootElement };
|
|
32
|
-
//# sourceMappingURL=elements.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"elements.esm.js","sources":["../../src/extensions/elements.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 { AlertDisplay, OAuthRequestDialog } from '@backstage/core-components';\nimport { AppRootElementBlueprint } from '@backstage/frontend-plugin-api';\nimport React from 'react';\n\nexport const oauthRequestDialogAppRootElement = AppRootElementBlueprint.make({\n namespace: 'app',\n name: 'oauth-request-dialog',\n params: {\n element: <OAuthRequestDialog />,\n },\n});\n\nexport const alertDisplayAppRootElement =\n AppRootElementBlueprint.makeWithOverrides({\n namespace: 'app',\n name: 'alert-display',\n config: {\n schema: {\n transientTimeoutMs: z => z.number().default(5000),\n anchorOrigin: z =>\n z\n .object({\n vertical: z.enum(['top', 'bottom']).default('top'),\n horizontal: z.enum(['left', 'center', 'right']).default('center'),\n })\n .default({}),\n },\n },\n factory: (originalFactory, { config }) => {\n return originalFactory({\n element: () => <AlertDisplay {...config} />,\n });\n },\n });\n"],"names":[],"mappings":";;;;AAoBa,MAAA,gCAAA,GAAmC,wBAAwB,IAAK,CAAA;AAAA,EAC3E,SAAW,EAAA,KAAA;AAAA,EACX,IAAM,EAAA,sBAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,OAAA,sCAAU,kBAAmB,EAAA,IAAA,CAAA;AAAA,GAC/B;AACF,CAAC,EAAA;AAEY,MAAA,0BAAA,GACX,wBAAwB,iBAAkB,CAAA;AAAA,EACxC,SAAW,EAAA,KAAA;AAAA,EACX,IAAM,EAAA,eAAA;AAAA,EACN,MAAQ,EAAA;AAAA,IACN,MAAQ,EAAA;AAAA,MACN,oBAAoB,CAAK,CAAA,KAAA,CAAA,CAAE,MAAO,EAAA,CAAE,QAAQ,GAAI,CAAA;AAAA,MAChD,YAAA,EAAc,CACZ,CAAA,KAAA,CAAA,CACG,MAAO,CAAA;AAAA,QACN,QAAA,EAAU,EAAE,IAAK,CAAA,CAAC,OAAO,QAAQ,CAAC,CAAE,CAAA,OAAA,CAAQ,KAAK,CAAA;AAAA,QACjD,UAAA,EAAY,CAAE,CAAA,IAAA,CAAK,CAAC,MAAA,EAAQ,UAAU,OAAO,CAAC,CAAE,CAAA,OAAA,CAAQ,QAAQ,CAAA;AAAA,OACjE,CAAA,CACA,OAAQ,CAAA,EAAE,CAAA;AAAA,KACjB;AAAA,GACF;AAAA,EACA,OAAS,EAAA,CAAC,eAAiB,EAAA,EAAE,QAAa,KAAA;AACxC,IAAA,OAAO,eAAgB,CAAA;AAAA,MACrB,OAAS,EAAA,sBAAO,KAAA,CAAA,aAAA,CAAA,YAAA,EAAA,EAAc,GAAG,MAAQ,EAAA,CAAA;AAAA,KAC1C,CAAA,CAAA;AAAA,GACH;AACF,CAAC;;;;"}
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { UnifiedThemeProvider, themes } from '@backstage/theme';
|
|
3
|
-
import DarkIcon from '@material-ui/icons/Brightness2';
|
|
4
|
-
import LightIcon from '@material-ui/icons/WbSunny';
|
|
5
|
-
import { ThemeBlueprint } from '@backstage/frontend-plugin-api';
|
|
6
|
-
|
|
7
|
-
const LightTheme = ThemeBlueprint.make({
|
|
8
|
-
name: "light",
|
|
9
|
-
params: {
|
|
10
|
-
theme: {
|
|
11
|
-
id: "light",
|
|
12
|
-
title: "Light Theme",
|
|
13
|
-
variant: "light",
|
|
14
|
-
icon: /* @__PURE__ */ React.createElement(LightIcon, null),
|
|
15
|
-
Provider: ({ children }) => /* @__PURE__ */ React.createElement(UnifiedThemeProvider, { theme: themes.light, children })
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
const DarkTheme = ThemeBlueprint.make({
|
|
20
|
-
name: "dark",
|
|
21
|
-
params: {
|
|
22
|
-
theme: {
|
|
23
|
-
id: "dark",
|
|
24
|
-
title: "Dark Theme",
|
|
25
|
-
variant: "dark",
|
|
26
|
-
icon: /* @__PURE__ */ React.createElement(DarkIcon, null),
|
|
27
|
-
Provider: ({ children }) => /* @__PURE__ */ React.createElement(UnifiedThemeProvider, { theme: themes.dark, children })
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
export { DarkTheme, LightTheme };
|
|
33
|
-
//# sourceMappingURL=themes.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"themes.esm.js","sources":["../../src/extensions/themes.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 from 'react';\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 { ThemeBlueprint } from '@backstage/frontend-plugin-api';\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":";;;;;;AAyBa,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,sCAAO,SAAU,EAAA,IAAA,CAAA;AAAA,MACjB,QAAA,EAAU,CAAC,EAAE,QAAS,EAAA,yCACnB,oBAAqB,EAAA,EAAA,KAAA,EAAOA,MAAc,CAAA,KAAA,EAAO,QAAoB,EAAA,CAAA;AAAA,KAE1E;AAAA,GACF;AACF,CAAC,EAAA;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,sCAAO,QAAS,EAAA,IAAA,CAAA;AAAA,MAChB,QAAA,EAAU,CAAC,EAAE,QAAS,EAAA,yCACnB,oBAAqB,EAAA,EAAA,KAAA,EAAOA,MAAc,CAAA,IAAA,EAAM,QAAoB,EAAA,CAAA;AAAA,KAEzE;AAAA,GACF;AACF,CAAC;;;;"}
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
import React, { useEffect } from 'react';
|
|
2
|
-
import { useLocation, matchRoutes } from 'react-router-dom';
|
|
3
|
-
import { AnalyticsContext, useAnalytics } from '@backstage/frontend-plugin-api';
|
|
4
|
-
|
|
5
|
-
const getExtensionContext = (pathname, routes) => {
|
|
6
|
-
try {
|
|
7
|
-
const matches = matchRoutes(routes, { pathname });
|
|
8
|
-
const routeMatch = matches?.filter((match) => match?.route.routeRefs?.size > 0).pop();
|
|
9
|
-
const routeObject = routeMatch?.route;
|
|
10
|
-
if (!routeObject) {
|
|
11
|
-
return void 0;
|
|
12
|
-
}
|
|
13
|
-
if (routeObject.path === "" && pathname !== "/") {
|
|
14
|
-
return void 0;
|
|
15
|
-
}
|
|
16
|
-
const params = Object.entries(
|
|
17
|
-
routeMatch?.params || {}
|
|
18
|
-
).reduce((acc, [key, value]) => {
|
|
19
|
-
if (value !== void 0 && key !== "*") {
|
|
20
|
-
acc[key] = value;
|
|
21
|
-
}
|
|
22
|
-
return acc;
|
|
23
|
-
}, {});
|
|
24
|
-
const plugin = routeObject.appNode?.spec.source;
|
|
25
|
-
const extension = routeObject.appNode?.spec.extension;
|
|
26
|
-
return {
|
|
27
|
-
params,
|
|
28
|
-
pluginId: plugin?.id || "root",
|
|
29
|
-
extensionId: extension?.id || "App"
|
|
30
|
-
};
|
|
31
|
-
} catch {
|
|
32
|
-
return void 0;
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
const TrackNavigation = ({
|
|
36
|
-
pathname,
|
|
37
|
-
search,
|
|
38
|
-
hash,
|
|
39
|
-
attributes
|
|
40
|
-
}) => {
|
|
41
|
-
const analytics = useAnalytics();
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
analytics.captureEvent("navigate", `${pathname}${search}${hash}`, {
|
|
44
|
-
attributes
|
|
45
|
-
});
|
|
46
|
-
}, [analytics, pathname, search, hash, attributes]);
|
|
47
|
-
return null;
|
|
48
|
-
};
|
|
49
|
-
const RouteTracker = ({
|
|
50
|
-
routeObjects
|
|
51
|
-
}) => {
|
|
52
|
-
const { pathname, search, hash } = useLocation();
|
|
53
|
-
const { params, ...attributes } = getExtensionContext(
|
|
54
|
-
pathname,
|
|
55
|
-
routeObjects
|
|
56
|
-
) || { params: {} };
|
|
57
|
-
return /* @__PURE__ */ React.createElement(AnalyticsContext, { attributes }, /* @__PURE__ */ React.createElement(
|
|
58
|
-
TrackNavigation,
|
|
59
|
-
{
|
|
60
|
-
pathname,
|
|
61
|
-
search,
|
|
62
|
-
hash,
|
|
63
|
-
attributes: params
|
|
64
|
-
}
|
|
65
|
-
));
|
|
66
|
-
};
|
|
67
|
-
|
|
68
|
-
export { RouteTracker };
|
|
69
|
-
//# sourceMappingURL=RouteTracker.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"RouteTracker.esm.js","sources":["../../src/routing/RouteTracker.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, { useEffect } from 'react';\nimport { matchRoutes, useLocation } from 'react-router-dom';\nimport {\n useAnalytics,\n AnalyticsContext,\n AnalyticsEventAttributes,\n} from '@backstage/frontend-plugin-api';\nimport { BackstageRouteObject } from './types';\n\n/**\n * Returns an extension context given the current pathname and a list of\n * Backstage route objects.\n */\nconst getExtensionContext = (\n pathname: string,\n routes: BackstageRouteObject[],\n) => {\n try {\n // Find matching routes for the given path name.\n const matches = matchRoutes(routes, { pathname });\n\n // Of the matching routes, get the last (e.g. most specific) instance of\n // the BackstageRouteObject that contains a routeRef. Filtering by routeRef\n // ensures subRouteRefs are aligned to their parent routes' context.\n const routeMatch = matches\n ?.filter(match => match?.route.routeRefs?.size > 0)\n .pop();\n const routeObject = routeMatch?.route;\n\n // If there is no route object, then allow inheritance of default context.\n if (!routeObject) {\n return undefined;\n }\n\n // If the matched route is the root route (no path), and the pathname is\n // not the path of the homepage, then inherit from the default context.\n if (routeObject.path === '' && pathname !== '/') {\n return undefined;\n }\n\n const params = Object.entries(\n routeMatch?.params || {},\n ).reduce<AnalyticsEventAttributes>((acc, [key, value]) => {\n if (value !== undefined && key !== '*') {\n acc[key] = value;\n }\n return acc;\n }, {});\n\n const plugin = routeObject.appNode?.spec.source;\n const extension = routeObject.appNode?.spec.extension;\n\n return {\n params,\n pluginId: plugin?.id || 'root',\n extensionId: extension?.id || 'App',\n };\n } catch {\n return undefined;\n }\n};\n\n/**\n * Performs the actual event capture on render.\n */\nconst TrackNavigation = ({\n pathname,\n search,\n hash,\n attributes,\n}: {\n pathname: string;\n search: string;\n hash: string;\n attributes?: AnalyticsEventAttributes;\n}) => {\n const analytics = useAnalytics();\n useEffect(() => {\n analytics.captureEvent('navigate', `${pathname}${search}${hash}`, {\n attributes,\n });\n }, [analytics, pathname, search, hash, attributes]);\n\n return null;\n};\n\n/**\n * Logs a \"navigate\" event with appropriate plugin-level analytics context\n * attributes each time the user navigates to a page.\n */\nexport const RouteTracker = ({\n routeObjects,\n}: {\n routeObjects: BackstageRouteObject[];\n}) => {\n const { pathname, search, hash } = useLocation();\n\n const { params, ...attributes } = getExtensionContext(\n pathname,\n routeObjects,\n ) || { params: {} };\n\n return (\n <AnalyticsContext attributes={attributes}>\n <TrackNavigation\n pathname={pathname}\n search={search}\n hash={hash}\n attributes={params}\n />\n </AnalyticsContext>\n );\n};\n"],"names":[],"mappings":";;;;AA6BA,MAAM,mBAAA,GAAsB,CAC1B,QAAA,EACA,MACG,KAAA;AACH,EAAI,IAAA;AAEF,IAAA,MAAM,OAAU,GAAA,WAAA,CAAY,MAAQ,EAAA,EAAE,UAAU,CAAA,CAAA;AAKhD,IAAM,MAAA,UAAA,GAAa,OACf,EAAA,MAAA,CAAO,CAAS,KAAA,KAAA,KAAA,EAAO,MAAM,SAAW,EAAA,IAAA,GAAO,CAAC,CAAA,CACjD,GAAI,EAAA,CAAA;AACP,IAAA,MAAM,cAAc,UAAY,EAAA,KAAA,CAAA;AAGhC,IAAA,IAAI,CAAC,WAAa,EAAA;AAChB,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAIA,IAAA,IAAI,WAAY,CAAA,IAAA,KAAS,EAAM,IAAA,QAAA,KAAa,GAAK,EAAA;AAC/C,MAAO,OAAA,KAAA,CAAA,CAAA;AAAA,KACT;AAEA,IAAA,MAAM,SAAS,MAAO,CAAA,OAAA;AAAA,MACpB,UAAA,EAAY,UAAU,EAAC;AAAA,MACvB,MAAiC,CAAA,CAAC,KAAK,CAAC,GAAA,EAAK,KAAK,CAAM,KAAA;AACxD,MAAI,IAAA,KAAA,KAAU,KAAa,CAAA,IAAA,GAAA,KAAQ,GAAK,EAAA;AACtC,QAAA,GAAA,CAAI,GAAG,CAAI,GAAA,KAAA,CAAA;AAAA,OACb;AACA,MAAO,OAAA,GAAA,CAAA;AAAA,KACT,EAAG,EAAE,CAAA,CAAA;AAEL,IAAM,MAAA,MAAA,GAAS,WAAY,CAAA,OAAA,EAAS,IAAK,CAAA,MAAA,CAAA;AACzC,IAAM,MAAA,SAAA,GAAY,WAAY,CAAA,OAAA,EAAS,IAAK,CAAA,SAA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AAA,CAAA;AAEJ;;;;"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { readAppExtensionsConfig } from './readAppExtensionsConfig.esm.js';
|
|
2
|
-
import { resolveAppTree } from './resolveAppTree.esm.js';
|
|
3
|
-
import { resolveAppNodeSpecs } from './resolveAppNodeSpecs.esm.js';
|
|
4
|
-
import { instantiateAppNodeTree } from './instantiateAppNodeTree.esm.js';
|
|
5
|
-
|
|
6
|
-
function createAppTree(options) {
|
|
7
|
-
const tree = resolveAppTree(
|
|
8
|
-
"app",
|
|
9
|
-
resolveAppNodeSpecs({
|
|
10
|
-
features: options.features,
|
|
11
|
-
builtinExtensions: options.builtinExtensions,
|
|
12
|
-
parameters: readAppExtensionsConfig(options.config),
|
|
13
|
-
forbidden: /* @__PURE__ */ new Set(["app"])
|
|
14
|
-
})
|
|
15
|
-
);
|
|
16
|
-
instantiateAppNodeTree(tree.root);
|
|
17
|
-
return tree;
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
export { createAppTree };
|
|
21
|
-
//# sourceMappingURL=createAppTree.esm.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createAppTree.esm.js","sources":["../../src/tree/createAppTree.ts"],"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 { Extension, FrontendFeature } from '@backstage/frontend-plugin-api';\nimport { readAppExtensionsConfig } from './readAppExtensionsConfig';\nimport { resolveAppTree } from './resolveAppTree';\nimport { resolveAppNodeSpecs } from './resolveAppNodeSpecs';\nimport { AppTree } from '@backstage/frontend-plugin-api';\nimport { Config } from '@backstage/config';\nimport { instantiateAppNodeTree } from './instantiateAppNodeTree';\n\n/** @internal */\nexport interface CreateAppTreeOptions {\n features: FrontendFeature[];\n builtinExtensions: Extension<any, any>[];\n config: Config;\n}\n\n/** @internal */\nexport function createAppTree(options: CreateAppTreeOptions): AppTree {\n const tree = resolveAppTree(\n 'app',\n resolveAppNodeSpecs({\n features: options.features,\n builtinExtensions: options.builtinExtensions,\n parameters: readAppExtensionsConfig(options.config),\n forbidden: new Set(['app']),\n }),\n );\n instantiateAppNodeTree(tree.root);\n return tree;\n}\n"],"names":[],"mappings":";;;;;AAgCO,SAAS,cAAc,OAAwC,EAAA;AACpE,EAAA,MAAM,IAAO,GAAA,cAAA;AAAA,IACX,KAAA;AAAA,IACA,mBAAoB,CAAA;AAAA,MAClB,UAAU,OAAQ,CAAA,QAAA;AAAA,MAClB,mBAAmB,OAAQ,CAAA,iBAAA;AAAA,MAC3B,UAAA,EAAY,uBAAwB,CAAA,OAAA,CAAQ,MAAM,CAAA;AAAA,MAClD,SAAW,kBAAA,IAAI,GAAI,CAAA,CAAC,KAAK,CAAC,CAAA;AAAA,KAC3B,CAAA;AAAA,GACH,CAAA;AACA,EAAA,sBAAA,CAAuB,KAAK,IAAI,CAAA,CAAA;AAChC,EAAO,OAAA,IAAA,CAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"InternalAppContext.esm.js","sources":["../../src/wiring/InternalAppContext.ts"],"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 { createContext } from 'react';\n// eslint-disable-next-line @backstage/no-relative-monorepo-imports\nimport { AppIdentityProxy } from '../../../core-app-api/src/apis/implementations/IdentityApi/AppIdentityProxy';\nimport { BackstageRouteObject } from '../routing/types';\n\nexport const InternalAppContext = createContext<\n | undefined\n | {\n appIdentityProxy: AppIdentityProxy;\n routeObjects: BackstageRouteObject[];\n }\n>(undefined);\n"],"names":[],"mappings":";;AAqBa,MAAA,kBAAA,GAAqB,cAMhC,KAAS,CAAA;;;;"}
|