{"version":3,"sources":["webpack:///./public/app/features/dashboard/containers/SoloPanelPage.tsx"],"names":["SoloPanelPage","state","panel","notFound","this","props","$injector","$scope","urlUid","urlType","urlSlug","routeInfo","initDashboard","fixUrl","prevProps","urlPanelId","dashboard","panelId","parseInt","expandParentRowFor","getPanelById","setState","className","isEditing","isViewing","isInView","Component","mapDispatchToProps","hot","module","connect","location","routeParams","uid","slug","type","query","getModel"],"mappings":"2mCAgCO,IAAMA,EAAb,6KACEC,MAAe,CACbC,MAAO,KACPC,UAAU,GAHd,E,UAAA,O,kOAAA,M,EAAA,G,EAAA,2CAMsB,MACiDC,KAAKC,MAAhEC,EADU,EACVA,UAAWC,EADD,EACCA,OAAQC,EADT,EACSA,OAAQC,EADjB,EACiBA,QAASC,EAD1B,EAC0BA,QAASC,EADnC,EACmCA,UAErDP,KAAKC,MAAMO,cAAc,CACvBN,UAAWA,EACXC,OAAQA,EACRG,QAASA,EACTF,OAAQA,EACRC,QAASA,EACTE,UAAWA,EACXE,QAAQ,MAhBd,yCAoBqBC,GAAkB,MACDV,KAAKC,MAA/BU,EAD2B,EAC3BA,WAAYC,EADe,EACfA,UAEpB,GAAKA,IAKAF,EAAUE,UAAW,CACxB,IAAMC,EAAUC,SAASH,EAAY,IAGrCC,EAAUG,mBAAmBF,GAE7B,IAAMf,EAAQc,EAAUI,aAAaH,GAErC,IAAKf,EAEH,YADAE,KAAKiB,SAAS,CAAElB,UAAU,IAI5BC,KAAKiB,SAAS,CAAEnB,aAzCtB,+BA6CW,MAC2BE,KAAKC,MAA/BU,EADD,EACCA,WAAYC,EADb,EACaA,UADb,EAEqBZ,KAAKH,MAAzBE,EAFD,EAECA,SAAUD,EAFX,EAEWA,MAElB,OAAIC,EACK,yBAAKmB,UAAU,qBAAf,iBAAkDP,EAAlD,cAGJb,GAAUc,EAKb,yBAAKM,UAAU,cACb,kBAAC,IAAD,CAAgBN,UAAWA,EAAWd,MAAOA,EAAOqB,WAAW,EAAOC,WAAW,EAAOC,UAAU,KAL7F,sE,2BAtDb,GAAmCC,aAyE7BC,EAAqB,CACzBf,mBAGagB,wBAAIC,EAAJD,CAAYE,mBAZH,SAAC7B,GAAD,MAAwB,CAC9CO,OAAQP,EAAM8B,SAASC,YAAYC,IACnCvB,QAAST,EAAM8B,SAASC,YAAYE,KACpCzB,QAASR,EAAM8B,SAASC,YAAYG,KACpCpB,WAAYd,EAAM8B,SAASK,MAAMnB,QACjCD,UAAWf,EAAMe,UAAUqB,cAOuBV,EAAzBG,CAA6C9B,K","file":"SoloPanelPage.d3489276abe5fda2bd26.js","sourcesContent":["// Libraries\nimport React, { Component } from 'react';\nimport { hot } from 'react-hot-loader';\nimport { connect } from 'react-redux';\n\n// Components\nimport { DashboardPanel } from '../dashgrid/DashboardPanel';\n\n// Redux\nimport { initDashboard } from '../state/initDashboard';\n\n// Types\nimport { StoreState, DashboardRouteInfo } from 'app/types';\nimport { PanelModel, DashboardModel } from 'app/features/dashboard/state';\n\ninterface Props {\n  urlPanelId: string;\n  urlUid?: string;\n  urlSlug?: string;\n  urlType?: string;\n  $scope: any;\n  $injector: any;\n  routeInfo: DashboardRouteInfo;\n  initDashboard: typeof initDashboard;\n  dashboard: DashboardModel | null;\n}\n\ninterface State {\n  panel: PanelModel | null;\n  notFound: boolean;\n}\n\nexport class SoloPanelPage extends Component<Props, State> {\n  state: State = {\n    panel: null,\n    notFound: false,\n  };\n\n  componentDidMount() {\n    const { $injector, $scope, urlUid, urlType, urlSlug, routeInfo } = this.props;\n\n    this.props.initDashboard({\n      $injector: $injector,\n      $scope: $scope,\n      urlSlug: urlSlug,\n      urlUid: urlUid,\n      urlType: urlType,\n      routeInfo: routeInfo,\n      fixUrl: false,\n    });\n  }\n\n  componentDidUpdate(prevProps: Props) {\n    const { urlPanelId, dashboard } = this.props;\n\n    if (!dashboard) {\n      return;\n    }\n\n    // we just got the dashboard!\n    if (!prevProps.dashboard) {\n      const panelId = parseInt(urlPanelId, 10);\n\n      // need to expand parent row if this panel is inside a row\n      dashboard.expandParentRowFor(panelId);\n\n      const panel = dashboard.getPanelById(panelId);\n\n      if (!panel) {\n        this.setState({ notFound: true });\n        return;\n      }\n\n      this.setState({ panel });\n    }\n  }\n\n  render() {\n    const { urlPanelId, dashboard } = this.props;\n    const { notFound, panel } = this.state;\n\n    if (notFound) {\n      return <div className=\"alert alert-error\">Panel with id {urlPanelId} not found</div>;\n    }\n\n    if (!panel || !dashboard) {\n      return <div>Loading & initializing dashboard</div>;\n    }\n\n    return (\n      <div className=\"panel-solo\">\n        <DashboardPanel dashboard={dashboard} panel={panel} isEditing={false} isViewing={false} isInView={true} />\n      </div>\n    );\n  }\n}\n\nconst mapStateToProps = (state: StoreState) => ({\n  urlUid: state.location.routeParams.uid,\n  urlSlug: state.location.routeParams.slug,\n  urlType: state.location.routeParams.type,\n  urlPanelId: state.location.query.panelId,\n  dashboard: state.dashboard.getModel() as DashboardModel,\n});\n\nconst mapDispatchToProps = {\n  initDashboard,\n};\n\nexport default hot(module)(connect(mapStateToProps, mapDispatchToProps)(SoloPanelPage));\n"],"sourceRoot":""}