Skip to content

Commit

Permalink
web体验优化 全量任务,表同步列表可支持跳转到表同步配置详情页,并自动选中库表
Browse files Browse the repository at this point in the history
  • Loading branch information
jc3wish committed Oct 22, 2023
1 parent 3450d2f commit adad77e
Showing 1 changed file with 43 additions and 4 deletions.
47 changes: 43 additions & 4 deletions admin/view/template/db.detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,7 @@ <h3 class="modal-title" id="showLikeTable_Title"></h3>
return false;
}
setTableName(TableName);
UpdateWebUri(SchemaName,TableName);
$("#TableListContair a").removeClass("active");
$("#"+key).parent("a").addClass("active");
ChangeTableFlowBtnHref(SchemaName,TableName);
Expand Down Expand Up @@ -657,7 +658,7 @@ <h3 class="modal-title" id="showLikeTable_Title"></h3>
$("#TableFieldsContair").html(html);
}

function showSchemaTableList(id){
function showSchemaTableList(id,initTableName){
$("#DatabaseListContair a").removeClass("active");
$("#"+id).addClass("active");
var SchemaName = $("#"+id).find("h3").text();
Expand All @@ -666,8 +667,9 @@ <h3 class="modal-title" id="showLikeTable_Title"></h3>
setSchemaName(SchemaName);
$("#tableToServerListContair").attr("DbName",DbName);
$("#tableToServerListContair").attr("schema",SchemaName);
var showTableList = function(data){
var showTableList = function(data,initTableName){
$("#TableListContair").html("");
var initTableNameCanGetTableToServerList = false
$.each(data,function(index,v) {
var html = "";
var title = "";
Expand Down Expand Up @@ -700,24 +702,30 @@ <h3 class="modal-title" id="showLikeTable_Title"></h3>
if (v.AddStatus == false){
html+= '<div class="button"><button data-toggle="button" class="btn-sm btn-warning" type="button" onClick="showAddTable(\''+v.TableName+'\')">ADD</button></div>';
}else{
if( initTableName == v.TableName ) {
initTableNameCanGetTableToServerList = true
}
html+= '<div class="button"><button data-toggle="button" class="btn-sm btn-danger" type="button" onClick="DelTable(\''+v.TableName+'\')">DEL</button></div>';
}
html += "<div class='check_input'> <input type='checkbox' name='table_check_name' value='"+v.TableName+"' style='width: 20px; height: 20px;' /></div>";
html += '</div>';
html += '</div></a>';
$("#TableListContair").append(html);
});
if(initTableNameCanGetTableToServerList && initTableName !="" && initTableName != null && initTableName != undefined) {
GetTableToServerList(SchemaName,initTableName);
}
}
if (!DataBaseMap.has(SchemaName) || DataBaseMap.get(SchemaName) == undefined){

var callback = function (data) {
DataBaseMap.set(SchemaName,data);
showTableList(data);
showTableList(data,initTableName);
};
var ajaxParam = {DbName:DbName,SchemaName:SchemaName};
Ajax("GET",url, ajaxParam,callback,true);
}else{
showTableList(DataBaseMap.get(SchemaName));
showTableList(DataBaseMap.get(SchemaName),initTableName);
}
showBatchDelOrAddBtn();
}
Expand Down Expand Up @@ -1022,6 +1030,37 @@ <h3 class="modal-title" id="showLikeTable_Title"></h3>
}
});

function InitSchemaAndTableSelect() {
var urlParams = new URLSearchParams(window.location.search);
var schema= urlParams.get("schema");
var table= urlParams.get("TableName");
if(schema == "" || schema ==null || schema == undefined){
// 全量任务和表同步列表提交过来的url这个字段不一样,这里只在这里修改,后续再统一
schema=urlParams.get("SchemaName");
}
if(schema == "" || schema ==null || schema == undefined){
return
}
if(schema=="*"){
schema = "AllDataBases";
}
if(table=="*"){
table = "AllTables";
}
$("#DatabaseListContair h3:contains('"+schema+"')").each(function(){
showSchemaTableList($(this).closest("a").attr("id"),table)
});
}
function UpdateWebUri(SchemaName,TableName) {
if(SchemaName=="AllDataBases"){
SchemaName = "%2a";
}
if(TableName=="AllTables"){
TableName = "%2a";
}
window.history.replaceState(null, null, '?DbName='+getDbName()+"&SchemaName="+SchemaName+"&TableName="+TableName);
}
InitSchemaAndTableSelect();
</script>

{{template "db.detail.table.add" .}}
Expand Down

0 comments on commit adad77e

Please sign in to comment.