!function(){var t;t=jQuery,Craft.DbBackupUtility=Garnish.Base.extend({$trigger:null,$form:null,init:function(r){this.$form=t("#"+r),this.$trigger=t("input.submit",this.$form),this.$status=t(".utility-status",this.$form),this.addListener(this.$form,"submit","onSubmit")},onSubmit:function(r){var s=this;r.preventDefault(),this.$trigger.hasClass("disabled")||(this.progressBar?this.progressBar.resetProgressBar():this.progressBar=new Craft.ProgressBar(this.$status),this.progressBar.showProgressBar(),this.progressBar.$progressBar.velocity("stop").velocity({opacity:1},{complete:function(){t("#download-backup").prop("checked")?Craft.downloadFromUrl("POST",Craft.getActionUrl("utilities/db-backup-perform-action"),s.$form.serialize()).then((function(){s.updateProgressBar(),setTimeout(s.onComplete.bind(s),300)})).catch((function(){Craft.cp.displayError(Craft.t("app","There was a problem backing up your database. Please check the Craft logs.")),s.onComplete(!1)})):Craft.sendActionRequest("POST","utilities/db-backup-perform-action").then((function(t){s.updateProgressBar(),setTimeout(s.onComplete.bind(s),300)})).catch((function(t){t.response,s.updateProgressBar(),Craft.cp.displayError(Craft.t("app","There was a problem backing up your database. Please check the Craft logs.")),s.onComplete(!1)}))}}),this.$allDone&&this.$allDone.css("opacity",0),this.$trigger.addClass("disabled"),this.$trigger.trigger("blur"))},updateProgressBar:function(){this.progressBar.setProgressPercentage(100)},onComplete:function(r){this.$allDone||(this.$allDone=t('<div class="alldone" data-icon="done" />').appendTo(this.$status),this.$allDone.css("opacity",0)),Craft.cp.announce(Craft.t("app","Success")),this.progressBar.hideProgressBar(),void 0!==r&&!0!==r||this.$allDone.velocity({opacity:1},{duration:"fast"}),this.$trigger.removeClass("disabled"),this.$trigger.focus()}})}();
//# sourceMappingURL=DbBackupUtility.js.map