
<script type="text/javascript">
    addHorizonLoadEvent(function () {
        horizon.modals.addModalInitFunction(function (modal) {
          $("#id_data_source_type").change(function() {
            var username = $("#id_data_source_credential_user").closest(".form-group");
            var password = $("#id_data_source_credential_pass").closest(".form-group");
            switch($(this).val()) {
              case "hdfs":
                username.hide();
                password.hide();
                break;
              case "swift":
                username.show();
                password.show();
                break;
            }
          });
          $("#id_data_source_type").change();
       });
    });
</script>
