/// class PD.Manage.Modules.DataLoadDeleteAllJobsCommand

PD.Manage.Modules.DataLoadDeleteAllJobsCommand =
PD.Commands.Command.extend({

    //===================================
    // PUBLIC METHODS
    //===================================

    setDefaults: function () {
        this.props("id", "job/delete-all");
        this.props("enabled", true);
        this.props("icon", PD.Path.to16x16("delete.png"));
        this.props("label", "Delete All");
        this.props("tooltip", "Delete all jobs.");
    },

    execute: function (e) {
        this._super(e);

        var service = new PD.Manage.Services.DataLoadService();

        this._showConfirmationDialog(function (e) {

            service.deleteAllJobs(function (e) {
                PD.context.get_default().get_events().publish("jobs/delete");
            });

        });

    },

    //===================================
    // PRIVATE METHODS
    //===================================

    _showConfirmationDialog: function (callback) {

        PD.Web.UI.MessageDialog.warn({
            title: "Delete All Jobs?",
            message: "Delete all of the jobs?",
            ok: function (e) {
                e.close();
                callback(e);
            }
        });

    }

});