Pārlūkot izejas kodu

优化连接器配置

AE86 2 gadi atpakaļ
vecāks
revīzija
c92b0958f8

+ 5 - 5
dbsyncer-web/src/main/resources/public/connector/addFile.html

@@ -23,14 +23,14 @@
         <label class="col-sm-2 control-label">schema <i class="fa fa-question-circle fa_gray" aria-hidden="true"
                                                         title="支持10种字段类型。name字段名, typeName类型名称, type类型编码, pk是否为主键"></i><strong
                 class="driverVerifcateRequired">*</strong></label>
-        <div class="col-sm-9">
+        <div class="col-sm-10">
             <textarea id="schema" name="schema" class="form-control dbsyncer_textarea_resize_none" maxlength="4096"
                       dbsyncer-valid="require" rows="20" th:text="${connector?.config?.schema}"></textarea>
         </div>
-        <div class="col-sm-1">
-            <button type="button" class="btn btn-default" onclick="format()">
-                <span class="fa fa-magic"></span>美化
-            </button>
+    </div>
+    <div class="form-group">
+        <div class="col-sm-12 text-right">
+            <a href="javascript:format();"><span class="fa fa-magic fa-1x fa-flip-horizontal dbsyncer_pointer" title="美化"></span>美化</a>
         </div>
     </div>
 

+ 5 - 5
dbsyncer-web/src/main/resources/public/connector/addKafka.html

@@ -16,13 +16,13 @@
 
     <div class="form-group">
         <label class="col-sm-2 control-label">字段 <i class="fa fa-question-circle fa_gray" aria-hidden="true" title="支持11种字段类型。name字段名, typeName类型名称, type类型编码, pk是否为主键"></i><strong class="driverVerifcateRequired">*</strong></label>
-        <div class="col-sm-9">
+        <div class="col-sm-10">
             <textarea id="fields" name="fields" class="form-control dbsyncer_textarea_resize_none" maxlength="4096" dbsyncer-valid="require" rows="20" th:text="${connector?.config?.fields}"></textarea>
         </div>
-        <div class="col-sm-1">
-            <button type="button" class="btn btn-default" onclick="format()">
-                <span class="fa fa-magic"></span>美化
-            </button>
+    </div>
+    <div class="form-group">
+        <div class="col-sm-12 text-right">
+            <a href="javascript:format();"><span class="fa fa-magic fa-1x fa-flip-horizontal dbsyncer_pointer" title="美化"></span>美化</a>
         </div>
     </div>
 

+ 27 - 27
dbsyncer-web/src/main/resources/public/connector/addSQL.html

@@ -98,7 +98,7 @@
             },
             // 删除下拉选中项
             removeOption: function () {
-                this.sqlTableArray = removeSqlTableBySqlName(this.sqlTableArray, this.selectedVal());
+                this.removeSqlTable(this.selectedVal());
                 this.selector.find('option:selected').remove();
                 this.selector.selectpicker('refresh');
                 this.stash();
@@ -121,7 +121,7 @@
             },
             // 回显下拉选中配置
             apply: function () {
-                let sqlTable = findSqlTableBySqlName(this.sqlTableArray, this.selectedVal());
+                let sqlTable = this.getSqlTable(this.selectedVal());
                 if (sqlTable != null) {
                     this.sqlNameInput.val(sqlTable.sqlName);
                     this.tableInput.val(sqlTable.table);
@@ -158,6 +158,29 @@
             // 恢复按钮
             after: function ($btn) {
                 $btn.removeAttr('disabled');
+            },
+            getSqlTable: function (sqlName) {
+                if (!isBlank(sqlName)) {
+                    let tLen = this.sqlTableArray.length;
+                    for (let j = 0; j < tLen; j++) {
+                        if (this.sqlTableArray[j].sqlName == sqlName) {
+                            return this.sqlTableArray[j];
+                        }
+                    }
+                }
+                return null;
+            },
+            removeSqlTable: function (sqlName) {
+                let newArray = [];
+                if (!isBlank(sqlName)) {
+                    let tLen = this.sqlTableArray.length;
+                    for (let j = 0; j < tLen; j++) {
+                        if (this.sqlTableArray[j].sqlName != sqlName) {
+                            newArray.push(this.sqlTableArray[j]);
+                        }
+                    }
+                }
+                this.sqlTableArray = newArray;
             }
         }
 
@@ -172,36 +195,13 @@
         bindSqlTableDelEvent($template);
     })
 
-    function findSqlTableBySqlName(sqlTableArray, sqlName) {
-        if (!isBlank(sqlName)) {
-            let tLen = sqlTableArray.length;
-            for (let j = 0; j < tLen; j++) {
-                if (sqlTableArray[j].sqlName == sqlName) {
-                    return sqlTableArray[j];
-                }
-            }
-        }
-        return null;
-    }
-    function removeSqlTableBySqlName(sqlTableArray, sqlName) {
-        let newArray = [];
-        if (!isBlank(sqlName)) {
-            let tLen = sqlTableArray.length;
-            for (let j = 0; j < tLen; j++) {
-                if (sqlTableArray[j].sqlName != sqlName) {
-                    newArray.push(sqlTableArray[j]);
-                }
-            }
-        }
-        return newArray;
-    }
     function bindSqlTableAddEvent($template) {
         $template.addSqlTableBtn.click(function () {
             $template.before($(this));
             $template.validate(function () {
                 // 重复校验
                 let newSqlName = $template.sqlNameInput.val();
-                let sqlTable = findSqlTableBySqlName($template.sqlTableArray, newSqlName);
+                let sqlTable = $template.getSqlTable(newSqlName);
                 if (sqlTable != null) {
                     bootGrowl(newSqlName + " 已存在.", "danger");
                 } else {
@@ -222,7 +222,7 @@
                 if (!isBlank(oldSqlName)) {
                     let newSqlName = $template.sqlNameInput.val();
                     // 重命名的SQL名称已存在
-                    if (oldSqlName != newSqlName && findSqlTableBySqlName($template.sqlTableArray, newSqlName) != null) {
+                    if (oldSqlName != newSqlName && $template.getSqlTable(newSqlName) != null) {
                         bootGrowl(newSqlName + " 已存在.", "danger");
                         return;
                     }