Blame view

static/js/mongo_server_select.js 861 Bytes
831eac332   zhuzhenchao   add file
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
  
  $("#mongodb_server").change(function () {
      var mongo_server_id = $(this).val();
      var db_name=document.getElementById("mongodb_name");
      var selectOptions = db_name.options;
      var optionLength = selectOptions.length;
  
      for (var j = 0; j < optionLength; j++) {
          db_name.removeChild(selectOptions[0]);
      }
  
      db_name[0] = new Option("");
      $("#mongodb_name").val('');
  
      if (mongo_server_id != "") {
          $.post("/myworkflowjob/mongoserverselect/", {mongo_server_id: mongo_server_id, 'csrfmiddlewaretoken':getCookie('csrftoken')},function(data){
              var mongo_db_list = data.mongo_db_list;
  
              if (mongo_db_list.length) {
                  for (var i=0; i<mongo_db_list.length; i++) {
                      db_name[i] = new Option(mongo_db_list[i]);
                  }
              }
          }, "json")
      }
  }).change();