/*! grafana - v4.5.1 - 2017-09-19
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["angular","lodash"],function(a,b){"use strict";var c,d,e,f;b&&b.id;return{setters:[function(a){c=a},function(a){d=a}],execute:function(){e={},f=function(){function a(a,b,c){this.backendSrv=a,this.$routeParams=b,this.$rootScope=c,this.pluginId=b.pluginId,e[this.pluginId]?this.initPage(e[this.pluginId]):this.loadPluginInfo()}return a.$inject=["backendSrv","$routeParams","$rootScope"],a.prototype.initPage=function(a){if(this.appModel=a,this.page=d.default.find(a.includes,{slug:this.$routeParams.slug}),e[this.pluginId]=a,!this.page)return this.$rootScope.appEvent("alert-error",["App Page Not Found",""]),void(this.navModel={section:{title:"Page not found",url:a.defaultNavUrl,icon:"icon-gf icon-gf-sadface"},menu:[]});for(var b=[],c=0,f=a.includes;c<f.length;c++){var g=f[c];g.addToNav&&("dashboard"===g.type&&b.push({title:g.name,url:"dashboard/db/"+g.slug,icon:"fa fa-fw fa-dot-circle-o"}),"page"===g.type&&b.push({title:g.name,url:"plugins/"+a.id+"/page/"+g.slug,icon:"fa fa-fw fa-dot-circle-o"}))}this.navModel={section:{title:a.name,url:a.defaultNavUrl,iconUrl:a.info.logos.small},menu:b}},a.prototype.loadPluginInfo=function(){var a=this;this.backendSrv.get("/api/plugins/"+this.pluginId+"/settings").then(function(b){a.initPage(b)})},a}(),a("AppPageCtrl",f),c.default.module("grafana.controllers").controller("AppPageCtrl",f)}}});