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

System.register(["lodash","../../core/core_module"],function(a,b){"use strict";var c,d,e;b&&b.id;return{setters:[function(a){c=a},function(a){d=a}],execute:function(){e=function(){function a(a,b,c,d){var e=this;this.$scope=a,this.$location=b,this.backendSrv=c,this.navModelSrv=d,this.navModel=d.getPlaylistsNav(0),c.get("/api/playlists").then(function(a){e.playlists=a})}return a.$inject=["$scope","$location","backendSrv","navModelSrv"],a.prototype.removePlaylistConfirmed=function(a){var b=this;c.default.remove(this.playlists,{id:a.id}),this.backendSrv.delete("/api/playlists/"+a.id).then(function(){b.$scope.appEvent("alert-success",["Playlist deleted",""])},function(){b.$scope.appEvent("alert-error",["Unable to delete playlist",""]),b.playlists.push(a)})},a.prototype.removePlaylist=function(a){var b=this;this.$scope.appEvent("confirm-modal",{title:"Delete",text:"Are you sure you want to delete playlist "+a.name+"?",yesText:"Delete",icon:"fa-trash",onConfirm:function(){b.removePlaylistConfirmed(a)}})},a}(),a("PlaylistsCtrl",e),d.default.controller("PlaylistsCtrl",e)}}});