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AM+F,YAClBC,KAAM5H,KAAK4B,MAAMyE,SAASC,aAI/BzB,GACC,SAACgD,EAAA,EAAD,CAAMC,SAAUjD,EAAhB,UACE,SAACgD,EAAA,WAAD,CAAeE,UAAW7B,EAA1B,UACE,SAACzC,EAAD,CAAWT,KAAMtB,SAIrB,UAACmG,EAAA,EAAD,YACE,SAACpE,EAAD,CAAWT,KAAMtB,IAChBwE,IAAO,OAAI,SAAC8B,EAAA,EAAD,aAQxB","sources":["webpack://grafana/./public/app/angular/core_module.ts","webpack://grafana/./.yarn/__virtual__/react-reverse-portal-virtual-c5abbb1959/3/opt/drone/yarncache/react-reverse-portal-npm-2.1.0-efa56de168-ecc93ea67c.zip/node_modules/react-reverse-portal/dist/web/index.js","webpack://grafana/./public/app/angular/services/nav_model_srv.ts","webpack://grafana/./public/app/features/plugins/components/AppRootPage.tsx"],"sourcesContent":["import angular from 'angular';\n\nconst coreModule = angular.module('grafana.core', ['ngRoute']);\n\n// legacy modules\nconst angularModules = [\n coreModule,\n angular.module('grafana.controllers', []),\n angular.module('grafana.directives', []),\n angular.module('grafana.factories', []),\n angular.module('grafana.services', []),\n angular.module('grafana.filters', []),\n angular.module('grafana.routes', []),\n];\n\nexport { angularModules, coreModule };\n\nexport default coreModule;\n","var __extends = (this && this.__extends) || (function () {\n var extendStatics = function (d, b) {\n extendStatics = Object.setPrototypeOf ||\n ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||\n function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };\n return extendStatics(d, b);\n };\n return function (d, b) {\n extendStatics(d, b);\n function __() { this.constructor = d; }\n d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());\n };\n})();\nimport * as React from 'react';\nimport * as ReactDOM from 'react-dom';\n// Internally, the portalNode must be for either HTML or SVG elements\nvar ELEMENT_TYPE_HTML = 'html';\nvar ELEMENT_TYPE_SVG = 'svg';\n// ReactDOM can handle several different namespaces, but they're not exported publicly\n// https://github.com/facebook/react/blob/b87aabdfe1b7461e7331abb3601d9e6bb27544bc/packages/react-dom/src/shared/DOMNamespaces.js#L8-L10\nvar SVG_NAMESPACE = 'http://www.w3.org/2000/svg';\nvar validateElementType = function (domElement, elementType) {\n if (elementType === ELEMENT_TYPE_HTML) {\n return domElement instanceof HTMLElement;\n }\n if (elementType === ELEMENT_TYPE_SVG) {\n return domElement instanceof SVGElement;\n }\n throw new Error(\"Unrecognized element type \\\"\" + elementType + \"\\\" for validateElementType.\");\n};\n// This is the internal implementation: the public entry points set elementType to an appropriate value\nvar createPortalNode = function (elementType, options) {\n var initialProps = {};\n var parent;\n var lastPlaceholder;\n var element;\n if (elementType === ELEMENT_TYPE_HTML) {\n element = document.createElement('div');\n }\n else if (elementType === ELEMENT_TYPE_SVG) {\n element = document.createElementNS(SVG_NAMESPACE, 'g');\n }\n else {\n throw new Error(\"Invalid element type \\\"\" + elementType + \"\\\" for createPortalNode: must be \\\"html\\\" or \\\"svg\\\".\");\n }\n if (options && typeof options === \"object\") {\n for (var _i = 0, _a = Object.entries(options.attributes); _i < _a.length; _i++) {\n var _b = _a[_i], key = _b[0], value = _b[1];\n element.setAttribute(key, value);\n }\n }\n var portalNode = {\n element: element,\n elementType: elementType,\n setPortalProps: function (props) {\n initialProps = props;\n },\n getInitialPortalProps: function () {\n return initialProps;\n },\n mount: function (newParent, newPlaceholder) {\n if (newPlaceholder === lastPlaceholder) {\n // Already mounted - noop.\n return;\n }\n portalNode.unmount();\n // To support SVG and other non-html elements, the portalNode's elementType needs to match\n // the elementType it's being rendered into\n if (newParent !== parent) {\n if (!validateElementType(newParent, elementType)) {\n throw new Error(\"Invalid element type for portal: \\\"\" + elementType + \"\\\" portalNodes must be used with \" + elementType + \" elements, but OutPortal is within <\" + newParent.tagName + \">.\");\n }\n }\n newParent.replaceChild(portalNode.element, newPlaceholder);\n parent = newParent;\n lastPlaceholder = newPlaceholder;\n },\n unmount: function (expectedPlaceholder) {\n if (expectedPlaceholder && expectedPlaceholder !== lastPlaceholder) {\n // Skip unmounts for placeholders that aren't currently mounted\n // They will have been automatically unmounted already by a subsequent mount()\n return;\n }\n if (parent && lastPlaceholder) {\n parent.replaceChild(lastPlaceholder, portalNode.element);\n parent = undefined;\n lastPlaceholder = undefined;\n }\n }\n };\n return portalNode;\n};\nvar InPortal = /** @class */ (function (_super) {\n __extends(InPortal, _super);\n function InPortal(props) {\n var _this = _super.call(this, props) || this;\n _this.addPropsChannel = function () {\n Object.assign(_this.props.node, {\n setPortalProps: function (props) {\n // Rerender the child node here if/when the out portal props change\n _this.setState({ nodeProps: props });\n }\n });\n };\n _this.state = {\n nodeProps: _this.props.node.getInitialPortalProps(),\n };\n return _this;\n }\n InPortal.prototype.componentDidMount = function () {\n this.addPropsChannel();\n };\n InPortal.prototype.componentDidUpdate = function () {\n this.addPropsChannel();\n };\n InPortal.prototype.render = function () {\n var _this = this;\n var _a = this.props, children = _a.children, node = _a.node;\n return ReactDOM.createPortal(React.Children.map(children, function (child) {\n if (!React.isValidElement(child))\n return child;\n return React.cloneElement(child, _this.state.nodeProps);\n }), node.element);\n };\n return InPortal;\n}(React.PureComponent));\nvar OutPortal = /** @class */ (function (_super) {\n __extends(OutPortal, _super);\n function OutPortal(props) {\n var _this = _super.call(this, props) || this;\n _this.placeholderNode = React.createRef();\n _this.passPropsThroughPortal();\n return _this;\n }\n OutPortal.prototype.passPropsThroughPortal = function () {\n var propsForTarget = Object.assign({}, this.props, { node: undefined });\n this.props.node.setPortalProps(propsForTarget);\n };\n OutPortal.prototype.componentDidMount = function () {\n var node = this.props.node;\n this.currentPortalNode = node;\n var placeholder = this.placeholderNode.current;\n var parent = placeholder.parentNode;\n node.mount(parent, placeholder);\n this.passPropsThroughPortal();\n };\n OutPortal.prototype.componentDidUpdate = function () {\n // We re-mount on update, just in case we were unmounted (e.g. by\n // a second OutPortal, which has now been removed)\n var node = this.props.node;\n // If we're switching portal nodes, we need to clean up the current one first.\n if (this.currentPortalNode && node !== this.currentPortalNode) {\n this.currentPortalNode.unmount(this.placeholderNode.current);\n this.currentPortalNode = node;\n }\n var placeholder = this.placeholderNode.current;\n var parent = placeholder.parentNode;\n node.mount(parent, placeholder);\n this.passPropsThroughPortal();\n };\n OutPortal.prototype.componentWillUnmount = function () {\n var node = this.props.node;\n node.unmount(this.placeholderNode.current);\n };\n OutPortal.prototype.render = function () {\n // Render a placeholder to the DOM, so we can get a reference into\n // our location in the DOM, and swap it out for the portaled node.\n // A <div> placeholder works fine even for SVG.\n return React.createElement(\"div\", { ref: this.placeholderNode });\n };\n return OutPortal;\n}(React.PureComponent));\nvar createHtmlPortalNode = createPortalNode.bind(null, ELEMENT_TYPE_HTML);\nvar createSvgPortalNode = createPortalNode.bind(null, ELEMENT_TYPE_SVG);\nexport { createHtmlPortalNode, createSvgPortalNode, InPortal, OutPortal, };\n//# sourceMappingURL=index.js.map","import { NavModel, NavModelItem } from '@grafana/data';\nimport coreModule from 'app/angular/core_module';\nimport config from 'app/core/config';\n\ninterface Nav {\n breadcrumbs: NavModelItem[];\n node?: NavModelItem;\n main?: NavModelItem;\n}\n\nexport class NavModelSrv {\n navItems: NavModelItem[];\n\n constructor() {\n this.navItems = config.bootData.navTree;\n }\n\n getCfgNode() {\n return this.navItems.find((navItem) => navItem.id === 'cfg');\n }\n\n getNav(...args: Array<string | number>) {\n let children = this.navItems;\n const nav: Nav = {\n breadcrumbs: [],\n };\n\n for (const id of args) {\n // if its a number then it's the index to use for main\n if (typeof id === 'number') {\n nav.main = nav.breadcrumbs[id];\n break;\n }\n\n const node = children.find((child) => child.id === id);\n if (node) {\n nav.breadcrumbs.push(node);\n nav.node = node;\n nav.main = node;\n children = node.children ?? [];\n }\n }\n\n if (nav.main?.children) {\n for (const item of nav.main.children) {\n item.active = item.url === nav.node?.url;\n }\n }\n\n return nav;\n }\n\n getNotFoundNav() {\n return getNotFoundNav(); // the exported function\n }\n}\n\nexport function getExceptionNav(error: any): NavModel {\n console.error(error);\n return getWarningNav('Exception thrown', 'See console for details');\n}\n\nexport function getNotFoundNav(): NavModel {\n return getWarningNav('Page not found', '404 Error');\n}\n\nexport function getWarningNav(text: string, subTitle?: string): NavModel {\n const node = {\n text,\n subTitle,\n icon: 'exclamation-triangle',\n };\n return {\n breadcrumbs: [node],\n node: node,\n main: node,\n };\n}\n\ncoreModule.service('navModelSrv', NavModelSrv);\n","// Libraries\nimport React, { Component } from 'react';\nimport { createHtmlPortalNode, InPortal, OutPortal, HtmlPortalNode } from 'react-reverse-portal';\n\nimport { AppEvents, AppPlugin, AppPluginMeta, KeyValue, NavModel, PluginType } from '@grafana/data';\nimport { getNotFoundNav, getWarningNav, getExceptionNav } from 'app/angular/services/nav_model_srv';\nimport Page from 'app/core/components/Page/Page';\nimport PageLoader from 'app/core/components/PageLoader/PageLoader';\nimport { appEvents } from 'app/core/core';\nimport { GrafanaRouteComponentProps } from 'app/core/navigation/types';\n\nimport { getPluginSettings } from '../pluginSettings';\nimport { importAppPlugin } from '../plugin_loader';\ninterface RouteParams {\n pluginId: string;\n}\n\ninterface Props extends GrafanaRouteComponentProps<RouteParams> {}\n\ninterface State {\n loading: boolean;\n portalNode: HtmlPortalNode;\n plugin?: AppPlugin | null;\n nav?: NavModel;\n}\n\nexport function getAppPluginPageError(meta: AppPluginMeta) {\n if (!meta) {\n return 'Unknown Plugin';\n }\n if (meta.type !== PluginType.app) {\n return 'Plugin must be an app';\n }\n if (!meta.enabled) {\n return 'Application Not Enabled';\n }\n return null;\n}\n\nclass AppRootPage extends Component<Props, State> {\n constructor(props: Props) {\n super(props);\n this.state = {\n loading: true,\n portalNode: createHtmlPortalNode(),\n };\n }\n\n shouldComponentUpdate(nextProps: Props) {\n return nextProps.location.pathname.startsWith('/a/');\n }\n\n async loadPluginSettings() {\n const { params } = this.props.match;\n try {\n const app = await getPluginSettings(params.pluginId).then((info) => {\n const error = getAppPluginPageError(info);\n if (error) {\n appEvents.emit(AppEvents.alertError, [error]);\n this.setState({ nav: getWarningNav(error) });\n return null;\n }\n return importAppPlugin(info);\n });\n this.setState({ plugin: app, loading: false, nav: undefined });\n } catch (err) {\n this.setState({\n plugin: null,\n loading: false,\n nav: process.env.NODE_ENV === 'development' ? getExceptionNav(err) : getNotFoundNav(),\n });\n }\n }\n\n componentDidMount() {\n this.loadPluginSettings();\n }\n\n componentDidUpdate(prevProps: Props) {\n const { params } = this.props.match;\n\n if (prevProps.match.params.pluginId !== params.pluginId) {\n this.setState({\n loading: true,\n });\n this.loadPluginSettings();\n }\n }\n\n onNavChanged = (nav: NavModel) => {\n this.setState({ nav });\n };\n\n render() {\n const { loading, plugin, nav, portalNode } = this.state;\n\n if (plugin && !plugin.root) {\n // TODO? redirect to plugin page?\n return <div>No Root App</div>;\n }\n\n return (\n <>\n <InPortal node={portalNode}>\n {plugin && plugin.root && (\n <plugin.root\n meta={plugin.meta}\n basename={this.props.match.url}\n onNavChanged={this.onNavChanged}\n query={this.props.queryParams as KeyValue}\n path={this.props.location.pathname}\n />\n )}\n </InPortal>\n {nav ? (\n <Page navModel={nav}>\n <Page.Contents isLoading={loading}>\n <OutPortal node={portalNode} />\n </Page.Contents>\n </Page>\n ) : (\n <Page>\n <OutPortal node={portalNode} />\n {loading && <PageLoader />}\n </Page>\n )}\n </>\n );\n }\n}\n\nexport default AppRootPage;\n"],"names":["coreModule","angular","angularModules","extendStatics","__extends","d","b","Object","setPrototypeOf","__proto__","Array","p","hasOwnProperty","__","this","constructor","prototype","create","ELEMENT_TYPE_HTML","ELEMENT_TYPE_SVG","createPortalNode","elementType","options","parent","lastPlaceholder","element","initialProps","document","createElement","Error","createElementNS","_i","_a","entries","attributes","length","_b","key","value","setAttribute","portalNode","setPortalProps","props","getInitialPortalProps","mount","newParent","newPlaceholder","unmount","domElement","HTMLElement","SVGElement","validateElementType","tagName","replaceChild","expectedPlaceholder","undefined","InPortal","_super","_this","call","addPropsChannel","assign","node","setState","nodeProps","state","componentDidMount","componentDidUpdate","render","children","child","OutPortal","placeholderNode","passPropsThroughPortal","propsForTarget","currentPortalNode","placeholder","current","parentNode","componentWillUnmount","ref","createHtmlPortalNode","bind","NavModelSrv","navItems","config","getCfgNode","find","navItem","id","getNav","nav","breadcrumbs","args","main","push","item","active","url","getNotFoundNav","getWarningNav","text","subTitle","icon","getAppPluginPageError","meta","type","PluginType","enabled","AppRootPage","Component","super","loading","shouldComponentUpdate","nextProps","location","pathname","startsWith","params","match","app","getPluginSettings","pluginId","then","info","error","appEvents","AppEvents","importAppPlugin","plugin","err","loadPluginSettings","prevProps","root","basename","onNavChanged","query","queryParams","path","Page","navModel","isLoading","PageLoader"],"sourceRoot":""}
|