/*! grafana - v4.2.0 - 2017-03-24
 * Copyright (c) 2017 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["app/plugins/sdk","app/core/core"],function(a,b){"use strict";var c,d,e,f=this&&this.__extends||function(a,b){function c(){this.constructor=a}for(var d in b)b.hasOwnProperty(d)&&(a[d]=b[d]);a.prototype=null===b?Object.create(b):(c.prototype=b.prototype,new c)};b&&b.id;return{setters:[function(a){c=a},function(a){d=a}],execute:function(){e=function(a){function b(b,c,d,e,f){var g=a.call(this,b,c)||this;return g.backendSrv=d,g.datasourceSrv=e,g.$q=f,g.stepIndex=0,g.steps=[],g.steps.push({title:"Install Grafana",icon:"icon-gf icon-gf-check",href:"http://docs.grafana.org/",target:"_blank",note:"Review the installation docs",check:function(){return f.when(!0)}}),g.steps.push({title:"Create your first data source",cta:"Add data source",icon:"icon-gf icon-gf-datasources",href:"datasources/new?gettingstarted",check:function(){return f.when(e.getMetricSources().filter(function(a){return a.meta.builtIn===!1}).length>0)}}),g.steps.push({title:"Create your first dashboard",cta:"New dashboard",icon:"icon-gf icon-gf-dashboard",href:"dashboard/new?gettingstarted",check:function(){return g.backendSrv.search({limit:1}).then(function(a){return a.length>0})}}),g.steps.push({title:"Invite your team",cta:"Add Users",icon:"icon-gf icon-gf-users",href:"org/users?gettingstarted",check:function(){return g.backendSrv.get("api/org/users").then(function(a){return a.length>1})}}),g.steps.push({title:"Install apps & plugins",cta:"Explore plugin repository",icon:"icon-gf icon-gf-apps",href:"https://grafana.net/plugins?utm_source=grafana_getting_started",check:function(){return g.backendSrv.get("api/plugins",{embedded:0,core:0}).then(function(a){return a.length>0})}}),g}return f(b,a),b.$inject=["$scope","$injector","backendSrv","datasourceSrv","$q"],b.prototype.$onInit=function(){var a=this;return this.stepIndex=-1,this.nextStep().then(function(b){a.checksDone=!0})},b.prototype.nextStep=function(){var a=this;if(this.stepIndex===this.steps.length-1)return this.$q.when();this.stepIndex+=1;var b=this.steps[this.stepIndex];return b.check().then(function(c){return c?(b.cssClass="completed",a.nextStep()):(b.cssClass="active",a.$q.when())})},b.prototype.dismiss=function(){this.row.removePanel(this.panel,!1),this.backendSrv.request({method:"PUT",url:"/api/user/helpflags/1",showSuccessAlert:!1}).then(function(a){d.contextSrv.user.helpFlags1=a.helpFlags1})},b}(c.PanelCtrl),e.templateUrl="public/app/plugins/panel/gettingstarted/module.html",a("GettingStartedPanelCtrl",e),a("PanelCtrl",e)}}});