LdapDataMigration.jsp 2.66 KB
<%--
  Created by IntelliJ IDEA.
  User: jiaks
  Date: 2019/1/29
  Time: 10:08
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page import="java.util.ArrayList" %>
<jsp:useBean id="DataSourceXML" class="weaver.servicefiles.DataSourceXML" scope="page" />
<script type="text/javascript" src="/integration/js/jquery-1.10.2.js"></script>

<html>
<head>
    <title>Data Migration</title>
    <span>Select DataSource:</span>
    <select id="dbsource" style='width:180px!important;' name="dbsource">
        <option value=""></option>
        <%
            ArrayList pointArrayList = DataSourceXML.getPointArrayList();
            for(int i=0;i<pointArrayList.size();i++){
                String pointid = (String)pointArrayList.get(i);
                String isselected = "";
        %>
        <option value="<%=pointid%>" <%=isselected%>><%=pointid%></option>
        <%
            }
        %>
    </select>
    LDAP Code:<input type="text" name="ldapCode" value="" id="ldapCode">
    Schedule Task Code:<input type="text" name="scheduleTaskCode" value="" id="scheduleTaskCode">
    <input type="button" value="Confirm" onclick="onConfirm()"/>
</head>
<body>

</body>
</html>

<script language="javascript">
    function onConfirm(){
        var ldapCode = $.trim($("#ldapCode").val());
        if(ldapCode.length<=0){
            window.alert("LDAP Code can not be empty");
            return;
        }
        var scheduleTaskCode = $.trim($("#scheduleTaskCode").val());
        if(scheduleTaskCode.length<=0){
            window.alert("Schedule Task Code can not be empty");
            return;
        }
        jQuery.ajax({
            url : "/api/integration/ldap/dataMigration",
            type : "post",
            async : true,
            data: {
                datasourceid:$("#dbsource").val(),
                ldapCode:$("#ldapCode").val(),
                scheduleTaskCode:$("#scheduleTaskCode").val()
            },
            dataType : "json",
            success: function(msg){
                if(msg&&msg.errorCode=="100"){
                    window.alert("Success");
                }else if(msg&&msg.errorCode=="103"){
                    window.alert("LDAP configuration not found");
                }else if(msg&&msg.errorCode=="104"){
                    window.alert("Upgraded successfully,LDAP CODE already exists");
                }else if(msg&&msg.errorCode=="107"){
                    window.alert("Schedule Task Code already exists");
                }else{
                    window.alert("Error, please contact Administrator");
                }
            }
        });
    }
</script>