{"size": 3607, "ext": "js", "max_stars_repo_path": "airflow_scheduler/static/schedulermain.js", "max_stars_repo_name": "webscal3r/ZExtensions", "max_stars_repo_stars_event_min_datetime": "2018-08-24T10:13:51.000Z", "max_stars_repo_stars_event_max_datetime": "2022-01-19T09:30:56.000Z", "max_issues_repo_path": "airflow_scheduler/static/schedulermain.js", "max_issues_repo_name": "webscal3r/ZExtensions", "max_issues_repo_issues_event_min_datetime": "2018-08-24T03:54:18.000Z", "max_issues_repo_issues_event_max_datetime": "2019-11-22T13:46:41.000Z", "max_forks_repo_path": "airflow_scheduler/static/schedulermain.js", "max_forks_repo_name": "webscal3r/ZExtensions", "max_forks_repo_forks_event_min_datetime": "2018-08-24T03:31:38.000Z", "max_forks_repo_forks_event_max_datetime": "2021-10-21T22:04:15.000Z"}
{"max_stars_count": 49, "max_issues_count": 43, "max_forks_count": 28, "avg_line_length": 48.7432432432, "max_line_length": 174, "alphanum_fraction": 0.5117826449}
define(["jquery",
  "base/js/namespace",
  "base/js/utils",
  "./scheduler"
], function ($, Jupyter, utils, scheduleoperation) {
  function load_ipython_extension () {
    var scheduler_html = $("<button title=\"Schedule selected\" class=\"schedule-button btn btn-default btn-xs\">Schedule</button>");
    var scheduler_tab_html = $.parseHTML("<li><a href=\"#scheduledjobs\" class=\"scheduled_jobs\" data-toggle=\"tab\">Scheduled Jobs</a></li>");
    var scheduler_tab_content_html = $.parseHTML("         <div id=\"scheduledjobs\" class=\"tab-pane\">\n" +
            "           <div id=\"schedule_toolbar\" class=\"row\" style=\"margin-top:10px; margin-bottom:10px\">\n" +
            "            <div class=\"col-sm-8 no-padding\">\n" +
            "              <span id=\"schedule_list_info\">Currently scheduled airflow jobs</span>\n" +
            "            </div>\n" +
            "            <div class=\"col-sm-4 no-padding tree-buttons\">\n" +
            "              <span id=\"schedule_buttons\" class=\"pull-right\">\n" +
            "              <button id=\"refresh_schedule_list\" title=\"Refresh schedule list\" class=\"btn btn-default btn-xs\"><i class=\"fa fa-refresh\"></i></button>\n" +
            "              </span>\n" +
            "            </div>\n" +
            "           </div>\n" +
            "           <div class=\"panel-group\" id=\"scheduled\" >\n" +
            "            <div class=\"panel panel-default\">\n" +
            "              <div class=\"panel-heading\">\n" +
            "                <a data-toggle=\"collapse\" data-target=\"#collapseThree\" href=\"#\">\n" +
            "                  Airflow Jobs:\n" +
            "                </a>\n" +
            "              </div>\n" +
            "              <div id=\"collapseThree\" class=\"collapse in\">\n" +
            "                <div class=\"panel-body\">\n" +
            "                  <div id=\"schedule_list\">\n" +
            "                    <div id=\"schedule_list_placeholder\" class=\"row list_placeholder\">\n" +
            "                    </div>\n" +
            "                  </div>\n" +
            "                </div>\n" +
            "              </div>\n" +
            "            </div>\n" +
            "          </div>\n" +
            "        </div>");

    scheduler_html.insertAfter($("button[title|='Edit selected']"));
    $(".tab-content").append(scheduler_tab_content_html);
    $("#tab_content > #tabs").append(scheduler_tab_html);

    var schedule = new scheduleoperation.ScheduleOperation();
    var url_get_dag = utils.url_path_join(Jupyter.notebook_list.base_url, "/scheduler/get_dag?base_url=" + Jupyter.notebook_list.base_url);

    $("#refresh_schedule_list, .scheduled_jobs").click(function () {
      window.history.pushState(null, null, "#scheduledjobs");
      $("#schedule_list_placeholder").load(url_get_dag);
    });

    if (window.location.hash == "#scheduledjobs") {
        $(".scheduled_jobs").click();
    }

    var _selection_changed = Jupyter.notebook_list.__proto__._selection_changed;

    Jupyter.notebook_list.__proto__._selection_changed = function () {
      _selection_changed.apply(this);
      var selected = this.selected;
      if (selected.length === 1 && selected[0].type !== "directory") {
        $(".schedule-button").css("display", "inline-block");
      } else {
        $(".schedule-button").css("display", "none");
      }
    };
    Jupyter.notebook_list._selection_changed();
  }

  return {
    load_ipython_extension: load_ipython_extension
  };
});

