/*! grafana - v3.1.0 - 2016-07-18
 * Copyright (c) 2016 Torkel Ödegaard; Licensed Apache-2.0 */

System.register(["../../core/core_module"],function(a){var b,c;return{setters:[function(a){b=a}],execute:function(){c=function(){function a(a,b,c,d,e){var f=this;this.$scope=a,this.$location=b,this.$http=c,this.backendSrv=d,this.datasourceSrv=e,d.get("/api/datasources").then(function(a){f.datasources=a})}return a.$inject=["$scope","$location","$http","backendSrv","datasourceSrv"],a.prototype.removeDataSourceConfirmed=function(a){var b=this;this.backendSrv["delete"]("/api/datasources/"+a.id).then(function(){b.$scope.appEvent("alert-success",["Datasource deleted",""])},function(){b.$scope.appEvent("alert-error",["Unable to delete datasource",""])}).then(function(){b.backendSrv.get("/api/datasources").then(function(a){b.datasources=a}),b.backendSrv.get("/api/frontend/settings").then(function(a){b.datasourceSrv.init(a.datasources)})})},a.prototype.removeDataSource=function(a){var b=this;this.$scope.appEvent("confirm-modal",{title:"Delete",text:"Are you sure you want to delete datasource "+a.name+"?",yesText:"Delete",icon:"fa-trash",onConfirm:function(){b.removeDataSourceConfirmed(a)}})},a}(),a("DataSourcesCtrl",c),b["default"].controller("DataSourcesCtrl",c)}}});